From 65f67baa425af71fc52639d22c1683da3b386a1b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 19 Dec 2007 13:12:34 +0000 Subject: [PATCH] 965: make sure stipple state gets uploaded --- src/mesa/pipe/i965simple/brw_context.h | 2 - src/mesa/pipe/i965simple/brw_misc_state.c | 86 ++++++++++++++++++++--------- src/mesa/pipe/i965simple/brw_state.h | 5 -- src/mesa/pipe/i965simple/brw_state_upload.c | 7 ++- 4 files changed, 65 insertions(+), 35 deletions(-) diff --git a/src/mesa/pipe/i965simple/brw_context.h b/src/mesa/pipe/i965simple/brw_context.h index fc2cb05..59e3d24 100644 --- a/src/mesa/pipe/i965simple/brw_context.h +++ b/src/mesa/pipe/i965simple/brw_context.h @@ -666,8 +666,6 @@ void brwUpdateTextureState( struct brw_context *brw ); void brw_upload_urb_fence(struct brw_context *brw); void brw_upload_constant_buffer_state(struct brw_context *brw); -void brw_upload_polygon_stipple(struct brw_context *brw); -void brw_upload_line_stipple(struct brw_context *brw); void brw_init_surface_functions(struct brw_context *brw); void brw_init_state_functions(struct brw_context *brw); diff --git a/src/mesa/pipe/i965simple/brw_misc_state.c b/src/mesa/pipe/i965simple/brw_misc_state.c index 70b1c43..13b3b16 100644 --- a/src/mesa/pipe/i965simple/brw_misc_state.c +++ b/src/mesa/pipe/i965simple/brw_misc_state.c @@ -42,7 +42,7 @@ * Blend color */ -void brw_upload_blend_constant_color(struct brw_context *brw) +static void upload_blend_constant_color(struct brw_context *brw) { struct brw_blend_constant_color bcc; @@ -57,6 +57,19 @@ void brw_upload_blend_constant_color(struct brw_context *brw) BRW_CACHED_BATCH_STRUCT(brw, &bcc); } + +const struct brw_tracked_state brw_blend_constant_color = { + .dirty = { + .brw = BRW_NEW_BLEND, + .cache = 0 + }, + .update = upload_blend_constant_color +}; + + +/*********************************************************************** + * Drawing rectangle + */ static void upload_drawing_rect(struct brw_context *brw) { struct brw_drawrect bdr; @@ -243,7 +256,7 @@ static void upload_depthbuffer(struct brw_context *brw) const struct brw_tracked_state brw_depthbuffer = { .dirty = { - .brw = 0, + .brw = BRW_NEW_SCENE, .cache = 0 }, .update = upload_depthbuffer, @@ -251,50 +264,43 @@ const struct brw_tracked_state brw_depthbuffer = { -/*********************************************************************** - * Polygon stipple offset packet - */ - -static void upload_polygon_stipple_offset(struct brw_context *brw) -{ - struct brw_polygon_stipple_offset bpso; - - memset(&bpso, 0, sizeof(bpso)); - bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET; - bpso.header.length = sizeof(bpso)/4-2; - - bpso.bits0.x_offset = 0; - bpso.bits0.y_offset = 0; - - BRW_CACHED_BATCH_STRUCT(brw, &bpso); -} /*********************************************************************** * Polygon stipple packet */ -void brw_upload_polygon_stipple(struct brw_context *brw) +static void upload_polygon_stipple(struct brw_context *brw) { struct brw_polygon_stipple bps; unsigned i; - /*update the offset at the same time it will always be 0*/ - upload_polygon_stipple_offset(brw); memset(&bps, 0, sizeof(bps)); bps.header.opcode = CMD_POLY_STIPPLE_PATTERN; bps.header.length = sizeof(bps)/4-2; - for (i = 0; i < 32; i++) - bps.stipple[i] = brw->attribs.PolygonStipple->stipple[31 - i]; /* invert */ + /* XXX: state tracker should send *all* state down initially! + */ + if (brw->attribs.PolygonStipple) + for (i = 0; i < 32; i++) + bps.stipple[i] = brw->attribs.PolygonStipple->stipple[31 - i]; /* invert */ BRW_CACHED_BATCH_STRUCT(brw, &bps); } +const struct brw_tracked_state brw_polygon_stipple = { + .dirty = { + .brw = BRW_NEW_STIPPLE, + .cache = 0 + }, + .update = upload_polygon_stipple +}; + + /*********************************************************************** * Line stipple packet */ -void brw_upload_line_stipple(struct brw_context *brw) +static void upload_line_stipple(struct brw_context *brw) { struct brw_line_stipple bls; float tmp; @@ -316,6 +322,14 @@ void brw_upload_line_stipple(struct brw_context *brw) BRW_CACHED_BATCH_STRUCT(brw, &bls); } +const struct brw_tracked_state brw_line_stipple = { + .dirty = { + .brw = BRW_NEW_STIPPLE, + .cache = 0 + }, + .update = upload_line_stipple +}; + /*********************************************************************** * Misc constant state packets @@ -356,6 +370,15 @@ const struct brw_tracked_state brw_pipe_control = { static void upload_invarient_state( struct brw_context *brw ) { { + struct brw_mi_flush flush; + + memset(&flush, 0, sizeof(flush)); + flush.opcode = CMD_MI_FLUSH; + flush.flags = BRW_FLUSH_STATE_CACHE | BRW_FLUSH_READ_CACHE; + BRW_BATCH_STRUCT(brw, &flush); + } + + { /* 0x61040000 Pipeline Select */ /* PipelineSelect : 0 */ struct brw_pipeline_select ps; @@ -403,6 +426,19 @@ static void upload_invarient_state( struct brw_context *brw ) BRW_BATCH_STRUCT(brw, &vfs); } + + + { + struct brw_polygon_stipple_offset bpso; + + memset(&bpso, 0, sizeof(bpso)); + bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET; + bpso.header.length = sizeof(bpso)/4-2; + bpso.bits0.x_offset = 0; + bpso.bits0.y_offset = 0; + + BRW_BATCH_STRUCT(brw, &bpso); + } } const struct brw_tracked_state brw_invarient_state = { diff --git a/src/mesa/pipe/i965simple/brw_state.h b/src/mesa/pipe/i965simple/brw_state.h index d09711f..62055e5 100644 --- a/src/mesa/pipe/i965simple/brw_state.h +++ b/src/mesa/pipe/i965simple/brw_state.h @@ -65,7 +65,6 @@ const struct brw_tracked_state brw_urb_fence; const struct brw_tracked_state brw_vertex_state; const struct brw_tracked_state brw_vs_prog; const struct brw_tracked_state brw_vs_unit; -const struct brw_tracked_state brw_wm_input_sizes; const struct brw_tracked_state brw_wm_prog; const struct brw_tracked_state brw_wm_samplers; const struct brw_tracked_state brw_wm_surfaces; @@ -149,10 +148,6 @@ void brw_clear_all_caches( struct brw_context *brw ); void brw_invalidate_pools( struct brw_context *brw ); void brw_clear_batch_cache_flush( struct brw_context *brw ); -void brw_upload_cc_unit(struct brw_context *brw); -void brw_upload_clip_prog(struct brw_context *brw); -void brw_upload_blend_constant_color(struct brw_context *brw); -void brw_upload_wm_samplers(struct brw_context *brw); /* brw_shader_info.c */ diff --git a/src/mesa/pipe/i965simple/brw_state_upload.c b/src/mesa/pipe/i965simple/brw_state_upload.c index 2502e54..e727601 100644 --- a/src/mesa/pipe/i965simple/brw_state_upload.c +++ b/src/mesa/pipe/i965simple/brw_state_upload.c @@ -43,7 +43,6 @@ */ const struct brw_tracked_state *atoms[] = { - &brw_wm_input_sizes, &brw_vs_prog, &brw_gs_prog, &brw_clip_prog, @@ -84,8 +83,6 @@ const struct brw_tracked_state *atoms[] = &brw_depthbuffer, &brw_polygon_stipple, - &brw_polygon_stipple_offset, - &brw_line_stipple, &brw_psp_urb_cbs, @@ -192,6 +189,10 @@ void brw_validate_state( struct brw_context *brw ) for (i = 0; i < Elements(atoms); i++) { const struct brw_tracked_state *atom = atoms[i]; + assert(atom->dirty.brw || + atom->dirty.cache); + assert(atom->update); + if (check_state(state, &atom->dirty)) atom->update( brw ); } -- 2.7.4