Skip to contentSkip to conversation

drm/i915: Emit even number of dwords when emitting LRIs

PATCH In review Arun Siluvery 2 participants 3 messages Oct 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Emit even number of dwords when emitting LRIs

The number of DWords should be even when doing ring emits as command sequences require QWord alignment.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -1
index 12a546f..79211ae 100644
@@ -680,7 +680,7 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring)
 	if (ret)
 		return ret;
 
-	ret = intel_ring_begin(ring, w->count * 3);
+	ret = intel_ring_begin(ring, w->count * 4);
 	if (ret)
 		return ret;
 
@@ -688,6 +688,7 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring)
 		intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
 		intel_ring_emit(ring, w->reg[i].addr);
 		intel_ring_emit(ring, w->reg[i].value);
+		intel_ring_emit(ring, MI_NOOP);
 	}
 
 	intel_ring_advance(ring);
Signature · 1 line
2.1.2
#1 lore raw
Quoted 2 lines · Arun Siluvery

The number of DWords should be even when doing ring emits as command sequences require QWord alignment.

It looks like we could just pad at the end of the batch instead of one NOP per register write?

Also, It looks like we could use the LRI variant that can write more than one register in one go (separate patch)?.

Signature · 1 line
Damien
Quoted 34 lines
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -1
index 12a546f..79211ae 100644
@@ -680,7 +680,7 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring)
 	if (ret)
 		return ret;
 
-	ret = intel_ring_begin(ring, w->count * 3);
+	ret = intel_ring_begin(ring, w->count * 4);
 	if (ret)
 		return ret;
 
@@ -688,6 +688,7 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring)
 		intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
 		intel_ring_emit(ring, w->reg[i].addr);
 		intel_ring_emit(ring, w->reg[i].value);
+		intel_ring_emit(ring, MI_NOOP);
 	}
 
 	intel_ring_advance(ring);
Signature · 6 lines
2.1.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 9 lines · Damien Lespiau
Quoted 2 lines · Arun Siluvery

The number of DWords should be even when doing ring emits as command sequences require QWord alignment.

It looks like we could just pad at the end of the batch instead of one NOP per register write?

Also, It looks like we could use the LRI variant that can write more than one register in one go (separate patch)?.

Note that if you use the multi-register LRI variant, the number of dwords will always be odd, so we'll always need to pad a NOP, that makes it easy.

Signature · 1 line
Damien