aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-03-08 07:35:02 -0500
committerEric Anholt <eric@anholt.net>2010-03-25 14:06:17 -0400
commit23010e43b353c2cdc9725cbedc7e364708039bf7 (patch)
treec0615881eabefb7b26a7f7dba23a5e00ea5a2398 /drivers
parent8d06a1e1e9c69244f08beb7d17146483f9dcd120 (diff)
drm/i915: introduce to_intel_bo helper
This is a purely cosmetic change to make changes in this area easier. And hey, it's not only clearer and typechecked, but actually shorter, too! [anholt: To clarify, this is a change to let us later make drm_i915_gem_object subclass drm_gem_object, instead of having drm_gem_object have a pointer to i915's private data] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Dave Airlie <airlied@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c132
-rw-r--r--drivers/gpu/drm/i915/i915_gem_debug.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c10
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c28
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c2
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c6
10 files changed, 96 insertions, 94 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 1376dfe44c95..bb3a4a8aba08 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -225,7 +225,7 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
225 } else { 225 } else {
226 struct drm_i915_gem_object *obj_priv; 226 struct drm_i915_gem_object *obj_priv;
227 227
228 obj_priv = obj->driver_private; 228 obj_priv = to_intel_bo(obj);
229 seq_printf(m, "Fenced object[%2d] = %p: %s " 229 seq_printf(m, "Fenced object[%2d] = %p: %s "
230 "%08x %08zx %08x %s %08x %08x %d", 230 "%08x %08zx %08x %s %08x %08x %d",
231 i, obj, get_pin_flag(obj_priv), 231 i, obj, get_pin_flag(obj_priv),
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 1a39ec75d76b..0af3dcc85ce9 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -361,7 +361,7 @@ int i965_reset(struct drm_device *dev, u8 flags)
361 !dev_priv->mm.suspended) { 361 !dev_priv->mm.suspended) {
362 drm_i915_ring_buffer_t *ring = &dev_priv->ring; 362 drm_i915_ring_buffer_t *ring = &dev_priv->ring;
363 struct drm_gem_object *obj = ring->ring_obj; 363 struct drm_gem_object *obj = ring->ring_obj;
364 struct drm_i915_gem_object *obj_priv = obj->driver_private; 364 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
365 dev_priv->mm.suspended = 0; 365 dev_priv->mm.suspended = 0;
366 366
367 /* Stop the ring if it's running. */ 367 /* Stop the ring if it's running. */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index aba8260fbc5e..b7cb4aadd059 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -731,6 +731,8 @@ struct drm_i915_gem_object {
731 atomic_t pending_flip; 731 atomic_t pending_flip;
732}; 732};
733 733
734#define to_intel_bo(x) ((struct drm_i915_gem_object *) (x)->driver_private)
735
734/** 736/**
735 * Request queue structure. 737 * Request queue structure.
736 * 738 *
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 933e865a8929..b85727ce308e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -162,7 +162,7 @@ fast_shmem_read(struct page **pages,
162static int i915_gem_object_needs_bit17_swizzle(struct drm_gem_object *obj) 162static int i915_gem_object_needs_bit17_swizzle(struct drm_gem_object *obj)
163{ 163{
164 drm_i915_private_t *dev_priv = obj->dev->dev_private; 164 drm_i915_private_t *dev_priv = obj->dev->dev_private;
165 struct drm_i915_gem_object *obj_priv = obj->driver_private; 165 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
166 166
167 return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 && 167 return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 &&
168 obj_priv->tiling_mode != I915_TILING_NONE; 168 obj_priv->tiling_mode != I915_TILING_NONE;
@@ -263,7 +263,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj,
263 struct drm_i915_gem_pread *args, 263 struct drm_i915_gem_pread *args,
264 struct drm_file *file_priv) 264 struct drm_file *file_priv)
265{ 265{
266 struct drm_i915_gem_object *obj_priv = obj->driver_private; 266 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
267 ssize_t remain; 267 ssize_t remain;
268 loff_t offset, page_base; 268 loff_t offset, page_base;
269 char __user *user_data; 269 char __user *user_data;
@@ -284,7 +284,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj,
284 if (ret != 0) 284 if (ret != 0)
285 goto fail_put_pages; 285 goto fail_put_pages;
286 286
287 obj_priv = obj->driver_private; 287 obj_priv = to_intel_bo(obj);
288 offset = args->offset; 288 offset = args->offset;
289 289
290 while (remain > 0) { 290 while (remain > 0) {
@@ -353,7 +353,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj,
353 struct drm_i915_gem_pread *args, 353 struct drm_i915_gem_pread *args,
354 struct drm_file *file_priv) 354 struct drm_file *file_priv)
355{ 355{
356 struct drm_i915_gem_object *obj_priv = obj->driver_private; 356 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
357 struct mm_struct *mm = current->mm; 357 struct mm_struct *mm = current->mm;
358 struct page **user_pages; 358 struct page **user_pages;
359 ssize_t remain; 359 ssize_t remain;
@@ -402,7 +402,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj,
402 if (ret != 0) 402 if (ret != 0)
403 goto fail_put_pages; 403 goto fail_put_pages;
404 404
405 obj_priv = obj->driver_private; 405 obj_priv = to_intel_bo(obj);
406 offset = args->offset; 406 offset = args->offset;
407 407
408 while (remain > 0) { 408 while (remain > 0) {
@@ -478,7 +478,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
478 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 478 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
479 if (obj == NULL) 479 if (obj == NULL)
480 return -EBADF; 480 return -EBADF;
481 obj_priv = obj->driver_private; 481 obj_priv = to_intel_bo(obj);
482 482
483 /* Bounds check source. 483 /* Bounds check source.
484 * 484 *
@@ -580,7 +580,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
580 struct drm_i915_gem_pwrite *args, 580 struct drm_i915_gem_pwrite *args,
581 struct drm_file *file_priv) 581 struct drm_file *file_priv)
582{ 582{
583 struct drm_i915_gem_object *obj_priv = obj->driver_private; 583 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
584 drm_i915_private_t *dev_priv = dev->dev_private; 584 drm_i915_private_t *dev_priv = dev->dev_private;
585 ssize_t remain; 585 ssize_t remain;
586 loff_t offset, page_base; 586 loff_t offset, page_base;
@@ -604,7 +604,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
604 if (ret) 604 if (ret)
605 goto fail; 605 goto fail;
606 606
607 obj_priv = obj->driver_private; 607 obj_priv = to_intel_bo(obj);
608 offset = obj_priv->gtt_offset + args->offset; 608 offset = obj_priv->gtt_offset + args->offset;
609 609
610 while (remain > 0) { 610 while (remain > 0) {
@@ -654,7 +654,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
654 struct drm_i915_gem_pwrite *args, 654 struct drm_i915_gem_pwrite *args,
655 struct drm_file *file_priv) 655 struct drm_file *file_priv)
656{ 656{
657 struct drm_i915_gem_object *obj_priv = obj->driver_private; 657 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
658 drm_i915_private_t *dev_priv = dev->dev_private; 658 drm_i915_private_t *dev_priv = dev->dev_private;
659 ssize_t remain; 659 ssize_t remain;
660 loff_t gtt_page_base, offset; 660 loff_t gtt_page_base, offset;
@@ -698,7 +698,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
698 if (ret) 698 if (ret)
699 goto out_unpin_object; 699 goto out_unpin_object;
700 700
701 obj_priv = obj->driver_private; 701 obj_priv = to_intel_bo(obj);
702 offset = obj_priv->gtt_offset + args->offset; 702 offset = obj_priv->gtt_offset + args->offset;
703 703
704 while (remain > 0) { 704 while (remain > 0) {
@@ -760,7 +760,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
760 struct drm_i915_gem_pwrite *args, 760 struct drm_i915_gem_pwrite *args,
761 struct drm_file *file_priv) 761 struct drm_file *file_priv)
762{ 762{
763 struct drm_i915_gem_object *obj_priv = obj->driver_private; 763 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
764 ssize_t remain; 764 ssize_t remain;
765 loff_t offset, page_base; 765 loff_t offset, page_base;
766 char __user *user_data; 766 char __user *user_data;
@@ -780,7 +780,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
780 if (ret != 0) 780 if (ret != 0)
781 goto fail_put_pages; 781 goto fail_put_pages;
782 782
783 obj_priv = obj->driver_private; 783 obj_priv = to_intel_bo(obj);
784 offset = args->offset; 784 offset = args->offset;
785 obj_priv->dirty = 1; 785 obj_priv->dirty = 1;
786 786
@@ -828,7 +828,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
828 struct drm_i915_gem_pwrite *args, 828 struct drm_i915_gem_pwrite *args,
829 struct drm_file *file_priv) 829 struct drm_file *file_priv)
830{ 830{
831 struct drm_i915_gem_object *obj_priv = obj->driver_private; 831 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
832 struct mm_struct *mm = current->mm; 832 struct mm_struct *mm = current->mm;
833 struct page **user_pages; 833 struct page **user_pages;
834 ssize_t remain; 834 ssize_t remain;
@@ -876,7 +876,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
876 if (ret != 0) 876 if (ret != 0)
877 goto fail_put_pages; 877 goto fail_put_pages;
878 878
879 obj_priv = obj->driver_private; 879 obj_priv = to_intel_bo(obj);
880 offset = args->offset; 880 offset = args->offset;
881 obj_priv->dirty = 1; 881 obj_priv->dirty = 1;
882 882
@@ -951,7 +951,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
951 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 951 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
952 if (obj == NULL) 952 if (obj == NULL)
953 return -EBADF; 953 return -EBADF;
954 obj_priv = obj->driver_private; 954 obj_priv = to_intel_bo(obj);
955 955
956 /* Bounds check destination. 956 /* Bounds check destination.
957 * 957 *
@@ -1033,7 +1033,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
1033 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 1033 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
1034 if (obj == NULL) 1034 if (obj == NULL)
1035 return -EBADF; 1035 return -EBADF;
1036 obj_priv = obj->driver_private; 1036 obj_priv = to_intel_bo(obj);
1037 1037
1038 mutex_lock(&dev->struct_mutex); 1038 mutex_lock(&dev->struct_mutex);
1039 1039
@@ -1095,7 +1095,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
1095 DRM_INFO("%s: sw_finish %d (%p %zd)\n", 1095 DRM_INFO("%s: sw_finish %d (%p %zd)\n",
1096 __func__, args->handle, obj, obj->size); 1096 __func__, args->handle, obj, obj->size);
1097#endif 1097#endif
1098 obj_priv = obj->driver_private; 1098 obj_priv = to_intel_bo(obj);
1099 1099
1100 /* Pinned buffers may be scanout, so flush the cache */ 1100 /* Pinned buffers may be scanout, so flush the cache */
1101 if (obj_priv->pin_count) 1101 if (obj_priv->pin_count)
@@ -1166,7 +1166,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1166 struct drm_gem_object *obj = vma->vm_private_data; 1166 struct drm_gem_object *obj = vma->vm_private_data;
1167 struct drm_device *dev = obj->dev; 1167 struct drm_device *dev = obj->dev;
1168 struct drm_i915_private *dev_priv = dev->dev_private; 1168 struct drm_i915_private *dev_priv = dev->dev_private;
1169 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1169 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1170 pgoff_t page_offset; 1170 pgoff_t page_offset;
1171 unsigned long pfn; 1171 unsigned long pfn;
1172 int ret = 0; 1172 int ret = 0;
@@ -1233,7 +1233,7 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj)
1233{ 1233{
1234 struct drm_device *dev = obj->dev; 1234 struct drm_device *dev = obj->dev;
1235 struct drm_gem_mm *mm = dev->mm_private; 1235 struct drm_gem_mm *mm = dev->mm_private;
1236 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1236 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1237 struct drm_map_list *list; 1237 struct drm_map_list *list;
1238 struct drm_local_map *map; 1238 struct drm_local_map *map;
1239 int ret = 0; 1239 int ret = 0;
@@ -1304,7 +1304,7 @@ void
1304i915_gem_release_mmap(struct drm_gem_object *obj) 1304i915_gem_release_mmap(struct drm_gem_object *obj)
1305{ 1305{
1306 struct drm_device *dev = obj->dev; 1306 struct drm_device *dev = obj->dev;
1307 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1307 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1308 1308
1309 if (dev->dev_mapping) 1309 if (dev->dev_mapping)
1310 unmap_mapping_range(dev->dev_mapping, 1310 unmap_mapping_range(dev->dev_mapping,
@@ -1315,7 +1315,7 @@ static void
1315i915_gem_free_mmap_offset(struct drm_gem_object *obj) 1315i915_gem_free_mmap_offset(struct drm_gem_object *obj)
1316{ 1316{
1317 struct drm_device *dev = obj->dev; 1317 struct drm_device *dev = obj->dev;
1318 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1318 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1319 struct drm_gem_mm *mm = dev->mm_private; 1319 struct drm_gem_mm *mm = dev->mm_private;
1320 struct drm_map_list *list; 1320 struct drm_map_list *list;
1321 1321
@@ -1346,7 +1346,7 @@ static uint32_t
1346i915_gem_get_gtt_alignment(struct drm_gem_object *obj) 1346i915_gem_get_gtt_alignment(struct drm_gem_object *obj)
1347{ 1347{
1348 struct drm_device *dev = obj->dev; 1348 struct drm_device *dev = obj->dev;
1349 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1349 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1350 int start, i; 1350 int start, i;
1351 1351
1352 /* 1352 /*
@@ -1405,7 +1405,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1405 1405
1406 mutex_lock(&dev->struct_mutex); 1406 mutex_lock(&dev->struct_mutex);
1407 1407
1408 obj_priv = obj->driver_private; 1408 obj_priv = to_intel_bo(obj);
1409 1409
1410 if (obj_priv->madv != I915_MADV_WILLNEED) { 1410 if (obj_priv->madv != I915_MADV_WILLNEED) {
1411 DRM_ERROR("Attempting to mmap a purgeable buffer\n"); 1411 DRM_ERROR("Attempting to mmap a purgeable buffer\n");
@@ -1449,7 +1449,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1449void 1449void
1450i915_gem_object_put_pages(struct drm_gem_object *obj) 1450i915_gem_object_put_pages(struct drm_gem_object *obj)
1451{ 1451{
1452 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1452 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1453 int page_count = obj->size / PAGE_SIZE; 1453 int page_count = obj->size / PAGE_SIZE;
1454 int i; 1454 int i;
1455 1455
@@ -1485,7 +1485,7 @@ i915_gem_object_move_to_active(struct drm_gem_object *obj, uint32_t seqno)
1485{ 1485{
1486 struct drm_device *dev = obj->dev; 1486 struct drm_device *dev = obj->dev;
1487 drm_i915_private_t *dev_priv = dev->dev_private; 1487 drm_i915_private_t *dev_priv = dev->dev_private;
1488 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1488 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1489 1489
1490 /* Add a reference if we're newly entering the active list. */ 1490 /* Add a reference if we're newly entering the active list. */
1491 if (!obj_priv->active) { 1491 if (!obj_priv->active) {
@@ -1505,7 +1505,7 @@ i915_gem_object_move_to_flushing(struct drm_gem_object *obj)
1505{ 1505{
1506 struct drm_device *dev = obj->dev; 1506 struct drm_device *dev = obj->dev;
1507 drm_i915_private_t *dev_priv = dev->dev_private; 1507 drm_i915_private_t *dev_priv = dev->dev_private;
1508 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1508 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1509 1509
1510 BUG_ON(!obj_priv->active); 1510 BUG_ON(!obj_priv->active);
1511 list_move_tail(&obj_priv->list, &dev_priv->mm.flushing_list); 1511 list_move_tail(&obj_priv->list, &dev_priv->mm.flushing_list);
@@ -1516,7 +1516,7 @@ i915_gem_object_move_to_flushing(struct drm_gem_object *obj)
1516static void 1516static void
1517i915_gem_object_truncate(struct drm_gem_object *obj) 1517i915_gem_object_truncate(struct drm_gem_object *obj)
1518{ 1518{
1519 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1519 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1520 struct inode *inode; 1520 struct inode *inode;
1521 1521
1522 inode = obj->filp->f_path.dentry->d_inode; 1522 inode = obj->filp->f_path.dentry->d_inode;
@@ -1537,7 +1537,7 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
1537{ 1537{
1538 struct drm_device *dev = obj->dev; 1538 struct drm_device *dev = obj->dev;
1539 drm_i915_private_t *dev_priv = dev->dev_private; 1539 drm_i915_private_t *dev_priv = dev->dev_private;
1540 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1540 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1541 1541
1542 i915_verify_inactive(dev, __FILE__, __LINE__); 1542 i915_verify_inactive(dev, __FILE__, __LINE__);
1543 if (obj_priv->pin_count != 0) 1543 if (obj_priv->pin_count != 0)
@@ -1964,7 +1964,7 @@ static int
1964i915_gem_object_wait_rendering(struct drm_gem_object *obj) 1964i915_gem_object_wait_rendering(struct drm_gem_object *obj)
1965{ 1965{
1966 struct drm_device *dev = obj->dev; 1966 struct drm_device *dev = obj->dev;
1967 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1967 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1968 int ret; 1968 int ret;
1969 1969
1970 /* This function only exists to support waiting for existing rendering, 1970 /* This function only exists to support waiting for existing rendering,
@@ -1996,7 +1996,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
1996{ 1996{
1997 struct drm_device *dev = obj->dev; 1997 struct drm_device *dev = obj->dev;
1998 drm_i915_private_t *dev_priv = dev->dev_private; 1998 drm_i915_private_t *dev_priv = dev->dev_private;
1999 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1999 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2000 int ret = 0; 2000 int ret = 0;
2001 2001
2002#if WATCH_BUF 2002#if WATCH_BUF
@@ -2172,7 +2172,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
2172#if WATCH_LRU 2172#if WATCH_LRU
2173 DRM_INFO("%s: evicting %p\n", __func__, obj); 2173 DRM_INFO("%s: evicting %p\n", __func__, obj);
2174#endif 2174#endif
2175 obj_priv = obj->driver_private; 2175 obj_priv = to_intel_bo(obj);
2176 BUG_ON(obj_priv->pin_count != 0); 2176 BUG_ON(obj_priv->pin_count != 0);
2177 BUG_ON(obj_priv->active); 2177 BUG_ON(obj_priv->active);
2178 2178
@@ -2243,7 +2243,7 @@ int
2243i915_gem_object_get_pages(struct drm_gem_object *obj, 2243i915_gem_object_get_pages(struct drm_gem_object *obj,
2244 gfp_t gfpmask) 2244 gfp_t gfpmask)
2245{ 2245{
2246 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2246 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2247 int page_count, i; 2247 int page_count, i;
2248 struct address_space *mapping; 2248 struct address_space *mapping;
2249 struct inode *inode; 2249 struct inode *inode;
@@ -2296,7 +2296,7 @@ static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg)
2296 struct drm_gem_object *obj = reg->obj; 2296 struct drm_gem_object *obj = reg->obj;
2297 struct drm_device *dev = obj->dev; 2297 struct drm_device *dev = obj->dev;
2298 drm_i915_private_t *dev_priv = dev->dev_private; 2298 drm_i915_private_t *dev_priv = dev->dev_private;
2299 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2299 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2300 int regnum = obj_priv->fence_reg; 2300 int regnum = obj_priv->fence_reg;
2301 uint64_t val; 2301 uint64_t val;
2302 2302
@@ -2318,7 +2318,7 @@ static void i965_write_fence_reg(struct drm_i915_fence_reg *reg)
2318 struct drm_gem_object *obj = reg->obj; 2318 struct drm_gem_object *obj = reg->obj;
2319 struct drm_device *dev = obj->dev; 2319 struct drm_device *dev = obj->dev;
2320 drm_i915_private_t *dev_priv = dev->dev_private; 2320 drm_i915_private_t *dev_priv = dev->dev_private;
2321 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2321 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2322 int regnum = obj_priv->fence_reg; 2322 int regnum = obj_priv->fence_reg;
2323 uint64_t val; 2323 uint64_t val;
2324 2324
@@ -2338,7 +2338,7 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
2338 struct drm_gem_object *obj = reg->obj; 2338 struct drm_gem_object *obj = reg->obj;
2339 struct drm_device *dev = obj->dev; 2339 struct drm_device *dev = obj->dev;
2340 drm_i915_private_t *dev_priv = dev->dev_private; 2340 drm_i915_private_t *dev_priv = dev->dev_private;
2341 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2341 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2342 int regnum = obj_priv->fence_reg; 2342 int regnum = obj_priv->fence_reg;
2343 int tile_width; 2343 int tile_width;
2344 uint32_t fence_reg, val; 2344 uint32_t fence_reg, val;
@@ -2380,7 +2380,7 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
2380 struct drm_gem_object *obj = reg->obj; 2380 struct drm_gem_object *obj = reg->obj;
2381 struct drm_device *dev = obj->dev; 2381 struct drm_device *dev = obj->dev;
2382 drm_i915_private_t *dev_priv = dev->dev_private; 2382 drm_i915_private_t *dev_priv = dev->dev_private;
2383 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2383 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2384 int regnum = obj_priv->fence_reg; 2384 int regnum = obj_priv->fence_reg;
2385 uint32_t val; 2385 uint32_t val;
2386 uint32_t pitch_val; 2386 uint32_t pitch_val;
@@ -2424,7 +2424,7 @@ static int i915_find_fence_reg(struct drm_device *dev)
2424 if (!reg->obj) 2424 if (!reg->obj)
2425 return i; 2425 return i;
2426 2426
2427 obj_priv = reg->obj->driver_private; 2427 obj_priv = to_intel_bo(reg->obj);
2428 if (!obj_priv->pin_count) 2428 if (!obj_priv->pin_count)
2429 avail++; 2429 avail++;
2430 } 2430 }
@@ -2479,7 +2479,7 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
2479{ 2479{
2480 struct drm_device *dev = obj->dev; 2480 struct drm_device *dev = obj->dev;
2481 struct drm_i915_private *dev_priv = dev->dev_private; 2481 struct drm_i915_private *dev_priv = dev->dev_private;
2482 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2482 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2483 struct drm_i915_fence_reg *reg = NULL; 2483 struct drm_i915_fence_reg *reg = NULL;
2484 int ret; 2484 int ret;
2485 2485
@@ -2546,7 +2546,7 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj)
2546{ 2546{
2547 struct drm_device *dev = obj->dev; 2547 struct drm_device *dev = obj->dev;
2548 drm_i915_private_t *dev_priv = dev->dev_private; 2548 drm_i915_private_t *dev_priv = dev->dev_private;
2549 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2549 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2550 2550
2551 if (IS_GEN6(dev)) { 2551 if (IS_GEN6(dev)) {
2552 I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + 2552 I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 +
@@ -2582,7 +2582,7 @@ int
2582i915_gem_object_put_fence_reg(struct drm_gem_object *obj) 2582i915_gem_object_put_fence_reg(struct drm_gem_object *obj)
2583{ 2583{
2584 struct drm_device *dev = obj->dev; 2584 struct drm_device *dev = obj->dev;
2585 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2585 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2586 2586
2587 if (obj_priv->fence_reg == I915_FENCE_REG_NONE) 2587 if (obj_priv->fence_reg == I915_FENCE_REG_NONE)
2588 return 0; 2588 return 0;
@@ -2620,7 +2620,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
2620{ 2620{
2621 struct drm_device *dev = obj->dev; 2621 struct drm_device *dev = obj->dev;
2622 drm_i915_private_t *dev_priv = dev->dev_private; 2622 drm_i915_private_t *dev_priv = dev->dev_private;
2623 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2623 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2624 struct drm_mm_node *free_space; 2624 struct drm_mm_node *free_space;
2625 gfp_t gfpmask = __GFP_NORETRY | __GFP_NOWARN; 2625 gfp_t gfpmask = __GFP_NORETRY | __GFP_NOWARN;
2626 int ret; 2626 int ret;
@@ -2727,7 +2727,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
2727void 2727void
2728i915_gem_clflush_object(struct drm_gem_object *obj) 2728i915_gem_clflush_object(struct drm_gem_object *obj)
2729{ 2729{
2730 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2730 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2731 2731
2732 /* If we don't have a page list set up, then we're not pinned 2732 /* If we don't have a page list set up, then we're not pinned
2733 * to GPU, and we can ignore the cache flush because it'll happen 2733 * to GPU, and we can ignore the cache flush because it'll happen
@@ -2828,7 +2828,7 @@ i915_gem_object_flush_write_domain(struct drm_gem_object *obj)
2828int 2828int
2829i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write) 2829i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write)
2830{ 2830{
2831 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2831 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2832 uint32_t old_write_domain, old_read_domains; 2832 uint32_t old_write_domain, old_read_domains;
2833 int ret; 2833 int ret;
2834 2834
@@ -2878,7 +2878,7 @@ int
2878i915_gem_object_set_to_display_plane(struct drm_gem_object *obj) 2878i915_gem_object_set_to_display_plane(struct drm_gem_object *obj)
2879{ 2879{
2880 struct drm_device *dev = obj->dev; 2880 struct drm_device *dev = obj->dev;
2881 struct drm_i915_gem_object *obj_priv = obj->driver_private; 2881 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
2882 uint32_t old_write_domain, old_read_domains; 2882 uint32_t old_write_domain, old_read_domains;
2883 int ret; 2883 int ret;
2884 2884
@@ -3091,7 +3091,7 @@ static void
3091i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj) 3091i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
3092{ 3092{
3093 struct drm_device *dev = obj->dev; 3093 struct drm_device *dev = obj->dev;
3094 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3094 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
3095 uint32_t invalidate_domains = 0; 3095 uint32_t invalidate_domains = 0;
3096 uint32_t flush_domains = 0; 3096 uint32_t flush_domains = 0;
3097 uint32_t old_read_domains; 3097 uint32_t old_read_domains;
@@ -3176,7 +3176,7 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
3176static void 3176static void
3177i915_gem_object_set_to_full_cpu_read_domain(struct drm_gem_object *obj) 3177i915_gem_object_set_to_full_cpu_read_domain(struct drm_gem_object *obj)
3178{ 3178{
3179 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3179 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
3180 3180
3181 if (!obj_priv->page_cpu_valid) 3181 if (!obj_priv->page_cpu_valid)
3182 return; 3182 return;
@@ -3216,7 +3216,7 @@ static int
3216i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj, 3216i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj,
3217 uint64_t offset, uint64_t size) 3217 uint64_t offset, uint64_t size)
3218{ 3218{
3219 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3219 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
3220 uint32_t old_read_domains; 3220 uint32_t old_read_domains;
3221 int i, ret; 3221 int i, ret;
3222 3222
@@ -3285,7 +3285,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3285{ 3285{
3286 struct drm_device *dev = obj->dev; 3286 struct drm_device *dev = obj->dev;
3287 drm_i915_private_t *dev_priv = dev->dev_private; 3287 drm_i915_private_t *dev_priv = dev->dev_private;
3288 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3288 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
3289 int i, ret; 3289 int i, ret;
3290 void __iomem *reloc_page; 3290 void __iomem *reloc_page;
3291 bool need_fence; 3291 bool need_fence;
@@ -3336,7 +3336,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3336 i915_gem_object_unpin(obj); 3336 i915_gem_object_unpin(obj);
3337 return -EBADF; 3337 return -EBADF;
3338 } 3338 }
3339 target_obj_priv = target_obj->driver_private; 3339 target_obj_priv = to_intel_bo(target_obj);
3340 3340
3341#if WATCH_RELOC 3341#if WATCH_RELOC
3342 DRM_INFO("%s: obj %p offset %08x target %d " 3342 DRM_INFO("%s: obj %p offset %08x target %d "
@@ -3688,7 +3688,7 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev,
3688 prepare_to_wait(&dev_priv->pending_flip_queue, 3688 prepare_to_wait(&dev_priv->pending_flip_queue,
3689 &wait, TASK_INTERRUPTIBLE); 3689 &wait, TASK_INTERRUPTIBLE);
3690 for (i = 0; i < count; i++) { 3690 for (i = 0; i < count; i++) {
3691 obj_priv = object_list[i]->driver_private; 3691 obj_priv = to_intel_bo(object_list[i]);
3692 if (atomic_read(&obj_priv->pending_flip) > 0) 3692 if (atomic_read(&obj_priv->pending_flip) > 0)
3693 break; 3693 break;
3694 } 3694 }
@@ -3797,7 +3797,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3797 goto err; 3797 goto err;
3798 } 3798 }
3799 3799
3800 obj_priv = object_list[i]->driver_private; 3800 obj_priv = to_intel_bo(object_list[i]);
3801 if (obj_priv->in_execbuffer) { 3801 if (obj_priv->in_execbuffer) {
3802 DRM_ERROR("Object %p appears more than once in object list\n", 3802 DRM_ERROR("Object %p appears more than once in object list\n",
3803 object_list[i]); 3803 object_list[i]);
@@ -3923,7 +3923,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3923 3923
3924 for (i = 0; i < args->buffer_count; i++) { 3924 for (i = 0; i < args->buffer_count; i++) {
3925 struct drm_gem_object *obj = object_list[i]; 3925 struct drm_gem_object *obj = object_list[i];
3926 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3926 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
3927 uint32_t old_write_domain = obj->write_domain; 3927 uint32_t old_write_domain = obj->write_domain;
3928 3928
3929 obj->write_domain = obj->pending_write_domain; 3929 obj->write_domain = obj->pending_write_domain;
@@ -3998,7 +3998,7 @@ err:
3998 3998
3999 for (i = 0; i < args->buffer_count; i++) { 3999 for (i = 0; i < args->buffer_count; i++) {
4000 if (object_list[i]) { 4000 if (object_list[i]) {
4001 obj_priv = object_list[i]->driver_private; 4001 obj_priv = to_intel_bo(object_list[i]);
4002 obj_priv->in_execbuffer = false; 4002 obj_priv->in_execbuffer = false;
4003 } 4003 }
4004 drm_gem_object_unreference(object_list[i]); 4004 drm_gem_object_unreference(object_list[i]);
@@ -4176,7 +4176,7 @@ int
4176i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) 4176i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
4177{ 4177{
4178 struct drm_device *dev = obj->dev; 4178 struct drm_device *dev = obj->dev;
4179 struct drm_i915_gem_object *obj_priv = obj->driver_private; 4179 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
4180 int ret; 4180 int ret;
4181 4181
4182 i915_verify_inactive(dev, __FILE__, __LINE__); 4182 i915_verify_inactive(dev, __FILE__, __LINE__);
@@ -4209,7 +4209,7 @@ i915_gem_object_unpin(struct drm_gem_object *obj)
4209{ 4209{
4210 struct drm_device *dev = obj->dev; 4210 struct drm_device *dev = obj->dev;
4211 drm_i915_private_t *dev_priv = dev->dev_private; 4211 drm_i915_private_t *dev_priv = dev->dev_private;
4212 struct drm_i915_gem_object *obj_priv = obj->driver_private; 4212 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
4213 4213
4214 i915_verify_inactive(dev, __FILE__, __LINE__); 4214 i915_verify_inactive(dev, __FILE__, __LINE__);
4215 obj_priv->pin_count--; 4215 obj_priv->pin_count--;
@@ -4249,7 +4249,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
4249 mutex_unlock(&dev->struct_mutex); 4249 mutex_unlock(&dev->struct_mutex);
4250 return -EBADF; 4250 return -EBADF;
4251 } 4251 }
4252 obj_priv = obj->driver_private; 4252 obj_priv = to_intel_bo(obj);
4253 4253
4254 if (obj_priv->madv != I915_MADV_WILLNEED) { 4254 if (obj_priv->madv != I915_MADV_WILLNEED) {
4255 DRM_ERROR("Attempting to pin a purgeable buffer\n"); 4255 DRM_ERROR("Attempting to pin a purgeable buffer\n");
@@ -4306,7 +4306,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
4306 return -EBADF; 4306 return -EBADF;
4307 } 4307 }
4308 4308
4309 obj_priv = obj->driver_private; 4309 obj_priv = to_intel_bo(obj);
4310 if (obj_priv->pin_filp != file_priv) { 4310 if (obj_priv->pin_filp != file_priv) {
4311 DRM_ERROR("Not pinned by caller in i915_gem_pin_ioctl(): %d\n", 4311 DRM_ERROR("Not pinned by caller in i915_gem_pin_ioctl(): %d\n",
4312 args->handle); 4312 args->handle);
@@ -4348,7 +4348,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
4348 */ 4348 */
4349 i915_gem_retire_requests(dev); 4349 i915_gem_retire_requests(dev);
4350 4350
4351 obj_priv = obj->driver_private; 4351 obj_priv = to_intel_bo(obj);
4352 /* Don't count being on the flushing list against the object being 4352 /* Don't count being on the flushing list against the object being
4353 * done. Otherwise, a buffer left on the flushing list but not getting 4353 * done. Otherwise, a buffer left on the flushing list but not getting
4354 * flushed (because nobody's flushing that domain) won't ever return 4354 * flushed (because nobody's flushing that domain) won't ever return
@@ -4394,7 +4394,7 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
4394 } 4394 }
4395 4395
4396 mutex_lock(&dev->struct_mutex); 4396 mutex_lock(&dev->struct_mutex);
4397 obj_priv = obj->driver_private; 4397 obj_priv = to_intel_bo(obj);
4398 4398
4399 if (obj_priv->pin_count) { 4399 if (obj_priv->pin_count) {
4400 drm_gem_object_unreference(obj); 4400 drm_gem_object_unreference(obj);
@@ -4455,7 +4455,7 @@ int i915_gem_init_object(struct drm_gem_object *obj)
4455void i915_gem_free_object(struct drm_gem_object *obj) 4455void i915_gem_free_object(struct drm_gem_object *obj)
4456{ 4456{
4457 struct drm_device *dev = obj->dev; 4457 struct drm_device *dev = obj->dev;
4458 struct drm_i915_gem_object *obj_priv = obj->driver_private; 4458 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
4459 4459
4460 trace_i915_gem_object_destroy(obj); 4460 trace_i915_gem_object_destroy(obj);
4461 4461
@@ -4564,7 +4564,7 @@ i915_gem_init_hws(struct drm_device *dev)
4564 DRM_ERROR("Failed to allocate status page\n"); 4564 DRM_ERROR("Failed to allocate status page\n");
4565 return -ENOMEM; 4565 return -ENOMEM;
4566 } 4566 }
4567 obj_priv = obj->driver_private; 4567 obj_priv = to_intel_bo(obj);
4568 obj_priv->agp_type = AGP_USER_CACHED_MEMORY; 4568 obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
4569 4569
4570 ret = i915_gem_object_pin(obj, 4096); 4570 ret = i915_gem_object_pin(obj, 4096);
@@ -4608,7 +4608,7 @@ i915_gem_cleanup_hws(struct drm_device *dev)
4608 return; 4608 return;
4609 4609
4610 obj = dev_priv->hws_obj; 4610 obj = dev_priv->hws_obj;
4611 obj_priv = obj->driver_private; 4611 obj_priv = to_intel_bo(obj);
4612 4612
4613 kunmap(obj_priv->pages[0]); 4613 kunmap(obj_priv->pages[0]);
4614 i915_gem_object_unpin(obj); 4614 i915_gem_object_unpin(obj);
@@ -4642,7 +4642,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
4642 i915_gem_cleanup_hws(dev); 4642 i915_gem_cleanup_hws(dev);
4643 return -ENOMEM; 4643 return -ENOMEM;
4644 } 4644 }
4645 obj_priv = obj->driver_private; 4645 obj_priv = to_intel_bo(obj);
4646 4646
4647 ret = i915_gem_object_pin(obj, 4096); 4647 ret = i915_gem_object_pin(obj, 4096);
4648 if (ret != 0) { 4648 if (ret != 0) {
@@ -4935,7 +4935,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
4935 int ret; 4935 int ret;
4936 int page_count; 4936 int page_count;
4937 4937
4938 obj_priv = obj->driver_private; 4938 obj_priv = to_intel_bo(obj);
4939 if (!obj_priv->phys_obj) 4939 if (!obj_priv->phys_obj)
4940 return; 4940 return;
4941 4941
@@ -4974,7 +4974,7 @@ i915_gem_attach_phys_object(struct drm_device *dev,
4974 if (id > I915_MAX_PHYS_OBJECT) 4974 if (id > I915_MAX_PHYS_OBJECT)
4975 return -EINVAL; 4975 return -EINVAL;
4976 4976
4977 obj_priv = obj->driver_private; 4977 obj_priv = to_intel_bo(obj);
4978 4978
4979 if (obj_priv->phys_obj) { 4979 if (obj_priv->phys_obj) {
4980 if (obj_priv->phys_obj->id == id) 4980 if (obj_priv->phys_obj->id == id)
@@ -5025,7 +5025,7 @@ i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
5025 struct drm_i915_gem_pwrite *args, 5025 struct drm_i915_gem_pwrite *args,
5026 struct drm_file *file_priv) 5026 struct drm_file *file_priv)
5027{ 5027{
5028 struct drm_i915_gem_object *obj_priv = obj->driver_private; 5028 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
5029 void *obj_addr; 5029 void *obj_addr;
5030 int ret; 5030 int ret;
5031 char __user *user_data; 5031 char __user *user_data;
diff --git a/drivers/gpu/drm/i915/i915_gem_debug.c b/drivers/gpu/drm/i915/i915_gem_debug.c
index e602614bd3f8..35507cf53fa3 100644
--- a/drivers/gpu/drm/i915/i915_gem_debug.c
+++ b/drivers/gpu/drm/i915/i915_gem_debug.c
@@ -72,7 +72,7 @@ void
72i915_gem_dump_object(struct drm_gem_object *obj, int len, 72i915_gem_dump_object(struct drm_gem_object *obj, int len,
73 const char *where, uint32_t mark) 73 const char *where, uint32_t mark)
74{ 74{
75 struct drm_i915_gem_object *obj_priv = obj->driver_private; 75 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
76 int page; 76 int page;
77 77
78 DRM_INFO("%s: object at offset %08x\n", where, obj_priv->gtt_offset); 78 DRM_INFO("%s: object at offset %08x\n", where, obj_priv->gtt_offset);
@@ -137,7 +137,7 @@ void
137i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle) 137i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle)
138{ 138{
139 struct drm_device *dev = obj->dev; 139 struct drm_device *dev = obj->dev;
140 struct drm_i915_gem_object *obj_priv = obj->driver_private; 140 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
141 int page; 141 int page;
142 uint32_t *gtt_mapping; 142 uint32_t *gtt_mapping;
143 uint32_t *backing_map = NULL; 143 uint32_t *backing_map = NULL;
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index c01c878e51ba..449157f71610 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -240,7 +240,7 @@ bool
240i915_gem_object_fence_offset_ok(struct drm_gem_object *obj, int tiling_mode) 240i915_gem_object_fence_offset_ok(struct drm_gem_object *obj, int tiling_mode)
241{ 241{
242 struct drm_device *dev = obj->dev; 242 struct drm_device *dev = obj->dev;
243 struct drm_i915_gem_object *obj_priv = obj->driver_private; 243 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
244 244
245 if (obj_priv->gtt_space == NULL) 245 if (obj_priv->gtt_space == NULL)
246 return true; 246 return true;
@@ -280,7 +280,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
280 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 280 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
281 if (obj == NULL) 281 if (obj == NULL)
282 return -EINVAL; 282 return -EINVAL;
283 obj_priv = obj->driver_private; 283 obj_priv = to_intel_bo(obj);
284 284
285 if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) { 285 if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) {
286 drm_gem_object_unreference_unlocked(obj); 286 drm_gem_object_unreference_unlocked(obj);
@@ -364,7 +364,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
364 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 364 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
365 if (obj == NULL) 365 if (obj == NULL)
366 return -EINVAL; 366 return -EINVAL;
367 obj_priv = obj->driver_private; 367 obj_priv = to_intel_bo(obj);
368 368
369 mutex_lock(&dev->struct_mutex); 369 mutex_lock(&dev->struct_mutex);
370 370
@@ -427,7 +427,7 @@ i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj)
427{ 427{
428 struct drm_device *dev = obj->dev; 428 struct drm_device *dev = obj->dev;
429 drm_i915_private_t *dev_priv = dev->dev_private; 429 drm_i915_private_t *dev_priv = dev->dev_private;
430 struct drm_i915_gem_object *obj_priv = obj->driver_private; 430 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
431 int page_count = obj->size >> PAGE_SHIFT; 431 int page_count = obj->size >> PAGE_SHIFT;
432 int i; 432 int i;
433 433
@@ -456,7 +456,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj)
456{ 456{
457 struct drm_device *dev = obj->dev; 457 struct drm_device *dev = obj->dev;
458 drm_i915_private_t *dev_priv = dev->dev_private; 458 drm_i915_private_t *dev_priv = dev->dev_private;
459 struct drm_i915_gem_object *obj_priv = obj->driver_private; 459 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
460 int page_count = obj->size >> PAGE_SHIFT; 460 int page_count = obj->size >> PAGE_SHIFT;
461 int i; 461 int i;
462 462
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 5388354da0d1..bfbdad92d73d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -443,7 +443,7 @@ i915_error_object_create(struct drm_device *dev,
443 if (src == NULL) 443 if (src == NULL)
444 return NULL; 444 return NULL;
445 445
446 src_priv = src->driver_private; 446 src_priv = to_intel_bo(src);
447 if (src_priv->pages == NULL) 447 if (src_priv->pages == NULL)
448 return NULL; 448 return NULL;
449 449
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f0214908a935..7adb3a54aac6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1002,7 +1002,7 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
1002 struct drm_i915_private *dev_priv = dev->dev_private; 1002 struct drm_i915_private *dev_priv = dev->dev_private;
1003 struct drm_framebuffer *fb = crtc->fb; 1003 struct drm_framebuffer *fb = crtc->fb;
1004 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 1004 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
1005 struct drm_i915_gem_object *obj_priv = intel_fb->obj->driver_private; 1005 struct drm_i915_gem_object *obj_priv = to_intel_bo(intel_fb->obj);
1006 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1006 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1007 int plane, i; 1007 int plane, i;
1008 u32 fbc_ctl, fbc_ctl2; 1008 u32 fbc_ctl, fbc_ctl2;
@@ -1079,7 +1079,7 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
1079 struct drm_i915_private *dev_priv = dev->dev_private; 1079 struct drm_i915_private *dev_priv = dev->dev_private;
1080 struct drm_framebuffer *fb = crtc->fb; 1080 struct drm_framebuffer *fb = crtc->fb;
1081 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 1081 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
1082 struct drm_i915_gem_object *obj_priv = intel_fb->obj->driver_private; 1082 struct drm_i915_gem_object *obj_priv = to_intel_bo(intel_fb->obj);
1083 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1083 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1084 int plane = (intel_crtc->plane == 0 ? DPFC_CTL_PLANEA : 1084 int plane = (intel_crtc->plane == 0 ? DPFC_CTL_PLANEA :
1085 DPFC_CTL_PLANEB); 1085 DPFC_CTL_PLANEB);
@@ -1175,7 +1175,7 @@ static void intel_update_fbc(struct drm_crtc *crtc,
1175 return; 1175 return;
1176 1176
1177 intel_fb = to_intel_framebuffer(fb); 1177 intel_fb = to_intel_framebuffer(fb);
1178 obj_priv = intel_fb->obj->driver_private; 1178 obj_priv = to_intel_bo(intel_fb->obj);
1179 1179
1180 /* 1180 /*
1181 * If FBC is already on, we just have to verify that we can 1181 * If FBC is already on, we just have to verify that we can
@@ -1242,7 +1242,7 @@ out_disable:
1242static int 1242static int
1243intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj) 1243intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)
1244{ 1244{
1245 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1245 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1246 u32 alignment; 1246 u32 alignment;
1247 int ret; 1247 int ret;
1248 1248
@@ -1322,7 +1322,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1322 1322
1323 intel_fb = to_intel_framebuffer(crtc->fb); 1323 intel_fb = to_intel_framebuffer(crtc->fb);
1324 obj = intel_fb->obj; 1324 obj = intel_fb->obj;
1325 obj_priv = obj->driver_private; 1325 obj_priv = to_intel_bo(obj);
1326 1326
1327 mutex_lock(&dev->struct_mutex); 1327 mutex_lock(&dev->struct_mutex);
1328 ret = intel_pin_and_fence_fb_obj(dev, obj); 1328 ret = intel_pin_and_fence_fb_obj(dev, obj);
@@ -1400,7 +1400,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1400 1400
1401 if (old_fb) { 1401 if (old_fb) {
1402 intel_fb = to_intel_framebuffer(old_fb); 1402 intel_fb = to_intel_framebuffer(old_fb);
1403 obj_priv = intel_fb->obj->driver_private; 1403 obj_priv = to_intel_bo(intel_fb->obj);
1404 i915_gem_object_unpin(intel_fb->obj); 1404 i915_gem_object_unpin(intel_fb->obj);
1405 } 1405 }
1406 intel_increase_pllclock(crtc, true); 1406 intel_increase_pllclock(crtc, true);
@@ -3510,7 +3510,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
3510 if (!bo) 3510 if (!bo)
3511 return -ENOENT; 3511 return -ENOENT;
3512 3512
3513 obj_priv = bo->driver_private; 3513 obj_priv = to_intel_bo(bo);
3514 3514
3515 if (bo->size < width * height * 4) { 3515 if (bo->size < width * height * 4) {
3516 DRM_ERROR("buffer is to small\n"); 3516 DRM_ERROR("buffer is to small\n");
@@ -4155,7 +4155,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
4155 work = intel_crtc->unpin_work; 4155 work = intel_crtc->unpin_work;
4156 if (work == NULL || !work->pending) { 4156 if (work == NULL || !work->pending) {
4157 if (work && !work->pending) { 4157 if (work && !work->pending) {
4158 obj_priv = work->pending_flip_obj->driver_private; 4158 obj_priv = to_intel_bo(work->pending_flip_obj);
4159 DRM_DEBUG_DRIVER("flip finish: %p (%d) not pending?\n", 4159 DRM_DEBUG_DRIVER("flip finish: %p (%d) not pending?\n",
4160 obj_priv, 4160 obj_priv,
4161 atomic_read(&obj_priv->pending_flip)); 4161 atomic_read(&obj_priv->pending_flip));
@@ -4180,7 +4180,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
4180 4180
4181 spin_unlock_irqrestore(&dev->event_lock, flags); 4181 spin_unlock_irqrestore(&dev->event_lock, flags);
4182 4182
4183 obj_priv = work->pending_flip_obj->driver_private; 4183 obj_priv = to_intel_bo(work->pending_flip_obj);
4184 4184
4185 /* Initial scanout buffer will have a 0 pending flip count */ 4185 /* Initial scanout buffer will have a 0 pending flip count */
4186 if ((atomic_read(&obj_priv->pending_flip) == 0) || 4186 if ((atomic_read(&obj_priv->pending_flip) == 0) ||
@@ -4251,7 +4251,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
4251 ret = intel_pin_and_fence_fb_obj(dev, obj); 4251 ret = intel_pin_and_fence_fb_obj(dev, obj);
4252 if (ret != 0) { 4252 if (ret != 0) {
4253 DRM_DEBUG_DRIVER("flip queue: %p pin & fence failed\n", 4253 DRM_DEBUG_DRIVER("flip queue: %p pin & fence failed\n",
4254 obj->driver_private); 4254 to_intel_bo(obj));
4255 kfree(work); 4255 kfree(work);
4256 intel_crtc->unpin_work = NULL; 4256 intel_crtc->unpin_work = NULL;
4257 mutex_unlock(&dev->struct_mutex); 4257 mutex_unlock(&dev->struct_mutex);
@@ -4265,7 +4265,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
4265 crtc->fb = fb; 4265 crtc->fb = fb;
4266 i915_gem_object_flush_write_domain(obj); 4266 i915_gem_object_flush_write_domain(obj);
4267 drm_vblank_get(dev, intel_crtc->pipe); 4267 drm_vblank_get(dev, intel_crtc->pipe);
4268 obj_priv = obj->driver_private; 4268 obj_priv = to_intel_bo(obj);
4269 atomic_inc(&obj_priv->pending_flip); 4269 atomic_inc(&obj_priv->pending_flip);
4270 work->pending_flip_obj = obj; 4270 work->pending_flip_obj = obj;
4271 4271
@@ -4778,14 +4778,14 @@ void intel_init_clock_gating(struct drm_device *dev)
4778 struct drm_i915_gem_object *obj_priv = NULL; 4778 struct drm_i915_gem_object *obj_priv = NULL;
4779 4779
4780 if (dev_priv->pwrctx) { 4780 if (dev_priv->pwrctx) {
4781 obj_priv = dev_priv->pwrctx->driver_private; 4781 obj_priv = to_intel_bo(dev_priv->pwrctx);
4782 } else { 4782 } else {
4783 struct drm_gem_object *pwrctx; 4783 struct drm_gem_object *pwrctx;
4784 4784
4785 pwrctx = intel_alloc_power_context(dev); 4785 pwrctx = intel_alloc_power_context(dev);
4786 if (pwrctx) { 4786 if (pwrctx) {
4787 dev_priv->pwrctx = pwrctx; 4787 dev_priv->pwrctx = pwrctx;
4788 obj_priv = pwrctx->driver_private; 4788 obj_priv = to_intel_bo(pwrctx);
4789 } 4789 }
4790 } 4790 }
4791 4791
@@ -4956,7 +4956,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
4956 if (dev_priv->pwrctx) { 4956 if (dev_priv->pwrctx) {
4957 struct drm_i915_gem_object *obj_priv; 4957 struct drm_i915_gem_object *obj_priv;
4958 4958
4959 obj_priv = dev_priv->pwrctx->driver_private; 4959 obj_priv = to_intel_bo(dev_priv->pwrctx);
4960 I915_WRITE(PWRCTXA, obj_priv->gtt_offset &~ PWRCTX_EN); 4960 I915_WRITE(PWRCTXA, obj_priv->gtt_offset &~ PWRCTX_EN);
4961 I915_READ(PWRCTXA); 4961 I915_READ(PWRCTXA);
4962 i915_gem_object_unpin(dev_priv->pwrctx); 4962 i915_gem_object_unpin(dev_priv->pwrctx);
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 8cd791dc5b29..c9fbdfa9c575 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -145,7 +145,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
145 ret = -ENOMEM; 145 ret = -ENOMEM;
146 goto out; 146 goto out;
147 } 147 }
148 obj_priv = fbo->driver_private; 148 obj_priv = to_intel_bo(fbo);
149 149
150 mutex_lock(&dev->struct_mutex); 150 mutex_lock(&dev->struct_mutex);
151 151
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 60595fc26fdd..6d524a1fc271 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -724,7 +724,7 @@ int intel_overlay_do_put_image(struct intel_overlay *overlay,
724 int ret, tmp_width; 724 int ret, tmp_width;
725 struct overlay_registers *regs; 725 struct overlay_registers *regs;
726 bool scale_changed = false; 726 bool scale_changed = false;
727 struct drm_i915_gem_object *bo_priv = new_bo->driver_private; 727 struct drm_i915_gem_object *bo_priv = to_intel_bo(new_bo);
728 struct drm_device *dev = overlay->dev; 728 struct drm_device *dev = overlay->dev;
729 729
730 BUG_ON(!mutex_is_locked(&dev->struct_mutex)); 730 BUG_ON(!mutex_is_locked(&dev->struct_mutex));
@@ -809,7 +809,7 @@ int intel_overlay_do_put_image(struct intel_overlay *overlay,
809 intel_overlay_continue(overlay, scale_changed); 809 intel_overlay_continue(overlay, scale_changed);
810 810
811 overlay->old_vid_bo = overlay->vid_bo; 811 overlay->old_vid_bo = overlay->vid_bo;
812 overlay->vid_bo = new_bo->driver_private; 812 overlay->vid_bo = to_intel_bo(new_bo);
813 813
814 return 0; 814 return 0;
815 815
@@ -1344,7 +1344,7 @@ void intel_setup_overlay(struct drm_device *dev)
1344 reg_bo = drm_gem_object_alloc(dev, PAGE_SIZE); 1344 reg_bo = drm_gem_object_alloc(dev, PAGE_SIZE);
1345 if (!reg_bo) 1345 if (!reg_bo)
1346 goto out_free; 1346 goto out_free;
1347 overlay->reg_bo = reg_bo->driver_private; 1347 overlay->reg_bo = to_intel_bo(reg_bo);
1348 1348
1349 if (OVERLAY_NONPHYSICAL(dev)) { 1349 if (OVERLAY_NONPHYSICAL(dev)) {
1350 ret = i915_gem_object_pin(reg_bo, PAGE_SIZE); 1350 ret = i915_gem_object_pin(reg_bo, PAGE_SIZE);