drm/i915/execlists: Move WA_TAIL_DWORDS to callee
Subsystems (2)
PATCH v7 1/1 drm/i915/execlists: Move WA_TAIL_DWORDS to callee
Currently the execlist-specific emit-request functions start writing to the ring and reserve space for a workaround to be emitted later whilst submitting the request. It is easier to read if the caller only allocates sufficient space for its own accesses (then the reader can quickly verify that the ring begin allocates the exact space for the number of dwords emitted) and closes the access to the ring. During submit, if we need to add the workaround, we can reacquire ring access, in the assurance that we reserved space for ourselves when beginning the request.
v3:
Reinstated #define for WA_TAIL_DWORDS so we could accommodate GPUs that required different amounts of padding, generalised NOOP fill [Rodrigo Vivi], added W/A space to reserved amount and updated code comments [Dave Gordon],
v4:
Made #define for WA_TAIL_DWORDS a function-type macro in case we want different values on different platforms (or engines), to address comment by [Rodrigo Vivi]. But the current value is still the constant (2) on all platforms, so this doesn't add any overhead.
v5:
Eliminated local variable & multiple indirections. Added long essay comment about WaIdleLiteRestore.
v6:
Renamed #define for amount of space used by add_request() - it's the *maximum* length of opcodes emitted by that function, not a minimum, and made it (hypothetically) platform- or engine-dependent. But it's still the same literal-constant on all platforms for now.
v7:
Rebased
--- drivers/gpu/drm/i915/i915_gem_request.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 92 ++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_ringbuffer.h | 19 ++++--- 3 files changed, 81 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/i915_gem_request.c +1 -1
@@ -411,7 +411,7 @@ struct drm_i915_gem_request ** to be redone if the request is not actually submitted straight * away, e.g. because a GPU scheduler has deferred it. */ - req->reserved_space =MIN_SPACE_FOR_ADD_REQUEST ; + req->reserved_space =sizeof (u32) *MAX_ADD_REQUEST_DWORDS (req);if (i915.enable_execlists) ret =intel_logical_ring_alloc_request_extras (req);
drivers/gpu/drm/i915/intel_lrc.c +67 -25
146 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +13 -6
@@ -509,13 +509,20 @@ static inline u32 intel_engine_get_seqno(struct intel_engine_cs *engine)int init_workarounds_ring (struct intel_engine_cs *engine);/* -* Arbitrary size for largest possible 'add request' sequence. The code paths -* are complex and variable. Empirical measurement shows that the worst case -* is BDW at 192 bytes (6 + 6 + 36 dwords), then ILK at 136 bytes. However, -* we need to allocate double the largest single packet within that emission -* to account for tail wraparound (so 6 + 6 + 72 dwords for BDW). +* Size for the longest possible 'add_request' sequence, for the given request. +* +* In theory, this could depend on the platform, or the engine, or many other +* things; hence the macro takes the request as an argument on which to base +* this calculation. In practive, the code paths are complex and variable, +* and it's simpler just to give an upper bound for all possibilities, +* ignoring the details of the actual request. +* +* Empirical measurement shows that the worst case is BDW at 192 bytes +* (6 + 6 + 36 dwords), then ILK at 136 bytes. However, we need to allocate +* double the largest single packet within that emissionto account for tail +* wraparound (so 6 + 6 + 72 dwords for BDW). */ -#define MIN_SPACE_FOR_ADD_REQUEST 336 +#define MAX_ADD_REQUEST_DWORDS (request) (6+6+72)static inline u32 intel_hws_seqno_address (struct intel_engine_cs *engine) {
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
drivers/gpu/drm/i915/intel_lrc.c int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request · line 689
Quoted 11 lines · Dave Gordon
drivers/gpu/drm/i915/intel_lrc.c +7
-0@@ -654,6 +680,14 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request*/ request->reserved_space +=EXECLISTS_REQUEST_SIZE ; +/* +* WA_TAIL_DWORDS is specific to the execlist submission mechanism, +* to accommodate some NOOPs at the end of each request, to be used +* by a workaround for not being allowed to do lite restore with +* HEAD==TAIL (WaIdleLiteRestore). See intel_logical_ring_submit() +*/ + request->reserved_space +=sizeof (u32) *WA_TAIL_DWORDS (request);
We already have the define that accommodates the tail. Whilst this remains a fixed size, let's use it appropriately. And when it is dynamic, we store it in the engine (or context).
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Chris Wilson
Quoted 4 lines · Dave Gordon
drivers/gpu/drm/i915/intel_lrc.c +0
-0@@ -654,6 +680,14 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request*/ request->reserved_space +=EXECLISTS_REQUEST_SIZE ;
Quoted 12 lines
drivers/gpu/drm/i915/intel_lrc.c int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request · line 689
Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +7
-0+/* +* WA_TAIL_DWORDS is specific to the execlist submission mechanism, +* to accommodate some NOOPs at the end of each request, to be used +* by a workaround for not being allowed to do lite restore with +* HEAD==TAIL (WaIdleLiteRestore). See intel_logical_ring_submit() +*/ + request->reserved_space +=sizeof (u32) *WA_TAIL_DWORDS (request);We already have the define that accommodates the tail. Whilst this remains a fixed size, let's use it appropriately. And when it is dynamic, we store it in the engine (or context).
-Chris
It might not depend on the engine or context, but on the specifics of the request. For the other cases, we could find the engine or context from the request but not vice-versa. Hence we should (pretend to) pass the request here, because that provides the most generality.
We do have a future use for this, so this is really part of the prepwork. And Rodrigo specifically asked for the possibility of variable amounts of padding, as documented in the commit message.
But the main point of this patch is to get rid of the "+WA_TAIL_DWORDS" in the *_emit_request() functions and instead claim-and-use the space inside intel_logical_ring_advance(), thus keeping all begin()/advance() pairs matched and local, as opposed to the current scheme of the space being claimed in _emit_request() but *used* by _logical_ring_advance().
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Ro.CI.BAT: failure for drm/i915/execlists: Move WA_TAIL_DWORDS to callee (rev3)
In reply to Dave Gordon== Series Details ==
== Series Details ==
Series: drm/i915/execlists: Move WA_TAIL_DWORDS to callee (rev3)
URL : https://patchwork.freedesktop.org/series/3133/
State : failure
== Summary ==
Series 3133v3 drm/i915/execlists: Move WA_TAIL_DWORDS to callee
http://patchwork.freedesktop.org/api/1.0/series/3133/revisions/3/mbox
Test kms_cursor_legacy:
Subgroup basic-flip-vs-cursor-legacy:
pass -> FAIL (ro-byt-n2820)
fail -> PASS (ro-bdw-i5-5250u)
Subgroup basic-flip-vs-cursor-varying-size:
pass -> FAIL (ro-byt-n2820)
fail -> PASS (fi-hsw-i7-4770k)
fail -> PASS (ro-bdw-i5-5250u)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
dmesg-warn -> SKIP (ro-bdw-i5-5250u)
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (ro-bdw-i7-5600u)fi-hsw-i7-4770k total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-qkkr total:244 pass:186 dwarn:28 dfail:0 fail:3 skip:27 fi-skl-i7-6700k total:244 pass:208 dwarn:4 dfail:2 fail:2 skip:28 fi-snb-i7-2600 total:244 pass:202 dwarn:0 dfail:0 fail:0 skip:42 ro-bdw-i5-5250u total:240 pass:220 dwarn:1 dfail:0 fail:0 skip:19 ro-bdw-i7-5557U total:240 pass:219 dwarn:2 dfail:0 fail:1 skip:18 ro-bdw-i7-5600u total:240 pass:206 dwarn:0 dfail:0 fail:2 skip:32 ro-bsw-n3050 total:240 pass:195 dwarn:0 dfail:0 fail:3 skip:42 ro-byt-n2820 total:240 pass:196 dwarn:0 dfail:0 fail:4 skip:40 ro-hsw-i3-4010u total:240 pass:213 dwarn:0 dfail:0 fail:1 skip:26 ro-hsw-i7-4770r total:240 pass:185 dwarn:0 dfail:0 fail:0 skip:55 ro-ilk1-i5-650 total:235 pass:174 dwarn:0 dfail:0 fail:2 skip:59 ro-ivb-i7-3770 total:240 pass:204 dwarn:0 dfail:0 fail:1 skip:35 ro-ivb2-i7-3770 total:240 pass:208 dwarn:0 dfail:0 fail:1 skip:31 ro-skl3-i5-6260u total:240 pass:223 dwarn:0 dfail:0 fail:3 skip:14
Results at /archive/results/CI_IGT_test/RO_Patchwork_1942/
21defee drm-intel-nightly: 2016y-08m-19d-09h-06m-36s UTC integration manifest fc5328f drm/i915/execlists: Move WA_TAIL_DWORDS to callee
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx