All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Zhenyu Wang <zhenyuw@linux.intel.com>, intel-gfx@lists.freedesktop.org
Cc: stable team <stable@kernel.org>
Subject: Re: [PATCH] drm/i915: set scan-buffer as uncached on Sandybridge
Date: Mon, 25 Oct 2010 09:22:41 +0100	[thread overview]
Message-ID: <849307$a48ipo@azsmga001.ch.intel.com> (raw)
In-Reply-To: <1287970951-3677-1-git-send-email-zhenyuw@linux.intel.com>

[I haven't seen my first email arrive yet...]

On Mon, 25 Oct 2010 09:42:31 +0800, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
> Display engine on Sandybridge is not coherent with LLC, so
> try to always bind display buffer as uncached on Sandybridge.
> This fixed screen artifacts seen by using blit engine on Sandybridge.
[snip]

> @@ -1579,6 +1579,14 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  	obj = intel_fb->obj;
>  	obj_priv = to_intel_bo(obj);
>  
> +	/* 
> +	 *  Set uncacheable for scan-out buffer on Sandybridge.
> +	 *  Display engine is non-coherent with LLC, and read from
> +	 *  main memory only. This ensures data is coherent with display.
> +	 */
> +	if (IS_GEN6(dev))
> +		obj_priv->agp_type = AGP_USER_UNCACHED_MEMORY;
> +

[Quick recap of first email]
You can't do this here, changing the AGP type of a potentially bound
object without any locking.

Move this into intel_pin_and_fence_fb_obj(), give it a decent name and
make it robust.

int i915_gem_object_enable_scanout(struct drm_i915_gem_object *obj)
{
	int type = IS_GEN6(dev) ? AGP_USER_UNCACHED_MEMORY : AGP_USER_MEMORY;
/* These names are absolutely terrible. we should have just made
 * AGR_USER_CACHED_MEMORY the default on gen6 and kept the AGP_USER_MEMORY
 * as uncached on all generations, rather than mixing up the cacheability
 * status of common enums.
 */

	if (obj->agp_type == type)
		return 0;

	if (obj->gtt_space) {
		int ret = i915_gem_object_unbind(&obj->base);
		if (ret)
			return ret;
	}

	obj->agp_type = type;
	return 0;
}

[And the additional bit of insight...]

Also add a call from intel_user_framebuffer_create, as being the earliest
opportunity to avoid the unbind penalty. What is the performance impact of
rendering to an uncached buffer on Sandybridge? Should we only be changing
the caching status whilst pinned as the framebuffer? Rather than
unbinding/rebinding, should we introduce a function [once we have a native
GTT interface, Daniel!] to simply update the flags on the PTEs for an
object (obviously with suitable flushing).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

  reply	other threads:[~2010-10-25  8:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25  1:42 [PATCH] drm/i915: set scan-buffer as uncached on Sandybridge Zhenyu Wang
2010-10-25  8:22 ` Chris Wilson [this message]
2010-10-25  8:50   ` Zou, Nanhai
2010-10-25 10:31     ` Clemens Eisserer
2010-10-26  2:07       ` Zou, Nanhai
2010-10-25 14:52   ` Zhenyu Wang
2010-10-26  7:29 ` Dave Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='849307$a48ipo@azsmga001.ch.intel.com' \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@kernel.org \
    --cc=zhenyuw@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.