[Intel-gfx] [PATCH 8/8] drm/i915/context: context switch, and PPGTT params

Ben Widawsky bwidawsk at gmail.com
Thu Feb 3 00:00:20 CET 2011


Adding parameters for userspace to query what features the
driver/hardware supports. In the future context and ppgtt will always go
together, but for now we will use hardware contexts without ppgtt since
there are some issues with ppgtt on the current generation.
---
 drivers/gpu/drm/i915/i915_dma.c |    6 ++++++
 drivers/gpu/drm/i915/i915_drv.h |    3 +++
 include/drm/i915_drm.h          |    2 ++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8dbf17c..1c1eecc 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -771,6 +771,12 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_EXEC_CONSTANTS:
 		value = INTEL_INFO(dev)->gen >= 4;
 		break;
+	case I915_PARAM_HAS_CONTEXTS:
+		value = dev_priv->ctx_disable ? 0 : 1;
+		break;
+	case I915_PARAM_HAS_PPGTT:
+		value = HAS_PPGTT(dev);
+		break;
 	default:
 		DRM_DEBUG_DRIVER("Unknown parameter %d\n",
 				 param->param);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index dc7b132..5324742 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -982,6 +982,9 @@ enum intel_chip_family {
 #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
 #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
 
+#define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 4)
+#define HAS_PPGTT(dev)		(INTEL_INFO(dev)->gen >= 7)
+
 #include "i915_trace.h"
 
 extern struct drm_ioctl_desc i915_ioctls[];
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 5605e97..dbd0332 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -295,6 +295,8 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_RELAXED_FENCING	 12
 #define I915_PARAM_HAS_COHERENT_RINGS	 13
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
+#define I915_PARAM_HAS_CONTEXTS		 15
+#define I915_PARAM_HAS_PPGTT		 16
 
 typedef struct drm_i915_getparam {
 	int param;
-- 
1.7.3.4




More information about the Intel-gfx mailing list