Mesa (pipe-video): [g3dvl] make clear color configureable

Christian König deathsimple at kemper.freedesktop.org
Wed Apr 27 08:12:35 PDT 2011


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

Author: Christian König <deathsimple at vodafone.de>
Date:   Wed Apr 27 16:50:34 2011 +0200

[g3dvl] make clear color configureable

---

 src/gallium/auxiliary/vl/vl_compositor.c   |   19 +++++++++++++++++--
 src/gallium/auxiliary/vl/vl_compositor.h   |    1 +
 src/gallium/include/pipe/p_video_context.h |    5 +++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index c13e69d..cc257e5 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -512,6 +512,18 @@ vl_compositor_reset_dirty_area(struct pipe_video_compositor *compositor)
 }
 
 static void
+vl_compositor_set_clear_color(struct pipe_video_compositor *compositor, float color[4])
+{
+   struct vl_compositor *c = (struct vl_compositor *)compositor;
+   unsigned i;
+
+   assert(compositor);
+
+   for (i = 0; i < 4; ++i)
+      c->clear_color[i] = color[i];
+}
+
+static void
 vl_compositor_clear_layers(struct pipe_video_compositor *compositor)
 {
    struct vl_compositor *c = (struct vl_compositor *)compositor;
@@ -655,7 +667,6 @@ vl_compositor_render(struct pipe_video_compositor *compositor,
 {
    struct vl_compositor *c = (struct vl_compositor *)compositor;
    struct pipe_scissor_state scissor;
-   float clearcolor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
 
    assert(compositor);
    assert(dst_surface);
@@ -682,7 +693,7 @@ vl_compositor_render(struct pipe_video_compositor *compositor,
    gen_vertex_data(c);
 
    if (c->dirty_tl.x < c->dirty_br.x || c->dirty_tl.y < c->dirty_br.y) {
-      util_clear_render_target(c->pipe, dst_surface, clearcolor, 0, 0, dst_surface->width, dst_surface->height);
+      util_clear_render_target(c->pipe, dst_surface, c->clear_color, 0, 0, dst_surface->width, dst_surface->height);
       c->dirty_tl.x = c->dirty_tl.y = 1.0f;
       c->dirty_br.x = c->dirty_br.y = 0.0f;
    }
@@ -714,6 +725,7 @@ vl_compositor_init(struct pipe_video_context *vpipe, struct pipe_context *pipe)
    compositor->base.destroy = vl_compositor_destroy;
    compositor->base.set_csc_matrix = vl_compositor_set_csc_matrix;
    compositor->base.reset_dirty_area = vl_compositor_reset_dirty_area;
+   compositor->base.set_clear_color = vl_compositor_set_clear_color;
    compositor->base.clear_layers = vl_compositor_clear_layers;
    compositor->base.set_buffer_layer = vl_compositor_set_buffer_layer;
    compositor->base.set_palette_layer = vl_compositor_set_palette_layer;
@@ -739,6 +751,9 @@ vl_compositor_init(struct pipe_video_context *vpipe, struct pipe_context *pipe)
 
    vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_IDENTITY, NULL, true, csc_matrix);
    vl_compositor_set_csc_matrix(&compositor->base, csc_matrix);
+
+   compositor->clear_color[0] = compositor->clear_color[1] = 0.0f;
+   compositor->clear_color[2] = compositor->clear_color[3] = 0.0f;
    vl_compositor_reset_dirty_area(&compositor->base);
 
    return &compositor->base;
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h
index 725dcc1..33d2a20 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/src/gallium/auxiliary/vl/vl_compositor.h
@@ -72,6 +72,7 @@ struct vl_compositor
    void *fs_palette;
    void *fs_rgba;
 
+   float clear_color[4];
    struct vertex2f dirty_tl, dirty_br;
 
    unsigned used_layers:VL_COMPOSITOR_MAX_LAYERS;
diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h
index 933b377..80bbb6e 100644
--- a/src/gallium/include/pipe/p_video_context.h
+++ b/src/gallium/include/pipe/p_video_context.h
@@ -270,6 +270,11 @@ struct pipe_video_compositor
    void (*reset_dirty_area)(struct pipe_video_compositor *compositor);
 
    /**
+    * set the clear color
+    */
+   void (*set_clear_color)(struct pipe_video_compositor *compositor, float color[4]);
+
+   /**
     * set overlay samplers
     */
    /*@{*/



More information about the mesa-commit mailing list