From: Eugeni Dodonov Subject: [PATCH 3/4] drm/i915: add drm PARAM to query available cache levels Date: Wed, 14 Dec 2011 00:33:03 -0200 Message-ID: <1323829984-22140-4-git-send-email-eugeni@dodonov.net> References: <1323829984-22140-1-git-send-email-eugeni@dodonov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from oproxy3-pub.bluehost.com (oproxy3-pub.bluehost.com [69.89.21.8]) by gabe.freedesktop.org (Postfix) with SMTP id D1ED29EF30 for ; Tue, 13 Dec 2011 18:34:11 -0800 (PST) In-Reply-To: <1323829984-22140-1-git-send-email-eugeni@dodonov.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Eugeni Dodonov List-Id: intel-gfx@lists.freedesktop.org From: Eugeni Dodonov This allows to query available cache levels from libdrm and check for presence of LLC from userspace. Signed-off-by: Eugeni Dodonov --- 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