mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
drm/i915/selftest: Synchronise with the GPU timestamp
Wait for the GPU to wake up from the semaphore before measuring the time, so that we coordinate the sampling on both the CPU and GPU for more accurate comparisons. v2: Switch to local_irq_disable() as once suggested by Mika. Reported-by: Bruce Chang <yu.bruce.chang@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: CQ Tang <cq.tang@intel.com> Reviewed-by: Bruce Chang <yu.bruce.chang@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210205112912.22978-1-chris@chris-wilson.co.uk Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
dc43040012
commit
985458d706
1 changed files with 5 additions and 3 deletions
|
@ -110,13 +110,15 @@ static int __measure_timestamps(struct intel_context *ce,
|
|||
cpu_relax();
|
||||
|
||||
/* Run the request for a 100us, sampling timestamps before/after */
|
||||
preempt_disable();
|
||||
*dt = local_clock();
|
||||
local_irq_disable();
|
||||
write_semaphore(&sema[2], 0);
|
||||
while (READ_ONCE(sema[1]) == 0) /* wait for the gpu to catch up */
|
||||
cpu_relax();
|
||||
*dt = local_clock();
|
||||
udelay(100);
|
||||
*dt = local_clock() - *dt;
|
||||
write_semaphore(&sema[2], 1);
|
||||
preempt_enable();
|
||||
local_irq_enable();
|
||||
|
||||
if (i915_request_wait(rq, 0, HZ / 2) < 0) {
|
||||
i915_request_put(rq);
|
||||
|
|
Loading…
Reference in a new issue