[Mesa-dev] [PATCH] i965: Correct constant buffer MOCS

Ben Widawsky benjamin.widawsky at intel.com
Tue Jun 2 20:07:50 PDT 2015


I'm very confused here. It seems pretty clear that since the command has been
introduced with support for MOCS, MOCS lives at bit 8 of dword 0 for all
constant buffers. The error has existed since forever AFAICT.

No piglit regressions or fixes:
http://otc-mesa-ci.jf.intel.com/view/dev/job/bwidawsk/143/

I suspect the low bits are discarded by the hardware when using the buffer
offset (we were setting 1). I suppose it could potentially impact perf, though
I'd imagine the kernel is already doing the right thing by default anyway. This
would explain why the patch doesn't really do anything behaviorally.

NOTE: gen8+ should have no change at all since MOCS was always 0 anyway.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/gen7_vs_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c
index 278b3ec..f60dcb1 100644
--- a/src/mesa/drivers/dri/i965/gen7_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c
@@ -42,13 +42,13 @@ gen7_upload_constant_state(struct brw_context *brw,
 
    int dwords = brw->gen >= 8 ? 11 : 7;
    BEGIN_BATCH(dwords);
-   OUT_BATCH(opcode << 16 | (dwords - 2));
+   OUT_BATCH(opcode << 16 | (mocs << 8) | (dwords - 2));
    OUT_BATCH(active ? stage_state->push_const_size : 0);
    OUT_BATCH(0);
    /* Pointer to the constant buffer.  Covered by the set of state flags
     * from gen6_prepare_wm_contants
     */
-   OUT_BATCH(active ? (stage_state->push_const_offset | mocs) : 0);
+   OUT_BATCH(active ? stage_state->push_const_offset : 0);
    OUT_BATCH(0);
    OUT_BATCH(0);
    OUT_BATCH(0);
-- 
2.4.2



More information about the mesa-dev mailing list