Mesa (pipe-video): [g3dvl] remove texture dependencies from mc code

Christian König deathsimple at kemper.freedesktop.org
Sat Apr 2 11:53:18 PDT 2011


Module: Mesa
Branch: pipe-video
Commit: f3c9161b15988e90a2f727c8260ac3bff41912fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3c9161b15988e90a2f727c8260ac3bff41912fd

Author: Christian König <deathsimple at vodafone.de>
Date:   Sun Mar 27 20:41:43 2011 +0200

[g3dvl] remove texture dependencies from mc code

---

 src/gallium/auxiliary/vl/vl_mpeg12_context.c     |    4 ++--
 src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c |   22 ++++++++--------------
 src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h |    8 +-------
 3 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c
index 004d79d..6388b3e 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c
@@ -372,8 +372,8 @@ vl_mpeg12_create_buffer(struct pipe_video_context *vpipe)
 
    if(!vl_mpeg12_mc_init_buffer(&ctx->mc_renderer, &buffer->mc,
                                 buffer->idct_2_mc.resources.y,
-                                buffer->idct_2_mc.resources.cr,
-                                buffer->idct_2_mc.resources.cb)) {
+                                buffer->idct_2_mc.resources.cb,
+                                buffer->idct_2_mc.resources.cr)) {
       FREE(buffer);
       return NULL;
    }
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 60d61ab..d2ed747 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -539,30 +539,29 @@ vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer)
 
 bool
 vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg12_mc_buffer *buffer,
-                         struct pipe_resource *y, struct pipe_resource *cr, struct pipe_resource *cb)
+                         struct pipe_resource *y, struct pipe_resource *cb, struct pipe_resource *cr)
 {
    struct pipe_sampler_view sampler_view;
+   struct pipe_resource *res[3];
 
    unsigned i;
 
    assert(renderer && buffer);
    assert(y && cb && cr);
 
-   pipe_resource_reference(&buffer->textures.individual.y, y);
-   pipe_resource_reference(&buffer->textures.individual.cr, cr);
-   pipe_resource_reference(&buffer->textures.individual.cb, cb);
+   res[0] = y;
+   res[1] = cb;
+   res[2] = cr;
 
    for (i = 0; i < 3; ++i) {
       memset(&sampler_view, 0, sizeof(sampler_view));
-      u_sampler_view_default_template(&sampler_view,
-                                      buffer->textures.all[i],
-                                      buffer->textures.all[i]->format);
+      u_sampler_view_default_template(&sampler_view, res[i], res[i]->format);
       sampler_view.swizzle_r = i == 0 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO;
       sampler_view.swizzle_g = i == 1 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO;
       sampler_view.swizzle_b = i == 2 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO;
       sampler_view.swizzle_a = PIPE_SWIZZLE_ONE;
       buffer->sampler_views.all[i] = renderer->pipe->create_sampler_view(
-         renderer->pipe, buffer->textures.all[i], &sampler_view);
+         renderer->pipe, res[i], &sampler_view);
       if (!buffer->sampler_views.all[i])
          goto error_samplers;
    }
@@ -570,10 +569,8 @@ vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg1
    return true;
 
 error_samplers:
-   for (i = 0; i < 3; ++i) {
+   for (i = 0; i < 3; ++i)
       pipe_sampler_view_reference(&buffer->sampler_views.all[i], NULL);
-      pipe_resource_reference(&buffer->textures.all[i], NULL);
-   }
 
    return false;
 }
@@ -587,9 +584,6 @@ vl_mpeg12_mc_cleanup_buffer(struct vl_mpeg12_mc_buffer *buffer)
 
    for (i = 0; i < 5; ++i)
       pipe_sampler_view_reference(&buffer->sampler_views.all[i], NULL);
-
-   for (i = 0; i < 3; ++i)
-      pipe_resource_reference(&buffer->textures.all[i], NULL);
 }
 
 void
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
index 29a548e..0bb17ef 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
@@ -67,12 +67,6 @@ struct vl_mpeg12_mc_buffer
       struct pipe_sampler_view *all[5];
       struct { struct pipe_sampler_view *y, *cb, *cr, *ref[2]; } individual;
    } sampler_views;
-
-   union
-   {
-      struct pipe_resource *all[3];
-      struct { struct pipe_resource *y, *cb, *cr; } individual;
-   } textures;
 };
 
 bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
@@ -84,7 +78,7 @@ bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer,
 void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer);
 
 bool vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg12_mc_buffer *buffer,
-                              struct pipe_resource *y, struct pipe_resource *cr, struct pipe_resource *cb);
+                              struct pipe_resource *y, struct pipe_resource *cb, struct pipe_resource *cr);
 
 void vl_mpeg12_mc_cleanup_buffer(struct vl_mpeg12_mc_buffer *buffer);
 



More information about the mesa-commit mailing list