[Intel-gfx] [PATCH] drm/i915: Mark hardware context support optional

Chris Wilson chris at chris-wilson.co.uk
Tue Sep 25 15:53:37 CEST 2012


As using the contexts (with mesa) causes an instant hard hang on my
i5-2500 SandyBridge GT1 desktop, they are not ready for universal
enabling.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c         |    5 +++++
 drivers/gpu/drm/i915/i915_drv.h         |    1 +
 drivers/gpu/drm/i915/i915_gem_context.c |   10 +++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 705b2e1..6a87b21 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -64,6 +64,11 @@ module_param_named(semaphores, i915_semaphores, int, 0600);
 MODULE_PARM_DESC(semaphores,
 		"Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))");
 
+int i915_hw_contexts __read_mostly = 0;
+module_param_named(hw_contexts, i915_hw_contexts, int, 0400);
+MODULE_PARM_DESC(hw_contexts,
+		"Enable hardware context support for userspace (default: disabled))");
+
 int i915_enable_rc6 __read_mostly = -1;
 module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400);
 MODULE_PARM_DESC(i915_enable_rc6,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index dddc3dc..04b2134 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1245,6 +1245,7 @@ extern unsigned int i915_fbpercrtc __always_unused;
 extern int i915_panel_ignore_lid __read_mostly;
 extern unsigned int i915_powersave __read_mostly;
 extern int i915_semaphores __read_mostly;
+extern int i915_hw_contexts __read_mostly;
 extern unsigned int i915_lvds_downclock __read_mostly;
 extern int i915_lvds_channel_mode __read_mostly;
 extern int i915_panel_use_ssc __read_mostly;
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 3d3fc10..b26b592 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -247,12 +247,20 @@ err_destroy:
 	return ret;
 }
 
+static bool intel_has_hw_contexts(struct drm_device *dev)
+{
+	if (!i915_hw_contexts)
+		return false;
+
+	return HAS_HW_CONTEXTS(dev);
+}
+
 void i915_gem_context_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t ctx_size;
 
-	if (!HAS_HW_CONTEXTS(dev))
+	if (!intel_has_hw_contexts(dev))
 		dev_priv->hw_contexts_disabled = true;
 
 	if (dev_priv->hw_contexts_disabled)
-- 
1.7.10.4




More information about the Intel-gfx mailing list