i965/gen6: Move the clip VP to state streaming.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt
2011-04-22 13:20:08 -07:00
parent 32cc0c9d8d
commit 3628e123f1
4 changed files with 22 additions and 21 deletions
+5 -1
View File
@@ -658,7 +658,11 @@ struct brw_context
drm_intel_bo *prog_bo;
drm_intel_bo *state_bo;
drm_intel_bo *vp_bo;
/* As of gen6, this is the offset in the batch to the CLIP VP,
* instead of vp_bo.
*/
uint32_t vp_offset;
} clip;
+5 -7
View File
@@ -233,23 +233,21 @@ static void dump_sf_viewport_state(struct brw_context *brw)
static void dump_clip_viewport_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
const char *name = "CLIP VP";
struct brw_clipper_viewport *vp;
uint32_t vp_off;
if (brw->clip.vp_bo == NULL)
return;
drm_intel_bo_map(intel->batch.bo, GL_FALSE);
drm_intel_bo_map(brw->clip.vp_bo, GL_FALSE);
vp = brw->clip.vp_bo->virtual;
vp_off = brw->clip.vp_bo->offset;
vp = intel->batch.bo->virtual + brw->clip.vp_offset;
vp_off = intel->batch.bo->offset + brw->clip.vp_offset;
state_out(name, vp, vp_off, 0, "xmin = %f\n", vp->xmin);
state_out(name, vp, vp_off, 1, "xmax = %f\n", vp->xmax);
state_out(name, vp, vp_off, 2, "ymin = %f\n", vp->ymin);
state_out(name, vp, vp_off, 3, "ymax = %f\n", vp->ymax);
drm_intel_bo_unmap(brw->clip.vp_bo);
drm_intel_bo_unmap(intel->batch.bo);
}
static void dump_cc_viewport_state(struct brw_context *brw)
-1
View File
@@ -83,7 +83,6 @@ static void brw_destroy_context( struct intel_context *intel )
dri_bo_release(&brw->gs.state_bo);
dri_bo_release(&brw->clip.prog_bo);
dri_bo_release(&brw->clip.state_bo);
dri_bo_release(&brw->clip.vp_bo);
dri_bo_release(&brw->sf.prog_bo);
dri_bo_release(&brw->sf.state_bo);
dri_bo_release(&brw->sf.vp_bo);
+12 -12
View File
@@ -41,22 +41,22 @@
static void
prepare_clip_vp(struct brw_context *brw)
{
struct brw_clipper_viewport vp;
struct brw_clipper_viewport *vp;
vp.xmin = -1.0;
vp.xmax = 1.0;
vp.ymin = -1.0;
vp.ymax = 1.0;
vp = brw_state_batch(brw, sizeof(*vp), 32, &brw->clip.vp_offset);
drm_intel_bo_unreference(brw->clip.vp_bo);
brw->clip.vp_bo = brw_cache_data(&brw->cache, BRW_CLIP_VP,
&vp, sizeof(vp));
vp->xmin = -1.0;
vp->xmax = 1.0;
vp->ymin = -1.0;
vp->ymax = 1.0;
brw->state.dirty.cache |= CACHE_NEW_CLIP_VP;
}
const struct brw_tracked_state gen6_clip_vp = {
.dirty = {
.mesa = _NEW_VIEWPORT, /* XXX: not really, but we need nonzero */
.brw = 0,
.mesa = 0,
.brw = BRW_NEW_BATCH,
.cache = 0,
},
.prepare = prepare_clip_vp,
@@ -107,7 +107,6 @@ const struct brw_tracked_state gen6_sf_vp = {
static void prepare_viewport_state_pointers(struct brw_context *brw)
{
brw_add_validated_bo(brw, brw->clip.vp_bo);
brw_add_validated_bo(brw, brw->sf.vp_bo);
brw_add_validated_bo(brw, brw->cc.vp_bo);
}
@@ -121,7 +120,8 @@ static void upload_viewport_state_pointers(struct brw_context *brw)
GEN6_CC_VIEWPORT_MODIFY |
GEN6_SF_VIEWPORT_MODIFY |
GEN6_CLIP_VIEWPORT_MODIFY);
OUT_RELOC(brw->clip.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
OUT_RELOC(intel->batch.bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
brw->clip.vp_offset);
OUT_RELOC(brw->sf.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
OUT_RELOC(brw->cc.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
ADVANCE_BATCH();