Skip to contentSkip to conversation

sna: check for LLC support

PATCH New Eugeni Dodonov 3 participants 5 messages Jan 17, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sna: check for LLC support

Instead of checking for CPU generation, use the libdrm-provided I915_PARAM_HAS_LLC instead.

---
 src/sna/kgem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
src/sna/kgem.c +2 -2
index 970e462..96c5ddd 100644
@@ -603,8 +603,8 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
 	     kgem->has_relaxed_fencing));
 
 	kgem->has_llc = false;
-	if (!DBG_NO_LLC && gen >= 60)
-		kgem->has_llc = true;
+	if (!DBG_NO_LLC)
+		kgem->has_llc = gem_param(kgem, I915_PARAM_HAS_LLC);
 	kgem->has_cpu_bo = kgem->has_llc;
 	DBG(("%s: cpu bo enabled %d: llc? %d\n", __FUNCTION__,
 	     kgem->has_cpu_bo, kgem->has_llc));
Signature · 1 line
1.7.8.3
#1 lore raw

PATCH 2/2 configure: check for libdrm >= 2.4.31

This is requried for I915_PARAM_HAS_LLC support.

---
 configure.ac |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
configure.ac +1 -0
index 63beb64..604ea6d 100644
@@ -132,6 +132,7 @@ required_pixman_version=0.24
 if test "x$SNA" != "xno"; then
 	required_xorg_xserver_version=1.10
 	AC_DEFINE(USE_SNA, 1, [Enable SNA support])
+	PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= 2.4.31])
 fi
 AC_MSG_RESULT([$SNA])
 
Signature · 1 line
1.7.8.3
#2 lore raw

PATCH 1/1 sna: check for LLC support

In reply to Eugeni Dodonov

Instead of checking for CPU generation, use the libdrm-provided I915_PARAM_HAS_LLC instead.

v2: use a define check to verify if we have I915_PARAM_HAS_LLC.

---
 src/sna/kgem.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
src/sna/kgem.c +12 -0
index 970e462..aa9029d 100644
@@ -603,8 +603,20 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
 	     kgem->has_relaxed_fencing));
 
 	kgem->has_llc = false;
+#ifdef I915_PARAM_HAS_LLC
+	if (!DBG_NO_LLC)
+		kgem->has_llc = gem_param(kgem, I915_PARAM_HAS_LLC);
+#else
+	/* If I915_PARAM_HAS_LLC is not defined by the libdrm, fallback
+	 * to previous GPU generation check and assume that GPUs superior
+	 * to Gen6 support it.
+	 */
+	DBG(("%s: libdrm does not provides I915_PARAM_HAS_LLC, detect GPU gen instead\n",
+				__FUNCTION__));
 	if (!DBG_NO_LLC && gen >= 60)
 		kgem->has_llc = true;
+#endif
+
 	kgem->has_cpu_bo = kgem->has_llc;
 	DBG(("%s: cpu bo enabled %d: llc? %d\n", __FUNCTION__,
 	     kgem->has_cpu_bo, kgem->has_llc));
Signature · 1 line
1.7.8.3
#3 lore raw
Quoted 15 lines · Eugeni Dodonov

Instead of checking for CPU generation, use the libdrm-provided I915_PARAM_HAS_LLC instead.

v2: use a define check to verify if we have I915_PARAM_HAS_LLC.

---
 src/sna/kgem.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
src/sna/kgem.c +0 -0
index 970e462..aa9029d 100644

src/sna/kgem.c void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen) · line 608

Quoted 6 lines
src/sna/kgem.c +3 -0
@@ -603,8 +603,20 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
 	     kgem->has_relaxed_fencing));
 
 	kgem->has_llc = false;
+#ifdef I915_PARAM_HAS_LLC
+	if (!DBG_NO_LLC)
+		kgem->has_llc = gem_param(kgem, I915_PARAM_HAS_LLC);

I still think you want the fallback to use the heuristics here in case we have a new libdrm, but an old kernel lacking the param. -Daniel

Quoted 21 lines
src/sna/kgem.c +9 -0
+#else
+	/* If I915_PARAM_HAS_LLC is not defined by the libdrm, fallback
+	 * to previous GPU generation check and assume that GPUs superior
+	 * to Gen6 support it.
+	 */
+	DBG(("%s: libdrm does not provides I915_PARAM_HAS_LLC, detect GPU gen instead\n",
+				__FUNCTION__));
 	if (!DBG_NO_LLC && gen >= 60)
 		kgem->has_llc = true;
+#endif
+
 	kgem->has_cpu_bo = kgem->has_llc;
 	DBG(("%s: cpu bo enabled %d: llc? %d\n", __FUNCTION__,
 	     kgem->has_cpu_bo, kgem->has_llc));
Signature · 6 lines
1.7.8.3

_______________________________________________
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
#4 lore raw
In reply to Eugeni Dodonov
Quoted 6 lines · Eugeni Dodonov

Instead of checking for CPU generation, use the libdrm-provided I915_PARAM_HAS_LLC instead.

v2: use a define check to verify if we have I915_PARAM_HAS_LLC.

I attacked it slightly so that gem_param reported the lack of support so that we could fallback to guessing by gen for GET_PARAM failure. Thanks,
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre