[Mesa-dev] [PATCH 06/33] i965: Remove the validated BO list, now that it's unused.
Eric Anholt
eric at anholt.net
Mon Oct 24 14:16:53 PDT 2011
---
src/mesa/drivers/dri/i965/brw_context.h | 13 -------------
src/mesa/drivers/dri/i965/brw_curbe.c | 2 --
src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 ++------
src/mesa/drivers/dri/i965/brw_misc_state.c | 17 -----------------
src/mesa/drivers/dri/i965/brw_queryobj.c | 2 --
src/mesa/drivers/dri/i965/brw_state.h | 12 ------------
src/mesa/drivers/dri/i965/brw_state_upload.c | 19 -------------------
src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 1 -
src/mesa/drivers/dri/i965/brw_vtbl.c | 1 -
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 11 -----------
src/mesa/drivers/dri/i965/gen7_misc_state.c | 15 ---------------
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 10 ----------
12 files changed, 2 insertions(+), 109 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 7e2675a..526a4df 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -595,19 +595,6 @@ struct brw_context
struct {
struct brw_state_flags dirty;
- /**
- * List of buffers accumulated in brw_validate_state to receive
- * drm_intel_bo_check_aperture treatment before exec, so we can
- * know if we should flush the batch and try again before
- * emitting primitives.
- *
- * This can be a fixed number as we only have a limited number of
- * objects referenced from the batchbuffer in a primitive emit,
- * consisting of the vertex buffers, pipelined state pointers,
- * the CURBE, the depth buffer, and a query BO.
- */
- drm_intel_bo *validated_bos[VERT_ATTRIB_MAX + BRW_WM_MAX_SURF + 16];
- unsigned int validated_bo_count;
} state;
struct brw_cache cache;
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 0b7db0c..5845fa8 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -322,8 +322,6 @@ static void prepare_constant_buffer(struct brw_context *brw)
bufsz);
}
- brw_add_validated_bo(brw, brw->curbe.curbe_bo);
-
/* Because this provokes an action (ie copy the constants into the
* URB), it shouldn't be shortcircuited if identical to the
* previous time - because eg. the urb destination may have
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 358f426..2b6dd28 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -326,7 +326,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
return;
if (brw->vb.nr_buffers)
- goto validate;
+ goto prepare;
/* XXX: In the rare cases where this happens we fallback all
* the way to software rasterization, although a tnl fallback
@@ -535,11 +535,8 @@ static void brw_prepare_vertices(struct brw_context *brw)
brw->vb.nr_buffers = j;
-validate:
+prepare:
brw_prepare_query_begin(brw);
- for (i = 0; i < brw->vb.nr_buffers; i++) {
- brw_add_validated_bo(brw, brw->vb.buffers[i].bo);
- }
}
static void brw_emit_vertices(struct brw_context *brw)
@@ -738,7 +735,6 @@ static void brw_prepare_indices(struct brw_context *brw)
drm_intel_bo_unreference(brw->ib.bo);
brw->ib.bo = bo;
- brw_add_validated_bo(brw, brw->ib.bo);
brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER;
} else {
drm_intel_bo_unreference(bo);
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 2e6780b..fb1d3e1 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -196,22 +196,6 @@ const struct brw_tracked_state brw_psp_urb_cbs = {
.emit = upload_psp_urb_cbs,
};
-static void prepare_depthbuffer(struct brw_context *brw)
-{
- struct intel_context *intel = &brw->intel;
- struct gl_context *ctx = &intel->ctx;
- struct gl_framebuffer *fb = ctx->DrawBuffer;
- struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
- struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
-
- if (drb)
- brw_add_validated_bo(brw, drb->region->bo);
- if (drb && drb->hiz_region)
- brw_add_validated_bo(brw, drb->hiz_region->bo);
- if (srb)
- brw_add_validated_bo(brw, srb->region->bo);
-}
-
static void emit_depthbuffer(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
@@ -436,7 +420,6 @@ const struct brw_tracked_state brw_depthbuffer = {
.brw = BRW_NEW_BATCH,
.cache = 0,
},
- .prepare = prepare_depthbuffer,
.emit = emit_depthbuffer,
};
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 360724b..8875541 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -246,8 +246,6 @@ brw_prepare_query_begin(struct brw_context *brw)
brw->query.index = 0;
}
-
- brw_add_validated_bo(brw, brw->query.bo);
}
/** Called just before primitive drawing to get a beginning PS_DEPTH_COUNT. */
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 6fc95eb..208b683 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -35,17 +35,6 @@
#include "brw_context.h"
-static INLINE void
-brw_add_validated_bo(struct brw_context *brw, drm_intel_bo *bo)
-{
- assert(brw->state.validated_bo_count < ARRAY_SIZE(brw->state.validated_bos));
-
- if (bo != NULL) {
- drm_intel_bo_reference(bo);
- brw->state.validated_bos[brw->state.validated_bo_count++] = bo;
- }
-};
-
extern const struct brw_tracked_state brw_blend_constant_color;
extern const struct brw_tracked_state brw_cc_vp;
extern const struct brw_tracked_state brw_cc_unit;
@@ -139,7 +128,6 @@ void brw_validate_state(struct brw_context *brw);
void brw_upload_state(struct brw_context *brw);
void brw_init_state(struct brw_context *brw);
void brw_destroy_state(struct brw_context *brw);
-void brw_clear_validated_bos(struct brw_context *brw);
/***********************************************************************
* brw_state_cache.c
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 5374806..2737fee 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -303,19 +303,6 @@ static void xor_states( struct brw_state_flags *result,
result->cache = a->cache ^ b->cache;
}
-void
-brw_clear_validated_bos(struct brw_context *brw)
-{
- int i;
-
- /* Clear the last round of validated bos */
- for (i = 0; i < brw->state.validated_bo_count; i++) {
- drm_intel_bo_unreference(brw->state.validated_bos[i]);
- brw->state.validated_bos[i] = NULL;
- }
- brw->state.validated_bo_count = 0;
-}
-
struct dirty_bit_map {
uint32_t bit;
char *name;
@@ -444,13 +431,9 @@ void brw_validate_state( struct brw_context *brw )
int num_atoms = brw->num_prepare_atoms;
GLuint i;
- brw_clear_validated_bos(brw);
-
state->mesa |= brw->intel.NewGLState;
brw->intel.NewGLState = 0;
- brw_add_validated_bo(brw, intel->batch.bo);
-
if (brw->emit_state_always) {
state->mesa |= ~0;
state->brw |= ~0;
@@ -509,8 +492,6 @@ void brw_upload_state(struct brw_context *brw)
int i;
static int dirty_count = 0;
- brw_clear_validated_bos(brw);
-
if (unlikely(INTEL_DEBUG)) {
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index e164729..bfc4f5d 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -145,7 +145,6 @@ prepare_vs_surfaces(struct brw_context *brw)
int nr_surfaces = 0;
if (brw->vs.const_bo) {
- brw_add_validated_bo(brw, brw->vs.const_bo);
nr_surfaces = 1;
}
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 52be175..ddf75c0 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -70,7 +70,6 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
- brw_clear_validated_bos(brw);
ralloc_free(brw->wm.compile_data);
dri_bo_release(&brw->curbe.curbe_bo);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 355e23d..bb7fd2e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -549,17 +549,10 @@ prepare_wm_surfaces(struct brw_context *brw)
int nr_surfaces = 0;
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- struct intel_region *region = irb ? irb->region : NULL;
-
- if (region)
- brw_add_validated_bo(brw, region->bo);
nr_surfaces = SURF_INDEX_DRAW(i) + 1;
}
if (brw->wm.const_bo) {
- brw_add_validated_bo(brw, brw->wm.const_bo);
nr_surfaces = SURF_INDEX_FRAG_CONST_BUFFER + 1;
}
@@ -567,10 +560,6 @@ prepare_wm_surfaces(struct brw_context *brw)
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
if (texUnit->_ReallyEnabled) {
- struct gl_texture_object *tObj = texUnit->_Current;
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
-
- brw_add_validated_bo(brw, intelObj->mt->region->bo);
nr_surfaces = SURF_INDEX_TEXTURE(i) + 1;
}
}
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index e160641..6a3c086 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -56,20 +56,6 @@ gen7_depth_format(struct brw_context *brw)
return 0;
}
-static void prepare_depthbuffer(struct brw_context *brw)
-{
- struct intel_context *intel = &brw->intel;
- struct gl_context *ctx = &intel->ctx;
- struct gl_framebuffer *fb = ctx->DrawBuffer;
- struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
- struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
-
- if (drb)
- brw_add_validated_bo(brw, drb->region->bo);
- if (srb)
- brw_add_validated_bo(brw, srb->region->bo);
-}
-
static void emit_depthbuffer(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
@@ -177,6 +163,5 @@ const struct brw_tracked_state gen7_depthbuffer = {
.brw = BRW_NEW_BATCH,
.cache = 0,
},
- .prepare = prepare_depthbuffer,
.emit = emit_depthbuffer,
};
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index d2b9866..4741e76 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -311,28 +311,18 @@ prepare_wm_surfaces(struct brw_context *brw)
if (ctx->DrawBuffer->_NumColorDrawBuffers >= 1) {
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- struct intel_region *region = irb ? irb->region : NULL;
-
- if (region)
- brw_add_validated_bo(brw, region->bo);
nr_surfaces = SURF_INDEX_DRAW(i) + 1;
}
}
if (brw->wm.const_bo) {
- brw_add_validated_bo(brw, brw->wm.const_bo);
nr_surfaces = SURF_INDEX_FRAG_CONST_BUFFER + 1;
}
for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
- struct gl_texture_object *tObj = texUnit->_Current;
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
if (texUnit->_ReallyEnabled) {
- brw_add_validated_bo(brw, intelObj->mt->region->bo);
nr_surfaces = SURF_INDEX_TEXTURE(i) + 1;
}
}
--
1.7.7
More information about the mesa-dev
mailing list