Skip to contentSkip to conversation

drm/i915: enable semaphores on per-device defaults

PATCH In review Eugeni Dodonov 3 participants 3 messages Nov 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: enable semaphores on per-device defaults

We should enable semaphores on IVB by default, and on SNB in cases where dma remapping is disabled or iommu is not enabled.

v2: adapt patch according to the feedback, and put it in line with Keith's rc6 enabling patch.

CC: Daniel Vetter <[email protected]>
CC: Ben Widawsky <[email protected]>
CC: Keith Packard <[email protected]>
CC: Jesse Barnes <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42696
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40564
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41353
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38862

---
 drivers/gpu/drm/i915/i915_drv.c            |    4 ++--
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |   24 +++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -2
index cc531bb..83b2be4 100644
@@ -58,10 +58,10 @@ module_param_named(powersave, i915_powersave, int, 0600);
 MODULE_PARM_DESC(powersave,
 		"Enable powersavings, fbc, downclocking, etc. (default: true)");
 
-unsigned int i915_semaphores __read_mostly = 0;
+unsigned int i915_semaphores __read_mostly = -1;
 module_param_named(semaphores, i915_semaphores, int, 0600);
 MODULE_PARM_DESC(semaphores,
-		"Use semaphores for inter-ring sync (default: false)");
+		"Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))");
 
 unsigned int i915_enable_rc6 __read_mostly = 0;
 module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
drivers/gpu/drm/i915/i915_gem_execbuffer.c +23 -1
index 3693e83..c19a063 100644
@@ -33,6 +33,11 @@
 #include "i915_trace.h"
 #include "intel_drv.h"
 
+#ifdef CONFIG_INTEL_IOMMU
+#include <linux/dma_remapping.h>
+#include <linux/dmar.h>
+#endif
+
 struct change_domains {
 	uint32_t invalidate_domains;
 	uint32_t flush_domains;
@@ -746,6 +751,23 @@ i915_gem_execbuffer_flush(struct drm_device *dev,
 	return 0;
 }
 
+static bool
+intel_enable_semaphores(struct drm_device *dev)
+{
+	if (i915_semaphores >= 0)
+		return i915_semaphores;
+	if (INTEL_INFO(dev)->gen >= 7)
+		return 1;
+#ifdef CONFIG_INTEL_IOMMU
+	/* On gen6, we only enable semaphores if dma remapping is disabled,
+	 * or if there is no iommu.
+	 */
+	if (INTEL_INFO(dev)->gen == 6)
+		return no_iommu || dmar_disabled;
+#endif
+	return 1;
+}
+
 static int
 i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,
 			       struct intel_ring_buffer *to)
@@ -758,7 +780,7 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,
 		return 0;
 
 	/* XXX gpu semaphores are implicated in various hard hangs on SNB */
-	if (INTEL_INFO(obj->base.dev)->gen < 6 || !i915_semaphores)
+	if (INTEL_INFO(obj->base.dev)->gen < 6 || !intel_enable_semaphores(obj->base.dev))
 		return i915_gem_object_wait_rendering(obj);
 
 	idx = intel_ring_sync_index(from, to);
Signature · 1 line
1.7.7.4
#1 lore raw
Quoted 10 lines · Eugeni Dodonov

We should enable semaphores on IVB by default, and on SNB in cases where dma remapping is disabled or iommu is not enabled.

v2: adapt patch according to the feedback, and put it in line with Keith's rc6 enabling patch.
---
static int
i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,

drivers/gpu/drm/i915/i915_gem_execbuffer.c +0 -0
 			       struct intel_ring_buffer *to)

drivers/gpu/drm/i915/i915_gem_execbuffer.c i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, · line 783

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
@@ -758,7 +780,7 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,
 		return 0;
 
 	/* XXX gpu semaphores are implicated in various hard hangs on SNB */
-	if (INTEL_INFO(obj->base.dev)->gen < 6 || !i915_semaphores)
+	if (INTEL_INFO(obj->base.dev)->gen < 6 || !intel_enable_semaphores(obj->base.dev))

Just merge the generation check into intel_enable_semaphores(). -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Reviewed-by on v1 1/1
#2 lore raw
In reply to Eugeni Dodonov

drivers/gpu/drm/i915/i915_drv.c module_param_named(powersave, i915_powersave, int, 0600); · line 61

Quoted 2 lines · Eugeni Dodonov
drivers/gpu/drm/i915/i915_drv.c +1 -1
-unsigned int i915_semaphores __read_mostly = 0;
+unsigned int i915_semaphores __read_mostly = -1;

That better be signed or it's not going to compare well with -1

Otherwise, this looks good to me.

Signature · 1 line
[email protected]

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx