Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: enable semaphores on per-device defaults
@ 2011-11-21 13:22 Eugeni Dodonov
  2011-11-21 13:22 ` [PATCH 2/2] drm/i915: allow per-device fbc to work with default settings Eugeni Dodonov
  2011-11-21 13:33 ` [PATCH 1/2] drm/i915: enable semaphores on per-device defaults Chris Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: Eugeni Dodonov @ 2011-11-21 13:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky, Daniel Vetter, 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.

v3: move the generation check into intel_enable_semaphores function, and
fix variable type for i915_semaphores.

CC: Daniel Vetter <daniel.vetter@ffwll.ch>
CC: Ben Widawsky <ben@bwidawsk.net>
CC: Keith Packard <keithp@keithp.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: Chris Wilson <chris@chris-wilson.co.uk>
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
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c            |    4 +-
 drivers/gpu/drm/i915/i915_drv.h            |    2 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |   29 +++++++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index cc531bb..413b30d 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -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;
+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);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 06a37f4..561e67d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -997,7 +997,7 @@ extern int i915_max_ioctl;
 extern unsigned int i915_fbpercrtc __always_unused;
 extern int i915_panel_ignore_lid __read_mostly;
 extern unsigned int i915_powersave __read_mostly;
-extern unsigned int i915_semaphores __read_mostly;
+extern int i915_semaphores __read_mostly;
 extern unsigned int i915_lvds_downclock __read_mostly;
 extern unsigned int i915_panel_use_ssc __read_mostly;
 extern int i915_vbt_sdvo_panel_type __read_mostly;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3693e83..0a9778c 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -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,28 @@ i915_gem_execbuffer_flush(struct drm_device *dev,
 	return 0;
 }
 
+static bool
+intel_enable_semaphores(struct drm_device *dev)
+{
+	if (INTEL_INFO(dev)->gen < 6)
+		return 0;
+
+	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 +785,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_enable_semaphores(obj->base.dev))
 		return i915_gem_object_wait_rendering(obj);
 
 	idx = intel_ring_sync_index(from, to);
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/i915: allow per-device fbc to work with default settings
  2011-11-21 13:22 [PATCH 1/2] drm/i915: enable semaphores on per-device defaults Eugeni Dodonov
@ 2011-11-21 13:22 ` Eugeni Dodonov
  2011-11-21 13:34   ` Chris Wilson
  2011-11-21 13:33 ` [PATCH 1/2] drm/i915: enable semaphores on per-device defaults Chris Wilson
  1 sibling, 1 reply; 4+ messages in thread
From: Eugeni Dodonov @ 2011-11-21 13:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: Eugeni Dodonov

The change which added support for default settings for fbc has not
changed the variable type of i915_enable_fbc from unsigned int to int. So
we were unable to get into the default ('-1') state with the default
settings.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c |    2 +-
 drivers/gpu/drm/i915/i915_drv.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 413b30d..1a999f4 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -68,7 +68,7 @@ module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
 MODULE_PARM_DESC(i915_enable_rc6,
 		"Enable power-saving render C-state 6 (default: true)");
 
-unsigned int i915_enable_fbc __read_mostly = -1;
+int i915_enable_fbc __read_mostly = -1;
 module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600);
 MODULE_PARM_DESC(i915_enable_fbc,
 		"Enable frame buffer compression for power savings "
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 561e67d..57275ff 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1002,7 +1002,7 @@ extern unsigned int i915_lvds_downclock __read_mostly;
 extern unsigned int i915_panel_use_ssc __read_mostly;
 extern int i915_vbt_sdvo_panel_type __read_mostly;
 extern unsigned int i915_enable_rc6 __read_mostly;
-extern unsigned int i915_enable_fbc __read_mostly;
+extern int i915_enable_fbc __read_mostly;
 extern bool i915_enable_hangcheck __read_mostly;
 
 extern int i915_suspend(struct drm_device *dev, pm_message_t state);
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/i915: enable semaphores on per-device defaults
  2011-11-21 13:22 [PATCH 1/2] drm/i915: enable semaphores on per-device defaults Eugeni Dodonov
  2011-11-21 13:22 ` [PATCH 2/2] drm/i915: allow per-device fbc to work with default settings Eugeni Dodonov
@ 2011-11-21 13:33 ` Chris Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2011-11-21 13:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Ben Widawsky, Eugeni Dodonov

On Mon, 21 Nov 2011 11:22:09 -0200, Eugeni Dodonov <eugeni.dodonov@intel.com> wrote:
> 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.
> 
> v3: move the generation check into intel_enable_semaphores function, and
> fix variable type for i915_semaphores.
> 
> CC: Daniel Vetter <daniel.vetter@ffwll.ch>
> CC: Ben Widawsky <ben@bwidawsk.net>
> CC: Keith Packard <keithp@keithp.com>
> CC: Jesse Barnes <jbarnes@virtuousgeek.org>
> CC: Chris Wilson <chris@chris-wilson.co.uk>
> 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
> Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
>  
> +static bool
> +intel_enable_semaphores(struct drm_device *dev)
> +{
> +	if (INTEL_INFO(dev)->gen < 6)
> +		return 0;
> +
> +	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;
> +}

Now this function can be written more compactly by just removing the
gen >= 7 check. Otherwise,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] drm/i915: allow per-device fbc to work with default settings
  2011-11-21 13:22 ` [PATCH 2/2] drm/i915: allow per-device fbc to work with default settings Eugeni Dodonov
@ 2011-11-21 13:34   ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2011-11-21 13:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: Eugeni Dodonov

On Mon, 21 Nov 2011 11:22:10 -0200, Eugeni Dodonov <eugeni.dodonov@intel.com> wrote:
> The change which added support for default settings for fbc has not
> changed the variable type of i915_enable_fbc from unsigned int to int. So
> we were unable to get into the default ('-1') state with the default
> settings.
> 
> Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-21 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 13:22 [PATCH 1/2] drm/i915: enable semaphores on per-device defaults Eugeni Dodonov
2011-11-21 13:22 ` [PATCH 2/2] drm/i915: allow per-device fbc to work with default settings Eugeni Dodonov
2011-11-21 13:34   ` Chris Wilson
2011-11-21 13:33 ` [PATCH 1/2] drm/i915: enable semaphores on per-device defaults Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox