[Intel-gfx] [PATCH 3/4] drm/i915: add drm PARAM to query available cache levels
Eugeni Dodonov
eugeni at dodonov.net
Wed Dec 14 03:33:03 CET 2011
From: Eugeni Dodonov <eugeni.dodonov at intel.com>
This allows to query available cache levels from libdrm and check for
presence of LLC from userspace.
Signed-off-by: Eugeni Dodonov <eugeni.dodonov at intel.com>
---
drivers/gpu/drm/i915/i915_dma.c | 6 ++++++
include/drm/i915_drm.h | 1 +
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a9533c5..5ffbd95 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -781,6 +781,12 @@ static int i915_getparam(struct drm_device *dev, void *data,
case I915_PARAM_HAS_RELAXED_DELTA:
value = 1;
break;
+ case I915_PARAM_CACHE_LEVELS:
+ /* Everyone has CACHE_NONE but not everyone has LLC */
+ value = 1 << I915_CACHE_NONE;
+ if (HAS_LLC(dev))
+ value |= 1 << I915_CACHE_LLC;
+ break;
default:
DRM_DEBUG_DRIVER("Unknown parameter %d\n",
param->param);
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index e9f1cf4..7f778f5 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -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_CACHE_LEVELS 16
typedef struct drm_i915_getparam {
int param;
--
1.7.7.4
More information about the Intel-gfx
mailing list