diff mbox

drm/i915: Return a mask of the active rings in the high word of busy_ioctl

Message ID 1341401108-13866-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 4, 2012, 11:25 a.m. UTC
The intention is to help select which engine to use for copies with
interoperating clients - such as a GL client making a request to the X
server to perform a SwapBuffers, which may require copying from the
active GL back buffer to the X front buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c |    6 ++++++
 include/drm/i915_drm.h          |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Chris Wilson July 4, 2012, 11:42 a.m. UTC | #1
On Wed,  4 Jul 2012 12:25:08 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> The intention is to help select which engine to use for copies with
> interoperating clients - such as a GL client making a request to the X
> server to perform a SwapBuffers, which may require copying from the
> active GL back buffer to the X front buffer.

We choose to report a mask of the active rings to future proof the
interface against any changes which may allow for the object to reside
upon multiple rings.
-Chris
Daniel Vetter July 18, 2012, 7:19 p.m. UTC | #2
On Wed, Jul 04, 2012 at 12:42:32PM +0100, Chris Wilson wrote:
> On Wed,  4 Jul 2012 12:25:08 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > The intention is to help select which engine to use for copies with
> > interoperating clients - such as a GL client making a request to the X
> > server to perform a SwapBuffers, which may require copying from the
> > active GL back buffer to the X front buffer.
> 
> We choose to report a mask of the active rings to future proof the
> interface against any changes which may allow for the object to reside
> upon multiple rings.

Queued for -next with the bikeshed applied as discussed on irc, thanks for
the patch.  -Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 932b83e..a19a27d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3382,6 +3382,12 @@  i915_gem_busy_ioctl(struct drm_device *dev, void *data,
 	ret = i915_gem_object_flush_active(obj);
 
 	args->busy = obj->active;
+	if (obj->ring) {
+		BUILD_BUG_ON(I915_NUM_RINGS > 8);
+		args->busy |= intel_ring_flag(obj->ring) << 16;
+		if (obj->base.write_domain & I915_GEM_GPU_DOMAINS)
+			args->busy |= intel_ring_flag(obj->ring) << 24;
+	}
 
 	drm_gem_object_unreference(&obj->base);
 unlock:
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 8cc7083..564005e 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -698,7 +698,12 @@  struct drm_i915_gem_busy {
 	/** Handle of the buffer to check for busy */
 	__u32 handle;
 
-	/** Return busy status (1 if busy, 0 if idle) */
+	/** Return busy status (1 if busy, 0 if idle).
+	 * The high word is used to indicate on which rings the object
+	 * currently resides:
+	 *  16:23 - read rings (16 render, 17 bsd, 18 blt, etc)
+	 *  24:31 - write ring (24 render, 25 bsd, 26 blt, etc)
+	 */
 	__u32 busy;
 };