diff mbox

drm/i915: Add I915_GEM_PARAM_HAS_SEMAPHORES

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

Commit Message

Chris Wilson Aug. 8, 2012, 9:23 a.m. UTC
Userspace tries to estimate the cost of ring switching based on whether
the GPU and GEM supports semaphores. (If we have multiple rings and no
semaphores, userspace assumes that the cost of switching rings between
batches is exorbitant and will endeavour to keep the next batch on the
active ring - as a coarse approximation to tracking both destination and
source surfaces.) Currently userspace has to guess whether semaphores
exist based on the chipset generation and the module parameter,
i915.semaphores. This is a crude and inaccurate guess as the defaults
internally depend upon other chipset features being enabled or disabled,
nor does it extend well into the future. By exporting a HAS_SEMAPHORES
parameter, we can easily query the driver and obtain an accurate answer.

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

Comments

Daniel Vetter Aug. 8, 2012, 12:31 p.m. UTC | #1
On Wed, Aug 08, 2012 at 10:23:22AM +0100, Chris Wilson wrote:
> Userspace tries to estimate the cost of ring switching based on whether
> the GPU and GEM supports semaphores. (If we have multiple rings and no
> semaphores, userspace assumes that the cost of switching rings between
> batches is exorbitant and will endeavour to keep the next batch on the
> active ring - as a coarse approximation to tracking both destination and
> source surfaces.) Currently userspace has to guess whether semaphores
> exist based on the chipset generation and the module parameter,
> i915.semaphores. This is a crude and inaccurate guess as the defaults
> internally depend upon other chipset features being enabled or disabled,
> nor does it extend well into the future. By exporting a HAS_SEMAPHORES
> parameter, we can easily query the driver and obtain an accurate answer.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Sounds like something useful, applied for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 9cf7dfe..64fd7be 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1009,6 +1009,9 @@  static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_WAIT_TIMEOUT:
 		value = 1;
 		break;
+	case I915_PARAM_HAS_SEMAPHORES:
+		value = i915_semaphore_is_enabled(dev);
+		break;
 	default:
 		DRM_DEBUG_DRIVER("Unknown parameter %d\n",
 				 param->param);
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 8cc7083..2f0d472 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -305,6 +305,7 @@  typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_LLC     	 	 17
 #define I915_PARAM_HAS_ALIASING_PPGTT	 18
 #define I915_PARAM_HAS_WAIT_TIMEOUT	 19
+#define I915_PARAM_HAS_SEMAPHORES	 20
 
 typedef struct drm_i915_getparam {
 	int param;