[Mesa-dev] [PATCH 5/7] st/vdpau: always use the prefered surface format for decode

Christian König deathsimple at vodafone.de
Wed Jan 25 14:41:58 UTC 2017


From: Christian König <christian.koenig at amd.com>

That allows us to switch between different
surface formats for different codecs.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 src/gallium/state_trackers/vdpau/decode.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index f85bce8..5744714 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -571,6 +571,7 @@ vlVdpDecoderRender(VdpDecoder decoder,
    struct pipe_video_codec *dec;
    bool buffer_support[2];
    unsigned i;
+   enum pipe_format prefered_format;
    struct pipe_h264_sps sps_h264 = {};
    struct pipe_h264_pps pps_h264 = { &sps_h264 };
    struct pipe_h265_sps sps_h265 = {};
@@ -609,9 +610,10 @@ vlVdpDecoderRender(VdpDecoder decoder,
    buffer_support[1] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
                                                PIPE_VIDEO_CAP_SUPPORTS_INTERLACED);
 
-   if (vlsurf->video_buffer == NULL ||
-       !screen->is_video_format_supported(screen, vlsurf->video_buffer->buffer_format,
-                                          dec->profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM) ||
+   prefered_format = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+                                             PIPE_VIDEO_CAP_PREFERED_FORMAT);
+
+   if (vlsurf->video_buffer == NULL || vlsurf->video_buffer->buffer_format != prefered_format ||
        !buffer_support[vlsurf->video_buffer->interlaced]) {
 
       pipe_mutex_lock(vlsurf->device->mutex);
@@ -621,8 +623,7 @@ vlVdpDecoderRender(VdpDecoder decoder,
          vlsurf->video_buffer->destroy(vlsurf->video_buffer);
 
       /* set the buffer format to the prefered one */
-      vlsurf->templat.buffer_format = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
-                                                              PIPE_VIDEO_CAP_PREFERED_FORMAT);
+      vlsurf->templat.buffer_format = prefered_format;
 
       /* also set interlacing to decoders preferences */
       vlsurf->templat.interlaced = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
-- 
2.7.4



More information about the mesa-dev mailing list