Now, we only use ctx->NewDriverState.
I used this bash & sed command in the i965 directory:
for file in *.[ch] *.[ch]pp; do
sed -i -e 's/state\.dirty\.brw/ctx.NewDriverState/g' $file
done
Followed by manual changes to brw_state_upload.c.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
prog_data->binding_table.size_bytes);
}
- brw->state.dirty.brw |= brw_new_binding_table;
+ brw->ctx.NewDriverState |= brw_new_binding_table;
if (brw->gen >= 7) {
BEGIN_BATCH(2);
/* We've smashed all state compared to what the normal 3D pipeline
* rendering tracks for GL.
*/
- brw->state.dirty.brw = ~0ull;
+ brw->ctx.NewDriverState = ~0ull;
brw->no_depth_or_stencil = false;
brw->ib.type = -1;
OUT_BATCH(brw->cc.vp_offset);
ADVANCE_BATCH();
} else {
- brw->state.dirty.brw |= BRW_NEW_CC_VP;
+ brw->ctx.NewDriverState |= BRW_NEW_CC_VP;
}
}
cc->cc4.cc_viewport_state_offset = (brw->batch.bo->offset64 +
brw->cc.vp_offset) >> 5; /* reloc */
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+ brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
/* Emit CC viewport relocation */
drm_intel_bo_emit_reloc(brw->batch.bo,
clip->viewport_ymin = -1;
clip->viewport_ymax = 1;
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+ brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
}
const struct brw_tracked_state brw_clip_unit = {
brw->curbe.vs_start,
brw->curbe.vs_size );
- brw->state.dirty.brw |= BRW_NEW_CURBE_OFFSETS;
+ brw->ctx.NewDriverState |= BRW_NEW_CURBE_OFFSETS;
}
}
* We've found no documented reason why this should be necessary.
*/
if (brw->gen == 4 && !brw->is_g4x &&
- (brw->state.dirty.brw & (BRW_NEW_BATCH | BRW_NEW_PSP)) == 0) {
+ (brw->ctx.NewDriverState & (BRW_NEW_BATCH | BRW_NEW_PSP)) == 0) {
BEGIN_BATCH(1);
OUT_BATCH(MI_FLUSH);
ADVANCE_BATCH();
if (hw_prim != brw->primitive) {
brw->primitive = hw_prim;
- brw->state.dirty.brw |= BRW_NEW_PRIMITIVE;
+ brw->ctx.NewDriverState |= BRW_NEW_PRIMITIVE;
if (reduced_prim[prim->mode] != brw->reduced_primitive) {
brw->reduced_primitive = reduced_prim[prim->mode];
- brw->state.dirty.brw |= BRW_NEW_REDUCED_PRIMITIVE;
+ brw->ctx.NewDriverState |= BRW_NEW_REDUCED_PRIMITIVE;
}
}
}
if (hw_prim != brw->primitive) {
brw->primitive = hw_prim;
- brw->state.dirty.brw |= BRW_NEW_PRIMITIVE;
+ brw->ctx.NewDriverState |= BRW_NEW_PRIMITIVE;
}
}
if (brw->vb.attrib_wa_flags[i] != wa_flags) {
brw->vb.attrib_wa_flags[i] = wa_flags;
- brw->state.dirty.brw |= BRW_NEW_VS_ATTRIB_WORKAROUNDS;
+ brw->ctx.NewDriverState |= BRW_NEW_VS_ATTRIB_WORKAROUNDS;
}
}
}
brw_merge_inputs( brw, arrays );
brw->ib.ib = ib;
- brw->state.dirty.brw |= BRW_NEW_INDICES;
+ brw->ctx.NewDriverState |= BRW_NEW_INDICES;
brw->vb.min_index = min_index;
brw->vb.max_index = max_index;
- brw->state.dirty.brw |= BRW_NEW_VERTICES;
+ brw->ctx.NewDriverState |= BRW_NEW_VERTICES;
for (i = 0; i < nr_prims; i++) {
int estimated_max_prim_size;
brw->num_instances = prims[i].num_instances;
brw->basevertex = prims[i].basevertex;
if (i > 0) { /* For i == 0 we just did this before the loop */
- brw->state.dirty.brw |= BRW_NEW_VERTICES;
+ brw->ctx.NewDriverState |= BRW_NEW_VERTICES;
brw_merge_inputs(brw, arrays);
}
}
retry:
- /* Note that before the loop, brw->state.dirty.brw was set to != 0, and
+ /* Note that before the loop, brw->ctx.NewDriverState was set to != 0, and
* that the state updated in the loop outside of this block is that in
* *_set_prim or intel_batchbuffer_flush(), which only impacts
- * brw->state.dirty.brw.
+ * brw->ctx.NewDriverState.
*/
- if (brw->state.dirty.brw) {
+ if (brw->ctx.NewDriverState) {
brw->no_batch_wrap = true;
brw_upload_render_state(brw);
}
/* Now that we know we haven't run out of aperture space, we can safely
* reset the dirty bits.
*/
- if (brw->state.dirty.brw)
+ if (brw->ctx.NewDriverState)
brw_render_state_finished(brw);
}
brw->ib.start_vertex_offset = offset / ib_type_size;
if (brw->ib.bo != old_bo)
- brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER;
+ brw->ctx.NewDriverState |= BRW_NEW_INDEX_BUFFER;
if (index_buffer->type != brw->ib.type) {
brw->ib.type = index_buffer->type;
- brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER;
+ brw->ctx.NewDriverState |= BRW_NEW_INDEX_BUFFER;
}
}
populate_key(brw, &key);
if (brw->ff_gs.prog_active != key.need_gs_prog) {
- brw->state.dirty.brw |= BRW_NEW_FF_GS_PROG_DATA;
+ brw->ctx.NewDriverState |= BRW_NEW_FF_GS_PROG_DATA;
brw->ff_gs.prog_active = key.need_gs_prog;
}
if (gp == NULL) {
/* No geometry shader. Vertex data just passes straight through. */
- if (brw->state.dirty.brw & BRW_NEW_VUE_MAP_VS) {
+ if (brw->ctx.NewDriverState & BRW_NEW_VUE_MAP_VS) {
brw->vue_map_geom_out = brw->vue_map_vs;
- brw->state.dirty.brw |= BRW_NEW_VUE_MAP_GEOM_OUT;
+ brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_GEOM_OUT;
}
if (brw->gen == 6 &&
- (brw->state.dirty.brw & BRW_NEW_TRANSFORM_FEEDBACK)) {
+ (brw->ctx.NewDriverState & BRW_NEW_TRANSFORM_FEEDBACK)) {
gen6_brw_upload_ff_gs_prog(brw);
return;
}
if (memcmp(&brw->gs.prog_data->base.vue_map, &brw->vue_map_geom_out,
sizeof(brw->vue_map_geom_out)) != 0) {
brw->vue_map_geom_out = brw->gs.prog_data->base.vue_map;
- brw->state.dirty.brw |= BRW_NEW_VUE_MAP_GEOM_OUT;
+ brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_GEOM_OUT;
}
}
gs->gs6.max_vp_index = brw->ctx.Const.MaxViewports - 1;
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+ brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
}
const struct brw_tracked_state brw_gs_unit = {
memset(&brw->interpolation_mode, INTERP_QUALIFIER_NONE, sizeof(brw->interpolation_mode));
- brw->state.dirty.brw |= BRW_NEW_INTERPOLATION_MAP;
+ brw->ctx.NewDriverState |= BRW_NEW_INTERPOLATION_MAP;
if (!fprog)
return;
* 3DSTATE_PS.
*/
brw->wm.fast_clear_op = op;
- brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
}
static void
* clear color value.
*/
brw->state.dirty.mesa |= _NEW_LIGHT | _NEW_BUFFERS;
- brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
}
bool
brw->cc.state_offset);
ADVANCE_BATCH();
- brw->state.dirty.brw |= BRW_NEW_PSP;
+ brw->ctx.NewDriverState |= BRW_NEW_PSP;
}
static void upload_psp_urb_cbs(struct brw_context *brw )
* obvious.
*/
- brw->state.dirty.brw |= BRW_NEW_STATE_BASE_ADDRESS;
+ brw->ctx.NewDriverState |= BRW_NEW_STATE_BASE_ADDRESS;
}
const struct brw_tracked_state brw_state_base_address = {
brw_fragment_program_const(brw->fragment_program);
if (newFP == curFP)
- brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
newFP->id = get_new_program_id(brw->intelScreen);
brw_add_texrect_params(prog);
brw_vertex_program_const(brw->vertex_program);
if (newVP == curVP)
- brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_VERTEX_PROGRAM;
if (newVP->program.IsPositionInvariant) {
_mesa_insert_mvp_code(ctx, &newVP->program);
}
* so turn them on now.
*/
brw->stats_wm++;
- brw->state.dirty.brw |= BRW_NEW_STATS_WM;
+ brw->ctx.NewDriverState |= BRW_NEW_STATS_WM;
break;
default:
brw->query.obj = NULL;
brw->stats_wm--;
- brw->state.dirty.brw |= BRW_NEW_STATS_WM;
+ brw->ctx.NewDriverState |= BRW_NEW_STATS_WM;
break;
default:
/* Flag that the sampler state table pointer has changed; later atoms
* will handle it.
*/
- brw->state.dirty.brw |= BRW_NEW_SAMPLER_STATE_TABLE;
+ brw->ctx.NewDriverState |= BRW_NEW_SAMPLER_STATE_TABLE;
}
}
sfv->scissor.ymax = ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymin - 1;
}
- brw->state.dirty.brw |= BRW_NEW_SF_VP;
+ brw->ctx.NewDriverState |= BRW_NEW_SF_VP;
}
const struct brw_tracked_state brw_sf_vp = {
(sf->sf5.viewport_transform << 1)),
I915_GEM_DOMAIN_INSTRUCTION, 0);
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+ brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
}
const struct brw_tracked_state brw_sf_unit = {
brw_state_dirty(struct brw_context *brw, GLuint mesa_flags, uint64_t brw_flags)
{
return ((brw->state.dirty.mesa & mesa_flags) |
- (brw->state.dirty.brw & brw_flags)) != 0;
+ (brw->ctx.NewDriverState & brw_flags)) != 0;
}
/* brw_misc_state.c */
*(void **)out_aux = ((char *)item->key + item->key_size);
if (item->offset != *inout_offset) {
- brw->state.dirty.brw |= (1 << cache_id);
+ brw->ctx.NewDriverState |= (1 << cache_id);
*inout_offset = item->offset;
}
/* Since we have a new BO in place, we need to signal the units
* that depend on it (state base address on gen5+, or unit state before).
*/
- brw->state.dirty.brw |= BRW_NEW_PROGRAM_CACHE;
+ brw->ctx.NewDriverState |= BRW_NEW_PROGRAM_CACHE;
}
/**
*out_offset = item->offset;
*(void **)out_aux = (void *)((char *)item->key + item->key_size);
- cache->brw->state.dirty.brw |= 1 << cache_id;
+ cache->brw->ctx.NewDriverState |= 1 << cache_id;
}
void
* any offsets leftover in brw_context will no longer be valid.
*/
brw->state.dirty.mesa |= ~0;
- brw->state.dirty.brw |= ~0ull;
+ brw->ctx.NewDriverState |= ~0ull;
intel_batchbuffer_flush(brw);
}
brw_upload_initial_gpu_state(brw);
brw->state.dirty.mesa = ~0;
- brw->state.dirty.brw = ~0ull;
+ brw->ctx.NewDriverState = ~0ull;
/* ~0 is a nonsensical value which won't match anything we program, so
* the programming will take effect on the first time around.
*/
brw->pma_stall_bits = ~0;
- /* Make sure that brw->state.dirty.brw has enough bits to hold all possible
+ /* Make sure that brw->ctx.NewDriverState has enough bits to hold all possible
* dirty flags.
*/
- STATIC_ASSERT(BRW_NUM_STATE_BITS <= 8 * sizeof(brw->state.dirty.brw));
+ STATIC_ASSERT(BRW_NUM_STATE_BITS <= 8 * sizeof(brw->ctx.NewDriverState));
ctx->DriverFlags.NewTransformFeedback = BRW_NEW_TRANSFORM_FEEDBACK;
ctx->DriverFlags.NewTransformFeedbackProg = BRW_NEW_TRANSFORM_FEEDBACK;
struct brw_state_flags *state)
{
state->mesa |= brw->state.dirty.mesa;
- state->brw |= brw->state.dirty.brw;
+ state->brw |= brw->ctx.NewDriverState;
+ assert(brw->state.dirty.brw == 0ull);
}
static inline void
brw_state->mesa |= brw->NewGLState;
brw->NewGLState = 0;
- brw_state->brw |= ctx->NewDriverState;
- ctx->NewDriverState = 0;
-
if (0) {
/* Always re-emit all state. */
brw_state->mesa |= ~0;
- brw_state->brw |= ~0ull;
+ ctx->NewDriverState = ~0ull;
}
if (pipeline == BRW_RENDER_PIPELINE) {
if (brw->fragment_program != ctx->FragmentProgram._Current) {
brw->fragment_program = ctx->FragmentProgram._Current;
- brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
}
if (brw->geometry_program != ctx->GeometryProgram._Current) {
brw->geometry_program = ctx->GeometryProgram._Current;
- brw->state.dirty.brw |= BRW_NEW_GEOMETRY_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_GEOMETRY_PROGRAM;
}
if (brw->vertex_program != ctx->VertexProgram._Current) {
brw->vertex_program = ctx->VertexProgram._Current;
- brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
+ brw->ctx.NewDriverState |= BRW_NEW_VERTEX_PROGRAM;
}
}
if (brw->meta_in_progress != _mesa_meta_in_progress(ctx)) {
brw->meta_in_progress = _mesa_meta_in_progress(ctx);
- brw->state.dirty.brw |= BRW_NEW_META_IN_PROGRESS;
+ brw->ctx.NewDriverState |= BRW_NEW_META_IN_PROGRESS;
}
if (brw->num_samples != ctx->DrawBuffer->Visual.samples) {
brw->num_samples = ctx->DrawBuffer->Visual.samples;
- brw->state.dirty.brw |= BRW_NEW_NUM_SAMPLES;
+ brw->ctx.NewDriverState |= BRW_NEW_NUM_SAMPLES;
}
/* Exit early if no state is flagged as dirty */
for (int i = 0; i < BRW_NUM_PIPELINES; i++) {
if (i != pipeline) {
brw->state.pipelines[i].mesa |= state->mesa;
- brw->state.pipelines[i].brw |= state->brw;
+ brw->state.pipelines[i].brw |= brw->ctx.NewDriverState;
} else {
memset(&brw->state.pipelines[i], 0, sizeof(struct brw_state_flags));
}
}
+ brw->ctx.NewDriverState = 0ull;
memset(state, 0, sizeof(*state));
}
brw->urb.cs_start,
brw->urb.size);
- brw->state.dirty.brw |= BRW_NEW_URB_FENCE;
+ brw->ctx.NewDriverState |= BRW_NEW_URB_FENCE;
}
}
if (memcmp(&brw->vs.prog_data->base.vue_map, &brw->vue_map_geom_out,
sizeof(brw->vue_map_geom_out)) != 0) {
brw->vue_map_vs = brw->vs.prog_data->base.vue_map;
- brw->state.dirty.brw |= BRW_NEW_VUE_MAP_VS;
+ brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_VS;
if (brw->gen < 6) {
/* No geometry shader support, so the VS VUE map is the VUE map for
* the output of the "geometry" portion of the pipeline.
*/
brw->vue_map_geom_out = brw->vue_map_vs;
- brw->state.dirty.brw |= BRW_NEW_VUE_MAP_GEOM_OUT;
+ brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_GEOM_OUT;
}
}
}
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
}
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+ brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
}
const struct brw_tracked_state brw_vs_unit = {
if (!prog_data->nr_pull_params) {
if (stage_state->surf_offset[surf_index]) {
stage_state->surf_offset[surf_index] = 0;
- brw->state.dirty.brw |= brw_new_constbuf;
+ brw->ctx.NewDriverState |= brw_new_constbuf;
}
return;
}
dword_pitch);
drm_intel_bo_unreference(const_bo);
- brw->state.dirty.brw |= brw_new_constbuf;
+ brw->ctx.NewDriverState |= brw_new_constbuf;
}
I915_GEM_DOMAIN_INSTRUCTION, 0);
}
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+ brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
}
const struct brw_tracked_state brw_wm_unit = {
brw, fb->Width, fb->Height, fb->Visual.samples,
&brw->wm.base.surf_offset[surf_index]);
}
- brw->state.dirty.brw |= BRW_NEW_SURFACES;
+ brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
const struct brw_tracked_state brw_renderbuffer_surfaces = {
update_stage_texture_surfaces(brw, fs, &brw->wm.base, true);
}
- brw->state.dirty.brw |= BRW_NEW_SURFACES;
+ brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
const struct brw_tracked_state brw_texture_surfaces = {
}
if (shader->NumUniformBlocks)
- brw->state.dirty.brw |= BRW_NEW_SURFACES;
+ brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
static void
}
if (prog->NumAtomicBuffers)
- brw->state.dirty.brw |= BRW_NEW_SURFACES;
+ brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
static void
}
}
- brw->state.dirty.brw |= BRW_NEW_SURFACES;
+ brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
const struct brw_tracked_state gen6_sol_surface = {
}
if (!need_binding_table) {
if (brw->ff_gs.bind_bo_offset != 0) {
- brw->state.dirty.brw |= BRW_NEW_GS_BINDING_TABLE;
+ brw->ctx.NewDriverState |= BRW_NEW_GS_BINDING_TABLE;
brw->ff_gs.bind_bo_offset = 0;
}
return;
if (!need_binding_table) {
if (brw->gs.base.bind_bo_offset != 0) {
brw->gs.base.bind_bo_offset = 0;
- brw->state.dirty.brw |= BRW_NEW_GS_BINDING_TABLE;
+ brw->ctx.NewDriverState |= BRW_NEW_GS_BINDING_TABLE;
}
return;
}
BRW_MAX_SURFACES * sizeof(uint32_t));
}
- brw->state.dirty.brw |= BRW_NEW_GS_BINDING_TABLE;
+ brw->ctx.NewDriverState |= BRW_NEW_GS_BINDING_TABLE;
}
const struct brw_tracked_state gen6_gs_binding_table = {
vp->ymin = -gby;
vp->ymax = gby;
- brw->state.dirty.brw |= BRW_NEW_CLIP_VP;
+ brw->ctx.NewDriverState |= BRW_NEW_CLIP_VP;
}
const struct brw_tracked_state gen6_clip_vp = {
sfv->viewport.m31 = v[MAT_TY] * y_scale + y_bias;
sfv->viewport.m32 = v[MAT_TZ] * depth_scale;
- brw->state.dirty.brw |= BRW_NEW_SF_VP;
+ brw->ctx.NewDriverState |= BRW_NEW_SF_VP;
}
const struct brw_tracked_state gen6_sf_vp = {
* Similar text exists for the other 3DSTATE_PUSH_CONSTANT_ALLOC_*
* commands.
*/
- brw->state.dirty.brw |= BRW_NEW_PUSH_CONSTANT_ALLOCATION;
+ brw->ctx.NewDriverState |= BRW_NEW_PUSH_CONSTANT_ALLOCATION;
}
void
/* If we're just switching between programs with the same URB requirements,
* skip the rest of the logic.
*/
- if (!(brw->state.dirty.brw & BRW_NEW_CONTEXT) &&
+ if (!(brw->ctx.NewDriverState & BRW_NEW_CONTEXT) &&
brw->urb.vsize == vs_size &&
brw->urb.gs_present == gs_present &&
brw->urb.gsize == gs_size) {
* that is sent
*/
if (brw->gen >= 9)
- brw->state.dirty.brw |= BRW_NEW_SURFACES;
+ brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
}
ADVANCE_BATCH();
- brw->state.dirty.brw |= BRW_NEW_STATE_BASE_ADDRESS;
+ brw->ctx.NewDriverState |= BRW_NEW_STATE_BASE_ADDRESS;
}
const struct brw_tracked_state gen8_state_base_address = {
* purposes means everything).
*/
if (brw->hw_ctx == NULL)
- brw->state.dirty.brw |= BRW_NEW_CONTEXT;
+ brw->ctx.NewDriverState |= BRW_NEW_CONTEXT;
- brw->state.dirty.brw |= BRW_NEW_BATCH;
+ brw->ctx.NewDriverState |= BRW_NEW_BATCH;
brw->state_batch_count = 0;
/* the buffer might be bound as a uniform buffer, need to update it
*/
if (intel_obj->Base.UsageHistory & USAGE_UNIFORM_BUFFER)
- brw->state.dirty.brw |= BRW_NEW_UNIFORM_BUFFER;
+ brw->ctx.NewDriverState |= BRW_NEW_UNIFORM_BUFFER;
if (intel_obj->Base.UsageHistory & USAGE_TEXTURE_BUFFER)
- brw->state.dirty.brw |= BRW_NEW_TEXTURE_BUFFER;
+ brw->ctx.NewDriverState |= BRW_NEW_TEXTURE_BUFFER;
if (intel_obj->Base.UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER)
- brw->state.dirty.brw |= BRW_NEW_ATOMIC_BUFFER;
+ brw->ctx.NewDriverState |= BRW_NEW_ATOMIC_BUFFER;
mark_buffer_inactive(intel_obj);
}