0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

Revert "hwdec_vulkan: account for vulkan frames now using presentation size"

ffmpeg is again setting the frame dimensions to the coded size, so we
need to reintroduce our work-around to get the logical frame dimensions
from the frames_ctx rather than the frame itself.

ffmpeg commit:
* 9ee4f47c94

This reverts commit c40bd88872.
This commit is contained in:
Philip Langdale 2023-10-25 19:51:25 -07:00 committed by Philip Langdale
parent b9c42755a7
commit 7a58763ad9

View File

@ -236,6 +236,16 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
const AVVulkanFramesContext *vkfc = hwfc->hwctx;
AVVkFrame *vkf = (AVVkFrame *) mapper->src->planes[0];
/*
* We need to use the dimensions from the HW Frames Context for the
* textures, as the underlying images may be larger than the logical frame
* size. This most often happens with 1080p content where the actual frame
* height is 1088.
*/
struct mp_image raw_layout;
mp_image_setfmt(&raw_layout, p->layout.params.imgfmt);
mp_image_set_size(&raw_layout, hwfc->width, hwfc->height);
int num_images;
for (num_images = 0; (vkf->img[num_images] != NULL); num_images++);
const VkFormat *vk_fmt = av_vkfmt_from_pixfmt(hwfc->sw_format);
@ -269,8 +279,8 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
*tex = pl_vulkan_wrap(p_owner->gpu, pl_vulkan_wrap_params(
.image = vkf->img[index],
.width = mp_image_plane_w(&p->layout, i),
.height = mp_image_plane_h(&p->layout, i),
.width = mp_image_plane_w(&raw_layout, i),
.height = mp_image_plane_h(&raw_layout, i),
.format = vk_fmt[i],
.usage = vkfc->usage,
.aspect = aspect,