[Mesa-dev] [RFC] i965: Fix border color on Sandybridge and Ivybridge.
Kenneth Graunke
kenneth at whitecape.org
Fri Jan 20 04:16:00 PST 2012
While reading through the simulator, I found some interesting code that
looks like it checks the sampler default color pointer against the bound
set in STATE_BASE_ADDRESS. On failure, it appears to program it to a
bogus but in-bound value.
So I decided to try programming a legitimate bound, and lo and behold,
border color worked. Unfortunately, it's not entirely reliable: piglit
tests (such as tex-border-1) will still fail if you run them in a loop.
+91 piglits (or thereabouts).
This patch causes serious regressions and should not be pushed as-is.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28924
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_misc_state.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
This appears to break GNOME Shell horribly, among other things.
I'm guessing I screwed up the bound somehow.
But it does fix texture borders on SNB/IVB. Mostly.
Not a clue about ILK, sadly.
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 8e59a47..c506db6 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -769,7 +769,12 @@ static void upload_state_base_address( struct brw_context *brw )
1); /* Instruction base address: shader kernels (incl. SIP) */
OUT_BATCH(1); /* General state upper bound */
- OUT_BATCH(1); /* Dynamic state upper bound */
+ /* Dynamic state upper bound. Although the documentation says that
+ * programming it to zero will cause it to be ignored, that is a lie.
+ * If this isn't programmed to a real bound, the sampler border color
+ * pointer is rejected, causing border color to mysteriously fail.
+ */
+ OUT_BATCH(((uintptr_t) intel->batch.bo + intel->batch.bo->size) | 1);
OUT_BATCH(1); /* Indirect object upper bound */
OUT_BATCH(1); /* Instruction access upper bound */
ADVANCE_BATCH();
--
1.7.7.5
More information about the mesa-dev
mailing list