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;
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(brw->clip.vp_bo, GL_FALSE);
+ drm_intel_bo_map(intel->batch.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)
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);
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,
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);
}
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();