frontends/vdpau: Support creating VDP_CHROMA_TYPE_420_16 surfaces

Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28317>
This commit is contained in:
David Rosca 2024-03-21 10:53:47 +01:00 committed by Marge Bot
parent b17cf67895
commit fce9a31ba0
2 changed files with 18 additions and 8 deletions

View file

@ -82,14 +82,7 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type,
mtx_lock(&dev->mutex);
memset(&p_surf->templat, 0, sizeof(p_surf->templat));
/* TODO: buffer_format should be selected to match chroma_type */
p_surf->templat.buffer_format = pipe->screen->get_video_param
(
pipe->screen,
PIPE_VIDEO_PROFILE_UNKNOWN,
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_PREFERED_FORMAT
);
p_surf->templat.buffer_format = ChromaToPipeFormat(chroma_type);
p_surf->templat.width = width;
p_surf->templat.height = height;
p_surf->templat.interlaced = pipe->screen->get_video_param

View file

@ -162,6 +162,23 @@ FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
}
static inline enum pipe_format
ChromaToPipeFormat(VdpChromaType vdpau_type)
{
switch (vdpau_type) {
case VDP_CHROMA_TYPE_420:
return PIPE_FORMAT_NV12;
#ifdef VDP_CHROMA_TYPE_420_16
case VDP_CHROMA_TYPE_420_16:
return PIPE_FORMAT_P016;
#endif
default:
assert(0);
}
return PIPE_FORMAT_NONE;
}
static inline VdpYCbCrFormat
PipeToFormatYCBCR(enum pipe_format p_format)
{