@@ -2898,9 +2898,7 @@ bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj);
(&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base)
static inline bool i915_is_ggtt(struct i915_address_space *vm)
{
- struct i915_address_space *ggtt =
- &((struct drm_i915_private *)(vm)->dev->dev_private)->gtt.base;
- return vm == ggtt;
+ return vm->is_ggtt;
}
static inline struct i915_hw_ppgtt *
@@ -2511,6 +2511,7 @@ int i915_gem_gtt_init(struct drm_device *dev)
return ret;
gtt->base.dev = dev;
+ gtt->base.is_ggtt = true;
/* GMADR is the PCI mmio aperture into the global GTT. */
DRM_INFO("Memory usable by graphics device = %zdM\n",
@@ -235,6 +235,8 @@ struct i915_address_space {
unsigned long start; /* Start offset always 0 for dri2 */
size_t total; /* size addr space maps (ex. 2GB for ggtt) */
+ bool is_ggtt;
+
struct {
dma_addr_t addr;
struct page *page;
The multiple levels of indirect do nothing but hinder the compiler and the pointer chasing turns to be quite painful but painless to fix. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_drv.h | 4 +--- drivers/gpu/drm/i915/i915_gem_gtt.c | 1 + drivers/gpu/drm/i915/i915_gem_gtt.h | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-)