Mesa (master): vl/video_buffer: fix interlaced surface ordering

Christian König deathsimple at kemper.freedesktop.org
Mon Feb 6 09:47:52 UTC 2012


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

Author: Christian König <deathsimple at vodafone.de>
Date:   Thu Jan 26 15:30:53 2012 +0100

vl/video_buffer: fix interlaced surface ordering

Signed-off-by: Christian König <deathsimple at vodafone.de>

---

 src/gallium/auxiliary/vl/vl_video_buffer.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 249124f..f7134a5 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -285,23 +285,29 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer)
    struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer;
    struct pipe_surface surf_templ;
    struct pipe_context *pipe;
-   unsigned i, j, surf;
+   unsigned i, j, depth, surf;
 
    assert(buf);
 
    pipe = buf->base.context;
 
-   for (i = 0, surf = 0; i < buf->num_planes; ++i ) {
-      for (j = 0; j < buf->resources[i]->depth0; ++j, ++surf) {
+   depth = buffer->interlaced ? 2 : 1;
+   for (i = 0, surf = 0; i < depth; ++i ) {
+      for (j = 0; j < VL_MAX_PLANES; ++j, ++surf) {
          assert(surf < (VL_MAX_PLANES * 2));
 
+         if (!buf->resources[j]) {
+            pipe_surface_reference(&buf->surfaces[surf], NULL);
+            continue;
+         }
+
          if (!buf->surfaces[surf]) {
             memset(&surf_templ, 0, sizeof(surf_templ));
-            surf_templ.format = buf->resources[i]->format;
+            surf_templ.format = buf->resources[j]->format;
             surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
-            surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = j;
-            buf->surfaces[i] = pipe->create_surface(pipe, buf->resources[i], &surf_templ);
-            if (!buf->surfaces[i])
+            surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = i;
+            buf->surfaces[surf] = pipe->create_surface(pipe, buf->resources[j], &surf_templ);
+            if (!buf->surfaces[surf])
                goto error;
          }
       }




More information about the mesa-commit mailing list