From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 4/4] drm/i915: report all active objects as busy Date: Fri, 23 Apr 2010 10:48:40 +0100 Message-ID: <89kc63$gmr7i9@fmsmga002.fm.intel.com> References: <1271967172-3174-1-git-send-email-daniel.vetter@ffwll.ch> <1271967172-3174-5-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fmsmga102.fm.intel.com (mga10.intel.com [192.55.52.92]) by gabe.freedesktop.org (Postfix) with ESMTP id DBF0D9E84C for ; Fri, 23 Apr 2010 02:48:43 -0700 (PDT) In-Reply-To: <1271967172-3174-5-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Eric Anholt Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, 22 Apr 2010 22:12:52 +0200, Daniel Vetter wrote: > Reporting objects that are not currently used by the gpu but are > dirty and not yet flushed creates havoc to libdrm's bo reuse: > The usually immediatly following gtt_map afterwards will stall > until the gpu has executed the writeback. I like this and I think Eric will approve. Just one comment inline. > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/i915/i915_gem.c | 27 +++++++++++++++++++-------- > 1 files changed, 19 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 8e18c9d..7950169 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -4395,14 +4395,25 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, > i915_gem_retire_requests(dev); > > obj_priv = to_intel_bo(obj); > - /* Don't count being on the flushing list against the object being > - * done. Otherwise, a buffer left on the flushing list but not getting > - * flushed (because nobody's flushing that domain) won't ever return > - * unbusy and get reused by libdrm's bo cache. The other expected > - * consumer of this interface, OpenGL's occlusion queries, also specs > - * that the objects get unbusy "eventually" without any interference. > - */ > - args->busy = obj_priv->active && obj_priv->last_rendering_seqno != 0; > + > + /* Count all active objects as busy, even if they are currently not used > + * by the gpu. Users of this interface expect objects to eventually > + * become non-busy without any further actions, therefore emit any > + * necessary flushes here. */ > + args->busy = obj_priv->active; > + > + /* Unconditionally flush objects, even when the gpu still uses this > + * object. Userspace calling this function indicates that it wants to > + * use this buffer rather sooner than later, so issuing the required > + * flush earlier is beneficial. */ > + if (obj->write_domain) { > + uint32_t seqno; > + > + i915_gem_flush(dev, 0, obj->write_domain); > + seqno = i915_add_request(dev, file_priv, obj->write_domain); > + if (seqno == 0) > + return -ENOMEM; Return whilst holding the mutex and leaking a reference? Oh noes! Two wrongs do not make a right. ;-) -ickle -- Chris Wilson, Intel Open Source Technology Centre