Mesa (master): xorg/xvmc: Only set decode buffer when available

Younes Manton ymanton at kemper.freedesktop.org
Mon Aug 29 16:42:22 PDT 2011


Module: Mesa
Branch: master
Commit: f5cf4ec90db3fd69d54375fbe663f54a22dfebc0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5cf4ec90db3fd69d54375fbe663f54a22dfebc0

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Sun Aug 28 01:58:23 2011 +0200

xorg/xvmc: Only set decode buffer when available

The nouveau xvmc decoder doesn't need it.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst at gmail.com>

---

 src/gallium/state_trackers/xorg/xvmc/surface.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index 521bc42..76bcf63 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -111,7 +111,8 @@ SetDecoderStatus(XvMCSurfacePrivate *surface)
    context_priv = surface->context->privData;
    decoder = context_priv->decoder;
 
-   decoder->set_decode_buffer(decoder, surface->decode_buffer);
+   if (surface->decode_buffer)
+      decoder->set_decode_buffer(decoder, surface->decode_buffer);
    decoder->set_decode_target(decoder, surface->video_buffer);
 
    for (i = 0; i < 2; ++i) {
@@ -181,7 +182,8 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
    if (!surface_priv)
       return BadAlloc;
 
-   surface_priv->decode_buffer = context_priv->decoder->create_buffer(context_priv->decoder);
+   if (context_priv->decoder->create_buffer)
+      surface_priv->decode_buffer = context_priv->decoder->create_buffer(context_priv->decoder);
    surface_priv->video_buffer = pipe->create_video_buffer
    (
       pipe, PIPE_FORMAT_NV12, context_priv->decoder->chroma_format,
@@ -496,7 +498,8 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
       SetDecoderStatus(surface_priv);
       context_priv->decoder->end_frame(context_priv->decoder);
    }
-   context_priv->decoder->destroy_buffer(context_priv->decoder, surface_priv->decode_buffer);
+   if (surface_priv->decode_buffer)
+      context_priv->decoder->destroy_buffer(context_priv->decoder, surface_priv->decode_buffer);
    surface_priv->video_buffer->destroy(surface_priv->video_buffer);
    FREE(surface_priv);
    surface->privData = NULL;



More information about the mesa-commit mailing list