[Intel-gfx] [PATCH 4/6] drm/i915: Use gtt_space->start for stolen reservation

Ben Widawsky ben at bwidawsk.net
Wed Jul 3 23:45:24 CEST 2013


Shortly we'll want to switch to an embedded drm_mm_node per object, and
therefore using pointers as we're doing is unfeasible.

I've chosen an impossible gtt start offset as the way to denote a
reservation.

CC: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.h        | 2 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c    | 2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d06886b..b6864ffb 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1201,7 +1201,7 @@ enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
-#define I915_GTT_RESERVED ((struct drm_mm_node *)0x1)
+#define I915_GTT_RESERVED (dev_priv->gtt.total + 1)
 
 struct drm_i915_gem_object_ops {
 	/* Interface between the GEM object and its backing storage.
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 1eefba7..fbe2e72 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -633,7 +633,7 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
 		DRM_DEBUG_KMS("reserving preallocated space: %lx + %zx\n",
 			      i915_gem_obj_ggtt_offset(obj), obj->base.size);
 
-		BUG_ON(obj->ggtt_space != I915_GTT_RESERVED);
+		BUG_ON(obj->ggtt_space->start != I915_GTT_RESERVED);
 		obj->ggtt_space = kzalloc(sizeof(*obj->ggtt_space), GFP_KERNEL);
 		if (!obj->ggtt_space) {
 			DRM_ERROR("Failed to preserve all objects\n");
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 2f009e6..c9d7016 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -388,7 +388,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
 			goto unref_out;
 		}
 	} else
-		obj->ggtt_space = I915_GTT_RESERVED;
+		obj->ggtt_space->start = I915_GTT_RESERVED;
 
 	obj->has_global_gtt_mapping = 1;
 
-- 
1.8.3.2




More information about the Intel-gfx mailing list