summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vdpau/query.c
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2016-03-03 09:25:44 +0100
committerThomas Hellstrom <[email protected]>2017-02-24 16:44:33 +0100
commit3a418322ec6d540b1334f42688839aefb5d88d6d (patch)
tree803c0fe0488406a45ed151f0abee4cf6af5d7e8a /src/gallium/state_trackers/vdpau/query.c
parent5398d006de3d2bd668e3fc4b80a3de0c101a3e43 (diff)
st/vdpau: Provide YV12 to NV12 putBits conversion v2
mplayer likes putting YV12 data, and if there is a buffer format mismatch, the vdpau state tracker would try to reallocate the video surface as an YV12 surface. A virtual driver doesn't like reallocating and doesn't like YV12 surfaces, so if we can't support YV12, try an YV12 to NV12 conversion instead. Also advertize that we actually can do the getBits and putBits conversion. v2: A previous version of this patch prioritized conversion before reallocating. This has been changed to prioritize reallocating in this version. Cc: Christian König <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/query.c')
-rw-r--r--src/gallium/state_trackers/vdpau/query.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c
index e69c9b11f55..435cafd4041 100644
--- a/src/gallium/state_trackers/vdpau/query.c
+++ b/src/gallium/state_trackers/vdpau/query.c
@@ -123,8 +123,21 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
switch(bits_ycbcr_format) {
case VDP_YCBCR_FORMAT_NV12:
+ *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
+ break;
+
case VDP_YCBCR_FORMAT_YV12:
*is_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)) {
+ pipe_mutex_unlock(dev->mutex);
+ return VDP_STATUS_OK;
+ }
break;
case VDP_YCBCR_FORMAT_UYVY: