From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andy Whitcroft <apw@canonical.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 8/8] drm/i915: Fix tiling corruption from pipelined fencing
Date: Sat, 19 Mar 2011 23:17:56 +0100 [thread overview]
Message-ID: <20110319221756.GA16343@viiv.ffwll.ch> (raw)
In-Reply-To: <1300435330-15934-9-git-send-email-chris@chris-wilson.co.uk>
On Fri, Mar 18, 2011 at 08:02:10AM +0000, Chris Wilson wrote:
> ... even though it was disabled. A mistake in the handling of fence reuse
> caused us to skip the vital delay of waiting for the object to finish
> rendering before changing the register.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Nice catch and good simplification of the code-flow. One nitpick about a
possible further cleanup below.
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index d4bf061..c5dfb59 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2581,8 +2581,23 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
> reg = &dev_priv->fence_regs[obj->fence_reg];
> list_move_tail(®->lru_list, &dev_priv->mm.fence_list);
>
> - if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
> - pipelined = NULL;
> + if (obj->tiling_changed) {
> + ret = i915_gem_object_flush_fence(obj, pipelined);
> + if (ret)
> + return ret;
> +
> + if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
> + pipelined = NULL;
> +
> + if (pipelined) {
> + reg->setup_seqno =
> + i915_gem_next_request_seqno(pipelined);
> + obj->last_fenced_seqno = reg->setup_seqno;
> + obj->last_fenced_ring = pipelined;
> + }
> +
> + goto update;
I think we could move the update label 3 lines up, which would make the
above if(pipelined) clause unnecessary. Maybe even drop the goto and
extract the tail of get_fence as a function of its own.
> + }
>
> if (!pipelined) {
> if (reg->setup_seqno) {
> @@ -2601,31 +2616,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
> ret = i915_gem_object_flush_fence(obj, pipelined);
> if (ret)
> return ret;
> - } else if (obj->tiling_changed) {
> - if (obj->fenced_gpu_access) {
> - if (obj->base.write_domain & I915_GEM_GPU_DOMAINS) {
> - ret = i915_gem_flush_ring(obj->ring,
> - 0, obj->base.write_domain);
> - if (ret)
> - return ret;
> - }
> -
> - obj->fenced_gpu_access = false;
> - }
> - }
> -
> - if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
> - pipelined = NULL;
> - BUG_ON(!pipelined && reg->setup_seqno);
> -
> - if (obj->tiling_changed) {
> - if (pipelined) {
> - reg->setup_seqno =
> - i915_gem_next_request_seqno(pipelined);
> - obj->last_fenced_seqno = reg->setup_seqno;
> - obj->last_fenced_ring = pipelined;
> - }
> - goto update;
> }
>
> return 0;
> --
> 1.7.2.3
>
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
next prev parent reply other threads:[~2011-03-19 22:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-18 8:02 Patch queue for -fixes Chris Wilson
2011-03-18 8:02 ` [PATCH 1/8] drm/i915: Remove surplus POSTING_READs before wait_for_vblank Chris Wilson
2011-03-18 14:42 ` Keith Packard
2011-03-18 16:23 ` Jesse Barnes
2011-03-18 8:02 ` [PATCH 2/8] drm/i915: skip redundant operations whilst enabling pipes and planes Chris Wilson
2011-03-18 14:46 ` Keith Packard
2011-03-18 16:25 ` Jesse Barnes
2011-03-18 17:37 ` Chris Wilson
2011-03-18 17:41 ` Jesse Barnes
2011-03-18 8:02 ` [PATCH 3/8] drm/i915: Flush the plane enable using the DSPCNTR latch Chris Wilson
2011-03-18 15:09 ` Keith Packard
2011-03-18 16:26 ` Jesse Barnes
2011-03-18 17:42 ` Chris Wilson
2011-03-18 8:02 ` [PATCH 4/8] drm/i915: Only wait for vblank after pipe enabling on gen2 Chris Wilson
2011-03-18 15:10 ` Keith Packard
2011-03-18 16:27 ` Jesse Barnes
2011-03-18 8:02 ` [PATCH 5/8] drm/i915: Prevent racy removal of request from client list Chris Wilson
2011-03-18 8:02 ` [PATCH 6/8] drm: Fix use-after-free in drm_gem_vm_close() Chris Wilson
2011-03-18 15:15 ` [Intel-gfx] " Keith Packard
2011-03-18 8:02 ` [PATCH 7/8] drm/i915: Re-enable self-refresh Chris Wilson
2011-03-18 15:22 ` Keith Packard
2011-03-18 17:48 ` Chris Wilson
2011-03-18 18:12 ` Eric Anholt
2011-03-18 19:08 ` Chris Wilson
2011-03-18 8:02 ` [PATCH 8/8] drm/i915: Fix tiling corruption from pipelined fencing Chris Wilson
2011-03-19 22:17 ` Daniel Vetter [this message]
2011-03-19 22:25 ` Chris Wilson
2011-03-19 23:12 ` Daniel Vetter
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=20110319221756.GA16343@viiv.ffwll.ch \
--to=daniel@ffwll.ch \
--cc=apw@canonical.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
/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 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).