[Mesa-dev] [PATCH 06/11] st/vdpau: use interlacing capabilities

Christian König deathsimple at vodafone.de
Wed Feb 1 15:19:59 PST 2012


Recreate video buffer if need arises.

Signed-off-by: Christian König <deathsimple at vodafone.de>
---
 src/gallium/state_trackers/vdpau/decode.c  |   10 +++++++++-
 src/gallium/state_trackers/vdpau/surface.c |    6 ++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index 00232ad..de9835f 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -393,6 +393,7 @@ vlVdpDecoderRender(VdpDecoder decoder,
    VdpStatus ret;
    struct pipe_screen *screen;
    struct pipe_video_decoder *dec;
+   bool buffer_support[2];
    unsigned i;
    union {
       struct pipe_picture_desc base;
@@ -424,8 +425,12 @@ vlVdpDecoderRender(VdpDecoder decoder,
       // TODO: Recreate decoder with correct chroma
       return VDP_STATUS_INVALID_CHROMA_TYPE;
 
+   buffer_support[0] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE);
+   buffer_support[1] = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED);
+
    if (vlsurf->video_buffer == NULL ||
-       !screen->is_video_format_supported(screen, vlsurf->video_buffer->buffer_format, dec->profile)) {
+       !screen->is_video_format_supported(screen, vlsurf->video_buffer->buffer_format, dec->profile) ||
+       buffer_support[vlsurf->video_buffer->interlaced]) {
 
       /* destroy the old one */
       if (vlsurf->video_buffer)
@@ -434,6 +439,9 @@ vlVdpDecoderRender(VdpDecoder decoder,
       /* set the buffer format to the prefered one */
       vlsurf->templat.buffer_format = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_PREFERED_FORMAT);
 
+      /* also set interlacing to decoders preferences */
+      vlsurf->templat.interlaced = screen->get_video_param(screen, dec->profile, PIPE_VIDEO_CAP_PREFERS_INTERLACED);
+
       /* and recreate the video buffer */
       vlsurf->video_buffer = dec->context->create_video_buffer(dec->context, &vlsurf->templat);
 
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index 00c64ee..5774a83 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -85,6 +85,12 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type,
    p_surf->templat.chroma_format = ChromaToPipe(chroma_type);
    p_surf->templat.width = width;
    p_surf->templat.height = height;
+   p_surf->templat.interlaced = pipe->screen->get_video_param
+   (
+      pipe->screen,
+      PIPE_VIDEO_PROFILE_UNKNOWN,
+      PIPE_VIDEO_CAP_PREFERS_INTERLACED
+   );
    p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat);
 
    *surface = vlAddDataHTAB(p_surf);
-- 
1.7.5.4



More information about the mesa-dev mailing list