summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2013-04-08 05:43:34 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2013-04-08 05:43:34 +0000
commit4698866b14efa994aa6748451fda09ddbeaa8949 (patch)
tree289a037beb5885d05f212578bdc71c9c3a38c100
parent3f3cdb9f8e96b82ac2e9c36cc569ba99d3469442 (diff)
Don't clobber crtc->fb when queue_flip fails
from linux 3.8.6
-rw-r--r--sys/dev/pci/drm/i915/intel_display.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c
index 84c2d5ae739..66fc2d0f3fb 100644
--- a/sys/dev/pci/drm/i915/intel_display.c
+++ b/sys/dev/pci/drm/i915/intel_display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_display.c,v 1.2 2013/03/19 03:58:10 jsg Exp $ */
+/* $OpenBSD: intel_display.c,v 1.3 2013/04/08 05:43:33 jsg Exp $ */
/*
* Copyright © 2006-2007 Intel Corporation
*
@@ -8025,8 +8025,8 @@ intel_crtc_page_flip(struct drm_crtc *crtc,
{
struct drm_device *dev = crtc->dev;
struct inteldrm_softc *dev_priv = dev->dev_private;
- struct intel_framebuffer *intel_fb;
- struct drm_i915_gem_object *obj;
+ struct drm_framebuffer *old_fb = crtc->fb;
+ struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_unpin_work *work;
int ret;
@@ -8050,8 +8050,7 @@ intel_crtc_page_flip(struct drm_crtc *crtc,
work->event = event;
work->crtc = crtc;
- intel_fb = to_intel_framebuffer(crtc->fb);
- work->old_fb_obj = intel_fb->obj;
+ work->old_fb_obj = to_intel_framebuffer(old_fb)->obj;
ret = drm_vblank_get(dev, intel_crtc->pipe);
if (ret)
@@ -8070,9 +8069,6 @@ intel_crtc_page_flip(struct drm_crtc *crtc,
intel_crtc->unpin_work = work;
mtx_leave(&dev->event_lock);
- intel_fb = to_intel_framebuffer(fb);
- obj = intel_fb->obj;
-
#ifdef notyet
if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
flush_workqueue(dev_priv->wq);
@@ -8112,6 +8108,7 @@ intel_crtc_page_flip(struct drm_crtc *crtc,
cleanup_pending:
atomic_dec(&intel_crtc->unpin_work_count);
+ crtc->fb = old_fb;
atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
drm_gem_object_unreference(&work->old_fb_obj->base);
drm_gem_object_unreference(&obj->base);