[Intel-gfx] [PATCH 57/66] drm/i915: Disallow pin with full ppgtt

Ben Widawsky ben at bwidawsk.net
Fri Jun 28 01:30:58 CEST 2013


Pin doesn't fit with PPGTT since the interface doesn't allow for the
context for which we want to pin.

Full PPGTT will bring a new "soft pin" interface. The semantics of which
will probably take some time to iron out.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a4db2cc..e58584b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3746,6 +3746,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
 		return -EBUSY;
 
 	BUG_ON(map_and_fenceable && !is_i915_ggtt(vm));
+	BUG_ON(!HAS_HW_CONTEXTS(obj->base.dev) && !is_i915_ggtt(vm));
 
 	if (i915_gem_obj_bound(obj, vm)) {
 		if ((alignment &&
@@ -3800,6 +3801,7 @@ int
 i915_gem_pin_ioctl(struct drm_device *dev, void *data,
 		   struct drm_file *file)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_pin *args = data;
 	struct drm_i915_gem_object *obj;
 	int ret;
@@ -3808,6 +3810,11 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		return ret;
 
+	if (!dev_priv->hw_contexts_disabled) {
+		mutex_unlock(&dev->struct_mutex);
+		return -ENXIO;
+	}
+
 	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
 	if (&obj->base == NULL) {
 		ret = -ENOENT;
-- 
1.8.3.1




More information about the Intel-gfx mailing list