Mesa (master): r300g: Need to emit a hardware scissor rectangle even if scissor is disabled.
Michel Dänzer
daenzer at kemper.freedesktop.org
Sat Dec 5 17:11:11 UTC 2009
Module: Mesa
Branch: master
Commit: 56a4342a0493ad1d502d4791ab941ef171d36e60
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56a4342a0493ad1d502d4791ab941ef171d36e60
Author: Michel Dänzer <daenzer at vmware.com>
Date: Sat Dec 5 17:48:00 2009 +0100
r300g: Need to emit a hardware scissor rectangle even if scissor is disabled.
Just make it cover the whole framebuffer in that case. Otherwise the kernel CS
checker may complain, e.g. running progs/demos/gearbox. That runs fast now
here, but doesn't look right yet.
---
src/gallium/drivers/r300/r300_context.h | 2 ++
src/gallium/drivers/r300/r300_emit.c | 9 +++++++--
src/gallium/drivers/r300/r300_state.c | 19 +++++++++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index dd3f6ac..11cd9f8 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -101,6 +101,8 @@ struct r300_sampler_state {
struct r300_scissor_state {
uint32_t scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */
uint32_t scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */
+ uint32_t no_scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */
+ uint32_t no_scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */
};
struct r300_texture_state {
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 60be03f..04dca29 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -570,8 +570,13 @@ void r300_emit_scissor_state(struct r300_context* r300,
BEGIN_CS(3);
OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
- OUT_CS(scissor->scissor_top_left);
- OUT_CS(scissor->scissor_bottom_right);
+ if (r300->rs_state->rs.scissor) {
+ OUT_CS(scissor->scissor_top_left);
+ OUT_CS(scissor->scissor_bottom_right);
+ } else {
+ OUT_CS(scissor->no_scissor_top_left);
+ OUT_CS(scissor->no_scissor_bottom_right);
+ }
END_CS;
}
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 442af70..2bc2b79 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -302,6 +302,25 @@ static void
r300->framebuffer_state = *state;
r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
+
+ if (r300_screen(r300->context.screen)->caps->is_r500) {
+ r300->scissor_state->no_scissor_top_left =
+ (0 << R300_SCISSORS_X_SHIFT) |
+ (0 << R300_SCISSORS_Y_SHIFT);
+ r300->scissor_state->no_scissor_bottom_right =
+ ((state->width - 1) << R300_SCISSORS_X_SHIFT) |
+ ((state->height - 1) << R300_SCISSORS_Y_SHIFT);
+ } else {
+ /* Offset of 1440 in non-R500 chipsets. */
+ r300->scissor_state->no_scissor_top_left =
+ ((0 + 1440) << R300_SCISSORS_X_SHIFT) |
+ ((0 + 1440) << R300_SCISSORS_Y_SHIFT);
+ r300->scissor_state->no_scissor_bottom_right =
+ (((state->width - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
+ (((state->height - 1) + 1440) << R300_SCISSORS_Y_SHIFT);
+ }
+
+ r300->dirty_state |= R300_NEW_SCISSOR;
}
/* Create fragment shader state. */
More information about the mesa-commit
mailing list