Skip to content

Commit e9af4ea

Browse files
committed
drm/i915: Avoid waitboosting on the active request
Watching a light workload on Baytrail (running glxgears and a 1080p decode), instead of the system remaining at low frequency, the glxgears would regularly trigger waitboosting after which it would have to spend a few seconds throttling back down. In this case, the waitboosting is counter productive as the minimal wait for glxgears doesn't prevent it from functioning correctly and delivering frames on time. In this case, glxgears happens to almost always be waiting on the current request, which we already expect to complete quickly (see i915_spin_request) and so avoiding the waitboost on the active request and spinning instead provides the best latency without overcommitting to upclocking. However, if the system falls behind we still force the waitboost. Similarly, we will also trigger upclocking if we detect the system is not delivering frames on time - again using a mechanism that tries to detect a miss and not preemptively upclock. v2: Also skip boosting for after missed vblank if the desired request is already active. Signed-off-by: Chris Wilson <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Radoslaw Szwichtenberg <[email protected]> Reviewed-by: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent b6c51c3 commit e9af4ea

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ i915_gem_object_wait_fence(struct dma_fence *fence,
369369
if (i915_gem_request_completed(rq))
370370
goto out;
371371

372-
/* This client is about to stall waiting for the GPU. In many cases
372+
/*
373+
* This client is about to stall waiting for the GPU. In many cases
373374
* this is undesirable and limits the throughput of the system, as
374375
* many clients cannot continue processing user input/output whilst
375376
* blocked. RPS autotuning may take tens of milliseconds to respond
@@ -384,11 +385,9 @@ i915_gem_object_wait_fence(struct dma_fence *fence,
384385
* forcing the clocks too high for the whole system, we only allow
385386
* each client to waitboost once in a busy period.
386387
*/
387-
if (rps_client) {
388+
if (rps_client && !i915_gem_request_started(rq)) {
388389
if (INTEL_GEN(rq->i915) >= 6)
389390
gen6_rps_boost(rq, rps_client);
390-
else
391-
rps_client = NULL;
392391
}
393392

394393
timeout = i915_wait_request(rq, flags, timeout);

drivers/gpu/drm/i915/i915_gem_request.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ i915_gem_request_completed(const struct drm_i915_gem_request *req)
329329
return __i915_gem_request_completed(req, seqno);
330330
}
331331

332+
static inline bool
333+
i915_gem_request_started(const struct drm_i915_gem_request *req)
334+
{
335+
u32 seqno;
336+
337+
seqno = i915_gem_request_global_seqno(req);
338+
if (!seqno)
339+
return false;
340+
341+
return i915_seqno_passed(intel_engine_get_seqno(req->engine),
342+
seqno - 1);
343+
}
344+
332345
static inline bool i915_priotree_signaled(const struct i915_priotree *pt)
333346
{
334347
const struct drm_i915_gem_request *rq =

drivers/gpu/drm/i915/intel_display.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12519,7 +12519,13 @@ static int do_rps_boost(struct wait_queue_entry *_wait,
1251912519
struct wait_rps_boost *wait = container_of(_wait, typeof(*wait), wait);
1252012520
struct drm_i915_gem_request *rq = wait->request;
1252112521

12522-
gen6_rps_boost(rq, NULL);
12522+
/*
12523+
* If we missed the vblank, but the request is already running it
12524+
* is reasonable to assume that it will complete before the next
12525+
* vblank without our intervention, so leave RPS alone.
12526+
*/
12527+
if (!i915_gem_request_started(rq))
12528+
gen6_rps_boost(rq, NULL);
1252312529
i915_gem_request_put(rq);
1252412530

1252512531
drm_crtc_vblank_put(wait->crtc);

0 commit comments

Comments
 (0)