aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-10-27 12:15:10 -0400
committerDave Airlie <airlied@redhat.com>2011-10-27 12:15:10 -0400
commit83f30d0e0343ad010afbc3523007b68e8b439694 (patch)
tree7f24184e5560f9daa63c34fa37a8824694822313 /drivers/gpu
parent9b553f72869584cc14d5724fbbc09f88de0f08de (diff)
Revert "drm/radeon/kms: add a new gem_wait ioctl with read/write flags"
This reverts commit d3ed74027f1dd197b7e08247a40d3bf9be1852b0. Further upstream discussion between Thomas and Marek decided this needed more work and driver specifics. So revert before it goes upstream. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c36
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.h2
7 files changed, 8 insertions, 46 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 156b8b7e028e..e3170c794c1d 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1142,8 +1142,6 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
1142 struct drm_file *filp); 1142 struct drm_file *filp);
1143int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, 1143int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,
1144 struct drm_file *filp); 1144 struct drm_file *filp);
1145int radeon_gem_wait_ioctl(struct drm_device *dev, void *data,
1146 struct drm_file *filp);
1147 1145
1148/* VRAM scratch page for HDP bug */ 1146/* VRAM scratch page for HDP bug */
1149struct r700_vram_scratch { 1147struct r700_vram_scratch {
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index f0b9066abc5c..14e853151105 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -80,10 +80,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
80 p->relocs[i].lobj.wdomain = r->write_domain; 80 p->relocs[i].lobj.wdomain = r->write_domain;
81 p->relocs[i].lobj.rdomain = r->read_domains; 81 p->relocs[i].lobj.rdomain = r->read_domains;
82 p->relocs[i].lobj.tv.bo = &p->relocs[i].robj->tbo; 82 p->relocs[i].lobj.tv.bo = &p->relocs[i].robj->tbo;
83 if (r->read_domains) 83 p->relocs[i].lobj.tv.usage = TTM_USAGE_READWRITE;
84 p->relocs[i].lobj.tv.usage |= TTM_USAGE_READ;
85 if (r->write_domain)
86 p->relocs[i].lobj.tv.usage |= TTM_USAGE_WRITE;
87 p->relocs[i].handle = r->handle; 84 p->relocs[i].handle = r->handle;
88 p->relocs[i].flags = r->flags; 85 p->relocs[i].flags = r->flags;
89 radeon_bo_list_add_object(&p->relocs[i].lobj, 86 radeon_bo_list_add_object(&p->relocs[i].lobj,
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index bd187e097e77..e71d2ed7fa11 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -52,10 +52,9 @@
52 * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query 52 * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query
53 * 2.10.0 - fusion 2D tiling 53 * 2.10.0 - fusion 2D tiling
54 * 2.11.0 - backend map, initial compute support for the CS checker 54 * 2.11.0 - backend map, initial compute support for the CS checker
55 * 2.12.0 - DRM_RADEON_GEM_WAIT ioctl
56 */ 55 */
57#define KMS_DRIVER_MAJOR 2 56#define KMS_DRIVER_MAJOR 2
58#define KMS_DRIVER_MINOR 12 57#define KMS_DRIVER_MINOR 11
59#define KMS_DRIVER_PATCHLEVEL 0 58#define KMS_DRIVER_PATCHLEVEL 0
60int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 59int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
61int radeon_driver_unload_kms(struct drm_device *dev); 60int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 2edc2a40d4d7..aa1ca2dea42f 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -122,7 +122,7 @@ int radeon_gem_set_domain(struct drm_gem_object *gobj,
122 } 122 }
123 if (domain == RADEON_GEM_DOMAIN_CPU) { 123 if (domain == RADEON_GEM_DOMAIN_CPU) {
124 /* Asking for cpu access wait for object idle */ 124 /* Asking for cpu access wait for object idle */
125 r = radeon_bo_wait(robj, NULL, false, TTM_USAGE_READWRITE); 125 r = radeon_bo_wait(robj, NULL, false);
126 if (r) { 126 if (r) {
127 printk(KERN_ERR "Failed to wait for object !\n"); 127 printk(KERN_ERR "Failed to wait for object !\n");
128 return r; 128 return r;
@@ -273,7 +273,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
273 return -ENOENT; 273 return -ENOENT;
274 } 274 }
275 robj = gem_to_radeon_bo(gobj); 275 robj = gem_to_radeon_bo(gobj);
276 r = radeon_bo_wait(robj, &cur_placement, true, TTM_USAGE_READWRITE); 276 r = radeon_bo_wait(robj, &cur_placement, true);
277 switch (cur_placement) { 277 switch (cur_placement) {
278 case TTM_PL_VRAM: 278 case TTM_PL_VRAM:
279 args->domain = RADEON_GEM_DOMAIN_VRAM; 279 args->domain = RADEON_GEM_DOMAIN_VRAM;
@@ -303,7 +303,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
303 return -ENOENT; 303 return -ENOENT;
304 } 304 }
305 robj = gem_to_radeon_bo(gobj); 305 robj = gem_to_radeon_bo(gobj);
306 r = radeon_bo_wait(robj, NULL, false, TTM_USAGE_READWRITE); 306 r = radeon_bo_wait(robj, NULL, false);
307 /* callback hw specific functions if any */ 307 /* callback hw specific functions if any */
308 if (robj->rdev->asic->ioctl_wait_idle) 308 if (robj->rdev->asic->ioctl_wait_idle)
309 robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); 309 robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj);
@@ -311,36 +311,6 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
311 return r; 311 return r;
312} 312}
313 313
314int radeon_gem_wait_ioctl(struct drm_device *dev, void *data,
315 struct drm_file *filp)
316{
317 struct drm_radeon_gem_wait *args = data;
318 struct drm_gem_object *gobj;
319 struct radeon_bo *robj;
320 bool no_wait = (args->flags & RADEON_GEM_NO_WAIT) != 0;
321 enum ttm_buffer_usage usage = 0;
322 int r;
323
324 if (args->flags & RADEON_GEM_USAGE_READ)
325 usage |= TTM_USAGE_READ;
326 if (args->flags & RADEON_GEM_USAGE_WRITE)
327 usage |= TTM_USAGE_WRITE;
328 if (!usage)
329 usage = TTM_USAGE_READWRITE;
330
331 gobj = drm_gem_object_lookup(dev, filp, args->handle);
332 if (gobj == NULL) {
333 return -ENOENT;
334 }
335 robj = gem_to_radeon_bo(gobj);
336 r = radeon_bo_wait(robj, NULL, no_wait, usage);
337 /* callback hw specific functions if any */
338 if (!no_wait && robj->rdev->asic->ioctl_wait_idle)
339 robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj);
340 drm_gem_object_unreference_unlocked(gobj);
341 return r;
342}
343
344int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, 314int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
345 struct drm_file *filp) 315 struct drm_file *filp)
346{ 316{
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index a749c262663f..be2c1224e68a 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -451,6 +451,5 @@ struct drm_ioctl_desc radeon_ioctls_kms[] = {
451 DRM_IOCTL_DEF_DRV(RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH|DRM_UNLOCKED), 451 DRM_IOCTL_DEF_DRV(RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH|DRM_UNLOCKED),
452 DRM_IOCTL_DEF_DRV(RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH|DRM_UNLOCKED), 452 DRM_IOCTL_DEF_DRV(RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH|DRM_UNLOCKED),
453 DRM_IOCTL_DEF_DRV(RADEON_GEM_BUSY, radeon_gem_busy_ioctl, DRM_AUTH|DRM_UNLOCKED), 453 DRM_IOCTL_DEF_DRV(RADEON_GEM_BUSY, radeon_gem_busy_ioctl, DRM_AUTH|DRM_UNLOCKED),
454 DRM_IOCTL_DEF_DRV(RADEON_GEM_WAIT, radeon_gem_wait_ioctl, DRM_AUTH|DRM_UNLOCKED),
455}; 454};
456int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms); 455int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms);
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 138839312e8b..b8f75f5d344b 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -516,8 +516,7 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
516 return 0; 516 return 0;
517} 517}
518 518
519int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, bool no_wait, 519int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, bool no_wait)
520 enum ttm_buffer_usage usage)
521{ 520{
522 int r; 521 int r;
523 522
@@ -528,7 +527,7 @@ int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, bool no_wait,
528 if (mem_type) 527 if (mem_type)
529 *mem_type = bo->tbo.mem.mem_type; 528 *mem_type = bo->tbo.mem.mem_type;
530 if (bo->tbo.sync_obj) 529 if (bo->tbo.sync_obj)
531 r = ttm_bo_wait(&bo->tbo, true, true, no_wait, usage); 530 r = ttm_bo_wait(&bo->tbo, true, true, no_wait, false);
532 spin_unlock(&bo->tbo.bdev->fence_lock); 531 spin_unlock(&bo->tbo.bdev->fence_lock);
533 ttm_bo_unreserve(&bo->tbo); 532 ttm_bo_unreserve(&bo->tbo);
534 return r; 533 return r;
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
index c6c8e43e6d9a..b07f0f9b8627 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -98,7 +98,7 @@ static inline u64 radeon_bo_mmap_offset(struct radeon_bo *bo)
98} 98}
99 99
100extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, 100extern int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
101 bool no_wait, enum ttm_buffer_usage usage); 101 bool no_wait);
102 102
103extern int radeon_bo_create(struct radeon_device *rdev, 103extern int radeon_bo_create(struct radeon_device *rdev,
104 unsigned long size, int byte_align, 104 unsigned long size, int byte_align,