diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-04-25 22:16:20 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-04-25 22:16:20 +0000 |
commit | 69d3b1499f2fcd8b35e56e77aebf4dc0803acb4f (patch) | |
tree | 2a6b62dac825f351279ba4c21008fc4df0d6950a /sys | |
parent | 6f7d74c41cc3fd485ad725207555fb0530936d39 (diff) |
When querying if an object is busy, it is if it is marked active (being
accessed by the gpu or needing a flush). Since this implies that the object is
wanted, emit the flush then to save time.
Makes things a lot smoother than before in some GL applications, since
before we were claiming that object needing a flush were unbusy so the
next map stalled the gpu waiting on a flush.
From daniel vetter on intel-gfx.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/i915_drv.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c index 0ae2ef5246d..237b6c335cb 100644 --- a/sys/dev/pci/drm/i915_drv.c +++ b/sys/dev/pci/drm/i915_drv.c @@ -3524,6 +3524,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, struct drm_i915_gem_busy *args = data; struct drm_obj *obj; struct inteldrm_obj *obj_priv; + int ret = 0; obj = drm_gem_object_lookup(dev, file_priv, args->handle); if (obj == NULL) { @@ -3540,19 +3541,23 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, i915_gem_retire_requests(dev_priv); obj_priv = (struct inteldrm_obj *)obj; - /* - * Don't count being on the flushing list being done. Otherwise, a - * buffer left on the flushing list but not getting flushed (because - * no one is 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 object - * get unbusy "eventually" without any interference. + /* 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 = inteldrm_is_active(obj_priv) && - obj_priv->last_rendering_seqno != 0; + args->busy = inteldrm_is_active(obj_priv); + + /* Unconditionally flush objects, even when the gpu still uses them. + * Userspace calling this function indicates that it wants to use + * this buffer sooner rather than later, so flushing now helps. + */ + if (obj->write_domain && i915_gem_flush(dev_priv, + obj->write_domain, obj->write_domain) == 0) + ret = ENOMEM; drm_unref(&obj->uobj); - return 0; + return (ret); } int |