diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2013-07-05 17:41:04 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-07-08 16:04:34 -0400 |
commit | f343c5f6477354967ee1e331a68a56b9fece2f36 (patch) | |
tree | 71bcf1f5c511b3fa13369badf81e074d8d603543 /drivers/gpu/drm | |
parent | 338710e7aff3428dc8170a03704a8ae981b58dcd (diff) |
drm/i915: Getter/setter for object attributes
Soon we want to gut a lot of our existing assumptions how many address
spaces an object can live in, and in doing so, embed the drm_mm_node in
the object (and later the VMA).
It's possible in the future we'll want to add more getter/setter
methods, but for now this is enough to enable the VMAs.
v2: Reworked commit message (Ben)
Added comments to the main functions (Ben)
sed -i "s/i915_gem_obj_set_color/i915_gem_obj_ggtt_set_color/" drivers/gpu/drm/i915/*.[ch]
sed -i "s/i915_gem_obj_bound/i915_gem_obj_ggtt_bound/" drivers/gpu/drm/i915/*.[ch]
sed -i "s/i915_gem_obj_size/i915_gem_obj_ggtt_size/" drivers/gpu/drm/i915/*.[ch]
sed -i "s/i915_gem_obj_offset/i915_gem_obj_ggtt_offset/" drivers/gpu/drm/i915/*.[ch]
(Daniel)
v3: Rebased on new reserve_node patch
Changed DRM_DEBUG_KMS to actually work (will need fixing later)
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 89 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_context.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_tiling.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_trace.h | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_fb.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_overlay.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_sprite.c | 8 |
15 files changed, 164 insertions, 126 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 3e36756d0439..396387ed207a 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -122,9 +122,9 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | |||
122 | seq_printf(m, " (pinned x %d)", obj->pin_count); | 122 | seq_printf(m, " (pinned x %d)", obj->pin_count); |
123 | if (obj->fence_reg != I915_FENCE_REG_NONE) | 123 | if (obj->fence_reg != I915_FENCE_REG_NONE) |
124 | seq_printf(m, " (fence: %d)", obj->fence_reg); | 124 | seq_printf(m, " (fence: %d)", obj->fence_reg); |
125 | if (obj->gtt_space != NULL) | 125 | if (i915_gem_obj_ggtt_bound(obj)) |
126 | seq_printf(m, " (gtt offset: %08x, size: %08x)", | 126 | seq_printf(m, " (gtt offset: %08lx, size: %08x)", |
127 | obj->gtt_offset, (unsigned int)obj->gtt_space->size); | 127 | i915_gem_obj_ggtt_offset(obj), (unsigned int)i915_gem_obj_ggtt_size(obj)); |
128 | if (obj->stolen) | 128 | if (obj->stolen) |
129 | seq_printf(m, " (stolen: %08lx)", obj->stolen->start); | 129 | seq_printf(m, " (stolen: %08lx)", obj->stolen->start); |
130 | if (obj->pin_mappable || obj->fault_mappable) { | 130 | if (obj->pin_mappable || obj->fault_mappable) { |
@@ -175,7 +175,7 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
175 | describe_obj(m, obj); | 175 | describe_obj(m, obj); |
176 | seq_putc(m, '\n'); | 176 | seq_putc(m, '\n'); |
177 | total_obj_size += obj->base.size; | 177 | total_obj_size += obj->base.size; |
178 | total_gtt_size += obj->gtt_space->size; | 178 | total_gtt_size += i915_gem_obj_ggtt_size(obj); |
179 | count++; | 179 | count++; |
180 | } | 180 | } |
181 | mutex_unlock(&dev->struct_mutex); | 181 | mutex_unlock(&dev->struct_mutex); |
@@ -187,10 +187,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
187 | 187 | ||
188 | #define count_objects(list, member) do { \ | 188 | #define count_objects(list, member) do { \ |
189 | list_for_each_entry(obj, list, member) { \ | 189 | list_for_each_entry(obj, list, member) { \ |
190 | size += obj->gtt_space->size; \ | 190 | size += i915_gem_obj_ggtt_size(obj); \ |
191 | ++count; \ | 191 | ++count; \ |
192 | if (obj->map_and_fenceable) { \ | 192 | if (obj->map_and_fenceable) { \ |
193 | mappable_size += obj->gtt_space->size; \ | 193 | mappable_size += i915_gem_obj_ggtt_size(obj); \ |
194 | ++mappable_count; \ | 194 | ++mappable_count; \ |
195 | } \ | 195 | } \ |
196 | } \ | 196 | } \ |
@@ -209,7 +209,7 @@ static int per_file_stats(int id, void *ptr, void *data) | |||
209 | stats->count++; | 209 | stats->count++; |
210 | stats->total += obj->base.size; | 210 | stats->total += obj->base.size; |
211 | 211 | ||
212 | if (obj->gtt_space) { | 212 | if (i915_gem_obj_ggtt_bound(obj)) { |
213 | if (!list_empty(&obj->ring_list)) | 213 | if (!list_empty(&obj->ring_list)) |
214 | stats->active += obj->base.size; | 214 | stats->active += obj->base.size; |
215 | else | 215 | else |
@@ -267,11 +267,11 @@ static int i915_gem_object_info(struct seq_file *m, void *data) | |||
267 | size = count = mappable_size = mappable_count = 0; | 267 | size = count = mappable_size = mappable_count = 0; |
268 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { | 268 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { |
269 | if (obj->fault_mappable) { | 269 | if (obj->fault_mappable) { |
270 | size += obj->gtt_space->size; | 270 | size += i915_gem_obj_ggtt_size(obj); |
271 | ++count; | 271 | ++count; |
272 | } | 272 | } |
273 | if (obj->pin_mappable) { | 273 | if (obj->pin_mappable) { |
274 | mappable_size += obj->gtt_space->size; | 274 | mappable_size += i915_gem_obj_ggtt_size(obj); |
275 | ++mappable_count; | 275 | ++mappable_count; |
276 | } | 276 | } |
277 | if (obj->madv == I915_MADV_DONTNEED) { | 277 | if (obj->madv == I915_MADV_DONTNEED) { |
@@ -333,7 +333,7 @@ static int i915_gem_gtt_info(struct seq_file *m, void *data) | |||
333 | describe_obj(m, obj); | 333 | describe_obj(m, obj); |
334 | seq_putc(m, '\n'); | 334 | seq_putc(m, '\n'); |
335 | total_obj_size += obj->base.size; | 335 | total_obj_size += obj->base.size; |
336 | total_gtt_size += obj->gtt_space->size; | 336 | total_gtt_size += i915_gem_obj_ggtt_size(obj); |
337 | count++; | 337 | count++; |
338 | } | 338 | } |
339 | 339 | ||
@@ -379,12 +379,14 @@ static int i915_gem_pageflip_info(struct seq_file *m, void *data) | |||
379 | if (work->old_fb_obj) { | 379 | if (work->old_fb_obj) { |
380 | struct drm_i915_gem_object *obj = work->old_fb_obj; | 380 | struct drm_i915_gem_object *obj = work->old_fb_obj; |
381 | if (obj) | 381 | if (obj) |
382 | seq_printf(m, "Old framebuffer gtt_offset 0x%08x\n", obj->gtt_offset); | 382 | seq_printf(m, "Old framebuffer gtt_offset 0x%08lx\n", |
383 | i915_gem_obj_ggtt_offset(obj)); | ||
383 | } | 384 | } |
384 | if (work->pending_flip_obj) { | 385 | if (work->pending_flip_obj) { |
385 | struct drm_i915_gem_object *obj = work->pending_flip_obj; | 386 | struct drm_i915_gem_object *obj = work->pending_flip_obj; |
386 | if (obj) | 387 | if (obj) |
387 | seq_printf(m, "New framebuffer gtt_offset 0x%08x\n", obj->gtt_offset); | 388 | seq_printf(m, "New framebuffer gtt_offset 0x%08lx\n", |
389 | i915_gem_obj_ggtt_offset(obj)); | ||
388 | } | 390 | } |
389 | } | 391 | } |
390 | spin_unlock_irqrestore(&dev->event_lock, flags); | 392 | spin_unlock_irqrestore(&dev->event_lock, flags); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 0a91554e0aa1..8a92174109c2 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1361,6 +1361,37 @@ struct drm_i915_gem_object { | |||
1361 | 1361 | ||
1362 | #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) | 1362 | #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) |
1363 | 1363 | ||
1364 | /* Offset of the first PTE pointing to this object */ | ||
1365 | static inline unsigned long | ||
1366 | i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *o) | ||
1367 | { | ||
1368 | return o->gtt_space->start; | ||
1369 | } | ||
1370 | |||
1371 | /* Whether or not this object is currently mapped by the translation tables */ | ||
1372 | static inline bool | ||
1373 | i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *o) | ||
1374 | { | ||
1375 | return o->gtt_space != NULL; | ||
1376 | } | ||
1377 | |||
1378 | /* The size used in the translation tables may be larger than the actual size of | ||
1379 | * the object on GEN2/GEN3 because of the way tiling is handled. See | ||
1380 | * i915_gem_get_gtt_size() for more details. | ||
1381 | */ | ||
1382 | static inline unsigned long | ||
1383 | i915_gem_obj_ggtt_size(struct drm_i915_gem_object *o) | ||
1384 | { | ||
1385 | return o->gtt_space->size; | ||
1386 | } | ||
1387 | |||
1388 | static inline void | ||
1389 | i915_gem_obj_ggtt_set_color(struct drm_i915_gem_object *o, | ||
1390 | enum i915_cache_level color) | ||
1391 | { | ||
1392 | o->gtt_space->color = color; | ||
1393 | } | ||
1394 | |||
1364 | /** | 1395 | /** |
1365 | * Request queue structure. | 1396 | * Request queue structure. |
1366 | * | 1397 | * |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 769f75262feb..b8a0d91f2e2d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -135,7 +135,7 @@ int i915_mutex_lock_interruptible(struct drm_device *dev) | |||
135 | static inline bool | 135 | static inline bool |
136 | i915_gem_object_is_inactive(struct drm_i915_gem_object *obj) | 136 | i915_gem_object_is_inactive(struct drm_i915_gem_object *obj) |
137 | { | 137 | { |
138 | return obj->gtt_space && !obj->active; | 138 | return i915_gem_obj_ggtt_bound(obj) && !obj->active; |
139 | } | 139 | } |
140 | 140 | ||
141 | int | 141 | int |
@@ -178,7 +178,7 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, | |||
178 | mutex_lock(&dev->struct_mutex); | 178 | mutex_lock(&dev->struct_mutex); |
179 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) | 179 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) |
180 | if (obj->pin_count) | 180 | if (obj->pin_count) |
181 | pinned += obj->gtt_space->size; | 181 | pinned += i915_gem_obj_ggtt_size(obj); |
182 | mutex_unlock(&dev->struct_mutex); | 182 | mutex_unlock(&dev->struct_mutex); |
183 | 183 | ||
184 | args->aper_size = dev_priv->gtt.total; | 184 | args->aper_size = dev_priv->gtt.total; |
@@ -422,7 +422,7 @@ i915_gem_shmem_pread(struct drm_device *dev, | |||
422 | * anyway again before the next pread happens. */ | 422 | * anyway again before the next pread happens. */ |
423 | if (obj->cache_level == I915_CACHE_NONE) | 423 | if (obj->cache_level == I915_CACHE_NONE) |
424 | needs_clflush = 1; | 424 | needs_clflush = 1; |
425 | if (obj->gtt_space) { | 425 | if (i915_gem_obj_ggtt_bound(obj)) { |
426 | ret = i915_gem_object_set_to_gtt_domain(obj, false); | 426 | ret = i915_gem_object_set_to_gtt_domain(obj, false); |
427 | if (ret) | 427 | if (ret) |
428 | return ret; | 428 | return ret; |
@@ -609,7 +609,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, | |||
609 | user_data = to_user_ptr(args->data_ptr); | 609 | user_data = to_user_ptr(args->data_ptr); |
610 | remain = args->size; | 610 | remain = args->size; |
611 | 611 | ||
612 | offset = obj->gtt_offset + args->offset; | 612 | offset = i915_gem_obj_ggtt_offset(obj) + args->offset; |
613 | 613 | ||
614 | while (remain > 0) { | 614 | while (remain > 0) { |
615 | /* Operation in this page | 615 | /* Operation in this page |
@@ -739,7 +739,7 @@ i915_gem_shmem_pwrite(struct drm_device *dev, | |||
739 | * right away and we therefore have to clflush anyway. */ | 739 | * right away and we therefore have to clflush anyway. */ |
740 | if (obj->cache_level == I915_CACHE_NONE) | 740 | if (obj->cache_level == I915_CACHE_NONE) |
741 | needs_clflush_after = 1; | 741 | needs_clflush_after = 1; |
742 | if (obj->gtt_space) { | 742 | if (i915_gem_obj_ggtt_bound(obj)) { |
743 | ret = i915_gem_object_set_to_gtt_domain(obj, true); | 743 | ret = i915_gem_object_set_to_gtt_domain(obj, true); |
744 | if (ret) | 744 | if (ret) |
745 | return ret; | 745 | return ret; |
@@ -1360,8 +1360,9 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1360 | 1360 | ||
1361 | obj->fault_mappable = true; | 1361 | obj->fault_mappable = true; |
1362 | 1362 | ||
1363 | pfn = ((dev_priv->gtt.mappable_base + obj->gtt_offset) >> PAGE_SHIFT) + | 1363 | pfn = dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj); |
1364 | page_offset; | 1364 | pfn >>= PAGE_SHIFT; |
1365 | pfn += page_offset; | ||
1365 | 1366 | ||
1366 | /* Finally, remap it using the new GTT offset */ | 1367 | /* Finally, remap it using the new GTT offset */ |
1367 | ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn); | 1368 | ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn); |
@@ -1667,7 +1668,7 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj) | |||
1667 | if (obj->pages == NULL) | 1668 | if (obj->pages == NULL) |
1668 | return 0; | 1669 | return 0; |
1669 | 1670 | ||
1670 | BUG_ON(obj->gtt_space); | 1671 | BUG_ON(i915_gem_obj_ggtt_bound(obj)); |
1671 | 1672 | ||
1672 | if (obj->pages_pin_count) | 1673 | if (obj->pages_pin_count) |
1673 | return -EBUSY; | 1674 | return -EBUSY; |
@@ -2117,8 +2118,8 @@ i915_gem_request_remove_from_client(struct drm_i915_gem_request *request) | |||
2117 | 2118 | ||
2118 | static bool i915_head_inside_object(u32 acthd, struct drm_i915_gem_object *obj) | 2119 | static bool i915_head_inside_object(u32 acthd, struct drm_i915_gem_object *obj) |
2119 | { | 2120 | { |
2120 | if (acthd >= obj->gtt_offset && | 2121 | if (acthd >= i915_gem_obj_ggtt_offset(obj) && |
2121 | acthd < obj->gtt_offset + obj->base.size) | 2122 | acthd < i915_gem_obj_ggtt_offset(obj) + obj->base.size) |
2122 | return true; | 2123 | return true; |
2123 | 2124 | ||
2124 | return false; | 2125 | return false; |
@@ -2176,11 +2177,11 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring, | |||
2176 | 2177 | ||
2177 | if (ring->hangcheck.action != wait && | 2178 | if (ring->hangcheck.action != wait && |
2178 | i915_request_guilty(request, acthd, &inside)) { | 2179 | i915_request_guilty(request, acthd, &inside)) { |
2179 | DRM_ERROR("%s hung %s bo (0x%x ctx %d) at 0x%x\n", | 2180 | DRM_ERROR("%s hung %s bo (0x%lx ctx %d) at 0x%x\n", |
2180 | ring->name, | 2181 | ring->name, |
2181 | inside ? "inside" : "flushing", | 2182 | inside ? "inside" : "flushing", |
2182 | request->batch_obj ? | 2183 | request->batch_obj ? |
2183 | request->batch_obj->gtt_offset : 0, | 2184 | i915_gem_obj_ggtt_offset(request->batch_obj) : 0, |
2184 | request->ctx ? request->ctx->id : 0, | 2185 | request->ctx ? request->ctx->id : 0, |
2185 | acthd); | 2186 | acthd); |
2186 | 2187 | ||
@@ -2592,7 +2593,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj) | |||
2592 | drm_i915_private_t *dev_priv = obj->base.dev->dev_private; | 2593 | drm_i915_private_t *dev_priv = obj->base.dev->dev_private; |
2593 | int ret; | 2594 | int ret; |
2594 | 2595 | ||
2595 | if (obj->gtt_space == NULL) | 2596 | if (!i915_gem_obj_ggtt_bound(obj)) |
2596 | return 0; | 2597 | return 0; |
2597 | 2598 | ||
2598 | if (obj->pin_count) | 2599 | if (obj->pin_count) |
@@ -2675,11 +2676,11 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg, | |||
2675 | } | 2676 | } |
2676 | 2677 | ||
2677 | if (obj) { | 2678 | if (obj) { |
2678 | u32 size = obj->gtt_space->size; | 2679 | u32 size = i915_gem_obj_ggtt_size(obj); |
2679 | 2680 | ||
2680 | val = (uint64_t)((obj->gtt_offset + size - 4096) & | 2681 | val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) + size - 4096) & |
2681 | 0xfffff000) << 32; | 2682 | 0xfffff000) << 32; |
2682 | val |= obj->gtt_offset & 0xfffff000; | 2683 | val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000; |
2683 | val |= (uint64_t)((obj->stride / 128) - 1) << fence_pitch_shift; | 2684 | val |= (uint64_t)((obj->stride / 128) - 1) << fence_pitch_shift; |
2684 | if (obj->tiling_mode == I915_TILING_Y) | 2685 | if (obj->tiling_mode == I915_TILING_Y) |
2685 | val |= 1 << I965_FENCE_TILING_Y_SHIFT; | 2686 | val |= 1 << I965_FENCE_TILING_Y_SHIFT; |
@@ -2699,15 +2700,15 @@ static void i915_write_fence_reg(struct drm_device *dev, int reg, | |||
2699 | u32 val; | 2700 | u32 val; |
2700 | 2701 | ||
2701 | if (obj) { | 2702 | if (obj) { |
2702 | u32 size = obj->gtt_space->size; | 2703 | u32 size = i915_gem_obj_ggtt_size(obj); |
2703 | int pitch_val; | 2704 | int pitch_val; |
2704 | int tile_width; | 2705 | int tile_width; |
2705 | 2706 | ||
2706 | WARN((obj->gtt_offset & ~I915_FENCE_START_MASK) || | 2707 | WARN((i915_gem_obj_ggtt_offset(obj) & ~I915_FENCE_START_MASK) || |
2707 | (size & -size) != size || | 2708 | (size & -size) != size || |
2708 | (obj->gtt_offset & (size - 1)), | 2709 | (i915_gem_obj_ggtt_offset(obj) & (size - 1)), |
2709 | "object 0x%08x [fenceable? %d] not 1M or pot-size (0x%08x) aligned\n", | 2710 | "object 0x%08lx [fenceable? %d] not 1M or pot-size (0x%08x) aligned\n", |
2710 | obj->gtt_offset, obj->map_and_fenceable, size); | 2711 | i915_gem_obj_ggtt_offset(obj), obj->map_and_fenceable, size); |
2711 | 2712 | ||
2712 | if (obj->tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)) | 2713 | if (obj->tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)) |
2713 | tile_width = 128; | 2714 | tile_width = 128; |
@@ -2718,7 +2719,7 @@ static void i915_write_fence_reg(struct drm_device *dev, int reg, | |||
2718 | pitch_val = obj->stride / tile_width; | 2719 | pitch_val = obj->stride / tile_width; |
2719 | pitch_val = ffs(pitch_val) - 1; | 2720 | pitch_val = ffs(pitch_val) - 1; |
2720 | 2721 | ||
2721 | val = obj->gtt_offset; | 2722 | val = i915_gem_obj_ggtt_offset(obj); |
2722 | if (obj->tiling_mode == I915_TILING_Y) | 2723 | if (obj->tiling_mode == I915_TILING_Y) |
2723 | val |= 1 << I830_FENCE_TILING_Y_SHIFT; | 2724 | val |= 1 << I830_FENCE_TILING_Y_SHIFT; |
2724 | val |= I915_FENCE_SIZE_BITS(size); | 2725 | val |= I915_FENCE_SIZE_BITS(size); |
@@ -2743,19 +2744,19 @@ static void i830_write_fence_reg(struct drm_device *dev, int reg, | |||
2743 | uint32_t val; | 2744 | uint32_t val; |
2744 | 2745 | ||
2745 | if (obj) { | 2746 | if (obj) { |
2746 | u32 size = obj->gtt_space->size; | 2747 | u32 size = i915_gem_obj_ggtt_size(obj); |
2747 | uint32_t pitch_val; | 2748 | uint32_t pitch_val; |
2748 | 2749 | ||
2749 | WARN((obj->gtt_offset & ~I830_FENCE_START_MASK) || | 2750 | WARN((i915_gem_obj_ggtt_offset(obj) & ~I830_FENCE_START_MASK) || |
2750 | (size & -size) != size || | 2751 | (size & -size) != size || |
2751 | (obj->gtt_offset & (size - 1)), | 2752 | (i915_gem_obj_ggtt_offset(obj) & (size - 1)), |
2752 | "object 0x%08x not 512K or pot-size 0x%08x aligned\n", | 2753 | "object 0x%08lx not 512K or pot-size 0x%08x aligned\n", |
2753 | obj->gtt_offset, size); | 2754 | i915_gem_obj_ggtt_offset(obj), size); |
2754 | 2755 | ||
2755 | pitch_val = obj->stride / 128; | 2756 | pitch_val = obj->stride / 128; |
2756 | pitch_val = ffs(pitch_val) - 1; | 2757 | pitch_val = ffs(pitch_val) - 1; |
2757 | 2758 | ||
2758 | val = obj->gtt_offset; | 2759 | val = i915_gem_obj_ggtt_offset(obj); |
2759 | if (obj->tiling_mode == I915_TILING_Y) | 2760 | if (obj->tiling_mode == I915_TILING_Y) |
2760 | val |= 1 << I830_FENCE_TILING_Y_SHIFT; | 2761 | val |= 1 << I830_FENCE_TILING_Y_SHIFT; |
2761 | val |= I830_FENCE_SIZE_BITS(size); | 2762 | val |= I830_FENCE_SIZE_BITS(size); |
@@ -3044,8 +3045,8 @@ static void i915_gem_verify_gtt(struct drm_device *dev) | |||
3044 | 3045 | ||
3045 | if (obj->cache_level != obj->gtt_space->color) { | 3046 | if (obj->cache_level != obj->gtt_space->color) { |
3046 | printk(KERN_ERR "object reserved space [%08lx, %08lx] with wrong color, cache_level=%x, color=%lx\n", | 3047 | printk(KERN_ERR "object reserved space [%08lx, %08lx] with wrong color, cache_level=%x, color=%lx\n", |
3047 | obj->gtt_space->start, | 3048 | i915_gem_obj_ggtt_offset(obj), |
3048 | obj->gtt_space->start + obj->gtt_space->size, | 3049 | i915_gem_obj_ggtt_offset(obj) + i915_gem_obj_ggtt_size(obj), |
3049 | obj->cache_level, | 3050 | obj->cache_level, |
3050 | obj->gtt_space->color); | 3051 | obj->gtt_space->color); |
3051 | err++; | 3052 | err++; |
@@ -3056,8 +3057,8 @@ static void i915_gem_verify_gtt(struct drm_device *dev) | |||
3056 | obj->gtt_space, | 3057 | obj->gtt_space, |
3057 | obj->cache_level)) { | 3058 | obj->cache_level)) { |
3058 | printk(KERN_ERR "invalid GTT space found at [%08lx, %08lx] - color=%x\n", | 3059 | printk(KERN_ERR "invalid GTT space found at [%08lx, %08lx] - color=%x\n", |
3059 | obj->gtt_space->start, | 3060 | i915_gem_obj_ggtt_offset(obj), |
3060 | obj->gtt_space->start + obj->gtt_space->size, | 3061 | i915_gem_obj_ggtt_offset(obj) + i915_gem_obj_ggtt_size(obj), |
3061 | obj->cache_level); | 3062 | obj->cache_level); |
3062 | err++; | 3063 | err++; |
3063 | continue; | 3064 | continue; |
@@ -3169,8 +3170,8 @@ search_free: | |||
3169 | node->size == fence_size && | 3170 | node->size == fence_size && |
3170 | (node->start & (fence_alignment - 1)) == 0; | 3171 | (node->start & (fence_alignment - 1)) == 0; |
3171 | 3172 | ||
3172 | mappable = | 3173 | mappable = i915_gem_obj_ggtt_offset(obj) + obj->base.size <= |
3173 | obj->gtt_offset + obj->base.size <= dev_priv->gtt.mappable_end; | 3174 | dev_priv->gtt.mappable_end; |
3174 | 3175 | ||
3175 | obj->map_and_fenceable = mappable && fenceable; | 3176 | obj->map_and_fenceable = mappable && fenceable; |
3176 | 3177 | ||
@@ -3272,7 +3273,7 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) | |||
3272 | int ret; | 3273 | int ret; |
3273 | 3274 | ||
3274 | /* Not valid to be called on unbound objects. */ | 3275 | /* Not valid to be called on unbound objects. */ |
3275 | if (obj->gtt_space == NULL) | 3276 | if (!i915_gem_obj_ggtt_bound(obj)) |
3276 | return -EINVAL; | 3277 | return -EINVAL; |
3277 | 3278 | ||
3278 | if (obj->base.write_domain == I915_GEM_DOMAIN_GTT) | 3279 | if (obj->base.write_domain == I915_GEM_DOMAIN_GTT) |
@@ -3337,7 +3338,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, | |||
3337 | return ret; | 3338 | return ret; |
3338 | } | 3339 | } |
3339 | 3340 | ||
3340 | if (obj->gtt_space) { | 3341 | if (i915_gem_obj_ggtt_bound(obj)) { |
3341 | ret = i915_gem_object_finish_gpu(obj); | 3342 | ret = i915_gem_object_finish_gpu(obj); |
3342 | if (ret) | 3343 | if (ret) |
3343 | return ret; | 3344 | return ret; |
@@ -3360,7 +3361,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, | |||
3360 | i915_ppgtt_bind_object(dev_priv->mm.aliasing_ppgtt, | 3361 | i915_ppgtt_bind_object(dev_priv->mm.aliasing_ppgtt, |
3361 | obj, cache_level); | 3362 | obj, cache_level); |
3362 | 3363 | ||
3363 | obj->gtt_space->color = cache_level; | 3364 | i915_gem_obj_ggtt_set_color(obj, cache_level); |
3364 | } | 3365 | } |
3365 | 3366 | ||
3366 | if (cache_level == I915_CACHE_NONE) { | 3367 | if (cache_level == I915_CACHE_NONE) { |
@@ -3641,14 +3642,14 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, | |||
3641 | if (WARN_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) | 3642 | if (WARN_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) |
3642 | return -EBUSY; | 3643 | return -EBUSY; |
3643 | 3644 | ||
3644 | if (obj->gtt_space != NULL) { | 3645 | if (i915_gem_obj_ggtt_bound(obj)) { |
3645 | if ((alignment && obj->gtt_offset & (alignment - 1)) || | 3646 | if ((alignment && i915_gem_obj_ggtt_offset(obj) & (alignment - 1)) || |
3646 | (map_and_fenceable && !obj->map_and_fenceable)) { | 3647 | (map_and_fenceable && !obj->map_and_fenceable)) { |
3647 | WARN(obj->pin_count, | 3648 | WARN(obj->pin_count, |
3648 | "bo is already pinned with incorrect alignment:" | 3649 | "bo is already pinned with incorrect alignment:" |
3649 | " offset=%x, req.alignment=%x, req.map_and_fenceable=%d," | 3650 | " offset=%lx, req.alignment=%x, req.map_and_fenceable=%d," |
3650 | " obj->map_and_fenceable=%d\n", | 3651 | " obj->map_and_fenceable=%d\n", |
3651 | obj->gtt_offset, alignment, | 3652 | i915_gem_obj_ggtt_offset(obj), alignment, |
3652 | map_and_fenceable, | 3653 | map_and_fenceable, |
3653 | obj->map_and_fenceable); | 3654 | obj->map_and_fenceable); |
3654 | ret = i915_gem_object_unbind(obj); | 3655 | ret = i915_gem_object_unbind(obj); |
@@ -3657,7 +3658,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, | |||
3657 | } | 3658 | } |
3658 | } | 3659 | } |
3659 | 3660 | ||
3660 | if (obj->gtt_space == NULL) { | 3661 | if (!i915_gem_obj_ggtt_bound(obj)) { |
3661 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; | 3662 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
3662 | 3663 | ||
3663 | ret = i915_gem_object_bind_to_gtt(obj, alignment, | 3664 | ret = i915_gem_object_bind_to_gtt(obj, alignment, |
@@ -3683,7 +3684,7 @@ void | |||
3683 | i915_gem_object_unpin(struct drm_i915_gem_object *obj) | 3684 | i915_gem_object_unpin(struct drm_i915_gem_object *obj) |
3684 | { | 3685 | { |
3685 | BUG_ON(obj->pin_count == 0); | 3686 | BUG_ON(obj->pin_count == 0); |
3686 | BUG_ON(obj->gtt_space == NULL); | 3687 | BUG_ON(!i915_gem_obj_ggtt_bound(obj)); |
3687 | 3688 | ||
3688 | if (--obj->pin_count == 0) | 3689 | if (--obj->pin_count == 0) |
3689 | obj->pin_mappable = false; | 3690 | obj->pin_mappable = false; |
@@ -3733,7 +3734,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, | |||
3733 | * as the X server doesn't manage domains yet | 3734 | * as the X server doesn't manage domains yet |
3734 | */ | 3735 | */ |
3735 | i915_gem_object_flush_cpu_write_domain(obj); | 3736 | i915_gem_object_flush_cpu_write_domain(obj); |
3736 | args->offset = obj->gtt_offset; | 3737 | args->offset = i915_gem_obj_ggtt_offset(obj); |
3737 | out: | 3738 | out: |
3738 | drm_gem_object_unreference(&obj->base); | 3739 | drm_gem_object_unreference(&obj->base); |
3739 | unlock: | 3740 | unlock: |
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 51b7a2171cae..2074544682cf 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -377,7 +377,7 @@ mi_set_context(struct intel_ring_buffer *ring, | |||
377 | 377 | ||
378 | intel_ring_emit(ring, MI_NOOP); | 378 | intel_ring_emit(ring, MI_NOOP); |
379 | intel_ring_emit(ring, MI_SET_CONTEXT); | 379 | intel_ring_emit(ring, MI_SET_CONTEXT); |
380 | intel_ring_emit(ring, new_context->obj->gtt_offset | | 380 | intel_ring_emit(ring, i915_gem_obj_ggtt_offset(new_context->obj) | |
381 | MI_MM_SPACE_GTT | | 381 | MI_MM_SPACE_GTT | |
382 | MI_SAVE_EXT_STATE_EN | | 382 | MI_SAVE_EXT_STATE_EN | |
383 | MI_RESTORE_EXT_STATE_EN | | 383 | MI_RESTORE_EXT_STATE_EN | |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 87a3227e5179..5aeb447ead6b 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -188,7 +188,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, | |||
188 | return -ENOENT; | 188 | return -ENOENT; |
189 | 189 | ||
190 | target_i915_obj = to_intel_bo(target_obj); | 190 | target_i915_obj = to_intel_bo(target_obj); |
191 | target_offset = target_i915_obj->gtt_offset; | 191 | target_offset = i915_gem_obj_ggtt_offset(target_i915_obj); |
192 | 192 | ||
193 | /* Sandybridge PPGTT errata: We need a global gtt mapping for MI and | 193 | /* Sandybridge PPGTT errata: We need a global gtt mapping for MI and |
194 | * pipe_control writes because the gpu doesn't properly redirect them | 194 | * pipe_control writes because the gpu doesn't properly redirect them |
@@ -280,7 +280,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, | |||
280 | return ret; | 280 | return ret; |
281 | 281 | ||
282 | /* Map the page containing the relocation we're going to perform. */ | 282 | /* Map the page containing the relocation we're going to perform. */ |
283 | reloc->offset += obj->gtt_offset; | 283 | reloc->offset += i915_gem_obj_ggtt_offset(obj); |
284 | reloc_page = io_mapping_map_atomic_wc(dev_priv->gtt.mappable, | 284 | reloc_page = io_mapping_map_atomic_wc(dev_priv->gtt.mappable, |
285 | reloc->offset & PAGE_MASK); | 285 | reloc->offset & PAGE_MASK); |
286 | reloc_entry = (uint32_t __iomem *) | 286 | reloc_entry = (uint32_t __iomem *) |
@@ -436,8 +436,8 @@ i915_gem_execbuffer_reserve_object(struct drm_i915_gem_object *obj, | |||
436 | obj->has_aliasing_ppgtt_mapping = 1; | 436 | obj->has_aliasing_ppgtt_mapping = 1; |
437 | } | 437 | } |
438 | 438 | ||
439 | if (entry->offset != obj->gtt_offset) { | 439 | if (entry->offset != i915_gem_obj_ggtt_offset(obj)) { |
440 | entry->offset = obj->gtt_offset; | 440 | entry->offset = i915_gem_obj_ggtt_offset(obj); |
441 | *need_reloc = true; | 441 | *need_reloc = true; |
442 | } | 442 | } |
443 | 443 | ||
@@ -458,7 +458,7 @@ i915_gem_execbuffer_unreserve_object(struct drm_i915_gem_object *obj) | |||
458 | { | 458 | { |
459 | struct drm_i915_gem_exec_object2 *entry; | 459 | struct drm_i915_gem_exec_object2 *entry; |
460 | 460 | ||
461 | if (!obj->gtt_space) | 461 | if (!i915_gem_obj_ggtt_bound(obj)) |
462 | return; | 462 | return; |
463 | 463 | ||
464 | entry = obj->exec_entry; | 464 | entry = obj->exec_entry; |
@@ -530,7 +530,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, | |||
530 | struct drm_i915_gem_exec_object2 *entry = obj->exec_entry; | 530 | struct drm_i915_gem_exec_object2 *entry = obj->exec_entry; |
531 | bool need_fence, need_mappable; | 531 | bool need_fence, need_mappable; |
532 | 532 | ||
533 | if (!obj->gtt_space) | 533 | if (!i915_gem_obj_ggtt_bound(obj)) |
534 | continue; | 534 | continue; |
535 | 535 | ||
536 | need_fence = | 536 | need_fence = |
@@ -539,7 +539,8 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, | |||
539 | obj->tiling_mode != I915_TILING_NONE; | 539 | obj->tiling_mode != I915_TILING_NONE; |
540 | need_mappable = need_fence || need_reloc_mappable(obj); | 540 | need_mappable = need_fence || need_reloc_mappable(obj); |
541 | 541 | ||
542 | if ((entry->alignment && obj->gtt_offset & (entry->alignment - 1)) || | 542 | if ((entry->alignment && |
543 | i915_gem_obj_ggtt_offset(obj) & (entry->alignment - 1)) || | ||
543 | (need_mappable && !obj->map_and_fenceable)) | 544 | (need_mappable && !obj->map_and_fenceable)) |
544 | ret = i915_gem_object_unbind(obj); | 545 | ret = i915_gem_object_unbind(obj); |
545 | else | 546 | else |
@@ -550,7 +551,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, | |||
550 | 551 | ||
551 | /* Bind fresh objects */ | 552 | /* Bind fresh objects */ |
552 | list_for_each_entry(obj, objects, exec_list) { | 553 | list_for_each_entry(obj, objects, exec_list) { |
553 | if (obj->gtt_space) | 554 | if (i915_gem_obj_ggtt_bound(obj)) |
554 | continue; | 555 | continue; |
555 | 556 | ||
556 | ret = i915_gem_execbuffer_reserve_object(obj, ring, need_relocs); | 557 | ret = i915_gem_execbuffer_reserve_object(obj, ring, need_relocs); |
@@ -1058,7 +1059,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1058 | goto err; | 1059 | goto err; |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | exec_start = batch_obj->gtt_offset + args->batch_start_offset; | 1062 | exec_start = i915_gem_obj_ggtt_offset(batch_obj) + args->batch_start_offset; |
1062 | exec_len = args->batch_len; | 1063 | exec_len = args->batch_len; |
1063 | if (cliprects) { | 1064 | if (cliprects) { |
1064 | for (i = 0; i < args->num_cliprects; i++) { | 1065 | for (i = 0; i < args->num_cliprects; i++) { |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index afba7e5e7739..6f0a4c09e26a 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -378,7 +378,7 @@ void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt, | |||
378 | enum i915_cache_level cache_level) | 378 | enum i915_cache_level cache_level) |
379 | { | 379 | { |
380 | ppgtt->insert_entries(ppgtt, obj->pages, | 380 | ppgtt->insert_entries(ppgtt, obj->pages, |
381 | obj->gtt_space->start >> PAGE_SHIFT, | 381 | i915_gem_obj_ggtt_offset(obj) >> PAGE_SHIFT, |
382 | cache_level); | 382 | cache_level); |
383 | } | 383 | } |
384 | 384 | ||
@@ -386,7 +386,7 @@ void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt, | |||
386 | struct drm_i915_gem_object *obj) | 386 | struct drm_i915_gem_object *obj) |
387 | { | 387 | { |
388 | ppgtt->clear_range(ppgtt, | 388 | ppgtt->clear_range(ppgtt, |
389 | obj->gtt_space->start >> PAGE_SHIFT, | 389 | i915_gem_obj_ggtt_offset(obj) >> PAGE_SHIFT, |
390 | obj->base.size >> PAGE_SHIFT); | 390 | obj->base.size >> PAGE_SHIFT); |
391 | } | 391 | } |
392 | 392 | ||
@@ -551,7 +551,7 @@ void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj, | |||
551 | struct drm_i915_private *dev_priv = dev->dev_private; | 551 | struct drm_i915_private *dev_priv = dev->dev_private; |
552 | 552 | ||
553 | dev_priv->gtt.gtt_insert_entries(dev, obj->pages, | 553 | dev_priv->gtt.gtt_insert_entries(dev, obj->pages, |
554 | obj->gtt_space->start >> PAGE_SHIFT, | 554 | i915_gem_obj_ggtt_offset(obj) >> PAGE_SHIFT, |
555 | cache_level); | 555 | cache_level); |
556 | 556 | ||
557 | obj->has_global_gtt_mapping = 1; | 557 | obj->has_global_gtt_mapping = 1; |
@@ -563,7 +563,7 @@ void i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj) | |||
563 | struct drm_i915_private *dev_priv = dev->dev_private; | 563 | struct drm_i915_private *dev_priv = dev->dev_private; |
564 | 564 | ||
565 | dev_priv->gtt.gtt_clear_range(obj->base.dev, | 565 | dev_priv->gtt.gtt_clear_range(obj->base.dev, |
566 | obj->gtt_space->start >> PAGE_SHIFT, | 566 | i915_gem_obj_ggtt_offset(obj) >> PAGE_SHIFT, |
567 | obj->base.size >> PAGE_SHIFT); | 567 | obj->base.size >> PAGE_SHIFT); |
568 | 568 | ||
569 | obj->has_global_gtt_mapping = 0; | 569 | obj->has_global_gtt_mapping = 0; |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 537545be69db..92a8d279ca39 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -268,18 +268,18 @@ i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode) | |||
268 | return true; | 268 | return true; |
269 | 269 | ||
270 | if (INTEL_INFO(obj->base.dev)->gen == 3) { | 270 | if (INTEL_INFO(obj->base.dev)->gen == 3) { |
271 | if (obj->gtt_offset & ~I915_FENCE_START_MASK) | 271 | if (i915_gem_obj_ggtt_offset(obj) & ~I915_FENCE_START_MASK) |
272 | return false; | 272 | return false; |
273 | } else { | 273 | } else { |
274 | if (obj->gtt_offset & ~I830_FENCE_START_MASK) | 274 | if (i915_gem_obj_ggtt_offset(obj) & ~I830_FENCE_START_MASK) |
275 | return false; | 275 | return false; |
276 | } | 276 | } |
277 | 277 | ||
278 | size = i915_gem_get_gtt_size(obj->base.dev, obj->base.size, tiling_mode); | 278 | size = i915_gem_get_gtt_size(obj->base.dev, obj->base.size, tiling_mode); |
279 | if (obj->gtt_space->size != size) | 279 | if (i915_gem_obj_ggtt_size(obj) != size) |
280 | return false; | 280 | return false; |
281 | 281 | ||
282 | if (obj->gtt_offset & (size - 1)) | 282 | if (i915_gem_obj_ggtt_offset(obj) & (size - 1)) |
283 | return false; | 283 | return false; |
284 | 284 | ||
285 | return true; | 285 | return true; |
@@ -359,8 +359,8 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
359 | */ | 359 | */ |
360 | 360 | ||
361 | obj->map_and_fenceable = | 361 | obj->map_and_fenceable = |
362 | obj->gtt_space == NULL || | 362 | !i915_gem_obj_ggtt_bound(obj) || |
363 | (obj->gtt_offset + obj->base.size <= dev_priv->gtt.mappable_end && | 363 | (i915_gem_obj_ggtt_offset(obj) + obj->base.size <= dev_priv->gtt.mappable_end && |
364 | i915_gem_object_fence_ok(obj, args->tiling_mode)); | 364 | i915_gem_object_fence_ok(obj, args->tiling_mode)); |
365 | 365 | ||
366 | /* Rebind if we need a change of alignment */ | 366 | /* Rebind if we need a change of alignment */ |
@@ -369,7 +369,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
369 | i915_gem_get_gtt_alignment(dev, obj->base.size, | 369 | i915_gem_get_gtt_alignment(dev, obj->base.size, |
370 | args->tiling_mode, | 370 | args->tiling_mode, |
371 | false); | 371 | false); |
372 | if (obj->gtt_offset & (unfenced_alignment - 1)) | 372 | if (i915_gem_obj_ggtt_offset(obj) & (unfenced_alignment - 1)) |
373 | ret = i915_gem_object_unbind(obj); | 373 | ret = i915_gem_object_unbind(obj); |
374 | } | 374 | } |
375 | 375 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index c2e11a0fa40c..4aedd387c8b5 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1520,7 +1520,7 @@ i915_error_object_create_sized(struct drm_i915_private *dev_priv, | |||
1520 | if (dst == NULL) | 1520 | if (dst == NULL) |
1521 | return NULL; | 1521 | return NULL; |
1522 | 1522 | ||
1523 | reloc_offset = src->gtt_offset; | 1523 | reloc_offset = dst->gtt_offset = i915_gem_obj_ggtt_offset(src); |
1524 | for (i = 0; i < num_pages; i++) { | 1524 | for (i = 0; i < num_pages; i++) { |
1525 | unsigned long flags; | 1525 | unsigned long flags; |
1526 | void *d; | 1526 | void *d; |
@@ -1572,7 +1572,6 @@ i915_error_object_create_sized(struct drm_i915_private *dev_priv, | |||
1572 | reloc_offset += PAGE_SIZE; | 1572 | reloc_offset += PAGE_SIZE; |
1573 | } | 1573 | } |
1574 | dst->page_count = num_pages; | 1574 | dst->page_count = num_pages; |
1575 | dst->gtt_offset = src->gtt_offset; | ||
1576 | 1575 | ||
1577 | return dst; | 1576 | return dst; |
1578 | 1577 | ||
@@ -1626,7 +1625,7 @@ static void capture_bo(struct drm_i915_error_buffer *err, | |||
1626 | err->name = obj->base.name; | 1625 | err->name = obj->base.name; |
1627 | err->rseqno = obj->last_read_seqno; | 1626 | err->rseqno = obj->last_read_seqno; |
1628 | err->wseqno = obj->last_write_seqno; | 1627 | err->wseqno = obj->last_write_seqno; |
1629 | err->gtt_offset = obj->gtt_offset; | 1628 | err->gtt_offset = i915_gem_obj_ggtt_offset(obj); |
1630 | err->read_domains = obj->base.read_domains; | 1629 | err->read_domains = obj->base.read_domains; |
1631 | err->write_domain = obj->base.write_domain; | 1630 | err->write_domain = obj->base.write_domain; |
1632 | err->fence_reg = obj->fence_reg; | 1631 | err->fence_reg = obj->fence_reg; |
@@ -1724,8 +1723,8 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv, | |||
1724 | return NULL; | 1723 | return NULL; |
1725 | 1724 | ||
1726 | obj = ring->private; | 1725 | obj = ring->private; |
1727 | if (acthd >= obj->gtt_offset && | 1726 | if (acthd >= i915_gem_obj_ggtt_offset(obj) && |
1728 | acthd < obj->gtt_offset + obj->base.size) | 1727 | acthd < i915_gem_obj_ggtt_offset(obj) + obj->base.size) |
1729 | return i915_error_object_create(dev_priv, obj); | 1728 | return i915_error_object_create(dev_priv, obj); |
1730 | } | 1729 | } |
1731 | 1730 | ||
@@ -1806,7 +1805,7 @@ static void i915_gem_record_active_context(struct intel_ring_buffer *ring, | |||
1806 | return; | 1805 | return; |
1807 | 1806 | ||
1808 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { | 1807 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { |
1809 | if ((error->ccid & PAGE_MASK) == obj->gtt_offset) { | 1808 | if ((error->ccid & PAGE_MASK) == i915_gem_obj_ggtt_offset(obj)) { |
1810 | ering->ctx = i915_error_object_create_sized(dev_priv, | 1809 | ering->ctx = i915_error_object_create_sized(dev_priv, |
1811 | obj, 1); | 1810 | obj, 1); |
1812 | break; | 1811 | break; |
@@ -2160,10 +2159,10 @@ static void __always_unused i915_pageflip_stall_check(struct drm_device *dev, in | |||
2160 | if (INTEL_INFO(dev)->gen >= 4) { | 2159 | if (INTEL_INFO(dev)->gen >= 4) { |
2161 | int dspsurf = DSPSURF(intel_crtc->plane); | 2160 | int dspsurf = DSPSURF(intel_crtc->plane); |
2162 | stall_detected = I915_HI_DISPBASE(I915_READ(dspsurf)) == | 2161 | stall_detected = I915_HI_DISPBASE(I915_READ(dspsurf)) == |
2163 | obj->gtt_offset; | 2162 | i915_gem_obj_ggtt_offset(obj); |
2164 | } else { | 2163 | } else { |
2165 | int dspaddr = DSPADDR(intel_crtc->plane); | 2164 | int dspaddr = DSPADDR(intel_crtc->plane); |
2166 | stall_detected = I915_READ(dspaddr) == (obj->gtt_offset + | 2165 | stall_detected = I915_READ(dspaddr) == (i915_gem_obj_ggtt_offset(obj) + |
2167 | crtc->y * crtc->fb->pitches[0] + | 2166 | crtc->y * crtc->fb->pitches[0] + |
2168 | crtc->x * crtc->fb->bits_per_pixel/8); | 2167 | crtc->x * crtc->fb->bits_per_pixel/8); |
2169 | } | 2168 | } |
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index 3db4a6817713..7d283b5fcbf9 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h | |||
@@ -46,8 +46,8 @@ TRACE_EVENT(i915_gem_object_bind, | |||
46 | 46 | ||
47 | TP_fast_assign( | 47 | TP_fast_assign( |
48 | __entry->obj = obj; | 48 | __entry->obj = obj; |
49 | __entry->offset = obj->gtt_space->start; | 49 | __entry->offset = i915_gem_obj_ggtt_offset(obj); |
50 | __entry->size = obj->gtt_space->size; | 50 | __entry->size = i915_gem_obj_ggtt_size(obj); |
51 | __entry->mappable = mappable; | 51 | __entry->mappable = mappable; |
52 | ), | 52 | ), |
53 | 53 | ||
@@ -68,8 +68,8 @@ TRACE_EVENT(i915_gem_object_unbind, | |||
68 | 68 | ||
69 | TP_fast_assign( | 69 | TP_fast_assign( |
70 | __entry->obj = obj; | 70 | __entry->obj = obj; |
71 | __entry->offset = obj->gtt_space->start; | 71 | __entry->offset = i915_gem_obj_ggtt_offset(obj); |
72 | __entry->size = obj->gtt_space->size; | 72 | __entry->size = i915_gem_obj_ggtt_size(obj); |
73 | ), | 73 | ), |
74 | 74 | ||
75 | TP_printk("obj=%p, offset=%08x size=%x", | 75 | TP_printk("obj=%p, offset=%08x size=%x", |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index aaa9a752b7b6..a45bb92f35ad 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1980,16 +1980,17 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
1980 | intel_crtc->dspaddr_offset = linear_offset; | 1980 | intel_crtc->dspaddr_offset = linear_offset; |
1981 | } | 1981 | } |
1982 | 1982 | ||
1983 | DRM_DEBUG_KMS("Writing base %08X %08lX %d %d %d\n", | 1983 | DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", |
1984 | obj->gtt_offset, linear_offset, x, y, fb->pitches[0]); | 1984 | i915_gem_obj_ggtt_offset(obj), linear_offset, x, y, |
1985 | fb->pitches[0]); | ||
1985 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); | 1986 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); |
1986 | if (INTEL_INFO(dev)->gen >= 4) { | 1987 | if (INTEL_INFO(dev)->gen >= 4) { |
1987 | I915_MODIFY_DISPBASE(DSPSURF(plane), | 1988 | I915_MODIFY_DISPBASE(DSPSURF(plane), |
1988 | obj->gtt_offset + intel_crtc->dspaddr_offset); | 1989 | i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); |
1989 | I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); | 1990 | I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); |
1990 | I915_WRITE(DSPLINOFF(plane), linear_offset); | 1991 | I915_WRITE(DSPLINOFF(plane), linear_offset); |
1991 | } else | 1992 | } else |
1992 | I915_WRITE(DSPADDR(plane), obj->gtt_offset + linear_offset); | 1993 | I915_WRITE(DSPADDR(plane), i915_gem_obj_ggtt_offset(obj) + linear_offset); |
1993 | POSTING_READ(reg); | 1994 | POSTING_READ(reg); |
1994 | 1995 | ||
1995 | return 0; | 1996 | return 0; |
@@ -2069,11 +2070,12 @@ static int ironlake_update_plane(struct drm_crtc *crtc, | |||
2069 | fb->pitches[0]); | 2070 | fb->pitches[0]); |
2070 | linear_offset -= intel_crtc->dspaddr_offset; | 2071 | linear_offset -= intel_crtc->dspaddr_offset; |
2071 | 2072 | ||
2072 | DRM_DEBUG_KMS("Writing base %08X %08lX %d %d %d\n", | 2073 | DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", |
2073 | obj->gtt_offset, linear_offset, x, y, fb->pitches[0]); | 2074 | i915_gem_obj_ggtt_offset(obj), linear_offset, x, y, |
2075 | fb->pitches[0]); | ||
2074 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); | 2076 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); |
2075 | I915_MODIFY_DISPBASE(DSPSURF(plane), | 2077 | I915_MODIFY_DISPBASE(DSPSURF(plane), |
2076 | obj->gtt_offset + intel_crtc->dspaddr_offset); | 2078 | i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); |
2077 | if (IS_HASWELL(dev)) { | 2079 | if (IS_HASWELL(dev)) { |
2078 | I915_WRITE(DSPOFFSET(plane), (y << 16) | x); | 2080 | I915_WRITE(DSPOFFSET(plane), (y << 16) | x); |
2079 | } else { | 2081 | } else { |
@@ -6567,7 +6569,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
6567 | goto fail_unpin; | 6569 | goto fail_unpin; |
6568 | } | 6570 | } |
6569 | 6571 | ||
6570 | addr = obj->gtt_offset; | 6572 | addr = i915_gem_obj_ggtt_offset(obj); |
6571 | } else { | 6573 | } else { |
6572 | int align = IS_I830(dev) ? 16 * 1024 : 256; | 6574 | int align = IS_I830(dev) ? 16 * 1024 : 256; |
6573 | ret = i915_gem_attach_phys_object(dev, obj, | 6575 | ret = i915_gem_attach_phys_object(dev, obj, |
@@ -7339,7 +7341,7 @@ static int intel_gen2_queue_flip(struct drm_device *dev, | |||
7339 | intel_ring_emit(ring, MI_DISPLAY_FLIP | | 7341 | intel_ring_emit(ring, MI_DISPLAY_FLIP | |
7340 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 7342 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
7341 | intel_ring_emit(ring, fb->pitches[0]); | 7343 | intel_ring_emit(ring, fb->pitches[0]); |
7342 | intel_ring_emit(ring, obj->gtt_offset + intel_crtc->dspaddr_offset); | 7344 | intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); |
7343 | intel_ring_emit(ring, 0); /* aux display base address, unused */ | 7345 | intel_ring_emit(ring, 0); /* aux display base address, unused */ |
7344 | 7346 | ||
7345 | intel_mark_page_flip_active(intel_crtc); | 7347 | intel_mark_page_flip_active(intel_crtc); |
@@ -7380,7 +7382,7 @@ static int intel_gen3_queue_flip(struct drm_device *dev, | |||
7380 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | | 7382 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | |
7381 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 7383 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
7382 | intel_ring_emit(ring, fb->pitches[0]); | 7384 | intel_ring_emit(ring, fb->pitches[0]); |
7383 | intel_ring_emit(ring, obj->gtt_offset + intel_crtc->dspaddr_offset); | 7385 | intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); |
7384 | intel_ring_emit(ring, MI_NOOP); | 7386 | intel_ring_emit(ring, MI_NOOP); |
7385 | 7387 | ||
7386 | intel_mark_page_flip_active(intel_crtc); | 7388 | intel_mark_page_flip_active(intel_crtc); |
@@ -7420,7 +7422,7 @@ static int intel_gen4_queue_flip(struct drm_device *dev, | |||
7420 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 7422 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
7421 | intel_ring_emit(ring, fb->pitches[0]); | 7423 | intel_ring_emit(ring, fb->pitches[0]); |
7422 | intel_ring_emit(ring, | 7424 | intel_ring_emit(ring, |
7423 | (obj->gtt_offset + intel_crtc->dspaddr_offset) | | 7425 | (i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset) | |
7424 | obj->tiling_mode); | 7426 | obj->tiling_mode); |
7425 | 7427 | ||
7426 | /* XXX Enabling the panel-fitter across page-flip is so far | 7428 | /* XXX Enabling the panel-fitter across page-flip is so far |
@@ -7463,7 +7465,7 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
7463 | intel_ring_emit(ring, MI_DISPLAY_FLIP | | 7465 | intel_ring_emit(ring, MI_DISPLAY_FLIP | |
7464 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 7466 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
7465 | intel_ring_emit(ring, fb->pitches[0] | obj->tiling_mode); | 7467 | intel_ring_emit(ring, fb->pitches[0] | obj->tiling_mode); |
7466 | intel_ring_emit(ring, obj->gtt_offset + intel_crtc->dspaddr_offset); | 7468 | intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); |
7467 | 7469 | ||
7468 | /* Contrary to the suggestions in the documentation, | 7470 | /* Contrary to the suggestions in the documentation, |
7469 | * "Enable Panel Fitter" does not seem to be required when page | 7471 | * "Enable Panel Fitter" does not seem to be required when page |
@@ -7528,7 +7530,7 @@ static int intel_gen7_queue_flip(struct drm_device *dev, | |||
7528 | 7530 | ||
7529 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); | 7531 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); |
7530 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); | 7532 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); |
7531 | intel_ring_emit(ring, obj->gtt_offset + intel_crtc->dspaddr_offset); | 7533 | intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); |
7532 | intel_ring_emit(ring, (MI_NOOP)); | 7534 | intel_ring_emit(ring, (MI_NOOP)); |
7533 | 7535 | ||
7534 | intel_mark_page_flip_active(intel_crtc); | 7536 | intel_mark_page_flip_active(intel_crtc); |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index dff669e2387f..f3c97e05b0d8 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -139,11 +139,11 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
139 | info->apertures->ranges[0].base = dev->mode_config.fb_base; | 139 | info->apertures->ranges[0].base = dev->mode_config.fb_base; |
140 | info->apertures->ranges[0].size = dev_priv->gtt.mappable_end; | 140 | info->apertures->ranges[0].size = dev_priv->gtt.mappable_end; |
141 | 141 | ||
142 | info->fix.smem_start = dev->mode_config.fb_base + obj->gtt_offset; | 142 | info->fix.smem_start = dev->mode_config.fb_base + i915_gem_obj_ggtt_offset(obj); |
143 | info->fix.smem_len = size; | 143 | info->fix.smem_len = size; |
144 | 144 | ||
145 | info->screen_base = | 145 | info->screen_base = |
146 | ioremap_wc(dev_priv->gtt.mappable_base + obj->gtt_offset, | 146 | ioremap_wc(dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj), |
147 | size); | 147 | size); |
148 | if (!info->screen_base) { | 148 | if (!info->screen_base) { |
149 | ret = -ENOSPC; | 149 | ret = -ENOSPC; |
@@ -166,9 +166,9 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
166 | 166 | ||
167 | /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ | 167 | /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ |
168 | 168 | ||
169 | DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08x, bo %p\n", | 169 | DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08lx, bo %p\n", |
170 | fb->width, fb->height, | 170 | fb->width, fb->height, |
171 | obj->gtt_offset, obj); | 171 | i915_gem_obj_ggtt_offset(obj), obj); |
172 | 172 | ||
173 | 173 | ||
174 | mutex_unlock(&dev->struct_mutex); | 174 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index a3698812e9c7..81c3ca14fa92 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -196,7 +196,7 @@ intel_overlay_map_regs(struct intel_overlay *overlay) | |||
196 | regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_obj->handle->vaddr; | 196 | regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_obj->handle->vaddr; |
197 | else | 197 | else |
198 | regs = io_mapping_map_wc(dev_priv->gtt.mappable, | 198 | regs = io_mapping_map_wc(dev_priv->gtt.mappable, |
199 | overlay->reg_bo->gtt_offset); | 199 | i915_gem_obj_ggtt_offset(overlay->reg_bo)); |
200 | 200 | ||
201 | return regs; | 201 | return regs; |
202 | } | 202 | } |
@@ -740,7 +740,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, | |||
740 | swidth = params->src_w; | 740 | swidth = params->src_w; |
741 | swidthsw = calc_swidthsw(overlay->dev, params->offset_Y, tmp_width); | 741 | swidthsw = calc_swidthsw(overlay->dev, params->offset_Y, tmp_width); |
742 | sheight = params->src_h; | 742 | sheight = params->src_h; |
743 | iowrite32(new_bo->gtt_offset + params->offset_Y, ®s->OBUF_0Y); | 743 | iowrite32(i915_gem_obj_ggtt_offset(new_bo) + params->offset_Y, ®s->OBUF_0Y); |
744 | ostride = params->stride_Y; | 744 | ostride = params->stride_Y; |
745 | 745 | ||
746 | if (params->format & I915_OVERLAY_YUV_PLANAR) { | 746 | if (params->format & I915_OVERLAY_YUV_PLANAR) { |
@@ -754,8 +754,8 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, | |||
754 | params->src_w/uv_hscale); | 754 | params->src_w/uv_hscale); |
755 | swidthsw |= max_t(u32, tmp_U, tmp_V) << 16; | 755 | swidthsw |= max_t(u32, tmp_U, tmp_V) << 16; |
756 | sheight |= (params->src_h/uv_vscale) << 16; | 756 | sheight |= (params->src_h/uv_vscale) << 16; |
757 | iowrite32(new_bo->gtt_offset + params->offset_U, ®s->OBUF_0U); | 757 | iowrite32(i915_gem_obj_ggtt_offset(new_bo) + params->offset_U, ®s->OBUF_0U); |
758 | iowrite32(new_bo->gtt_offset + params->offset_V, ®s->OBUF_0V); | 758 | iowrite32(i915_gem_obj_ggtt_offset(new_bo) + params->offset_V, ®s->OBUF_0V); |
759 | ostride |= params->stride_UV << 16; | 759 | ostride |= params->stride_UV << 16; |
760 | } | 760 | } |
761 | 761 | ||
@@ -1355,7 +1355,7 @@ void intel_setup_overlay(struct drm_device *dev) | |||
1355 | DRM_ERROR("failed to pin overlay register bo\n"); | 1355 | DRM_ERROR("failed to pin overlay register bo\n"); |
1356 | goto out_free_bo; | 1356 | goto out_free_bo; |
1357 | } | 1357 | } |
1358 | overlay->flip_addr = reg_bo->gtt_offset; | 1358 | overlay->flip_addr = i915_gem_obj_ggtt_offset(reg_bo); |
1359 | 1359 | ||
1360 | ret = i915_gem_object_set_to_gtt_domain(reg_bo, true); | 1360 | ret = i915_gem_object_set_to_gtt_domain(reg_bo, true); |
1361 | if (ret) { | 1361 | if (ret) { |
@@ -1435,7 +1435,7 @@ intel_overlay_map_regs_atomic(struct intel_overlay *overlay) | |||
1435 | overlay->reg_bo->phys_obj->handle->vaddr; | 1435 | overlay->reg_bo->phys_obj->handle->vaddr; |
1436 | else | 1436 | else |
1437 | regs = io_mapping_map_atomic_wc(dev_priv->gtt.mappable, | 1437 | regs = io_mapping_map_atomic_wc(dev_priv->gtt.mappable, |
1438 | overlay->reg_bo->gtt_offset); | 1438 | i915_gem_obj_ggtt_offset(overlay->reg_bo)); |
1439 | 1439 | ||
1440 | return regs; | 1440 | return regs; |
1441 | } | 1441 | } |
@@ -1468,7 +1468,7 @@ intel_overlay_capture_error_state(struct drm_device *dev) | |||
1468 | if (OVERLAY_NEEDS_PHYSICAL(overlay->dev)) | 1468 | if (OVERLAY_NEEDS_PHYSICAL(overlay->dev)) |
1469 | error->base = (__force long)overlay->reg_bo->phys_obj->handle->vaddr; | 1469 | error->base = (__force long)overlay->reg_bo->phys_obj->handle->vaddr; |
1470 | else | 1470 | else |
1471 | error->base = overlay->reg_bo->gtt_offset; | 1471 | error->base = i915_gem_obj_ggtt_offset(overlay->reg_bo); |
1472 | 1472 | ||
1473 | regs = intel_overlay_map_regs_atomic(overlay); | 1473 | regs = intel_overlay_map_regs_atomic(overlay); |
1474 | if (!regs) | 1474 | if (!regs) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 0eed35da3ea5..125a741eed86 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -218,7 +218,7 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) | |||
218 | (stall_watermark << DPFC_RECOMP_STALL_WM_SHIFT) | | 218 | (stall_watermark << DPFC_RECOMP_STALL_WM_SHIFT) | |
219 | (interval << DPFC_RECOMP_TIMER_COUNT_SHIFT)); | 219 | (interval << DPFC_RECOMP_TIMER_COUNT_SHIFT)); |
220 | I915_WRITE(ILK_DPFC_FENCE_YOFF, crtc->y); | 220 | I915_WRITE(ILK_DPFC_FENCE_YOFF, crtc->y); |
221 | I915_WRITE(ILK_FBC_RT_BASE, obj->gtt_offset | ILK_FBC_RT_VALID); | 221 | I915_WRITE(ILK_FBC_RT_BASE, i915_gem_obj_ggtt_offset(obj) | ILK_FBC_RT_VALID); |
222 | /* enable it... */ | 222 | /* enable it... */ |
223 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); | 223 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); |
224 | 224 | ||
@@ -275,7 +275,7 @@ static void gen7_enable_fbc(struct drm_crtc *crtc, unsigned long interval) | |||
275 | struct drm_i915_gem_object *obj = intel_fb->obj; | 275 | struct drm_i915_gem_object *obj = intel_fb->obj; |
276 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 276 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
277 | 277 | ||
278 | I915_WRITE(IVB_FBC_RT_BASE, obj->gtt_offset); | 278 | I915_WRITE(IVB_FBC_RT_BASE, i915_gem_obj_ggtt_offset(obj)); |
279 | 279 | ||
280 | I915_WRITE(ILK_DPFC_CONTROL, DPFC_CTL_EN | DPFC_CTL_LIMIT_1X | | 280 | I915_WRITE(ILK_DPFC_CONTROL, DPFC_CTL_EN | DPFC_CTL_LIMIT_1X | |
281 | IVB_DPFC_CTL_FENCE_EN | | 281 | IVB_DPFC_CTL_FENCE_EN | |
@@ -3700,7 +3700,7 @@ static void ironlake_enable_rc6(struct drm_device *dev) | |||
3700 | 3700 | ||
3701 | intel_ring_emit(ring, MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN); | 3701 | intel_ring_emit(ring, MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN); |
3702 | intel_ring_emit(ring, MI_SET_CONTEXT); | 3702 | intel_ring_emit(ring, MI_SET_CONTEXT); |
3703 | intel_ring_emit(ring, dev_priv->ips.renderctx->gtt_offset | | 3703 | intel_ring_emit(ring, i915_gem_obj_ggtt_offset(dev_priv->ips.renderctx) | |
3704 | MI_MM_SPACE_GTT | | 3704 | MI_MM_SPACE_GTT | |
3705 | MI_SAVE_EXT_STATE_EN | | 3705 | MI_SAVE_EXT_STATE_EN | |
3706 | MI_RESTORE_EXT_STATE_EN | | 3706 | MI_RESTORE_EXT_STATE_EN | |
@@ -3723,7 +3723,7 @@ static void ironlake_enable_rc6(struct drm_device *dev) | |||
3723 | return; | 3723 | return; |
3724 | } | 3724 | } |
3725 | 3725 | ||
3726 | I915_WRITE(PWRCTXA, dev_priv->ips.pwrctx->gtt_offset | PWRCTX_EN); | 3726 | I915_WRITE(PWRCTXA, i915_gem_obj_ggtt_offset(dev_priv->ips.pwrctx) | PWRCTX_EN); |
3727 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) & ~RCX_SW_EXIT); | 3727 | I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) & ~RCX_SW_EXIT); |
3728 | } | 3728 | } |
3729 | 3729 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index e51ab552046c..54495df2403e 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -424,14 +424,14 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
424 | * registers with the above sequence (the readback of the HEAD registers | 424 | * registers with the above sequence (the readback of the HEAD registers |
425 | * also enforces ordering), otherwise the hw might lose the new ring | 425 | * also enforces ordering), otherwise the hw might lose the new ring |
426 | * register values. */ | 426 | * register values. */ |
427 | I915_WRITE_START(ring, obj->gtt_offset); | 427 | I915_WRITE_START(ring, i915_gem_obj_ggtt_offset(obj)); |
428 | I915_WRITE_CTL(ring, | 428 | I915_WRITE_CTL(ring, |
429 | ((ring->size - PAGE_SIZE) & RING_NR_PAGES) | 429 | ((ring->size - PAGE_SIZE) & RING_NR_PAGES) |
430 | | RING_VALID); | 430 | | RING_VALID); |
431 | 431 | ||
432 | /* If the head is still not zero, the ring is dead */ | 432 | /* If the head is still not zero, the ring is dead */ |
433 | if (wait_for((I915_READ_CTL(ring) & RING_VALID) != 0 && | 433 | if (wait_for((I915_READ_CTL(ring) & RING_VALID) != 0 && |
434 | I915_READ_START(ring) == obj->gtt_offset && | 434 | I915_READ_START(ring) == i915_gem_obj_ggtt_offset(obj) && |
435 | (I915_READ_HEAD(ring) & HEAD_ADDR) == 0, 50)) { | 435 | (I915_READ_HEAD(ring) & HEAD_ADDR) == 0, 50)) { |
436 | DRM_ERROR("%s initialization failed " | 436 | DRM_ERROR("%s initialization failed " |
437 | "ctl %08x head %08x tail %08x start %08x\n", | 437 | "ctl %08x head %08x tail %08x start %08x\n", |
@@ -489,7 +489,7 @@ init_pipe_control(struct intel_ring_buffer *ring) | |||
489 | if (ret) | 489 | if (ret) |
490 | goto err_unref; | 490 | goto err_unref; |
491 | 491 | ||
492 | pc->gtt_offset = obj->gtt_offset; | 492 | pc->gtt_offset = i915_gem_obj_ggtt_offset(obj); |
493 | pc->cpu_page = kmap(sg_page(obj->pages->sgl)); | 493 | pc->cpu_page = kmap(sg_page(obj->pages->sgl)); |
494 | if (pc->cpu_page == NULL) { | 494 | if (pc->cpu_page == NULL) { |
495 | ret = -ENOMEM; | 495 | ret = -ENOMEM; |
@@ -1129,7 +1129,7 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring, | |||
1129 | intel_ring_advance(ring); | 1129 | intel_ring_advance(ring); |
1130 | } else { | 1130 | } else { |
1131 | struct drm_i915_gem_object *obj = ring->private; | 1131 | struct drm_i915_gem_object *obj = ring->private; |
1132 | u32 cs_offset = obj->gtt_offset; | 1132 | u32 cs_offset = i915_gem_obj_ggtt_offset(obj); |
1133 | 1133 | ||
1134 | if (len > I830_BATCH_LIMIT) | 1134 | if (len > I830_BATCH_LIMIT) |
1135 | return -ENOSPC; | 1135 | return -ENOSPC; |
@@ -1214,7 +1214,7 @@ static int init_status_page(struct intel_ring_buffer *ring) | |||
1214 | goto err_unref; | 1214 | goto err_unref; |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | ring->status_page.gfx_addr = obj->gtt_offset; | 1217 | ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(obj); |
1218 | ring->status_page.page_addr = kmap(sg_page(obj->pages->sgl)); | 1218 | ring->status_page.page_addr = kmap(sg_page(obj->pages->sgl)); |
1219 | if (ring->status_page.page_addr == NULL) { | 1219 | if (ring->status_page.page_addr == NULL) { |
1220 | ret = -ENOMEM; | 1220 | ret = -ENOMEM; |
@@ -1308,7 +1308,7 @@ static int intel_init_ring_buffer(struct drm_device *dev, | |||
1308 | goto err_unpin; | 1308 | goto err_unpin; |
1309 | 1309 | ||
1310 | ring->virtual_start = | 1310 | ring->virtual_start = |
1311 | ioremap_wc(dev_priv->gtt.mappable_base + obj->gtt_offset, | 1311 | ioremap_wc(dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj), |
1312 | ring->size); | 1312 | ring->size); |
1313 | if (ring->virtual_start == NULL) { | 1313 | if (ring->virtual_start == NULL) { |
1314 | DRM_ERROR("Failed to map ringbuffer.\n"); | 1314 | DRM_ERROR("Failed to map ringbuffer.\n"); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 1fa5612a4572..55bdf70b548b 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -133,7 +133,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_framebuffer *fb, | |||
133 | 133 | ||
134 | I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); | 134 | I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); |
135 | I915_WRITE(SPCNTR(pipe, plane), sprctl); | 135 | I915_WRITE(SPCNTR(pipe, plane), sprctl); |
136 | I915_MODIFY_DISPBASE(SPSURF(pipe, plane), obj->gtt_offset + | 136 | I915_MODIFY_DISPBASE(SPSURF(pipe, plane), i915_gem_obj_ggtt_offset(obj) + |
137 | sprsurf_offset); | 137 | sprsurf_offset); |
138 | POSTING_READ(SPSURF(pipe, plane)); | 138 | POSTING_READ(SPSURF(pipe, plane)); |
139 | } | 139 | } |
@@ -308,7 +308,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, | |||
308 | if (intel_plane->can_scale) | 308 | if (intel_plane->can_scale) |
309 | I915_WRITE(SPRSCALE(pipe), sprscale); | 309 | I915_WRITE(SPRSCALE(pipe), sprscale); |
310 | I915_WRITE(SPRCTL(pipe), sprctl); | 310 | I915_WRITE(SPRCTL(pipe), sprctl); |
311 | I915_MODIFY_DISPBASE(SPRSURF(pipe), obj->gtt_offset + sprsurf_offset); | 311 | I915_MODIFY_DISPBASE(SPRSURF(pipe), |
312 | i915_gem_obj_ggtt_offset(obj) + sprsurf_offset); | ||
312 | POSTING_READ(SPRSURF(pipe)); | 313 | POSTING_READ(SPRSURF(pipe)); |
313 | 314 | ||
314 | /* potentially re-enable LP watermarks */ | 315 | /* potentially re-enable LP watermarks */ |
@@ -478,7 +479,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, | |||
478 | I915_WRITE(DVSSIZE(pipe), (crtc_h << 16) | crtc_w); | 479 | I915_WRITE(DVSSIZE(pipe), (crtc_h << 16) | crtc_w); |
479 | I915_WRITE(DVSSCALE(pipe), dvsscale); | 480 | I915_WRITE(DVSSCALE(pipe), dvsscale); |
480 | I915_WRITE(DVSCNTR(pipe), dvscntr); | 481 | I915_WRITE(DVSCNTR(pipe), dvscntr); |
481 | I915_MODIFY_DISPBASE(DVSSURF(pipe), obj->gtt_offset + dvssurf_offset); | 482 | I915_MODIFY_DISPBASE(DVSSURF(pipe), |
483 | i915_gem_obj_ggtt_offset(obj) + dvssurf_offset); | ||
482 | POSTING_READ(DVSSURF(pipe)); | 484 | POSTING_READ(DVSSURF(pipe)); |
483 | } | 485 | } |
484 | 486 | ||