diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 4d95f762510..69cc4563df7 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -118,21 +118,21 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen, vl_get_video_buffer_formats(screen, format, resource_formats); 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; /* we at least need to sample from it */ - if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) - return false; + if (!screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) + continue; - format = vl_video_buffer_surface_format(format); - if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET)) - return false; + fmt = vl_video_buffer_surface_format(fmt); + if (screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET)) + return true; } - return true; + return false; } unsigned diff --git a/src/gallium/frontends/vdpau/query.c b/src/gallium/frontends/vdpau/query.c index 158256b961b..6c48e9e8c12 100644 --- a/src/gallium/frontends/vdpau/query.c +++ b/src/gallium/frontends/vdpau/query.c @@ -108,6 +108,8 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp { vlVdpDevice *dev; struct pipe_screen *pscreen; + VdpYCbCrFormat ycbcrFormat; + bool supported; if (!is_supported) return VDP_STATUS_INVALID_POINTER; @@ -122,47 +124,50 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp mtx_lock(&dev->mutex); + ycbcrFormat = bits_ycbcr_format; switch(bits_ycbcr_format) { case VDP_YCBCR_FORMAT_NV12: - *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420; + supported = surface_chroma_type == VDP_CHROMA_TYPE_420; break; 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! */ - if (*is_supported && - 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; - } + ycbcrFormat = VDP_YCBCR_FORMAT_NV12; break; case VDP_YCBCR_FORMAT_UYVY: case VDP_YCBCR_FORMAT_YUYV: - *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_422; + supported = surface_chroma_type == VDP_CHROMA_TYPE_422; break; case VDP_YCBCR_FORMAT_Y8U8V8A8: 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; default: - *is_supported = false; + supported = false; break; } - if (*is_supported && + if (supported && !pscreen->is_video_format_supported(pscreen, - FormatYCBCRToPipe(bits_ycbcr_format), + FormatYCBCRToPipe(ycbcrFormat), PIPE_VIDEO_PROFILE_UNKNOWN, PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) { - *is_supported = false; + supported = false; } + *is_supported = supported; + mtx_unlock(&dev->mutex); return VDP_STATUS_OK;