linux/drivers/gpu/drm/i915
Chris Wilson a71d8d9452 drm/i915: Record the tail at each request and use it to estimate the head
By recording the location of every request in the ringbuffer, we know
that in order to retire the request the GPU must have finished reading
it and so the GPU head is now beyond the tail of the request. We can
therefore provide a conservative estimate of where the GPU is reading
from in order to avoid having to read back the ring buffer registers
when polling for space upon starting a new write into the ringbuffer.

A secondary effect is that this allows us to convert
intel_ring_buffer_wait() to use i915_wait_request() and so consolidate
upon the single function to handle the complicated task of waiting upon
the GPU. A necessary precaution is that we need to make that wait
uninterruptible to match the existing conditions as all the callers of
intel_ring_begin() have not been audited to handle ERESTARTSYS
correctly.

By using a conservative estimate for the head, and always processing all
outstanding requests first, we prevent a race condition between using
the estimate and direct reads of I915_RING_HEAD which could result in
the value of the head going backwards, and the tail overflowing once
again. We are also careful to mark any request that we skip over in
order to free space in ring as consumed which provides a
self-consistency check.

Given sufficient abuse, such as a set of unthrottled GPU bound
cairo-traces, avoiding the use of I915_RING_HEAD gives a 10-20% boost on
Sandy Bridge (i5-2520m):
  firefox-paintball  18927ms -> 15646ms: 1.21x speedup
  firefox-fishtank   12563ms -> 11278ms: 1.11x speedup
which is a mild consolation for the performance those traces achieved from
exploiting the buggy autoreported head.

v2: Add a few more comments and make request->tail a conservative
estimate as suggested by Daniel Vetter.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: resolve conflicts with retirement defering and the lack of
the autoreport head removal (that will go in through -fixes).]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-02-15 14:26:03 +01:00
..
dvo_ch7xxx.c Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
dvo_ch7017.c Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
dvo_ivch.c Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
dvo_sil164.c Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
dvo_tfp410.c Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
dvo.h drm/i915: Subclass intel_encoder. 2010-08-09 11:24:28 -07:00
i915_debugfs.c Merge remote-tracking branch 'airlied/drm-fixes' into drm-intel-next-queued 2012-02-10 17:14:49 +01:00
i915_dma.c drm/i915: fix up locking inconsistency around gem_do_init 2012-02-13 11:03:45 +01:00
i915_drv.c drm/i915: check gtfifodbg after possibly failed writes 2012-02-12 00:21:41 +01:00
i915_drv.h drm/i915: Record the tail at each request and use it to estimate the head 2012-02-15 14:26:03 +01:00
i915_gem_debug.c drm/i915: drop KM_USER0 argument to k(un)map_atomic 2011-10-20 15:26:37 -07:00
i915_gem_evict.c drm/i915: argument to control retiring behavior 2012-01-26 11:19:19 +01:00
i915_gem_execbuffer.c Merge remote-tracking branch 'airlied/drm-fixes' into drm-intel-next-queued 2012-02-10 17:14:49 +01:00
i915_gem_gtt.c drm/i915: ppgtt binding/unbinding support 2012-02-09 21:25:23 +01:00
i915_gem_tiling.c drm/i915: swizzling support for snb/ivb 2012-02-08 23:16:24 +01:00
i915_gem.c drm/i915: Record the tail at each request and use it to estimate the head 2012-02-15 14:26:03 +01:00
i915_ioc32.c drm: convert drm_ioctl to unlocked_ioctl 2009-12-18 11:22:31 +10:00
i915_irq.c drm/i915: enable forcewake voodoo also for gen6 2012-02-13 10:57:07 +01:00
i915_reg.h drm/i915: add missing SDVO bits for interlaced modes on ILK 2012-02-14 20:32:29 +01:00
i915_suspend.c drm/i915: Re-enable gen7 RC6 and GPU turbo after resume. 2012-01-24 13:25:10 -08:00
i915_trace_points.c drm/i915: Add tracepoints 2009-09-23 01:05:21 +01:00
i915_trace.h Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
intel_acpi.c drm/i915: Silence _DSM errors 2012-01-16 21:08:19 +01:00
intel_bios.c drm/i915: Use kcalloc instead of kzalloc to allocate array 2012-01-17 17:33:24 +01:00
intel_bios.h drm/i915: VBT Parser cleanup for eDP block 2012-01-13 08:37:44 -08:00
intel_crt.c drm/i915: don't allow interlaced pipeconf on gen2 2012-02-10 17:28:45 +01:00
intel_display.c drm/i915: add missing SDVO bits for interlaced modes on ILK 2012-02-14 20:32:29 +01:00
intel_dp.c Merge remote-tracking branch 'airlied/drm-fixes' into drm-intel-next-queued 2012-02-10 17:14:49 +01:00
intel_drv.h drm/i915: Separate fence pin counting from normal bind pin counting 2012-01-29 18:23:37 +01:00
intel_dvo.c drm/i915: fixup interlaced vertical timings confusion, part 1 2012-02-10 17:24:06 +01:00
intel_fb.c drm/i915: add SNB and IVB video sprite support v6 2012-01-03 09:31:09 -08:00
intel_hdmi.c drm/i915: add a "force-dvi" HDMI audio mode 2012-02-14 10:03:18 +01:00
intel_i2c.c drm/i915: Fix race condition in accessing GMBUS 2012-02-14 10:39:53 +01:00
intel_lvds.c drm/i915: no lvds quirk for AOpen MP45 2012-02-08 09:20:49 -08:00
intel_modes.c drm/i915: add a "force-dvi" HDMI audio mode 2012-02-14 10:03:18 +01:00
intel_opregion.c Drivers: i915: Fix all space related issues. 2011-09-19 18:01:47 -07:00
intel_overlay.c drm/i915: fixup overlay checks for interlaced modes 2012-02-10 17:43:49 +01:00
intel_panel.c drm/i915: fixup interlaced vertical timings confusion, part 1 2012-02-10 17:24:06 +01:00
intel_ringbuffer.c drm/i915: Record the tail at each request and use it to estimate the head 2012-02-15 14:26:03 +01:00
intel_ringbuffer.h drm/i915: Record the tail at each request and use it to estimate the head 2012-02-15 14:26:03 +01:00
intel_sdvo_regs.h misc latin1 to utf8 conversions 2012-01-02 13:04:55 +01:00
intel_sdvo.c drm/i915: allow interlaced mode output on the SDVO connector 2012-02-10 17:28:48 +01:00
intel_sprite.c Merge remote-tracking branch 'airlied/drm-fixes' into drm-intel-next-queued 2012-02-10 17:14:49 +01:00
intel_tv.c drm/i915: fixup interlaced vertical timings confusion, part 1 2012-02-10 17:24:06 +01:00
Makefile drm/i915: kill i915_mem.c 2012-01-17 20:01:01 +01:00