summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/i915simple/Makefile1
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h75
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_emit.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_state.h1
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c7
-rw-r--r--src/mesa/pipe/i915simple/i915_state_emit.c10
6 files changed, 88 insertions, 8 deletions
diff --git a/src/mesa/pipe/i915simple/Makefile b/src/mesa/pipe/i915simple/Makefile
index 93d9c6cf01..1adffbbfe1 100644
--- a/src/mesa/pipe/i915simple/Makefile
+++ b/src/mesa/pipe/i915simple/Makefile
@@ -15,6 +15,7 @@ DRIVER_SOURCES = \
i915_debug_fp.c \
i915_regions.c \
i915_state.c \
+ i915_state_immediate.c \
i915_state_derived.c \
i915_state_emit.c \
i915_state_fragprog.c \
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index c298f0f581..0f0728cde0 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -32,6 +32,63 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
+
+
+#define I915_TEX_UNITS 8
+
+#define I915_DYNAMIC_MODES4 0
+#define I915_DYNAMIC_DEPTHSCALE_0 1 /* just the header */
+#define I915_DYNAMIC_DEPTHSCALE_1 2
+#define I915_DYNAMIC_IAB 3
+#define I915_DYNAMIC_BC_0 4 /* just the header */
+#define I915_DYNAMIC_BC_1 5
+#define I915_DYNAMIC_BFO_0 6
+#define I915_DYNAMIC_BFO_1 7
+#define I915_DYNAMIC_STP_0 8
+#define I915_DYNAMIC_STP_1 9
+#define I915_DYNAMIC_SC_0 10
+#define I915_DYNAMIC_SC_1 11
+#define I915_DYNAMIC_SC_2 12
+#define I915_DYNAMIC_SC_3 13
+#define I915_MAX_DYNAMIC 14
+
+
+#define I915_IMMEDIATE_S0 0
+#define I915_IMMEDIATE_S1 1
+#define I915_IMMEDIATE_S2 2
+#define I915_IMMEDIATE_S3 3
+#define I915_IMMEDIATE_S4 4
+#define I915_IMMEDIATE_S5 5
+#define I915_IMMEDIATE_S6 6
+#define I915_IMMEDIATE_S7 7
+#define I915_MAX_IMMEDIATE 8
+
+/* These must mach the order of LI0_STATE_* bits, as they will be used
+ * to generate hardware packets:
+ */
+#define I915_CACHE_STATIC 0
+#define I915_CACHE_DYNAMIC 1 /* handled specially */
+#define I915_CACHE_SAMPLER 2
+#define I915_CACHE_MAP 3
+#define I915_CACHE_PROGRAM 4
+#define I915_CACHE_CONSTANTS 5
+#define I915_MAX_CACHE 6
+
+
+struct i915_cache_context;
+
+/* Use to calculate differences between state emitted to hardware and
+ * current driver-calculated state.
+ */
+struct i915_state
+{
+ GLuint immediate[I915_MAX_IMMEDIATE];
+
+ GLuint id; /* track lost context events */
+};
+
+
+
struct i915_context
{
struct pipe_context pipe;
@@ -56,13 +113,19 @@ struct i915_context
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
GLuint dirty;
- GLuint hw_dirty;
GLuint *batch_start;
+ struct i915_state current;
+ GLuint hardware_dirty;
+
+
+
struct pipe_scissor_state cliprect;
};
+/* A flag for each state_tracker state object:
+ */
#define I915_NEW_VIEWPORT 0x1
#define I915_NEW_SETUP 0x2
#define I915_NEW_FS 0x4
@@ -77,6 +140,16 @@ struct i915_context
#define I915_NEW_TEXTURE 0x800
#define I915_NEW_STENCIL 0x1000
+/* Driver's internally generated state flags:
+ */
+#define I915_NEW_VERTEX_FORMAT 0x10000
+
+
+/* Dirty flags for hardware emit
+ */
+#define I915_HW_INDIRECT (1<<0)
+#define I915_HW_IMMEDIATE (1<<1)
+
/***********************************************************************
* i915_prim_emit.c:
diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/mesa/pipe/i915simple/i915_prim_emit.c
index a1e0e85196..708fc41d31 100644
--- a/src/mesa/pipe/i915simple/i915_prim_emit.c
+++ b/src/mesa/pipe/i915simple/i915_prim_emit.c
@@ -123,7 +123,7 @@ emit_prim( struct draw_stage *stage,
if (i915->dirty)
i915_update_derived( i915 );
- if (i915->hw_dirty)
+ if (i915->hardware_dirty)
i915_emit_hardware_state( i915 );
ptr = winsys->batch_start( winsys, nr * vertex_size, 0 );
diff --git a/src/mesa/pipe/i915simple/i915_state.h b/src/mesa/pipe/i915simple/i915_state.h
index c9b9f15d39..e26e8f6b0b 100644
--- a/src/mesa/pipe/i915simple/i915_state.h
+++ b/src/mesa/pipe/i915simple/i915_state.h
@@ -33,6 +33,7 @@
struct i915_context;
+void i915_update_immediate( struct i915_context *i915 );
void i915_update_derived( struct i915_context *i915 );
void i915_emit_hardware_state( struct i915_context *i915 );
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
index f1f798b506..32b8b6c808 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/mesa/pipe/i915simple/i915_state_derived.c
@@ -183,7 +183,12 @@ void i915_update_derived( struct i915_context *i915 )
compute_cliprect(i915);
if (i915->dirty)
- i915->hw_dirty = 1;
+ i915_update_immediate( i915 );
+
+ /* HW emit currently references framebuffer state directly:
+ */
+ if (i915->dirty & I915_NEW_FRAMEBUFFER)
+ i915->hardware_dirty = 1;
i915->dirty = 0;
}
diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/mesa/pipe/i915simple/i915_state_emit.c
index 3b2ab4775b..1a50470fbd 100644
--- a/src/mesa/pipe/i915simple/i915_state_emit.c
+++ b/src/mesa/pipe/i915simple/i915_state_emit.c
@@ -151,10 +151,10 @@ i915_emit_hardware_state(struct i915_context *i915 )
I1_LOAD_S(6) |
(3));
- OUT_BATCH(0xffffffff);
- OUT_BATCH(0x00902440); // OUT_BATCH(S4_VFMT_XYZ | S4_VFMT_COLOR);
- OUT_BATCH(0x00000002);
- OUT_BATCH(0x00020216); // OUT_BATCH( S6_COLOR_WRITE_ENABLE | (2 << S6_TRISTRIP_PV_SHIFT));
+ OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S2]);
+ OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S4]);
+ OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S5]);
+ OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S6]);
}
{
@@ -264,6 +264,6 @@ i915_emit_hardware_state(struct i915_context *i915 )
}
- i915->hw_dirty = 0;
+ i915->hardware_dirty = 0;
}