Commit 23010e43 authored by Daniel Vetter's avatar Daniel Vetter Committed by Eric Anholt

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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarDave Airlie <airlied@gmail.com>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 8d06a1e1
...@@ -225,7 +225,7 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data) ...@@ -225,7 +225,7 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
} else { } else {
struct drm_i915_gem_object *obj_priv; struct drm_i915_gem_object *obj_priv;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
seq_printf(m, "Fenced object[%2d] = %p: %s " seq_printf(m, "Fenced object[%2d] = %p: %s "
"%08x %08zx %08x %s %08x %08x %d", "%08x %08zx %08x %s %08x %08x %d",
i, obj, get_pin_flag(obj_priv), i, obj, get_pin_flag(obj_priv),
......
...@@ -361,7 +361,7 @@ int i965_reset(struct drm_device *dev, u8 flags) ...@@ -361,7 +361,7 @@ int i965_reset(struct drm_device *dev, u8 flags)
!dev_priv->mm.suspended) { !dev_priv->mm.suspended) {
drm_i915_ring_buffer_t *ring = &dev_priv->ring; drm_i915_ring_buffer_t *ring = &dev_priv->ring;
struct drm_gem_object *obj = ring->ring_obj; struct drm_gem_object *obj = ring->ring_obj;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
dev_priv->mm.suspended = 0; dev_priv->mm.suspended = 0;
/* Stop the ring if it's running. */ /* Stop the ring if it's running. */
......
...@@ -731,6 +731,8 @@ struct drm_i915_gem_object { ...@@ -731,6 +731,8 @@ struct drm_i915_gem_object {
atomic_t pending_flip; atomic_t pending_flip;
}; };
#define to_intel_bo(x) ((struct drm_i915_gem_object *) (x)->driver_private)
/** /**
* Request queue structure. * Request queue structure.
* *
......
...@@ -162,7 +162,7 @@ fast_shmem_read(struct page **pages, ...@@ -162,7 +162,7 @@ fast_shmem_read(struct page **pages,
static int i915_gem_object_needs_bit17_swizzle(struct drm_gem_object *obj) static int i915_gem_object_needs_bit17_swizzle(struct drm_gem_object *obj)
{ {
drm_i915_private_t *dev_priv = obj->dev->dev_private; drm_i915_private_t *dev_priv = obj->dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 && return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 &&
obj_priv->tiling_mode != I915_TILING_NONE; 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,7 +263,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pread *args, struct drm_i915_gem_pread *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
ssize_t remain; ssize_t remain;
loff_t offset, page_base; loff_t offset, page_base;
char __user *user_data; char __user *user_data;
...@@ -284,7 +284,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -284,7 +284,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj,
if (ret != 0) if (ret != 0)
goto fail_put_pages; goto fail_put_pages;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
offset = args->offset; offset = args->offset;
while (remain > 0) { while (remain > 0) {
...@@ -353,7 +353,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -353,7 +353,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pread *args, struct drm_i915_gem_pread *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct page **user_pages; struct page **user_pages;
ssize_t remain; ssize_t remain;
...@@ -402,7 +402,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -402,7 +402,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj,
if (ret != 0) if (ret != 0)
goto fail_put_pages; goto fail_put_pages;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
offset = args->offset; offset = args->offset;
while (remain > 0) { while (remain > 0) {
...@@ -478,7 +478,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, ...@@ -478,7 +478,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL) if (obj == NULL)
return -EBADF; return -EBADF;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
/* Bounds check source. /* Bounds check source.
* *
...@@ -580,7 +580,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -580,7 +580,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pwrite *args, struct drm_i915_gem_pwrite *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
ssize_t remain; ssize_t remain;
loff_t offset, page_base; loff_t offset, page_base;
...@@ -604,7 +604,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -604,7 +604,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
if (ret) if (ret)
goto fail; goto fail;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
offset = obj_priv->gtt_offset + args->offset; offset = obj_priv->gtt_offset + args->offset;
while (remain > 0) { while (remain > 0) {
...@@ -654,7 +654,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -654,7 +654,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pwrite *args, struct drm_i915_gem_pwrite *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
ssize_t remain; ssize_t remain;
loff_t gtt_page_base, offset; 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,7 +698,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
if (ret) if (ret)
goto out_unpin_object; goto out_unpin_object;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
offset = obj_priv->gtt_offset + args->offset; offset = obj_priv->gtt_offset + args->offset;
while (remain > 0) { while (remain > 0) {
...@@ -760,7 +760,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -760,7 +760,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pwrite *args, struct drm_i915_gem_pwrite *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
ssize_t remain; ssize_t remain;
loff_t offset, page_base; loff_t offset, page_base;
char __user *user_data; char __user *user_data;
...@@ -780,7 +780,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -780,7 +780,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
if (ret != 0) if (ret != 0)
goto fail_put_pages; goto fail_put_pages;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
offset = args->offset; offset = args->offset;
obj_priv->dirty = 1; obj_priv->dirty = 1;
...@@ -828,7 +828,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -828,7 +828,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pwrite *args, struct drm_i915_gem_pwrite *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct page **user_pages; struct page **user_pages;
ssize_t remain; ssize_t remain;
...@@ -876,7 +876,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj, ...@@ -876,7 +876,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
if (ret != 0) if (ret != 0)
goto fail_put_pages; goto fail_put_pages;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
offset = args->offset; offset = args->offset;
obj_priv->dirty = 1; obj_priv->dirty = 1;
...@@ -951,7 +951,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, ...@@ -951,7 +951,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL) if (obj == NULL)
return -EBADF; return -EBADF;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
/* Bounds check destination. /* Bounds check destination.
* *
...@@ -1033,7 +1033,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, ...@@ -1033,7 +1033,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL) if (obj == NULL)
return -EBADF; return -EBADF;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -1095,7 +1095,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, ...@@ -1095,7 +1095,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
DRM_INFO("%s: sw_finish %d (%p %zd)\n", DRM_INFO("%s: sw_finish %d (%p %zd)\n",
__func__, args->handle, obj, obj->size); __func__, args->handle, obj, obj->size);
#endif #endif
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
/* Pinned buffers may be scanout, so flush the cache */ /* Pinned buffers may be scanout, so flush the cache */
if (obj_priv->pin_count) if (obj_priv->pin_count)
...@@ -1166,7 +1166,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -1166,7 +1166,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
struct drm_gem_object *obj = vma->vm_private_data; struct drm_gem_object *obj = vma->vm_private_data;
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
pgoff_t page_offset; pgoff_t page_offset;
unsigned long pfn; unsigned long pfn;
int ret = 0; int ret = 0;
...@@ -1233,7 +1233,7 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj) ...@@ -1233,7 +1233,7 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_gem_mm *mm = dev->mm_private; struct drm_gem_mm *mm = dev->mm_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct drm_map_list *list; struct drm_map_list *list;
struct drm_local_map *map; struct drm_local_map *map;
int ret = 0; int ret = 0;
...@@ -1304,7 +1304,7 @@ void ...@@ -1304,7 +1304,7 @@ void
i915_gem_release_mmap(struct drm_gem_object *obj) i915_gem_release_mmap(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (dev->dev_mapping) if (dev->dev_mapping)
unmap_mapping_range(dev->dev_mapping, unmap_mapping_range(dev->dev_mapping,
...@@ -1315,7 +1315,7 @@ static void ...@@ -1315,7 +1315,7 @@ static void
i915_gem_free_mmap_offset(struct drm_gem_object *obj) i915_gem_free_mmap_offset(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct drm_gem_mm *mm = dev->mm_private; struct drm_gem_mm *mm = dev->mm_private;
struct drm_map_list *list; struct drm_map_list *list;
...@@ -1346,7 +1346,7 @@ static uint32_t ...@@ -1346,7 +1346,7 @@ static uint32_t
i915_gem_get_gtt_alignment(struct drm_gem_object *obj) i915_gem_get_gtt_alignment(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int start, i; int start, i;
/* /*
...@@ -1405,7 +1405,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, ...@@ -1405,7 +1405,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (obj_priv->madv != I915_MADV_WILLNEED) { if (obj_priv->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to mmap a purgeable buffer\n"); DRM_ERROR("Attempting to mmap a purgeable buffer\n");
...@@ -1449,7 +1449,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, ...@@ -1449,7 +1449,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
void void
i915_gem_object_put_pages(struct drm_gem_object *obj) i915_gem_object_put_pages(struct drm_gem_object *obj)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int page_count = obj->size / PAGE_SIZE; int page_count = obj->size / PAGE_SIZE;
int i; int i;
...@@ -1485,7 +1485,7 @@ i915_gem_object_move_to_active(struct drm_gem_object *obj, uint32_t seqno) ...@@ -1485,7 +1485,7 @@ i915_gem_object_move_to_active(struct drm_gem_object *obj, uint32_t seqno)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
/* Add a reference if we're newly entering the active list. */ /* Add a reference if we're newly entering the active list. */
if (!obj_priv->active) { if (!obj_priv->active) {
...@@ -1505,7 +1505,7 @@ i915_gem_object_move_to_flushing(struct drm_gem_object *obj) ...@@ -1505,7 +1505,7 @@ i915_gem_object_move_to_flushing(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
BUG_ON(!obj_priv->active); BUG_ON(!obj_priv->active);
list_move_tail(&obj_priv->list, &dev_priv->mm.flushing_list); 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) ...@@ -1516,7 +1516,7 @@ i915_gem_object_move_to_flushing(struct drm_gem_object *obj)
static void static void
i915_gem_object_truncate(struct drm_gem_object *obj) i915_gem_object_truncate(struct drm_gem_object *obj)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct inode *inode; struct inode *inode;
inode = obj->filp->f_path.dentry->d_inode; inode = obj->filp->f_path.dentry->d_inode;
...@@ -1537,7 +1537,7 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj) ...@@ -1537,7 +1537,7 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
i915_verify_inactive(dev, __FILE__, __LINE__); i915_verify_inactive(dev, __FILE__, __LINE__);
if (obj_priv->pin_count != 0) if (obj_priv->pin_count != 0)
...@@ -1964,7 +1964,7 @@ static int ...@@ -1964,7 +1964,7 @@ static int
i915_gem_object_wait_rendering(struct drm_gem_object *obj) i915_gem_object_wait_rendering(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int ret; int ret;
/* This function only exists to support waiting for existing rendering, /* This function only exists to support waiting for existing rendering,
...@@ -1996,7 +1996,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj) ...@@ -1996,7 +1996,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int ret = 0; int ret = 0;
#if WATCH_BUF #if WATCH_BUF
...@@ -2172,7 +2172,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size) ...@@ -2172,7 +2172,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
#if WATCH_LRU #if WATCH_LRU
DRM_INFO("%s: evicting %p\n", __func__, obj); DRM_INFO("%s: evicting %p\n", __func__, obj);
#endif #endif
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
BUG_ON(obj_priv->pin_count != 0); BUG_ON(obj_priv->pin_count != 0);
BUG_ON(obj_priv->active); BUG_ON(obj_priv->active);
...@@ -2243,7 +2243,7 @@ int ...@@ -2243,7 +2243,7 @@ int
i915_gem_object_get_pages(struct drm_gem_object *obj, i915_gem_object_get_pages(struct drm_gem_object *obj,
gfp_t gfpmask) gfp_t gfpmask)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int page_count, i; int page_count, i;
struct address_space *mapping; struct address_space *mapping;
struct inode *inode; struct inode *inode;
...@@ -2296,7 +2296,7 @@ static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg) ...@@ -2296,7 +2296,7 @@ static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg)
struct drm_gem_object *obj = reg->obj; struct drm_gem_object *obj = reg->obj;
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int regnum = obj_priv->fence_reg; int regnum = obj_priv->fence_reg;
uint64_t val; uint64_t val;
...@@ -2318,7 +2318,7 @@ static void i965_write_fence_reg(struct drm_i915_fence_reg *reg) ...@@ -2318,7 +2318,7 @@ static void i965_write_fence_reg(struct drm_i915_fence_reg *reg)
struct drm_gem_object *obj = reg->obj; struct drm_gem_object *obj = reg->obj;
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int regnum = obj_priv->fence_reg; int regnum = obj_priv->fence_reg;
uint64_t val; uint64_t val;
...@@ -2338,7 +2338,7 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg) ...@@ -2338,7 +2338,7 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
struct drm_gem_object *obj = reg->obj; struct drm_gem_object *obj = reg->obj;
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int regnum = obj_priv->fence_reg; int regnum = obj_priv->fence_reg;
int tile_width; int tile_width;
uint32_t fence_reg, val; uint32_t fence_reg, val;
...@@ -2380,7 +2380,7 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg) ...@@ -2380,7 +2380,7 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
struct drm_gem_object *obj = reg->obj; struct drm_gem_object *obj = reg->obj;
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int regnum = obj_priv->fence_reg; int regnum = obj_priv->fence_reg;
uint32_t val; uint32_t val;
uint32_t pitch_val; uint32_t pitch_val;
...@@ -2424,7 +2424,7 @@ static int i915_find_fence_reg(struct drm_device *dev) ...@@ -2424,7 +2424,7 @@ static int i915_find_fence_reg(struct drm_device *dev)
if (!reg->obj) if (!reg->obj)
return i; return i;
obj_priv = reg->obj->driver_private; obj_priv = to_intel_bo(reg->obj);
if (!obj_priv->pin_count) if (!obj_priv->pin_count)
avail++; avail++;
} }
...@@ -2479,7 +2479,7 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj) ...@@ -2479,7 +2479,7 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct drm_i915_fence_reg *reg = NULL; struct drm_i915_fence_reg *reg = NULL;
int ret; int ret;
...@@ -2546,7 +2546,7 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj) ...@@ -2546,7 +2546,7 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (IS_GEN6(dev)) { if (IS_GEN6(dev)) {
I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 +
...@@ -2582,7 +2582,7 @@ int ...@@ -2582,7 +2582,7 @@ int
i915_gem_object_put_fence_reg(struct drm_gem_object *obj) i915_gem_object_put_fence_reg(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (obj_priv->fence_reg == I915_FENCE_REG_NONE) if (obj_priv->fence_reg == I915_FENCE_REG_NONE)
return 0; return 0;
...@@ -2620,7 +2620,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment) ...@@ -2620,7 +2620,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct drm_mm_node *free_space; struct drm_mm_node *free_space;
gfp_t gfpmask = __GFP_NORETRY | __GFP_NOWARN; gfp_t gfpmask = __GFP_NORETRY | __GFP_NOWARN;
int ret; int ret;
...@@ -2727,7 +2727,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment) ...@@ -2727,7 +2727,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
void void
i915_gem_clflush_object(struct drm_gem_object *obj) i915_gem_clflush_object(struct drm_gem_object *obj)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
/* If we don't have a page list set up, then we're not pinned /* If we don't have a page list set up, then we're not pinned
* to GPU, and we can ignore the cache flush because it'll happen * 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) ...@@ -2828,7 +2828,7 @@ i915_gem_object_flush_write_domain(struct drm_gem_object *obj)
int int
i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write) i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
uint32_t old_write_domain, old_read_domains; uint32_t old_write_domain, old_read_domains;
int ret; int ret;
...@@ -2878,7 +2878,7 @@ int ...@@ -2878,7 +2878,7 @@ int
i915_gem_object_set_to_display_plane(struct drm_gem_object *obj) i915_gem_object_set_to_display_plane(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
uint32_t old_write_domain, old_read_domains; uint32_t old_write_domain, old_read_domains;
int ret; int ret;
...@@ -3091,7 +3091,7 @@ static void ...@@ -3091,7 +3091,7 @@ static void
i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj) i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
uint32_t invalidate_domains = 0; uint32_t invalidate_domains = 0;
uint32_t flush_domains = 0; uint32_t flush_domains = 0;
uint32_t old_read_domains; uint32_t old_read_domains;
...@@ -3176,7 +3176,7 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj) ...@@ -3176,7 +3176,7 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
static void static void
i915_gem_object_set_to_full_cpu_read_domain(struct drm_gem_object *obj) i915_gem_object_set_to_full_cpu_read_domain(struct drm_gem_object *obj)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (!obj_priv->page_cpu_valid) if (!obj_priv->page_cpu_valid)
return; return;
...@@ -3216,7 +3216,7 @@ static int ...@@ -3216,7 +3216,7 @@ static int
i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj, i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj,
uint64_t offset, uint64_t size) uint64_t offset, uint64_t size)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
uint32_t old_read_domains; uint32_t old_read_domains;
int i, ret; int i, ret;
...@@ -3285,7 +3285,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, ...@@ -3285,7 +3285,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int i, ret; int i, ret;
void __iomem *reloc_page; void __iomem *reloc_page;
bool need_fence; bool need_fence;
...@@ -3336,7 +3336,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, ...@@ -3336,7 +3336,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
i915_gem_object_unpin(obj); i915_gem_object_unpin(obj);
return -EBADF; return -EBADF;
} }
target_obj_priv = target_obj->driver_private; target_obj_priv = to_intel_bo(target_obj);
#if WATCH_RELOC #if WATCH_RELOC
DRM_INFO("%s: obj %p offset %08x target %d " DRM_INFO("%s: obj %p offset %08x target %d "
...@@ -3688,7 +3688,7 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev, ...@@ -3688,7 +3688,7 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev,
prepare_to_wait(&dev_priv->pending_flip_queue, prepare_to_wait(&dev_priv->pending_flip_queue,
&wait, TASK_INTERRUPTIBLE); &wait, TASK_INTERRUPTIBLE);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
obj_priv = object_list[i]->driver_private; obj_priv = to_intel_bo(object_list[i]);
if (atomic_read(&obj_priv->pending_flip) > 0) if (atomic_read(&obj_priv->pending_flip) > 0)
break; break;
} }
...@@ -3797,7 +3797,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ...@@ -3797,7 +3797,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
goto err; goto err;
} }
obj_priv = object_list[i]->driver_private; obj_priv = to_intel_bo(object_list[i]);
if (obj_priv->in_execbuffer) { if (obj_priv->in_execbuffer) {
DRM_ERROR("Object %p appears more than once in object list\n", DRM_ERROR("Object %p appears more than once in object list\n",
object_list[i]); object_list[i]);
...@@ -3923,7 +3923,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ...@@ -3923,7 +3923,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
for (i = 0; i < args->buffer_count; i++) { for (i = 0; i < args->buffer_count; i++) {
struct drm_gem_object *obj = object_list[i]; struct drm_gem_object *obj = object_list[i];
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
uint32_t old_write_domain = obj->write_domain; uint32_t old_write_domain = obj->write_domain;
obj->write_domain = obj->pending_write_domain; obj->write_domain = obj->pending_write_domain;
...@@ -3998,7 +3998,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ...@@ -3998,7 +3998,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
for (i = 0; i < args->buffer_count; i++) { for (i = 0; i < args->buffer_count; i++) {
if (object_list[i]) { if (object_list[i]) {
obj_priv = object_list[i]->driver_private; obj_priv = to_intel_bo(object_list[i]);
obj_priv->in_execbuffer = false; obj_priv->in_execbuffer = false;
} }
drm_gem_object_unreference(object_list[i]); drm_gem_object_unreference(object_list[i]);
...@@ -4176,7 +4176,7 @@ int ...@@ -4176,7 +4176,7 @@ int
i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int ret; int ret;
i915_verify_inactive(dev, __FILE__, __LINE__); i915_verify_inactive(dev, __FILE__, __LINE__);
...@@ -4209,7 +4209,7 @@ i915_gem_object_unpin(struct drm_gem_object *obj) ...@@ -4209,7 +4209,7 @@ i915_gem_object_unpin(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
i915_verify_inactive(dev, __FILE__, __LINE__); i915_verify_inactive(dev, __FILE__, __LINE__);
obj_priv->pin_count--; obj_priv->pin_count--;
...@@ -4249,7 +4249,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, ...@@ -4249,7 +4249,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return -EBADF; return -EBADF;
} }
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (obj_priv->madv != I915_MADV_WILLNEED) { if (obj_priv->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to pin a purgeable buffer\n"); DRM_ERROR("Attempting to pin a purgeable buffer\n");
...@@ -4306,7 +4306,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data, ...@@ -4306,7 +4306,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
return -EBADF; return -EBADF;
} }
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (obj_priv->pin_filp != file_priv) { if (obj_priv->pin_filp != file_priv) {
DRM_ERROR("Not pinned by caller in i915_gem_pin_ioctl(): %d\n", DRM_ERROR("Not pinned by caller in i915_gem_pin_ioctl(): %d\n",
args->handle); args->handle);
...@@ -4348,7 +4348,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, ...@@ -4348,7 +4348,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
*/ */
i915_gem_retire_requests(dev); i915_gem_retire_requests(dev);
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
/* Don't count being on the flushing list against the object being /* Don't count being on the flushing list against the object being
* done. Otherwise, a buffer left on the flushing list but not getting * done. Otherwise, a buffer left on the flushing list but not getting
* flushed (because nobody's flushing that domain) won't ever return * 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,7 +4394,7 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
} }
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (obj_priv->pin_count) { if (obj_priv->pin_count) {
drm_gem_object_unreference(obj); drm_gem_object_unreference(obj);
...@@ -4455,7 +4455,7 @@ int i915_gem_init_object(struct drm_gem_object *obj) ...@@ -4455,7 +4455,7 @@ int i915_gem_init_object(struct drm_gem_object *obj)
void i915_gem_free_object(struct drm_gem_object *obj) void i915_gem_free_object(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
trace_i915_gem_object_destroy(obj); trace_i915_gem_object_destroy(obj);
...@@ -4564,7 +4564,7 @@ i915_gem_init_hws(struct drm_device *dev) ...@@ -4564,7 +4564,7 @@ i915_gem_init_hws(struct drm_device *dev)
DRM_ERROR("Failed to allocate status page\n"); DRM_ERROR("Failed to allocate status page\n");
return -ENOMEM; return -ENOMEM;
} }
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
obj_priv->agp_type = AGP_USER_CACHED_MEMORY; obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
ret = i915_gem_object_pin(obj, 4096); ret = i915_gem_object_pin(obj, 4096);
...@@ -4608,7 +4608,7 @@ i915_gem_cleanup_hws(struct drm_device *dev) ...@@ -4608,7 +4608,7 @@ i915_gem_cleanup_hws(struct drm_device *dev)
return; return;
obj = dev_priv->hws_obj; obj = dev_priv->hws_obj;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
kunmap(obj_priv->pages[0]); kunmap(obj_priv->pages[0]);
i915_gem_object_unpin(obj); i915_gem_object_unpin(obj);
...@@ -4642,7 +4642,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev) ...@@ -4642,7 +4642,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
i915_gem_cleanup_hws(dev); i915_gem_cleanup_hws(dev);
return -ENOMEM; return -ENOMEM;
} }
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
ret = i915_gem_object_pin(obj, 4096); ret = i915_gem_object_pin(obj, 4096);
if (ret != 0) { if (ret != 0) {
...@@ -4935,7 +4935,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev, ...@@ -4935,7 +4935,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
int ret; int ret;
int page_count; int page_count;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (!obj_priv->phys_obj) if (!obj_priv->phys_obj)
return; return;
...@@ -4974,7 +4974,7 @@ i915_gem_attach_phys_object(struct drm_device *dev, ...@@ -4974,7 +4974,7 @@ i915_gem_attach_phys_object(struct drm_device *dev,
if (id > I915_MAX_PHYS_OBJECT) if (id > I915_MAX_PHYS_OBJECT)
return -EINVAL; return -EINVAL;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (obj_priv->phys_obj) { if (obj_priv->phys_obj) {
if (obj_priv->phys_obj->id == id) 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,7 +5025,7 @@ i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
struct drm_i915_gem_pwrite *args, struct drm_i915_gem_pwrite *args,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
void *obj_addr; void *obj_addr;
int ret; int ret;
char __user *user_data; char __user *user_data;
......
...@@ -72,7 +72,7 @@ void ...@@ -72,7 +72,7 @@ void
i915_gem_dump_object(struct drm_gem_object *obj, int len, i915_gem_dump_object(struct drm_gem_object *obj, int len,
const char *where, uint32_t mark) const char *where, uint32_t mark)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int page; int page;
DRM_INFO("%s: object at offset %08x\n", where, obj_priv->gtt_offset); DRM_INFO("%s: object at offset %08x\n", where, obj_priv->gtt_offset);
...@@ -137,7 +137,7 @@ void ...@@ -137,7 +137,7 @@ void
i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle) i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int page; int page;
uint32_t *gtt_mapping; uint32_t *gtt_mapping;
uint32_t *backing_map = NULL; uint32_t *backing_map = NULL;
......
...@@ -240,7 +240,7 @@ bool ...@@ -240,7 +240,7 @@ bool
i915_gem_object_fence_offset_ok(struct drm_gem_object *obj, int tiling_mode) i915_gem_object_fence_offset_ok(struct drm_gem_object *obj, int tiling_mode)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (obj_priv->gtt_space == NULL) if (obj_priv->gtt_space == NULL)
return true; return true;
...@@ -280,7 +280,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, ...@@ -280,7 +280,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL) if (obj == NULL)
return -EINVAL; return -EINVAL;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) { if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) {
drm_gem_object_unreference_unlocked(obj); drm_gem_object_unreference_unlocked(obj);
...@@ -364,7 +364,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data, ...@@ -364,7 +364,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL) if (obj == NULL)
return -EINVAL; return -EINVAL;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -427,7 +427,7 @@ i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj) ...@@ -427,7 +427,7 @@ i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int page_count = obj->size >> PAGE_SHIFT; int page_count = obj->size >> PAGE_SHIFT;
int i; int i;
...@@ -456,7 +456,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj) ...@@ -456,7 +456,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int page_count = obj->size >> PAGE_SHIFT; int page_count = obj->size >> PAGE_SHIFT;
int i; int i;
......
...@@ -443,7 +443,7 @@ i915_error_object_create(struct drm_device *dev, ...@@ -443,7 +443,7 @@ i915_error_object_create(struct drm_device *dev,
if (src == NULL) if (src == NULL)
return NULL; return NULL;
src_priv = src->driver_private; src_priv = to_intel_bo(src);
if (src_priv->pages == NULL) if (src_priv->pages == NULL)
return NULL; return NULL;
......
...@@ -1002,7 +1002,7 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval) ...@@ -1002,7 +1002,7 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_framebuffer *fb = crtc->fb; struct drm_framebuffer *fb = crtc->fb;
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
struct drm_i915_gem_object *obj_priv = intel_fb->obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(intel_fb->obj);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int plane, i; int plane, i;
u32 fbc_ctl, fbc_ctl2; u32 fbc_ctl, fbc_ctl2;
...@@ -1079,7 +1079,7 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval) ...@@ -1079,7 +1079,7 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_framebuffer *fb = crtc->fb; struct drm_framebuffer *fb = crtc->fb;
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
struct drm_i915_gem_object *obj_priv = intel_fb->obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(intel_fb->obj);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int plane = (intel_crtc->plane == 0 ? DPFC_CTL_PLANEA : int plane = (intel_crtc->plane == 0 ? DPFC_CTL_PLANEA :
DPFC_CTL_PLANEB); DPFC_CTL_PLANEB);
...@@ -1175,7 +1175,7 @@ static void intel_update_fbc(struct drm_crtc *crtc, ...@@ -1175,7 +1175,7 @@ static void intel_update_fbc(struct drm_crtc *crtc,
return; return;
intel_fb = to_intel_framebuffer(fb); intel_fb = to_intel_framebuffer(fb);
obj_priv = intel_fb->obj->driver_private; obj_priv = to_intel_bo(intel_fb->obj);
/* /*
* If FBC is already on, we just have to verify that we can * If FBC is already on, we just have to verify that we can
...@@ -1242,7 +1242,7 @@ static void intel_update_fbc(struct drm_crtc *crtc, ...@@ -1242,7 +1242,7 @@ static void intel_update_fbc(struct drm_crtc *crtc,
static int static int
intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj) intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)
{ {
struct drm_i915_gem_object *obj_priv = obj->driver_private; struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
u32 alignment; u32 alignment;
int ret; int ret;
...@@ -1322,7 +1322,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -1322,7 +1322,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
intel_fb = to_intel_framebuffer(crtc->fb); intel_fb = to_intel_framebuffer(crtc->fb);
obj = intel_fb->obj; obj = intel_fb->obj;
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = intel_pin_and_fence_fb_obj(dev, obj); 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,7 +1400,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
if (old_fb) { if (old_fb) {
intel_fb = to_intel_framebuffer(old_fb); intel_fb = to_intel_framebuffer(old_fb);
obj_priv = intel_fb->obj->driver_private; obj_priv = to_intel_bo(intel_fb->obj);
i915_gem_object_unpin(intel_fb->obj); i915_gem_object_unpin(intel_fb->obj);
} }
intel_increase_pllclock(crtc, true); intel_increase_pllclock(crtc, true);
...@@ -3510,7 +3510,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -3510,7 +3510,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
if (!bo) if (!bo)
return -ENOENT; return -ENOENT;
obj_priv = bo->driver_private; obj_priv = to_intel_bo(bo);
if (bo->size < width * height * 4) { if (bo->size < width * height * 4) {
DRM_ERROR("buffer is to small\n"); DRM_ERROR("buffer is to small\n");
...@@ -4155,7 +4155,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe) ...@@ -4155,7 +4155,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
work = intel_crtc->unpin_work; work = intel_crtc->unpin_work;
if (work == NULL || !work->pending) { if (work == NULL || !work->pending) {
if (work && !work->pending) { if (work && !work->pending) {
obj_priv = work->pending_flip_obj->driver_private; obj_priv = to_intel_bo(work->pending_flip_obj);
DRM_DEBUG_DRIVER("flip finish: %p (%d) not pending?\n", DRM_DEBUG_DRIVER("flip finish: %p (%d) not pending?\n",
obj_priv, obj_priv,
atomic_read(&obj_priv->pending_flip)); atomic_read(&obj_priv->pending_flip));
...@@ -4180,7 +4180,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe) ...@@ -4180,7 +4180,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
obj_priv = work->pending_flip_obj->driver_private; obj_priv = to_intel_bo(work->pending_flip_obj);
/* Initial scanout buffer will have a 0 pending flip count */ /* Initial scanout buffer will have a 0 pending flip count */
if ((atomic_read(&obj_priv->pending_flip) == 0) || if ((atomic_read(&obj_priv->pending_flip) == 0) ||
...@@ -4251,7 +4251,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -4251,7 +4251,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
ret = intel_pin_and_fence_fb_obj(dev, obj); ret = intel_pin_and_fence_fb_obj(dev, obj);
if (ret != 0) { if (ret != 0) {
DRM_DEBUG_DRIVER("flip queue: %p pin & fence failed\n", DRM_DEBUG_DRIVER("flip queue: %p pin & fence failed\n",
obj->driver_private); to_intel_bo(obj));
kfree(work); kfree(work);
intel_crtc->unpin_work = NULL; intel_crtc->unpin_work = NULL;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -4265,7 +4265,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -4265,7 +4265,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
crtc->fb = fb; crtc->fb = fb;
i915_gem_object_flush_write_domain(obj); i915_gem_object_flush_write_domain(obj);
drm_vblank_get(dev, intel_crtc->pipe); drm_vblank_get(dev, intel_crtc->pipe);
obj_priv = obj->driver_private; obj_priv = to_intel_bo(obj);
atomic_inc(&obj_priv->pending_flip); atomic_inc(&obj_priv->pending_flip);
work->pending_flip_obj = obj; work->pending_flip_obj = obj;
...@@ -4778,14 +4778,14 @@ void intel_init_clock_gating(struct drm_device *dev) ...@@ -4778,14 +4778,14 @@ void intel_init_clock_gating(struct drm_device *dev)
struct drm_i915_gem_object *obj_priv = NULL; struct drm_i915_gem_object *obj_priv = NULL;
if (dev_priv->pwrctx) { if (dev_priv->pwrctx) {
obj_priv = dev_priv->pwrctx->driver_private; obj_priv = to_intel_bo(dev_priv->pwrctx);
} else { } else {
struct drm_gem_object *pwrctx; struct drm_gem_object *pwrctx;
pwrctx = intel_alloc_power_context(dev); pwrctx = intel_alloc_power_context(dev);
if (pwrctx) { if (pwrctx) {
dev_priv->pwrctx = pwrctx; dev_priv->pwrctx = pwrctx;
obj_priv = pwrctx->driver_private; obj_priv = to_intel_bo(pwrctx);
} }
} }
...@@ -4956,7 +4956,7 @@ void intel_modeset_cleanup(struct drm_device *dev) ...@@ -4956,7 +4956,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
if (dev_priv->pwrctx) { if (dev_priv->pwrctx) {
struct drm_i915_gem_object *obj_priv; struct drm_i915_gem_object *obj_priv;
obj_priv = dev_priv->pwrctx->driver_private; obj_priv = to_intel_bo(dev_priv->pwrctx);
I915_WRITE(PWRCTXA, obj_priv->gtt_offset &~ PWRCTX_EN); I915_WRITE(PWRCTXA, obj_priv->gtt_offset &~ PWRCTX_EN);
I915_READ(PWRCTXA); I915_READ(PWRCTXA);
i915_gem_object_unpin(dev_priv->pwrctx); i915_gem_object_unpin(dev_priv->pwrctx);
......
...@@ -145,7 +145,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, ...@@ -145,7 +145,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
obj_priv = fbo->driver_private; obj_priv = to_intel_bo(fbo);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
......
...@@ -724,7 +724,7 @@ int intel_overlay_do_put_image(struct intel_overlay *overlay, ...@@ -724,7 +724,7 @@ int intel_overlay_do_put_image(struct intel_overlay *overlay,
int ret, tmp_width; int ret, tmp_width;
struct overlay_registers *regs; struct overlay_registers *regs;
bool scale_changed = false; bool scale_changed = false;
struct drm_i915_gem_object *bo_priv = new_bo->driver_private; struct drm_i915_gem_object *bo_priv = to_intel_bo(new_bo);
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
BUG_ON(!mutex_is_locked(&dev->struct_mutex)); BUG_ON(!mutex_is_locked(&dev->struct_mutex));
...@@ -809,7 +809,7 @@ int intel_overlay_do_put_image(struct intel_overlay *overlay, ...@@ -809,7 +809,7 @@ int intel_overlay_do_put_image(struct intel_overlay *overlay,
intel_overlay_continue(overlay, scale_changed); intel_overlay_continue(overlay, scale_changed);
overlay->old_vid_bo = overlay->vid_bo; overlay->old_vid_bo = overlay->vid_bo;
overlay->vid_bo = new_bo->driver_private; overlay->vid_bo = to_intel_bo(new_bo);
return 0; return 0;
...@@ -1344,7 +1344,7 @@ void intel_setup_overlay(struct drm_device *dev) ...@@ -1344,7 +1344,7 @@ void intel_setup_overlay(struct drm_device *dev)
reg_bo = drm_gem_object_alloc(dev, PAGE_SIZE); reg_bo = drm_gem_object_alloc(dev, PAGE_SIZE);
if (!reg_bo) if (!reg_bo)
goto out_free; goto out_free;
overlay->reg_bo = reg_bo->driver_private; overlay->reg_bo = to_intel_bo(reg_bo);
if (OVERLAY_NONPHYSICAL(dev)) { if (OVERLAY_NONPHYSICAL(dev)) {
ret = i915_gem_object_pin(reg_bo, PAGE_SIZE); ret = i915_gem_object_pin(reg_bo, PAGE_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment