i965g: hook up more pipe_context functions
authorKeith Whitwell <keithw@vmware.com>
Wed, 4 Nov 2009 15:25:42 +0000 (15:25 +0000)
committerKeith Whitwell <keithw@vmware.com>
Wed, 4 Nov 2009 15:25:42 +0000 (15:25 +0000)
src/gallium/drivers/i965/Makefile
src/gallium/drivers/i965/brw_batchbuffer.h
src/gallium/drivers/i965/brw_context.c
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/i965/brw_draw.c
src/gallium/drivers/i965/brw_pipe_flush.c
src/gallium/drivers/i965/brw_pipe_misc.c
src/gallium/drivers/i965/brw_pipe_query.c
src/gallium/drivers/i965/brw_pipe_sampler.c

index 38b7a3094495ec1e313a52d4346f15c05fd6d15b..b42d9a92c4ad3ac546121732f15746a940676587 100644 (file)
@@ -31,6 +31,7 @@ C_SOURCES = \
        brw_pipe_query.c \
        brw_pipe_shader.c \
        brw_pipe_flush.c \
+       brw_pipe_misc.c \
        brw_pipe_rast.c \
        brw_sf.c \
        brw_sf_emit.c \
index b7186b3757db6d947f17c2970bb5317adc6f0e20..04ca6265ed2a54cd3237751c7cfa866ed032a828 100644 (file)
@@ -60,8 +60,6 @@ void brw_batchbuffer_free(struct brw_batchbuffer *batch);
 void _brw_batchbuffer_flush(struct brw_batchbuffer *batch,
                              const char *file, int line);
 
-#define brw_batchbuffer_flush(batch) \
-       _brw_batchbuffer_flush(batch, __FILE__, __LINE__)
 
 void brw_batchbuffer_reset(struct brw_batchbuffer *batch);
 
index e10b7d8bf55462f0eca4ecd7c7931419b5c11b58..30cc243255ba29abe15f512f13c01d0ec1be710e 100644 (file)
@@ -50,6 +50,17 @@ static void brw_destroy_context( struct pipe_context *pipe )
 
    brw_draw_cleanup( brw );
 
+   brw_pipe_blend_cleanup( brw );
+   brw_pipe_depth_stencil_cleanup( brw );
+   brw_pipe_framebuffer_cleanup( brw );
+   brw_pipe_flush_cleanup( brw );
+   brw_pipe_misc_cleanup( brw );
+   brw_pipe_query_cleanup( brw );
+   brw_pipe_rast_cleanup( brw );
+   brw_pipe_sampler_cleanup( brw );
+   brw_pipe_shader_cleanup( brw );
+   brw_pipe_vertex_cleanup( brw );
+
    FREE(brw->wm.compile_data);
 
    for (i = 0; i < brw->curr.fb.nr_cbufs; i++)
@@ -98,7 +109,17 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
 
    brw->base.destroy = brw_destroy_context;
 
-   brw_init_query( brw );
+   brw_pipe_blend_init( brw );
+   brw_pipe_depth_stencil_init( brw );
+   brw_pipe_framebuffer_init( brw );
+   brw_pipe_flush_init( brw );
+   brw_pipe_misc_init( brw );
+   brw_pipe_query_init( brw );
+   brw_pipe_rast_init( brw );
+   brw_pipe_sampler_init( brw );
+   brw_pipe_shader_init( brw );
+   brw_pipe_vertex_init( brw );
+
    brw_init_state( brw );
    brw_draw_init( brw );
 
index 97b2a8e27dd7b6d8e8a01e232950979b03940bc7..a4c48e6fd2132dfd10ba4af1a5ddb7c2189c6228 100644 (file)
@@ -777,6 +777,9 @@ void brw_pipe_shader_cleanup( struct brw_context *brw );
 void brw_pipe_vertex_cleanup( struct brw_context *brw );
 
 
+void brw_context_flush( struct brw_context *brw );
+
+
 /* brw_urb.c
  */
 int brw_upload_urb_fence(struct brw_context *brw);
index b5fe7c96010f976104ee71838c75f53507f68dcd..a2bed6256b7593465f776a2410c3d6577caac88b 100644 (file)
@@ -166,7 +166,7 @@ try_draw_range_elements(struct brw_context *brw,
       return ret;
 
    if (brw->flags.always_flush_batch)
-      brw_batchbuffer_flush(brw->batch);
+      brw_context_flush( brw );
 
    return 0;
 }
@@ -217,7 +217,7 @@ brw_draw_range_elements(struct pipe_context *pipe,
    /* Otherwise, flush and retry:
     */
    if (ret != 0) {
-      brw_batchbuffer_flush(brw->batch);
+      brw_context_flush( brw );
       ret = try_draw_range_elements(brw, index_buffer, hw_prim, start, count );
       assert(ret == 0);
    }
index 1b43428760d14f8551d409f1232323be3438192e..9b52b56eae7de9d425a529c3b42c1b61581e1460 100644 (file)
@@ -2,50 +2,55 @@
 #include "util/u_upload_mgr.h"
 
 #include "brw_context.h"
+#include "brw_batchbuffer.h"
 
 
-/**
- * called from brw_batchbuffer_flush and children before sending a
- * batchbuffer off.
+
+/* All batchbuffer flushes must go through this function.
  */
-static void brw_finish_batch(struct brw_context *brw)
+void brw_context_flush( struct brw_context *brw )
 {
+   /*
+    * 
+    */
    brw_emit_query_end(brw);
-}
 
+   /* Move to the end of the current upload buffer so that we'll force choosing
+    * a new buffer next time.
+    */
+   u_upload_flush( brw->vb.upload_vertex );
+   u_upload_flush( brw->vb.upload_index );
 
-/**
- * called from intelFlushBatchLocked
- */
-static void brw_new_batch( struct brw_context *brw )
-{
-   brw->curbe.need_new_bo = GL_TRUE;
+   _brw_batchbuffer_flush( brw->batch, __FILE__, __LINE__ );
 
    /* Mark all context state as needing to be re-emitted.
     * This is probably not as severe as on 915, since almost all of our state
     * is just in referenced buffers.
     */
    brw->state.dirty.brw |= BRW_NEW_CONTEXT;
-
    brw->state.dirty.mesa |= ~0;
    brw->state.dirty.brw |= ~0;
    brw->state.dirty.cache |= ~0;
 
-   /* Move to the end of the current upload buffer so that we'll force choosing
-    * a new buffer next time.
-    */
-   u_upload_flush( brw->vb.upload_vertex );
-   u_upload_flush( brw->vb.upload_index );
+   brw->curbe.need_new_bo = GL_TRUE;
+}
 
+static void
+brw_flush( struct pipe_context *pipe,
+           unsigned flags, 
+           struct pipe_fence_handle **fence )
+{
+   brw_context_flush( brw_context( pipe ) );
+   *fence = NULL;
 }
 
-/* called from intelWaitForIdle() and intelFlush()
- *
- * For now, just flush everything.  Could be smarter later.
- */
-static GLuint brw_flush_cmd( void )
+
+void brw_pipe_flush_init( struct brw_context *brw )
 {
-   return ((MI_FLUSH << 16) | BRW_FLUSH_STATE_CACHE);
+   brw->base.flush = brw_flush;
 }
 
 
+void brw_pipe_flush_cleanup( struct brw_context *brw )
+{
+}
index fb8d7ecc59afa900b6c813cd760989e3b9dc93be..a7ccde591702842df8856ab73787d284d7f10867 100644 (file)
@@ -1,7 +1,12 @@
 
+#include "brw_context.h"
+#include "brw_structs.h"
+#include "brw_defines.h"
+
 static void brw_set_polygon_stipple( struct pipe_context *pipe,
-                                    const unsigned *stipple )
+                                    const struct pipe_poly_stipple *stip )
 {
+   struct brw_context *brw = brw_context(pipe);
    struct brw_polygon_stipple *bps = &brw->curr.bps;
    GLuint i;
 
@@ -10,5 +15,17 @@ static void brw_set_polygon_stipple( struct pipe_context *pipe,
    bps->header.length = sizeof *bps/4-2;
 
    for (i = 0; i < 32; i++)
-      bps->stipple[i] = brw->curr.poly_stipple[i]; /* don't invert */
+      bps->stipple[i] = stip->stipple[i]; /* don't invert */
+}
+
+
+
+void brw_pipe_misc_init( struct brw_context *brw )
+{
+   brw->base.set_polygon_stipple = brw_set_polygon_stipple;
+}
+
+
+void brw_pipe_misc_cleanup( struct brw_context *brw )
+{
 }
index 1fe2f4da4f5fdf7b33dc015142fc631b5fd372df..d3e173f5ecf9f3c013d7cbe94998539d104061d0 100644 (file)
@@ -137,7 +137,7 @@ brw_query_end(struct pipe_context *pipe, struct pipe_query *q)
     */
    if (query->bo) {
       brw_emit_query_end(brw);
-      brw_batchbuffer_flush(brw->batch);
+      brw_context_flush( brw );
 
       brw->sws->bo_unreference(brw->query.bo);
       brw->query.bo = NULL;
index 08a5d220097b93d8fa71a315fcd5e66feb0d3938..56cf95c4cd2c44c8ad1c7d7b9d32272f98faf1f4 100644 (file)
@@ -156,10 +156,14 @@ static void brw_set_sampler_textures(struct pipe_context *pipe,
 }
 
 
-void brw_sampler_init( struct brw_context *brw )
+void brw_pipe_sampler_init( struct brw_context *brw )
 {
    brw->base.set_sampler_textures = brw_set_sampler_textures;
    brw->base.create_sampler_state = brw_create_sampler_state;
    brw->base.bind_sampler_state = brw_bind_sampler_state;
    brw->base.destroy_sampler_state = brw_destroy_sampler_state;
 }
+
+void brw_pipe_sampler_cleanup( struct brw_context *brw )
+{
+}