i915->hardware_dirty = ~0;
i915->immediate_dirty = ~0;
i915->dynamic_dirty = ~0;
+ i915->static_dirty = ~0;
i915->flush_dirty = 0;
return &i915->base;
struct i915_state current;
unsigned hardware_dirty;
- unsigned immediate_dirty;
- unsigned dynamic_dirty;
- unsigned flush_dirty;
+ unsigned immediate_dirty : I915_MAX_IMMEDIATE;
+ unsigned dynamic_dirty : I915_MAX_DYNAMIC;
+ unsigned static_dirty : 4;
+ unsigned flush_dirty : 2;
struct i915_winsys_buffer *validation_buffers[2 + 1 + I915_TEX_UNITS];
int num_validation_buffers;
#define I915_FLUSH_CACHE 1
#define I915_PIPELINE_FLUSH 2
+/* split up static state */
+#define I915_DST_BUF_COLOR 1
+#define I915_DST_BUF_DEPTH 2
+#define I915_DST_VARS 4
+#define I915_DST_RECT 8
+
static INLINE
void i915_set_flush_dirty(struct i915_context *i915, unsigned flush)
{
i915->hardware_dirty = ~0;
i915->immediate_dirty = ~0;
i915->dynamic_dirty = ~0;
+ i915->static_dirty = ~0;
/* kernel emits flushes in between batchbuffers */
i915->flush_dirty = 0;
}
static void
validate_static(struct i915_context *i915, unsigned *batch_space)
{
- *batch_space = 2 + 5; /* including DRAW_RECT */
+ *batch_space = 0;
- if (i915->current.cbuf_bo) {
+ if (i915->current.cbuf_bo && (i915->static_dirty & I915_DST_BUF_COLOR)) {
i915->validation_buffers[i915->num_validation_buffers++]
= i915->current.cbuf_bo;
*batch_space += 3;
}
- if (i915->current.depth_bo) {
+ if (i915->current.depth_bo && (i915->static_dirty & I915_DST_BUF_DEPTH)) {
i915->validation_buffers[i915->num_validation_buffers++]
= i915->current.depth_bo;
*batch_space += 3;
}
+
+ if (i915->static_dirty & I915_DST_VARS)
+ *batch_space += 2;
+
+ if (i915->static_dirty & I915_DST_RECT)
+ *batch_space += 5;
}
static void
emit_static(struct i915_context *i915)
{
- if (i915->current.cbuf_bo) {
+ if (i915->current.cbuf_bo && (i915->static_dirty & I915_DST_BUF_COLOR)) {
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
OUT_BATCH(i915->current.cbuf_flags);
OUT_RELOC(i915->current.cbuf_bo,
/* What happens if no zbuf??
*/
- if (i915->current.depth_bo) {
+ if (i915->current.depth_bo && (i915->static_dirty & I915_DST_BUF_DEPTH)) {
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
OUT_BATCH(i915->current.depth_flags);
OUT_RELOC(i915->current.depth_bo,
0);
}
- {
+ if (i915->static_dirty & I915_DST_VARS) {
OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD);
OUT_BATCH(i915->current.dst_buf_vars);
}
if (i915->current.sampler_enable_nr) {
int i;
- OUT_BATCH( _3DSTATE_SAMPLER_STATE |
+ OUT_BATCH( _3DSTATE_SAMPLER_STATE |
(3 * i915->current.sampler_enable_nr) );
OUT_BATCH( i915->current.sampler_enable_flags );
static void
emit_draw_rect(struct i915_context *i915)
{
- OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
- OUT_BATCH(DRAW_RECT_DIS_DEPTH_OFS);
- OUT_BATCH(i915->current.draw_offset);
- OUT_BATCH(i915->current.draw_size);
- OUT_BATCH(i915->current.draw_offset);
+ if (i915->static_dirty & I915_DST_RECT) {
+ OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
+ OUT_BATCH(DRAW_RECT_DIS_DEPTH_OFS);
+ OUT_BATCH(i915->current.draw_offset);
+ OUT_BATCH(i915->current.draw_size);
+ OUT_BATCH(i915->current.draw_offset);
+ }
}
static boolean
i915->hardware_dirty = 0;
i915->immediate_dirty = 0;
i915->dynamic_dirty = 0;
+ i915->static_dirty = 0;
i915->flush_dirty = 0;
}
struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
unsigned cformat, zformat;
- unsigned x, y, w, h;
+ unsigned x, y;
int layer;
- uint32_t draw_offset;
+ uint32_t draw_offset, draw_size, dst_buf_vars;
if (cbuf_surface) {
struct i915_texture *tex = i915_texture(cbuf_surface->texture);
x = y = 0;
}
cformat = translate_format(cformat);
+ i915->static_dirty |= I915_DST_BUF_COLOR;
/* What happens if no zbuf??
*/
i915->current.depth_bo = NULL;
zformat = 0;
}
-
- i915->current.dst_buf_vars = DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- cformat |
- zformat;
+ i915->static_dirty |= I915_DST_BUF_DEPTH;
+
+ dst_buf_vars = DSTORG_HORT_BIAS(0x8) | /* .5 */
+ DSTORG_VERT_BIAS(0x8) | /* .5 */
+ LOD_PRECLAMP_OGL |
+ TEX_DEFAULT_COLOR_OGL |
+ cformat |
+ zformat;
+ if (i915->current.dst_buf_vars != dst_buf_vars) {
+ i915->current.dst_buf_vars = dst_buf_vars;
+ i915->static_dirty |= I915_DST_VARS;
+ }
/* drawing rect calculations */
draw_offset = x | (y << 16);
+ draw_size = (i915->framebuffer.width - 1 + x) |
+ ((i915->framebuffer.height - 1 + y) << 16);
if (i915->current.draw_offset != draw_offset) {
i915->current.draw_offset = draw_offset;
i915_set_flush_dirty(i915, I915_PIPELINE_FLUSH);
+ i915->static_dirty |= I915_DST_RECT;
+ } else if (i915->current.draw_size != draw_size) {
+ i915->current.draw_size = draw_size;
+ i915->static_dirty |= I915_DST_RECT;
}
- w = i915->framebuffer.width;
- h = i915->framebuffer.height;
- i915->current.draw_size = (w - 1 + x) | ((h - 1 + y) << 16);
-
i915->hardware_dirty |= I915_HW_STATIC;
/* flush the cache in case we sample from the old renderbuffers */