All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/nouveau: hold mutex while syncing to kernel channel
@ 2014-01-14 15:48 Maarten Lankhorst
  2014-01-14 15:52 ` [PATCH 2/2] drm/nouveau: require cli->mutex in RING_SPACE Maarten Lankhorst
  0 siblings, 1 reply; 2+ messages in thread
From: Maarten Lankhorst @ 2014-01-14 15:48 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org

Not holding the mutex potentially causes corruption of the kernel
channel when page flipping.

Cc: stable@vger.kernel.org #3.13
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 29c3efdfc7dd..76e3cf025c10 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -603,6 +603,14 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
  	if (!s)
  		return -ENOMEM;
  
+	if (new_bo != old_bo) {
+		ret = nouveau_bo_pin(new_bo, TTM_PL_FLAG_VRAM);
+		if (ret)
+			goto fail_free;
+	}
+
+	mutex_lock(&chan->cli->mutex);
+
  	/* synchronise rendering channel with the kernel's channel */
  	spin_lock(&new_bo->bo.bdev->fence_lock);
  	fence = nouveau_fence_ref(new_bo->bo.sync_obj);
@@ -612,13 +620,6 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
  	if (ret)
  		return ret;
  
-	if (new_bo != old_bo) {
-		ret = nouveau_bo_pin(new_bo, TTM_PL_FLAG_VRAM);
-		if (ret)
-			goto fail_free;
-	}
-
-	mutex_lock(&chan->cli->mutex);
  	ret = ttm_bo_reserve(&old_bo->bo, true, false, false, NULL);
  	if (ret)
  		goto fail_unpin;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-14 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 15:48 [PATCH 1/2] drm/nouveau: hold mutex while syncing to kernel channel Maarten Lankhorst
2014-01-14 15:52 ` [PATCH 2/2] drm/nouveau: require cli->mutex in RING_SPACE Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.