aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-10-07 12:28:15 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-10-07 14:10:09 -0400
commite59f2bac15042eb744851bcf866f18dadc3091c6 (patch)
treea0534aea9beab6f65489d171e6dff2b3c992c13d /drivers/gpu/drm/i915/intel_display.c
parentc2873e9633fe908dccd36dbb1d370e9c59a1ca62 (diff)
drm/i915: Wait for pending flips on the GPU
Currently, if a batch buffer refers to an object with a pending flip, then we sleep until that pending flip is completed (unpinned and signalled). This is so that a flip can be queued and the user can continue rendering to the backbuffer oblivious to whether the buffer is still pinned as the scan out. (The kernel arbitrating at the last moment to stall the batch and wait until the buffer is unpinned and replaced as the front buffer.) As we only have a queue depth of 1, we can simply wait for the current pending flip to complete and continue rendering. We can achieve this with a single WAIT_FOR_EVENT command inserted into the ring buffer prior to executing the batch, *without* stalling the client. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9109c00f3ead..7fe92d06eb26 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4994,8 +4994,9 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
4994 obj_priv = to_intel_bo(work->pending_flip_obj); 4994 obj_priv = to_intel_bo(work->pending_flip_obj);
4995 4995
4996 /* Initial scanout buffer will have a 0 pending flip count */ 4996 /* Initial scanout buffer will have a 0 pending flip count */
4997 if ((atomic_read(&obj_priv->pending_flip) == 0) || 4997 atomic_clear_mask(1 << intel_crtc->plane,
4998 atomic_dec_and_test(&obj_priv->pending_flip)) 4998 &obj_priv->pending_flip.counter);
4999 if (atomic_read(&obj_priv->pending_flip) == 0)
4999 wake_up(&dev_priv->pending_flip_queue); 5000 wake_up(&dev_priv->pending_flip_queue);
5000 schedule_work(&work->work); 5001 schedule_work(&work->work);
5001 5002
@@ -5092,7 +5093,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
5092 goto cleanup_objs; 5093 goto cleanup_objs;
5093 5094
5094 obj_priv = to_intel_bo(obj); 5095 obj_priv = to_intel_bo(obj);
5095 atomic_inc(&obj_priv->pending_flip); 5096 atomic_add(1 << intel_crtc->plane, &obj_priv->pending_flip);
5096 work->pending_flip_obj = obj; 5097 work->pending_flip_obj = obj;
5097 5098
5098 if (IS_GEN3(dev) || IS_GEN2(dev)) { 5099 if (IS_GEN3(dev) || IS_GEN2(dev)) {