intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Move non-phys cursors into the GTT
@ 2010-06-02  7:41 Chris Wilson
  2010-06-02 20:05 ` Arkadiusz Miskiewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2010-06-02  7:41 UTC (permalink / raw)
  To: intel-gfx

Cursors need to be in the GTT domain when being accessed by the GPU.
Previously this was a fortuitous byproduct of userspace using pwrite()
to upload the image data into the cursor. The redundant clflush was
removed in commit 9b8c4a and so the image was no longer being flushed
out of the caches into main memory. One could also devise a scenario
where the cursor was rendered by the GPU, prior to being attached as the
cursor, resulting in similar corruption due to the missing MI_FLUSH.

Fixes:

  Bug 28335 - Cursor corruption caused by commit 9b8c4a0b21
  https://bugs.freedesktop.org/show_bug.cgi?id=28335

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b741a24..2e52692 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3959,6 +3959,13 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
 			DRM_ERROR("failed to pin cursor bo\n");
 			goto fail_locked;
 		}
+
+		ret = i915_gem_object_set_to_gtt_domain(bo, 0);
+		if (ret) {
+			DRM_ERROR("failed to move cursor bo into the GTT\n");
+			goto fail_unpin;
+		}
+
 		addr = obj_priv->gtt_offset;
 	} else {
 		ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
@@ -4002,6 +4009,8 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
 	intel_crtc->cursor_bo = bo;
 
 	return 0;
+fail_unpin:
+	i915_gem_object_unpin(bo);
 fail_locked:
 	mutex_unlock(&dev->struct_mutex);
 fail:
-- 
1.7.1

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

* Re: [PATCH] drm/i915: Move non-phys cursors into the GTT
  2010-06-02  7:41 [PATCH] drm/i915: Move non-phys cursors into the GTT Chris Wilson
@ 2010-06-02 20:05 ` Arkadiusz Miskiewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Arkadiusz Miskiewicz @ 2010-06-02 20:05 UTC (permalink / raw)
  To: intel-gfx

On Wednesday 02 of June 2010, Chris Wilson wrote:
> Cursors need to be in the GTT domain when being accessed by the GPU.
> Previously this was a fortuitous byproduct of userspace using pwrite()
> to upload the image data into the cursor. The redundant clflush was
> removed in commit 9b8c4a and so the image was no longer being flushed
> out of the caches into main memory. One could also devise a scenario
> where the cursor was rendered by the GPU, prior to being attached as the
> cursor, resulting in similar corruption due to the missing MI_FLUSH.
> 
> Fixes:
> 
>   Bug 28335 - Cursor corruption caused by commit 9b8c4a0b21
>   https://bugs.freedesktop.org/show_bug.cgi?id=28335
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Tested-by: Arkadiusz Miśkiewicz <arekm@maven.pl>

-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2010-06-02 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-02  7:41 [PATCH] drm/i915: Move non-phys cursors into the GTT Chris Wilson
2010-06-02 20:05 ` Arkadiusz Miskiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).