Skip to contentSkip to conversation

drm/i915: add a LLC feature flag in device description

PATCH In review Eugeni Dodonov 5 participants 9 messages Dec 13, 2011 – Jan 16, 2012

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

PATCH 1/1 drm/i915: add a LLC feature flag in device description

LLC is not SNB-specific, so we should check for it in a more generic way.

---
 drivers/gpu/drm/i915/i915_drv.c |    2 ++
 drivers/gpu/drm/i915/i915_drv.h |    2 ++
 drivers/gpu/drm/i915/i915_gem.c |    4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index e9c2cfe..b7ac903 100644
@@ -214,6 +214,7 @@ static const struct intel_device_info intel_sandybridge_d_info = {
 	.need_gfx_hws = 1, .has_hotplug = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_sandybridge_m_info = {
@@ -222,6 +223,7 @@ static const struct intel_device_info intel_sandybridge_m_info = {
 	.has_fbc = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_ivybridge_d_info = {
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 06a37f4..24969eb 100644
@@ -247,6 +247,7 @@ struct intel_device_info {
 	u8 supports_tv:1;
 	u8 has_bsd_ring:1;
 	u8 has_blt_ring:1;
+	u8 has_llc:1;
 };
 
 enum no_fbc_reason {
@@ -960,6 +961,7 @@ struct drm_i915_file_private {
 
 #define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
 #define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
+#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index d18b07a..2c0fa78 100644
@@ -3613,8 +3613,8 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
 	obj->base.write_domain = I915_GEM_DOMAIN_CPU;
 	obj->base.read_domains = I915_GEM_DOMAIN_CPU;
 
-	if (IS_GEN6(dev)) {
-		/* On Gen6, we can have the GPU use the LLC (the CPU
+	if (HAS_LLC(dev)) {
+		/* On some devices, we can have the GPU use the LLC (the CPU
 		 * cache) for about a 10% performance improvement
 		 * compared to uncached.  Graphics requests other than
 		 * display scanout are coherent with the CPU in
Signature · 1 line
1.7.7.4
#1 lore raw
Quoted 1 line · Eugeni Dodonov

LLC is not SNB-specific, so we should check for it in a more generic way.

Also add it to debugfs i915_capabilities for completeness. It would also be useful to inform userspace that the default is now LLC through a GET_PARAM, not to mention the ability for userspace to query and set the cache_level on bo.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw

PATCH 1/1 drm/i915: add a LLC feature flag in device description

From: Eugeni Dodonov <[email protected]>

LLC is not SNB-specific, so we should check for it in a more generic way.

v2: export LLC support status via debugfs and DRM GETPARAM.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +
 drivers/gpu/drm/i915/i915_dma.c     |    3 +++
 drivers/gpu/drm/i915/i915_drv.c     |    2 ++
 drivers/gpu/drm/i915/i915_drv.h     |    2 ++
 drivers/gpu/drm/i915/i915_gem.c     |    4 ++--
 include/drm/i915_drm.h              |    1 +
 6 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 4f40f1c..070dbd9 100644
@@ -82,6 +82,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 	B(supports_tv);
 	B(has_bsd_ring);
 	B(has_blt_ring);
+	B(has_llc);
 #undef B
 
 	return 0;
drivers/gpu/drm/i915/i915_dma.c +3 -0
index a9533c5..938ad57 100644
@@ -781,6 +781,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_RELAXED_DELTA:
 		value = 1;
 		break;
+	case I915_PARAM_HAS_LLC:
+		value = HAS_LLC(dev);
+		break;
 	default:
 		DRM_DEBUG_DRIVER("Unknown parameter %d\n",
 				 param->param);
drivers/gpu/drm/i915/i915_drv.c +2 -0
index e9c2cfe..b7ac903 100644
@@ -214,6 +214,7 @@ static const struct intel_device_info intel_sandybridge_d_info = {
 	.need_gfx_hws = 1, .has_hotplug = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_sandybridge_m_info = {
@@ -222,6 +223,7 @@ static const struct intel_device_info intel_sandybridge_m_info = {
 	.has_fbc = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_ivybridge_d_info = {
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 06a37f4..24969eb 100644
@@ -247,6 +247,7 @@ struct intel_device_info {
 	u8 supports_tv:1;
 	u8 has_bsd_ring:1;
 	u8 has_blt_ring:1;
+	u8 has_llc:1;
 };
 
 enum no_fbc_reason {
@@ -960,6 +961,7 @@ struct drm_i915_file_private {
 
 #define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
 #define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
+#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index d18b07a..2c0fa78 100644
@@ -3613,8 +3613,8 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
 	obj->base.write_domain = I915_GEM_DOMAIN_CPU;
 	obj->base.read_domains = I915_GEM_DOMAIN_CPU;
 
-	if (IS_GEN6(dev)) {
-		/* On Gen6, we can have the GPU use the LLC (the CPU
+	if (HAS_LLC(dev)) {
+		/* On some devices, we can have the GPU use the LLC (the CPU
 		 * cache) for about a 10% performance improvement
 		 * compared to uncached.  Graphics requests other than
 		 * display scanout are coherent with the CPU in
include/drm/i915_drm.h +1 -0
index 28c0d11..b34e630 100644
@@ -291,6 +291,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_COHERENT_RINGS	 13
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
 #define I915_PARAM_HAS_RELAXED_DELTA	 15
+#define I915_PARAM_HAS_LLC		 16
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 1 line
1.7.7.4
Nacked-by on v1 1/1 NAK
#4 lore raw
In reply to Eugeni Dodonov
Quoted 7 lines · Eugeni Dodonov

From: Eugeni Dodonov <[email protected]>

LLC is not SNB-specific, so we should check for it in a more generic way.

v2: export LLC support status via debugfs and DRM GETPARAM.

Nice patch and would get an r-b from me safe for the new GETPARAM. I really think we need to export this on a per-bo basis (and with the caveat that the kernel is free to change the caching on every ioctl that uses it). I.e. without forcing userspace to check the caching bits before any bo access I fear that we won't be able to change the kernel's behaviour in this area, which surely results in backwards-compat hell when the first w/a that needs such changes comes around. Hence in its current from

So please drop the GETPARAM. For the per-bo get_cache_flags ioctl there's already a patch by Ben floating around.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#5 lore raw
Quoted 17 lines · Daniel Vetter
Quoted 7 lines · Eugeni Dodonov

From: Eugeni Dodonov <[email protected]>

LLC is not SNB-specific, so we should check for it in a more generic way.

v2: export LLC support status via debugfs and DRM GETPARAM.

Nice patch and would get an r-b from me safe for the new GETPARAM. I really think we need to export this on a per-bo basis (and with the caveat that the kernel is free to change the caching on every ioctl that uses it). I.e. without forcing userspace to check the caching bits before any bo access I fear that we won't be able to change the kernel's behaviour in this area, which surely results in backwards-compat hell when the first w/a that needs such changes comes around. Hence in its current from

Quoted 4 lines

So please drop the GETPARAM. For the per-bo get_cache_flags ioctl there's already a patch by Ben floating around.

The way the getparam would be useful is that right now we're taking some different paths for performance reasons in Mesa on gen6, assuming that LLC is present. Knowing whether or not we expect BOs in general to be LLC for performance would be nice for that -- without that, I'll just make assumptions based on chipset generation.

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

Reviewed-by
#6 lore raw
Quoted 20 lines · Eric Anholt
Quoted 19 lines · Daniel Vetter
Quoted 7 lines · Eugeni Dodonov

From: Eugeni Dodonov <[email protected]>

LLC is not SNB-specific, so we should check for it in a more generic way.

v2: export LLC support status via debugfs and DRM GETPARAM.

Nice patch and would get an r-b from me safe for the new GETPARAM. I really think we need to export this on a per-bo basis (and with the caveat that the kernel is free to change the caching on every ioctl that uses it). I.e. without forcing userspace to check the caching bits before any bo access I fear that we won't be able to change the kernel's behaviour in this area, which surely results in backwards-compat hell when the first w/a that needs such changes comes around. Hence in its current from

Quoted 8 lines
Quoted 2 lines

So please drop the GETPARAM. For the per-bo get_cache_flags ioctl there's already a patch by Ben floating around.

The way the getparam would be useful is that right now we're taking some different paths for performance reasons in Mesa on gen6, assuming that LLC is present. Knowing whether or not we expect BOs in general to be LLC for performance would be nice for that -- without that, I'll just make assumptions based on chipset generation.

Ok, I'll reconsider: In the mesa example (and any other use-case for llc accelarated up/download) we don't depend upon llc for correctness and we're using the caching on a newly created buffer, so the per-bo ioctls aren't much use. So I think the backwards-compat mess is manageable if people promise to use the HAS_LLC getparam only for such optimizations ...

I still think we want to full get/set_cache_level in additions to this. But for this patch:

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#7 lore raw

PATCH 1/1 drm/i915: add a LLC feature flag in device description

From: Eugeni Dodonov <[email protected]>

LLC is not SNB-specific, so we should check for it in a more generic way.

v2: export LLC support status via debugfs and DRM GETPARAM.

v3: rebase on newer kernel version which says that IVB supports LLC as well.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +
 drivers/gpu/drm/i915/i915_dma.c     |    3 +++
 drivers/gpu/drm/i915/i915_drv.c     |    4 ++++
 drivers/gpu/drm/i915/i915_drv.h     |    2 ++
 drivers/gpu/drm/i915/i915_gem.c     |    4 ++--
 include/drm/i915_drm.h              |    1 +
 6 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index d09a6e0..cb8a153 100644
@@ -82,6 +82,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 	B(supports_tv);
 	B(has_bsd_ring);
 	B(has_blt_ring);
+	B(has_llc);
 #undef B
 
 	return 0;
drivers/gpu/drm/i915/i915_dma.c +3 -0
index a9533c5..938ad57 100644
@@ -781,6 +781,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_RELAXED_DELTA:
 		value = 1;
 		break;
+	case I915_PARAM_HAS_LLC:
+		value = HAS_LLC(dev);
+		break;
 	default:
 		DRM_DEBUG_DRIVER("Unknown parameter %d\n",
 				 param->param);
drivers/gpu/drm/i915/i915_drv.c +4 -0
index 15bfa91..19fb7a4 100644
@@ -214,6 +214,7 @@ static const struct intel_device_info intel_sandybridge_d_info = {
 	.need_gfx_hws = 1, .has_hotplug = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_sandybridge_m_info = {
@@ -222,6 +223,7 @@ static const struct intel_device_info intel_sandybridge_m_info = {
 	.has_fbc = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_ivybridge_d_info = {
@@ -229,6 +231,7 @@ static const struct intel_device_info intel_ivybridge_d_info = {
 	.need_gfx_hws = 1, .has_hotplug = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_ivybridge_m_info = {
@@ -237,6 +240,7 @@ static const struct intel_device_info intel_ivybridge_m_info = {
 	.has_fbc = 0,	/* FBC is not enabled on Ivybridge mobile yet */
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct pci_device_id pciidlist[] = {		/* aka */
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 4a9c1b9..abbbf32 100644
@@ -250,6 +250,7 @@ struct intel_device_info {
 	u8 supports_tv:1;
 	u8 has_bsd_ring:1;
 	u8 has_blt_ring:1;
+	u8 has_llc:1;
 };
 
 enum no_fbc_reason {
@@ -961,6 +962,7 @@ struct drm_i915_file_private {
 
 #define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
 #define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
+#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index 60ff1b6..fb69337 100644
@@ -3620,8 +3620,8 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
 	obj->base.write_domain = I915_GEM_DOMAIN_CPU;
 	obj->base.read_domains = I915_GEM_DOMAIN_CPU;
 
-	if (IS_GEN6(dev) || IS_GEN7(dev)) {
-		/* On Gen6, we can have the GPU use the LLC (the CPU
+	if (HAS_LLC(dev)) {
+		/* On some devices, we can have the GPU use the LLC (the CPU
 		 * cache) for about a 10% performance improvement
 		 * compared to uncached.  Graphics requests other than
 		 * display scanout are coherent with the CPU in
include/drm/i915_drm.h +1 -0
index 28c0d11..b34e630 100644
@@ -291,6 +291,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_COHERENT_RINGS	 13
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
 #define I915_PARAM_HAS_RELAXED_DELTA	 15
+#define I915_PARAM_HAS_LLC		 16
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 1 line
1.7.7.4
#8 lore raw
Quoted 4 lines · Eugeni Dodonov

From: Eugeni Dodonov <[email protected]>

LLC is not SNB-specific, so we should check for it in a more generic way.

Quoted 8 lines

v2: export LLC support status via debugfs and DRM GETPARAM.

v3: rebase on newer kernel version which says that IVB supports LLC as well.

The patch now conflicts with gen7 sol reset stuff. Care to rebase? Also can you create a quick libdrm helper to check for llc support that returns true for gen6&gen7 in the absence of this ioctl?
-Daniel

Quoted 125 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +
 drivers/gpu/drm/i915/i915_dma.c     |    3 +++
 drivers/gpu/drm/i915/i915_drv.c     |    4 ++++
 drivers/gpu/drm/i915/i915_drv.h     |    2 ++
 drivers/gpu/drm/i915/i915_gem.c     |    4 ++--
 include/drm/i915_drm.h              |    1 +
 6 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index d09a6e0..cb8a153 100644
@@ -82,6 +82,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 	B(supports_tv);
 	B(has_bsd_ring);
 	B(has_blt_ring);
+	B(has_llc);
 #undef B
 
 	return 0;
drivers/gpu/drm/i915/i915_dma.c +3 -0
index a9533c5..938ad57 100644
@@ -781,6 +781,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_RELAXED_DELTA:
 		value = 1;
 		break;
+	case I915_PARAM_HAS_LLC:
+		value = HAS_LLC(dev);
+		break;
 	default:
 		DRM_DEBUG_DRIVER("Unknown parameter %d\n",
 				 param->param);
drivers/gpu/drm/i915/i915_drv.c +4 -0
index 15bfa91..19fb7a4 100644
@@ -214,6 +214,7 @@ static const struct intel_device_info intel_sandybridge_d_info = {
 	.need_gfx_hws = 1, .has_hotplug = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_sandybridge_m_info = {
@@ -222,6 +223,7 @@ static const struct intel_device_info intel_sandybridge_m_info = {
 	.has_fbc = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_ivybridge_d_info = {
@@ -229,6 +231,7 @@ static const struct intel_device_info intel_ivybridge_d_info = {
 	.need_gfx_hws = 1, .has_hotplug = 1,
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct intel_device_info intel_ivybridge_m_info = {
@@ -237,6 +240,7 @@ static const struct intel_device_info intel_ivybridge_m_info = {
 	.has_fbc = 0,	/* FBC is not enabled on Ivybridge mobile yet */
 	.has_bsd_ring = 1,
 	.has_blt_ring = 1,
+	.has_llc = 1,
 };
 
 static const struct pci_device_id pciidlist[] = {		/* aka */
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 4a9c1b9..abbbf32 100644
@@ -250,6 +250,7 @@ struct intel_device_info {
 	u8 supports_tv:1;
 	u8 has_bsd_ring:1;
 	u8 has_blt_ring:1;
+	u8 has_llc:1;
 };
 
 enum no_fbc_reason {
@@ -961,6 +962,7 @@ struct drm_i915_file_private {
 
 #define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
 #define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
+#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index 60ff1b6..fb69337 100644
@@ -3620,8 +3620,8 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
 	obj->base.write_domain = I915_GEM_DOMAIN_CPU;
 	obj->base.read_domains = I915_GEM_DOMAIN_CPU;
 
-	if (IS_GEN6(dev) || IS_GEN7(dev)) {
-		/* On Gen6, we can have the GPU use the LLC (the CPU
+	if (HAS_LLC(dev)) {
+		/* On some devices, we can have the GPU use the LLC (the CPU
 		 * cache) for about a 10% performance improvement
 		 * compared to uncached.  Graphics requests other than
 		 * display scanout are coherent with the CPU in
include/drm/i915_drm.h +1 -0
index 28c0d11..b34e630 100644
@@ -291,6 +291,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_COHERENT_RINGS	 13
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
 #define I915_PARAM_HAS_RELAXED_DELTA	 15
+#define I915_PARAM_HAS_LLC		 16
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 6 lines
1.7.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48