Mesa (master): r300g: initialize state & render functions before creating u_vbuf & u_blitter

Marek Olšák mareko at kemper.freedesktop.org
Wed Apr 4 02:28:50 UTC 2012


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Apr  3 22:12:35 2012 +0200

r300g: initialize state & render functions before creating u_vbuf & u_blitter

---

 src/gallium/drivers/r300/r300_context.c |    7 +++----
 src/gallium/drivers/r300/r300_context.h |    6 ++++++
 src/gallium/drivers/r300/r300_render.c  |   13 ++++++-------
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 505c6cc..bf35472 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -418,6 +418,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300_init_query_functions(r300);
     r300_init_state_functions(r300);
     r300_init_resource_functions(r300);
+    r300_init_render_functions(r300);
+    r300_init_states(&r300->context);
 
     r300->context.create_video_decoder = vl_create_decoder;
     r300->context.create_video_buffer = vl_video_buffer_create;
@@ -435,10 +437,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300->blitter = util_blitter_create(&r300->context);
     if (r300->blitter == NULL)
         goto fail;
-
-    /* Render functions must be initialized after blitter. */
-    r300_init_render_functions(r300);
-    r300_init_states(&r300->context);
+    r300->blitter->draw_rectangle = r300_blitter_draw_rectangle;
 
     rws->cs_set_flush_callback(r300->cs, r300_flush_callback, r300);
 
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 0802e79..b679592 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -705,6 +705,12 @@ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300);
 /* r300_render.c */
 void r300_draw_flush_vbuf(struct r300_context *r300);
 void r500_emit_index_bias(struct r300_context *r300, int index_bias);
+void r300_blitter_draw_rectangle(struct blitter_context *blitter,
+                                 unsigned x1, unsigned y1,
+                                 unsigned x2, unsigned y2,
+                                 float depth,
+                                 enum blitter_attrib_type type,
+                                 const union pipe_color_union *attrib);
 
 /* r300_state.c */
 enum r300_fb_state_change {
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 91c528e..5981bec 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1165,12 +1165,12 @@ void r300_draw_flush_vbuf(struct r300_context *r300)
  * If we rendered a quad, the pixels on the main diagonal
  * would be computed and stored twice, which makes the clear/copy codepaths
  * somewhat inefficient. Instead we use a rectangular point sprite. */
-static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
-                                        unsigned x1, unsigned y1,
-                                        unsigned x2, unsigned y2,
-                                        float depth,
-                                        enum blitter_attrib_type type,
-                                        const union pipe_color_union *attrib)
+void r300_blitter_draw_rectangle(struct blitter_context *blitter,
+                                 unsigned x1, unsigned y1,
+                                 unsigned x2, unsigned y2,
+                                 float depth,
+                                 enum blitter_attrib_type type,
+                                 const union pipe_color_union *attrib)
 {
     struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter));
     unsigned last_sprite_coord_enable = r300->sprite_coord_enable;
@@ -1309,7 +1309,6 @@ void r300_init_render_functions(struct r300_context *r300)
     }
 
     r300->context.resource_resolve = r300_resource_resolve;
-    r300->blitter->draw_rectangle = r300_blitter_draw_rectangle;
 
     /* Plug in the two-sided stencil reference value fallback if needed. */
     if (!r300->screen->caps.is_r500)




More information about the mesa-commit mailing list