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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 at 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(-)

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;
 };
 
-- 
1.7.10



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux