i965g: hook up more pipe_context functions

This commit is contained in:
Keith Whitwell
2009-11-04 15:25:42 +00:00
parent a09b3d5097
commit 9706a83bc9
9 changed files with 87 additions and 38 deletions
+1
View 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 \
@@ -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);
+22 -1
View 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 );
+3
View 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);
+2 -2
View 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);
}
+34 -29
View File
@@ -2,34 +2,18 @@
#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);
}
/**
* called from intelFlushBatchLocked
*/
static void brw_new_batch( struct brw_context *brw )
{
brw->curbe.need_new_bo = GL_TRUE;
/* 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;
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.
@@ -37,15 +21,36 @@ static void brw_new_batch( struct brw_context *brw )
u_upload_flush( brw->vb.upload_vertex );
u_upload_flush( brw->vb.upload_index );
_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;
brw->curbe.need_new_bo = GL_TRUE;
}
/* called from intelWaitForIdle() and intelFlush()
*
* For now, just flush everything. Could be smarter later.
*/
static GLuint brw_flush_cmd( void )
static void
brw_flush( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence )
{
return ((MI_FLUSH << 16) | BRW_FLUSH_STATE_CACHE);
brw_context_flush( brw_context( pipe ) );
*fence = NULL;
}
void brw_pipe_flush_init( struct brw_context *brw )
{
brw->base.flush = brw_flush;
}
void brw_pipe_flush_cleanup( struct brw_context *brw )
{
}
+19 -2
View 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 )
{
}
+1 -1
View 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;
+5 -1
View 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 )
{
}