summaryrefslogtreecommitdiff
path: root/src/i915_3d.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-19 09:30:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-24 09:33:35 +0100
commitdcef703a7cdcf360f12312a338361697acffc3e9 (patch)
tree1ce52897452ddbf7abd6ca82d7adb19f02ecd0f9 /src/i915_3d.h
parentbc41f84e01f18548b05c670e1fd0d641adc28d0f (diff)
Kill paranoid assertions on every write into the batchbuffer.
On my PineView box these represent ~5% overhead on x11perf text: Before: 16000000 trep @ 0.0020 msec (495000.0/sec): Char in 80-char aa line (Charter 10) 12000000 trep @ 0.0022 msec (461000.0/sec): Char in 80-char rgb line (Charter 10) After: 16000000 trep @ 0.0020 msec (511000.0/sec): Char in 80-char aa line (Charter 10) 16000000 trep @ 0.0021 msec (480000.0/sec): Char in 80-char rgb line (Charter 10) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/i915_3d.h')
-rw-r--r--src/i915_3d.h31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/i915_3d.h b/src/i915_3d.h
index f85780aa..ab4fbb57 100644
--- a/src/i915_3d.h
+++ b/src/i915_3d.h
@@ -418,36 +418,25 @@ do { \
* \param x maximum number of shader commands that may be used between
* a FS_START and FS_END
*/
-#define FS_LOCALS(x) \
- uint32_t _shader_buf[(x) * 3]; \
- unsigned int _max_shader_commands = x; \
- unsigned int _cur_shader_commands
+#define FS_LOCALS() \
+ uint32_t _shader_offset
#define FS_BEGIN() \
do { \
- _cur_shader_commands = 0; \
+ _shader_offset = intel->batch_used; \
+ intel->batch_used += 4; \
} while (0)
#define FS_OUT(_shaderop) \
do { \
- if (_cur_shader_commands >= _max_shader_commands) \
- FatalError("fragment shader command buffer exceeded (%d)\n", \
- _cur_shader_commands); \
- _shader_buf[_cur_shader_commands * 3 + 0] = _shaderop.ui[0]; \
- _shader_buf[_cur_shader_commands * 3 + 1] = _shaderop.ui[1]; \
- _shader_buf[_cur_shader_commands * 3 + 2] = _shaderop.ui[2]; \
- ++_cur_shader_commands; \
+ OUT_BATCH(_shaderop.ui[0]); \
+ OUT_BATCH(_shaderop.ui[1]); \
+ OUT_BATCH(_shaderop.ui[2]); \
} while (0)
#define FS_END() \
do { \
- int _i, _pad = (_cur_shader_commands & 0x1) ? 0 : 1; \
- ATOMIC_BATCH(_cur_shader_commands * 3 + 1 + _pad); \
- OUT_BATCH(_3DSTATE_PIXEL_SHADER_PROGRAM | \
- (_cur_shader_commands * 3 - 1)); \
- for (_i = 0; _i < _cur_shader_commands * 3; _i++) \
- OUT_BATCH(_shader_buf[_i]); \
- if (_pad != 0) \
- OUT_BATCH(MI_NOOP); \
- ADVANCE_BATCH(); \
+ *(uint32_t *)(intel->batch_ptr + _shader_offset) = \
+ (_3DSTATE_PIXEL_SHADER_PROGRAM | \
+ ((intel->batch_used - _shader_offset) / 4 - 2)); \
} while (0);