vdpau: Refactor query for video surface formats.
Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10614 Signed-off-by: Chris Rankin <rankincj@gmail.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27730> (cherry picked from commit c3ceec6cd8533a5a5f3ccaf687308dee2f097a99)
This commit is contained in:
parent
40ab1da1b4
commit
aead18c79d
3 changed files with 30 additions and 25 deletions
|
|
@ -914,7 +914,7 @@
|
||||||
"description": "vdpau: Refactor query for video surface formats.",
|
"description": "vdpau: Refactor query for video surface formats.",
|
||||||
"nominated": true,
|
"nominated": true,
|
||||||
"nomination_type": 0,
|
"nomination_type": 0,
|
||||||
"resolution": 0,
|
"resolution": 1,
|
||||||
"main_sha": null,
|
"main_sha": null,
|
||||||
"because_sha": null,
|
"because_sha": null,
|
||||||
"notes": null
|
"notes": null
|
||||||
|
|
|
||||||
|
|
@ -118,21 +118,21 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,
|
||||||
vl_get_video_buffer_formats(screen, format, resource_formats);
|
vl_get_video_buffer_formats(screen, format, resource_formats);
|
||||||
|
|
||||||
for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
|
for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
|
||||||
enum pipe_format format = resource_formats[i];
|
enum pipe_format fmt = resource_formats[i];
|
||||||
|
|
||||||
if (format == PIPE_FORMAT_NONE)
|
if (fmt == PIPE_FORMAT_NONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* we at least need to sample from it */
|
/* we at least need to sample from it */
|
||||||
if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW))
|
if (!screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW))
|
||||||
return false;
|
continue;
|
||||||
|
|
||||||
format = vl_video_buffer_surface_format(format);
|
fmt = vl_video_buffer_surface_format(fmt);
|
||||||
if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET))
|
if (screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET))
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
|
||||||
{
|
{
|
||||||
vlVdpDevice *dev;
|
vlVdpDevice *dev;
|
||||||
struct pipe_screen *pscreen;
|
struct pipe_screen *pscreen;
|
||||||
|
VdpYCbCrFormat ycbcrFormat;
|
||||||
|
bool supported;
|
||||||
|
|
||||||
if (!is_supported)
|
if (!is_supported)
|
||||||
return VDP_STATUS_INVALID_POINTER;
|
return VDP_STATUS_INVALID_POINTER;
|
||||||
|
|
@ -122,47 +124,50 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
|
||||||
|
|
||||||
mtx_lock(&dev->mutex);
|
mtx_lock(&dev->mutex);
|
||||||
|
|
||||||
|
ycbcrFormat = bits_ycbcr_format;
|
||||||
switch(bits_ycbcr_format) {
|
switch(bits_ycbcr_format) {
|
||||||
case VDP_YCBCR_FORMAT_NV12:
|
case VDP_YCBCR_FORMAT_NV12:
|
||||||
*is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
|
supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VDP_YCBCR_FORMAT_YV12:
|
case VDP_YCBCR_FORMAT_YV12:
|
||||||
*is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
|
supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
|
||||||
|
|
||||||
/* We can convert YV12 to NV12 on the fly! */
|
/* We can convert YV12 to NV12 on the fly! */
|
||||||
if (*is_supported &&
|
ycbcrFormat = VDP_YCBCR_FORMAT_NV12;
|
||||||
pscreen->is_video_format_supported(pscreen,
|
|
||||||
PIPE_FORMAT_NV12,
|
|
||||||
PIPE_VIDEO_PROFILE_UNKNOWN,
|
|
||||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) {
|
|
||||||
mtx_unlock(&dev->mutex);
|
|
||||||
return VDP_STATUS_OK;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VDP_YCBCR_FORMAT_UYVY:
|
case VDP_YCBCR_FORMAT_UYVY:
|
||||||
case VDP_YCBCR_FORMAT_YUYV:
|
case VDP_YCBCR_FORMAT_YUYV:
|
||||||
*is_supported = surface_chroma_type == VDP_CHROMA_TYPE_422;
|
supported = surface_chroma_type == VDP_CHROMA_TYPE_422;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VDP_YCBCR_FORMAT_Y8U8V8A8:
|
case VDP_YCBCR_FORMAT_Y8U8V8A8:
|
||||||
case VDP_YCBCR_FORMAT_V8U8Y8A8:
|
case VDP_YCBCR_FORMAT_V8U8Y8A8:
|
||||||
*is_supported = surface_chroma_type == VDP_CHROMA_TYPE_444;
|
supported = surface_chroma_type == VDP_CHROMA_TYPE_444;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VDP_YCBCR_FORMAT_P010:
|
||||||
|
case VDP_YCBCR_FORMAT_P016:
|
||||||
|
/* Do any other profiles imply support for this chroma type? */
|
||||||
|
supported = (surface_chroma_type == VDP_CHROMA_TYPE_420_16)
|
||||||
|
&& vl_codec_supported(pscreen, PIPE_VIDEO_PROFILE_HEVC_MAIN_10, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*is_supported = false;
|
supported = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*is_supported &&
|
if (supported &&
|
||||||
!pscreen->is_video_format_supported(pscreen,
|
!pscreen->is_video_format_supported(pscreen,
|
||||||
FormatYCBCRToPipe(bits_ycbcr_format),
|
FormatYCBCRToPipe(ycbcrFormat),
|
||||||
PIPE_VIDEO_PROFILE_UNKNOWN,
|
PIPE_VIDEO_PROFILE_UNKNOWN,
|
||||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) {
|
PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) {
|
||||||
*is_supported = false;
|
supported = false;
|
||||||
}
|
}
|
||||||
|
*is_supported = supported;
|
||||||
|
|
||||||
mtx_unlock(&dev->mutex);
|
mtx_unlock(&dev->mutex);
|
||||||
|
|
||||||
return VDP_STATUS_OK;
|
return VDP_STATUS_OK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue