All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] various drm core cleanups
@ 2010-08-23 20:53 Daniel Vetter
  2010-08-23 20:53 ` [PATCH 01/14] drm: don't export drm_sg_alloc Daniel Vetter
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Hi all,

The following patch-pile contains various cleanups in the drm core. All but
patch 12 are resends. I've gone ahead and added the two reviewed-bys that
patch 9 scored on the first submission to the patch.

Patches apply on top of latest drm-core-next. Tested on my agp rv570 (kms and
ums) i945gm and ironlake (both kms only). Other drivers compile-tested.

Forward-porting these already a few months old patches only resulted in one
trivial conflict. Hence I think that merging this early won't cause a merging
headache.

Please review and (re)consider for merging to -next.

Thanks, Daniel

Daniel Vetter (14):
  drm: don't export drm_sg_alloc
  drm: kill kernel_context_switch callbacks
  drm: kill dma_ready callbacks
  drm: kill procfs callbacks
  drm: kill drm_map_ofs callbacks
  drm: kill get_reg_ofs callback
  drm: kill context_ctor callback
  drm: don't export drm_get_drawable_info
  drm: replace drawable ioctl by noops
  drm: kill dev->timer
  drm: kill gem_free_object_unlocked driver callback
  drm: don't export dri1 locking functions
  drm: drop return value of drm_free_agp
  drm: kill agp indirection mess

 drivers/gpu/drm/Makefile              |    2 +-
 drivers/gpu/drm/drm_agpsupport.c      |   40 +------
 drivers/gpu/drm/drm_context.c         |    8 --
 drivers/gpu/drm/drm_drawable.c        |  198 ---------------------------------
 drivers/gpu/drm/drm_drv.c             |   10 +-
 drivers/gpu/drm/drm_gem.c             |    4 +-
 drivers/gpu/drm/drm_lock.c            |   31 +-----
 drivers/gpu/drm/drm_memory.c          |   14 +--
 drivers/gpu/drm/drm_proc.c            |   13 --
 drivers/gpu/drm/drm_scatter.c         |    2 -
 drivers/gpu/drm/drm_stub.c            |    4 -
 drivers/gpu/drm/drm_vm.c              |   13 +--
 drivers/gpu/drm/i810/i810_drv.c       |    2 -
 drivers/gpu/drm/i830/i830_drv.c       |    2 -
 drivers/gpu/drm/i915/i915_drv.c       |    2 -
 drivers/gpu/drm/mga/mga_drv.c         |    2 -
 drivers/gpu/drm/nouveau/nouveau_drv.c |    2 -
 drivers/gpu/drm/r128/r128_drv.c       |    2 -
 drivers/gpu/drm/radeon/radeon_drv.c   |    4 -
 drivers/gpu/drm/savage/savage_drv.c   |    2 -
 drivers/gpu/drm/sis/sis_drv.c         |    3 -
 drivers/gpu/drm/tdfx/tdfx_drv.c       |    2 -
 drivers/gpu/drm/via/via_drv.c         |    2 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |    2 -
 include/drm/drmP.h                    |   38 +------
 25 files changed, 19 insertions(+), 385 deletions(-)
 delete mode 100644 drivers/gpu/drm/drm_drawable.c

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/14] drm: don't export drm_sg_alloc
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 02/14] drm: kill kernel_context_switch callbacks Daniel Vetter
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

It's not used internally by any driver, only by some generic ioctls.
So don't export it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_scatter.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index 9034c4c..d15e09b 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -184,8 +184,6 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
 	drm_sg_cleanup(entry);
 	return -ENOMEM;
 }
-EXPORT_SYMBOL(drm_sg_alloc);
-
 
 int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/14] drm: kill kernel_context_switch callbacks
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
  2010-08-23 20:53 ` [PATCH 01/14] drm: don't export drm_sg_alloc Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 03/14] drm: kill dma_ready callbacks Daniel Vetter
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Not used by any in-kernel driver. So drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_lock.c |   18 ------------------
 include/drm/drmP.h         |    3 ---
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index e2f70a5..566d203 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -134,12 +134,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 		}
 	}
 
-	if (dev->driver->kernel_context_switch &&
-	    dev->last_context != lock->context) {
-		dev->driver->kernel_context_switch(dev, dev->last_context,
-						   lock->context);
-	}
-
 	return 0;
 }
 
@@ -157,7 +151,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
 	struct drm_lock *lock = data;
-	struct drm_master *master = file_priv->master;
 
 	if (lock->context == DRM_KERNEL_CONTEXT) {
 		DRM_ERROR("Process %d using kernel context %d\n",
@@ -167,17 +160,6 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 
 	atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
 
-	/* kernel_context_switch isn't used by any of the x86 drm
-	 * modules but is required by the Sparc driver.
-	 */
-	if (dev->driver->kernel_context_switch_unlock)
-		dev->driver->kernel_context_switch_unlock(dev);
-	else {
-		if (drm_lock_free(&master->lock, lock->context)) {
-			/* FIXME: Should really bail out here. */
-		}
-	}
-
 	unblock_all_signals();
 	return 0;
 }
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7809d23..15ea8c4 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -703,9 +703,6 @@ struct drm_driver {
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_ctor) (struct drm_device *dev, int context);
 	int (*context_dtor) (struct drm_device *dev, int context);
-	int (*kernel_context_switch) (struct drm_device *dev, int old,
-				      int new);
-	void (*kernel_context_switch_unlock) (struct drm_device *dev);
 
 	/**
 	 * get_vblank_counter - get raw hardware vblank counter
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/14] drm: kill dma_ready callbacks
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
  2010-08-23 20:53 ` [PATCH 01/14] drm: don't export drm_sg_alloc Daniel Vetter
  2010-08-23 20:53 ` [PATCH 02/14] drm: kill kernel_context_switch callbacks Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 04/14] drm: kill procfs callbacks Daniel Vetter
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Not used by any driver. So drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_lock.c |    3 ---
 include/drm/drmP.h         |    1 -
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 566d203..1973d75 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -122,9 +122,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 		block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
 	}
 
-	if (dev->driver->dma_ready && (lock->flags & _DRM_LOCK_READY))
-		dev->driver->dma_ready(dev);
-
 	if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
 	{
 		if (dev->driver->dma_quiescent(dev)) {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 15ea8c4..3dd8796 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -699,7 +699,6 @@ struct drm_driver {
 	int (*suspend) (struct drm_device *, pm_message_t state);
 	int (*resume) (struct drm_device *);
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
-	void (*dma_ready) (struct drm_device *);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_ctor) (struct drm_device *dev, int context);
 	int (*context_dtor) (struct drm_device *dev, int context);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/14] drm: kill procfs callbacks
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (2 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 03/14] drm: kill dma_ready callbacks Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 05/14] drm: kill drm_map_ofs callbacks Daniel Vetter
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Not used by any driver (rightly so!). Kill them.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_proc.c |   13 -------------
 include/drm/drmP.h         |    2 --
 2 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index a9ba6b6..e571de5 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -151,7 +151,6 @@ fail:
 int drm_proc_init(struct drm_minor *minor, int minor_id,
 		  struct proc_dir_entry *root)
 {
-	struct drm_device *dev = minor->dev;
 	char name[64];
 	int ret;
 
@@ -172,14 +171,6 @@ int drm_proc_init(struct drm_minor *minor, int minor_id,
 		return ret;
 	}
 
-	if (dev->driver->proc_init) {
-		ret = dev->driver->proc_init(minor);
-		if (ret) {
-			DRM_ERROR("DRM: Driver failed to initialize "
-				  "/proc/dri.\n");
-			return ret;
-		}
-	}
 	return 0;
 }
 
@@ -216,15 +207,11 @@ int drm_proc_remove_files(struct drm_info_list *files, int count,
  */
 int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
 {
-	struct drm_device *dev = minor->dev;
 	char name[64];
 
 	if (!root || !minor->proc_root)
 		return 0;
 
-	if (dev->driver->proc_cleanup)
-		dev->driver->proc_cleanup(minor);
-
 	drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor);
 
 	sprintf(name, "%d", minor->index);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3dd8796..d5a2b88 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -791,8 +791,6 @@ struct drm_driver {
 	void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv,
 			    bool from_release);
 
-	int (*proc_init)(struct drm_minor *minor);
-	void (*proc_cleanup)(struct drm_minor *minor);
 	int (*debugfs_init)(struct drm_minor *minor);
 	void (*debugfs_cleanup)(struct drm_minor *minor);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/14] drm: kill drm_map_ofs callbacks
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (3 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 04/14] drm: kill procfs callbacks Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 06/14] drm: kill get_reg_ofs callback Daniel Vetter
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

All drivers happily copy&pasted the default implementation without
checking whether this callback is used at all. It's not. Sigh.

Kill it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_vm.c              |    7 -------
 drivers/gpu/drm/i810/i810_drv.c       |    1 -
 drivers/gpu/drm/i830/i830_drv.c       |    1 -
 drivers/gpu/drm/i915/i915_drv.c       |    1 -
 drivers/gpu/drm/mga/mga_drv.c         |    1 -
 drivers/gpu/drm/nouveau/nouveau_drv.c |    1 -
 drivers/gpu/drm/r128/r128_drv.c       |    1 -
 drivers/gpu/drm/radeon/radeon_drv.c   |    2 --
 drivers/gpu/drm/savage/savage_drv.c   |    1 -
 drivers/gpu/drm/sis/sis_drv.c         |    1 -
 drivers/gpu/drm/tdfx/tdfx_drv.c       |    1 -
 drivers/gpu/drm/via/via_drv.c         |    1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |    1 -
 include/drm/drmP.h                    |    2 --
 14 files changed, 0 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index fda6746..2fea2e6 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -515,13 +515,6 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
 	return 0;
 }
 
-resource_size_t drm_core_get_map_ofs(struct drm_local_map * map)
-{
-	return map->offset;
-}
-
-EXPORT_SYMBOL(drm_core_get_map_ofs);
-
 resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
 {
 #ifdef __alpha__
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index b4250b2..084a85c 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -52,7 +52,6 @@ static struct drm_driver driver = {
 	.device_is_agp = i810_driver_device_is_agp,
 	.reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
 	.dma_quiescent = i810_driver_dma_quiescent,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = i810_ioctls,
 	.fops = {
diff --git a/drivers/gpu/drm/i830/i830_drv.c b/drivers/gpu/drm/i830/i830_drv.c
index a5c66aa..1635295 100644
--- a/drivers/gpu/drm/i830/i830_drv.c
+++ b/drivers/gpu/drm/i830/i830_drv.c
@@ -57,7 +57,6 @@ static struct drm_driver driver = {
 	.device_is_agp = i830_driver_device_is_agp,
 	.reclaim_buffers_locked = i830_driver_reclaim_buffers_locked,
 	.dma_quiescent = i830_driver_dma_quiescent,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 #if USE_IRQS
 	.irq_preinstall = i830_driver_irq_preinstall,
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 5044f65..6d7e4cd 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -523,7 +523,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = i915_driver_irq_uninstall,
 	.irq_handler = i915_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.master_create = i915_master_create,
 	.master_destroy = i915_master_destroy,
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index 26d0d8c..e9c0cbc 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -60,7 +60,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = mga_driver_irq_uninstall,
 	.irq_handler = mga_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = mga_ioctls,
 	.dma_ioctl = mga_dma_buffers,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index 1de5eb5..0d64259 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -379,7 +379,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = nouveau_irq_uninstall,
 	.irq_handler = nouveau_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = nouveau_ioctls,
 	.fops = {
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 1e2971f..42ec20a 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -56,7 +56,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = r128_driver_irq_uninstall,
 	.irq_handler = r128_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = r128_ioctls,
 	.dma_ioctl = r128_cce_buffers,
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 795403b..8fd89bb 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -203,7 +203,6 @@ static struct drm_driver driver_old = {
 	.irq_uninstall = radeon_driver_irq_uninstall,
 	.irq_handler = radeon_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = radeon_ioctls,
 	.dma_ioctl = radeon_cp_buffers,
@@ -290,7 +289,6 @@ static struct drm_driver kms_driver = {
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
 	.irq_handler = radeon_driver_irq_handler_kms,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = radeon_ioctls_kms,
 	.gem_init_object = radeon_gem_object_init,
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
index 021de44..f539996 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -42,7 +42,6 @@ static struct drm_driver driver = {
 	.lastclose = savage_driver_lastclose,
 	.unload = savage_driver_unload,
 	.reclaim_buffers = savage_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = savage_ioctls,
 	.dma_ioctl = savage_bci_buffers,
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 776bf9e..66208ba 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -72,7 +72,6 @@ static struct drm_driver driver = {
 	.reclaim_buffers = NULL,
 	.reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
 	.lastclose = sis_lastclose,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = sis_ioctls,
 	.fops = {
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
index ec5a43e..38a5626 100644
--- a/drivers/gpu/drm/tdfx/tdfx_drv.c
+++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
@@ -42,7 +42,6 @@ static struct pci_device_id pciidlist[] = {
 static struct drm_driver driver = {
 	.driver_features = DRIVER_USE_MTRR,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.fops = {
 		 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index 7a1b210..0b9ad8b 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -51,7 +51,6 @@ static struct drm_driver driver = {
 	.reclaim_buffers_locked = NULL,
 	.reclaim_buffers_idlelocked = via_reclaim_buffers_locked,
 	.lastclose = via_lastclose,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = via_ioctls,
 	.fops = {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 72ec2e2..4a832de 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -723,7 +723,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = vmw_irq_uninstall,
 	.irq_handler = vmw_irq_handler,
 	.reclaim_buffers_locked = NULL,
-	.get_map_ofs = drm_core_get_map_ofs,
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = vmw_ioctls,
 	.num_ioctls = DRM_ARRAY_SIZE(vmw_ioctls),
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d5a2b88..4d9a941 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -773,7 +773,6 @@ struct drm_driver {
 					struct drm_file *file_priv);
 	void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
 					    struct drm_file *file_priv);
-	resource_size_t (*get_map_ofs) (struct drm_local_map * map);
 	resource_size_t (*get_reg_ofs) (struct drm_device *dev);
 	void (*set_version) (struct drm_device *dev,
 			     struct drm_set_version *sv);
@@ -1169,7 +1168,6 @@ extern int drm_release(struct inode *inode, struct file *filp);
 extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
 extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
 extern void drm_vm_open_locked(struct vm_area_struct *vma);
-extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
 extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
 extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/14] drm: kill get_reg_ofs callback
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (4 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 05/14] drm: kill drm_map_ofs callbacks Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 07/14] drm: kill context_ctor callback Daniel Vetter
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Every driver used the default implementation. Fold that one into
the only callsite and drop the callback.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_vm.c              |    6 ++----
 drivers/gpu/drm/i810/i810_drv.c       |    1 -
 drivers/gpu/drm/i830/i830_drv.c       |    1 -
 drivers/gpu/drm/i915/i915_drv.c       |    1 -
 drivers/gpu/drm/mga/mga_drv.c         |    1 -
 drivers/gpu/drm/nouveau/nouveau_drv.c |    1 -
 drivers/gpu/drm/r128/r128_drv.c       |    1 -
 drivers/gpu/drm/radeon/radeon_drv.c   |    2 --
 drivers/gpu/drm/savage/savage_drv.c   |    1 -
 drivers/gpu/drm/sis/sis_drv.c         |    1 -
 drivers/gpu/drm/tdfx/tdfx_drv.c       |    1 -
 drivers/gpu/drm/via/via_drv.c         |    1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |    1 -
 include/drm/drmP.h                    |    2 --
 14 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 2fea2e6..ee879d6 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -515,7 +515,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
 	return 0;
 }
 
-resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
+static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
 {
 #ifdef __alpha__
 	return dev->hose->dense_mem_base - dev->hose->mem_space->start;
@@ -524,8 +524,6 @@ resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
 #endif
 }
 
-EXPORT_SYMBOL(drm_core_get_reg_ofs);
-
 /**
  * mmap DMA memory.
  *
@@ -612,7 +610,7 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 #endif
 	case _DRM_FRAME_BUFFER:
 	case _DRM_REGISTERS:
-		offset = dev->driver->get_reg_ofs(dev);
+		offset = drm_core_get_reg_ofs(dev);
 		vma->vm_flags |= VM_IO;	/* not in core dump */
 		vma->vm_page_prot = drm_io_prot(map->type, vma);
 #if !defined(__arm__)
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index 084a85c..1c73b0c 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -52,7 +52,6 @@ static struct drm_driver driver = {
 	.device_is_agp = i810_driver_device_is_agp,
 	.reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
 	.dma_quiescent = i810_driver_dma_quiescent,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = i810_ioctls,
 	.fops = {
 		 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/i830/i830_drv.c b/drivers/gpu/drm/i830/i830_drv.c
index 1635295..7140ffc 100644
--- a/drivers/gpu/drm/i830/i830_drv.c
+++ b/drivers/gpu/drm/i830/i830_drv.c
@@ -57,7 +57,6 @@ static struct drm_driver driver = {
 	.device_is_agp = i830_driver_device_is_agp,
 	.reclaim_buffers_locked = i830_driver_reclaim_buffers_locked,
 	.dma_quiescent = i830_driver_dma_quiescent,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 #if USE_IRQS
 	.irq_preinstall = i830_driver_irq_preinstall,
 	.irq_postinstall = i830_driver_irq_postinstall,
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6d7e4cd..f627380 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -523,7 +523,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = i915_driver_irq_uninstall,
 	.irq_handler = i915_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.master_create = i915_master_create,
 	.master_destroy = i915_master_destroy,
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index e9c0cbc..65ea42c 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -60,7 +60,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = mga_driver_irq_uninstall,
 	.irq_handler = mga_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = mga_ioctls,
 	.dma_ioctl = mga_dma_buffers,
 	.fops = {
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index 0d64259..209912a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -379,7 +379,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = nouveau_irq_uninstall,
 	.irq_handler = nouveau_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = nouveau_ioctls,
 	.fops = {
 		.owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 42ec20a..67309f8 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -56,7 +56,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = r128_driver_irq_uninstall,
 	.irq_handler = r128_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = r128_ioctls,
 	.dma_ioctl = r128_cce_buffers,
 	.fops = {
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 8fd89bb..663cdc1 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -203,7 +203,6 @@ static struct drm_driver driver_old = {
 	.irq_uninstall = radeon_driver_irq_uninstall,
 	.irq_handler = radeon_driver_irq_handler,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = radeon_ioctls,
 	.dma_ioctl = radeon_cp_buffers,
 	.fops = {
@@ -289,7 +288,6 @@ static struct drm_driver kms_driver = {
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
 	.irq_handler = radeon_driver_irq_handler_kms,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = radeon_ioctls_kms,
 	.gem_init_object = radeon_gem_object_init,
 	.gem_free_object = radeon_gem_object_free,
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
index f539996..c038563 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -42,7 +42,6 @@ static struct drm_driver driver = {
 	.lastclose = savage_driver_lastclose,
 	.unload = savage_driver_unload,
 	.reclaim_buffers = savage_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = savage_ioctls,
 	.dma_ioctl = savage_bci_buffers,
 	.fops = {
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 66208ba..39f098a 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -72,7 +72,6 @@ static struct drm_driver driver = {
 	.reclaim_buffers = NULL,
 	.reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
 	.lastclose = sis_lastclose,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = sis_ioctls,
 	.fops = {
 		 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
index 38a5626..e0768ad 100644
--- a/drivers/gpu/drm/tdfx/tdfx_drv.c
+++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
@@ -42,7 +42,6 @@ static struct pci_device_id pciidlist[] = {
 static struct drm_driver driver = {
 	.driver_features = DRIVER_USE_MTRR,
 	.reclaim_buffers = drm_core_reclaim_buffers,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.fops = {
 		 .owner = THIS_MODULE,
 		 .open = drm_open,
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index 0b9ad8b..02f733d 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -51,7 +51,6 @@ static struct drm_driver driver = {
 	.reclaim_buffers_locked = NULL,
 	.reclaim_buffers_idlelocked = via_reclaim_buffers_locked,
 	.lastclose = via_lastclose,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = via_ioctls,
 	.fops = {
 		.owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 4a832de..e645f44 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -723,7 +723,6 @@ static struct drm_driver driver = {
 	.irq_uninstall = vmw_irq_uninstall,
 	.irq_handler = vmw_irq_handler,
 	.reclaim_buffers_locked = NULL,
-	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = vmw_ioctls,
 	.num_ioctls = DRM_ARRAY_SIZE(vmw_ioctls),
 	.dma_quiescent = NULL,	/*vmw_dma_quiescent, */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 4d9a941..b139de9 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -773,7 +773,6 @@ struct drm_driver {
 					struct drm_file *file_priv);
 	void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
 					    struct drm_file *file_priv);
-	resource_size_t (*get_reg_ofs) (struct drm_device *dev);
 	void (*set_version) (struct drm_device *dev,
 			     struct drm_set_version *sv);
 
@@ -1168,7 +1167,6 @@ extern int drm_release(struct inode *inode, struct file *filp);
 extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
 extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
 extern void drm_vm_open_locked(struct vm_area_struct *vma);
-extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
 extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
 
 				/* Memory management support (drm_memory.h) */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/14] drm: kill context_ctor callback
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (5 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 06/14] drm: kill get_reg_ofs callback Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 08/14] drm: don't export drm_get_drawable_info Daniel Vetter
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

It's not used by any driver. The destructor callback is unfortunately
used by the via driver in a rather convoluted piece of code used
to reimplement something resembling broken futexes. I didn't dare
to touch this code. But at least kill the needless NULL assignemt
in the sis driver.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_context.c |    8 --------
 drivers/gpu/drm/sis/sis_drv.c |    1 -
 include/drm/drmP.h            |    1 -
 3 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index 2607753..6d440fb 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -333,14 +333,6 @@ int drm_addctx(struct drm_device *dev, void *data,
 		return -ENOMEM;
 	}
 
-	if (ctx->handle != DRM_KERNEL_CONTEXT) {
-		if (dev->driver->context_ctor)
-			if (!dev->driver->context_ctor(dev, ctx->handle)) {
-				DRM_DEBUG("Running out of ctxs or memory.\n");
-				return -ENOMEM;
-			}
-	}
-
 	ctx_entry = kmalloc(sizeof(*ctx_entry), GFP_KERNEL);
 	if (!ctx_entry) {
 		DRM_DEBUG("out of memory\n");
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 39f098a..4d9f311 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -67,7 +67,6 @@ static struct drm_driver driver = {
 	.driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
 	.load = sis_driver_load,
 	.unload = sis_driver_unload,
-	.context_dtor = NULL,
 	.dma_quiescent = sis_idle,
 	.reclaim_buffers = NULL,
 	.reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b139de9..4fc2ea2 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -700,7 +700,6 @@ struct drm_driver {
 	int (*resume) (struct drm_device *);
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
-	int (*context_ctor) (struct drm_device *dev, int context);
 	int (*context_dtor) (struct drm_device *dev, int context);
 
 	/**
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/14] drm: don't export drm_get_drawable_info
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (6 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 07/14] drm: kill context_ctor callback Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 09/14] drm: replace drawable ioctl by noops Daniel Vetter
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Not used by any in-tree user. So drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_drawable.c |    3 +--
 include/drm/drmP.h             |    2 --
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c
index c53c976..170e531 100644
--- a/drivers/gpu/drm/drm_drawable.c
+++ b/drivers/gpu/drm/drm_drawable.c
@@ -173,11 +173,10 @@ error:
 /**
  * Caller must hold the drawable spinlock!
  */
-struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, drm_drawable_t id)
+static struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, drm_drawable_t id)
 {
 	return idr_find(&dev->drw_idr, id);
 }
-EXPORT_SYMBOL(drm_get_drawable_info);
 
 static int drm_drawable_free(int idr, void *p, void *data)
 {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 4fc2ea2..2357a69 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1235,8 +1235,6 @@ extern int drm_rmdraw(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv);
 extern int drm_update_drawable_info(struct drm_device *dev, void *data,
 				    struct drm_file *file_priv);
-extern struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
-						  drm_drawable_t id);
 extern void drm_drawable_free_all(struct drm_device *dev);
 
 				/* Authentication IOCTL support (drm_auth.h) */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/14] drm: replace drawable ioctl by noops
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (7 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 08/14] drm: don't export drm_get_drawable_info Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 10/14] drm: kill dev->timer Daniel Vetter
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

The information supplied by userspace through these ioctls is only
accessible by dev->drw_idr. But there's no in-tree user of that.
Also userspace does not really care about return values of these ioctls,
either. Only hw/xfree86/dri/dri.c from the xserver actually checks the
return from adddraw and keeps on trying to create a kernel drawable
every time somebody creates a dri drawable. But since that's now a noop,
who cares.

Therefore it's safe to replace these three ioctls with noops and rip
out the implementation.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
---
 drivers/gpu/drm/Makefile       |    2 +-
 drivers/gpu/drm/drm_drawable.c |  197 ----------------------------------------
 drivers/gpu/drm/drm_drv.c      |    8 +-
 drivers/gpu/drm/drm_stub.c     |    3 -
 include/drm/drmP.h             |   15 ---
 5 files changed, 4 insertions(+), 221 deletions(-)
 delete mode 100644 drivers/gpu/drm/drm_drawable.c

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index f3a23a3..997c43d 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -5,7 +5,7 @@
 ccflags-y := -Iinclude/drm
 
 drm-y       :=	drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
-		drm_context.o drm_dma.o drm_drawable.o \
+		drm_context.o drm_dma.o \
 		drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
 		drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
 		drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c
deleted file mode 100644
index 170e531..0000000
--- a/drivers/gpu/drm/drm_drawable.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/**
- * \file drm_drawable.c
- * IOCTLs for drawables
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- * \author Michel Dänzer <michel@tungstengraphics.com>
- */
-
-/*
- * Created: Tue Feb  2 08:37:54 1999 by faith@valinux.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * Copyright 2006 Tungsten Graphics, Inc., Bismarck, North Dakota.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "drmP.h"
-
-/**
- * Allocate drawable ID and memory to store information about it.
- */
-int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
-	unsigned long irqflags;
-	struct drm_draw *draw = data;
-	int new_id = 0;
-	int ret;
-
-again:
-	if (idr_pre_get(&dev->drw_idr, GFP_KERNEL) == 0) {
-		DRM_ERROR("Out of memory expanding drawable idr\n");
-		return -ENOMEM;
-	}
-
-	spin_lock_irqsave(&dev->drw_lock, irqflags);
-	ret = idr_get_new_above(&dev->drw_idr, NULL, 1, &new_id);
-	if (ret == -EAGAIN) {
-		spin_unlock_irqrestore(&dev->drw_lock, irqflags);
-		goto again;
-	}
-
-	spin_unlock_irqrestore(&dev->drw_lock, irqflags);
-
-	draw->handle = new_id;
-
-	DRM_DEBUG("%d\n", draw->handle);
-
-	return 0;
-}
-
-/**
- * Free drawable ID and memory to store information about it.
- */
-int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
-	struct drm_draw *draw = data;
-	unsigned long irqflags;
-	struct drm_drawable_info *info;
-
-	spin_lock_irqsave(&dev->drw_lock, irqflags);
-
-	info = drm_get_drawable_info(dev, draw->handle);
-	if (info == NULL) {
-		spin_unlock_irqrestore(&dev->drw_lock, irqflags);
-		return -EINVAL;
-	}
-	kfree(info->rects);
-	kfree(info);
-
-	idr_remove(&dev->drw_idr, draw->handle);
-
-	spin_unlock_irqrestore(&dev->drw_lock, irqflags);
-	DRM_DEBUG("%d\n", draw->handle);
-	return 0;
-}
-
-int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
-	struct drm_update_draw *update = data;
-	unsigned long irqflags;
-	struct drm_clip_rect *rects;
-	struct drm_drawable_info *info;
-	int err;
-
-	info = idr_find(&dev->drw_idr, update->handle);
-	if (!info) {
-		info = kzalloc(sizeof(*info), GFP_KERNEL);
-		if (!info)
-			return -ENOMEM;
-		if (IS_ERR(idr_replace(&dev->drw_idr, info, update->handle))) {
-			DRM_ERROR("No such drawable %d\n", update->handle);
-			kfree(info);
-			return -EINVAL;
-		}
-	}
-
-	switch (update->type) {
-	case DRM_DRAWABLE_CLIPRECTS:
-		if (update->num == 0)
-			rects = NULL;
-		else if (update->num != info->num_rects) {
-			rects = kmalloc(update->num *
-					sizeof(struct drm_clip_rect),
-					GFP_KERNEL);
-		} else
-			rects = info->rects;
-
-		if (update->num && !rects) {
-			DRM_ERROR("Failed to allocate cliprect memory\n");
-			err = -ENOMEM;
-			goto error;
-		}
-
-		if (update->num && DRM_COPY_FROM_USER(rects,
-						     (struct drm_clip_rect __user *)
-						     (unsigned long)update->data,
-						     update->num *
-						     sizeof(*rects))) {
-			DRM_ERROR("Failed to copy cliprects from userspace\n");
-			err = -EFAULT;
-			goto error;
-		}
-
-		spin_lock_irqsave(&dev->drw_lock, irqflags);
-
-		if (rects != info->rects) {
-			kfree(info->rects);
-		}
-
-		info->rects = rects;
-		info->num_rects = update->num;
-
-		spin_unlock_irqrestore(&dev->drw_lock, irqflags);
-
-		DRM_DEBUG("Updated %d cliprects for drawable %d\n",
-			  info->num_rects, update->handle);
-		break;
-	default:
-		DRM_ERROR("Invalid update type %d\n", update->type);
-		return -EINVAL;
-	}
-
-	return 0;
-
-error:
-	if (rects != info->rects)
-		kfree(rects);
-
-	return err;
-}
-
-/**
- * Caller must hold the drawable spinlock!
- */
-static struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, drm_drawable_t id)
-{
-	return idr_find(&dev->drw_idr, id);
-}
-
-static int drm_drawable_free(int idr, void *p, void *data)
-{
-	struct drm_drawable_info *info = p;
-
-	if (info) {
-		kfree(info->rects);
-		kfree(info);
-	}
-
-	return 0;
-}
-
-void drm_drawable_free_all(struct drm_device *dev)
-{
-	idr_for_each(&dev->drw_idr, drm_drawable_free, NULL);
-	idr_remove_all(&dev->drw_idr);
-}
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 84da748..a35a410 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -91,8 +91,8 @@ static struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_NEW_CTX, drm_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
 	DRM_IOCTL_DEF(DRM_IOCTL_RES_CTX, drm_resctx, DRM_AUTH),
 
-	DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_adddraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-	DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_rmdraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
+	DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
+	DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
 
 	DRM_IOCTL_DEF(DRM_IOCTL_LOCK, drm_lock, DRM_AUTH),
 	DRM_IOCTL_DEF(DRM_IOCTL_UNLOCK, drm_unlock, DRM_AUTH),
@@ -127,7 +127,7 @@ static struct drm_ioctl_desc drm_ioctls[] = {
 
 	DRM_IOCTL_DEF(DRM_IOCTL_MODESET_CTL, drm_modeset_ctl, 0),
 
-	DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_update_drawable_info, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
+	DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
 
 	DRM_IOCTL_DEF(DRM_IOCTL_GEM_CLOSE, drm_gem_close_ioctl, DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_GEM_FLINK, drm_gem_flink_ioctl, DRM_AUTH|DRM_UNLOCKED),
@@ -180,8 +180,6 @@ int drm_lastclose(struct drm_device * dev)
 
 	mutex_lock(&dev->struct_mutex);
 
-	/* Free drawable information memory */
-	drm_drawable_free_all(dev);
 	del_timer(&dev->timer);
 
 	/* Clear AGP information */
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index d1ad574..f797ae9 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -240,14 +240,11 @@ int drm_fill_in_dev(struct drm_device *dev,
 	INIT_LIST_HEAD(&dev->vblank_event_list);
 
 	spin_lock_init(&dev->count_lock);
-	spin_lock_init(&dev->drw_lock);
 	spin_lock_init(&dev->event_lock);
 	init_timer(&dev->timer);
 	mutex_init(&dev->struct_mutex);
 	mutex_init(&dev->ctxlist_mutex);
 
-	idr_init(&dev->drw_idr);
-
 	if (drm_ht_create(&dev->map_hash, 12)) {
 		return -ENOMEM;
 	}
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2357a69..2cf102d 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1037,12 +1037,6 @@ struct drm_device {
 	struct drm_minor *control;		/**< Control node for card */
 	struct drm_minor *primary;		/**< render type primary screen head */
 
-	/** \name Drawable information */
-	/*@{ */
-	spinlock_t drw_lock;
-	struct idr drw_idr;
-	/*@} */
-
         struct drm_mode_config mode_config;	/**< Current mode config */
 
 	/** \name GEM information */
@@ -1228,15 +1222,6 @@ extern int drm_setsareactx(struct drm_device *dev, void *data,
 extern int drm_getsareactx(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv);
 
-				/* Drawable IOCTL support (drm_drawable.h) */
-extern int drm_adddraw(struct drm_device *dev, void *data,
-		       struct drm_file *file_priv);
-extern int drm_rmdraw(struct drm_device *dev, void *data,
-		      struct drm_file *file_priv);
-extern int drm_update_drawable_info(struct drm_device *dev, void *data,
-				    struct drm_file *file_priv);
-extern void drm_drawable_free_all(struct drm_device *dev);
-
 				/* Authentication IOCTL support (drm_auth.h) */
 extern int drm_getmagic(struct drm_device *dev, void *data,
 			struct drm_file *file_priv);
-- 
1.7.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/14] drm: kill dev->timer
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (8 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 09/14] drm: replace drawable ioctl by noops Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 11/14] drm: kill gem_free_object_unlocked driver callback Daniel Vetter
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Totally unused.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_drv.c  |    2 --
 drivers/gpu/drm/drm_stub.c |    1 -
 include/drm/drmP.h         |    1 -
 3 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index a35a410..5ff75a3 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -180,8 +180,6 @@ int drm_lastclose(struct drm_device * dev)
 
 	mutex_lock(&dev->struct_mutex);
 
-	del_timer(&dev->timer);
-
 	/* Clear AGP information */
 	if (drm_core_has_AGP(dev) && dev->agp &&
 			!drm_core_check_feature(dev, DRIVER_MODESET)) {
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index f797ae9..cdc89ee 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -241,7 +241,6 @@ int drm_fill_in_dev(struct drm_device *dev,
 
 	spin_lock_init(&dev->count_lock);
 	spin_lock_init(&dev->event_lock);
-	init_timer(&dev->timer);
 	mutex_init(&dev->struct_mutex);
 	mutex_init(&dev->ctxlist_mutex);
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2cf102d..29e3df8 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -964,7 +964,6 @@ struct drm_device {
 	__volatile__ long context_flag;	/**< Context swapping flag */
 	__volatile__ long interrupt_flag; /**< Interruption handler flag */
 	__volatile__ long dma_flag;	/**< DMA dispatch flag */
-	struct timer_list timer;	/**< Timer for delaying ctx switch */
 	wait_queue_head_t context_wait;	/**< Processes waiting on ctx switch */
 	int last_checked;		/**< Last context checked for DMA */
 	int last_context;		/**< Last current context */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/14] drm: kill gem_free_object_unlocked driver callback
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (9 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 10/14] drm: kill dev->timer Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 12/14] drm: don't export dri1 locking functions Daniel Vetter
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Not used by any current driver.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_gem.c |    4 +---
 include/drm/drmP.h        |    1 -
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index bf92d07..cff7317 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -474,9 +474,7 @@ drm_gem_object_free_unlocked(struct kref *kref)
 	struct drm_gem_object *obj = (struct drm_gem_object *) kref;
 	struct drm_device *dev = obj->dev;
 
-	if (dev->driver->gem_free_object_unlocked != NULL)
-		dev->driver->gem_free_object_unlocked(obj);
-	else if (dev->driver->gem_free_object != NULL) {
+	if (dev->driver->gem_free_object != NULL) {
 		mutex_lock(&dev->struct_mutex);
 		dev->driver->gem_free_object(obj);
 		mutex_unlock(&dev->struct_mutex);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 29e3df8..07514bf 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -799,7 +799,6 @@ struct drm_driver {
 	 */
 	int (*gem_init_object) (struct drm_gem_object *obj);
 	void (*gem_free_object) (struct drm_gem_object *obj);
-	void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
 
 	/* vga arb irq handler */
 	void (*vgaarb_irq)(struct drm_device *dev, bool state);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/14] drm: don't export dri1 locking functions
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (10 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 11/14] drm: kill gem_free_object_unlocked driver callback Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 13/14] drm: drop return value of drm_free_agp Daniel Vetter
  2010-08-23 20:53 ` [PATCH 14/14] drm: kill agp indirection mess Daniel Vetter
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

Only used by ioctl, not by any in-tree drivers.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_lock.c |   10 +++-------
 include/drm/drmP.h         |    1 -
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 1973d75..4b9007e 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -37,6 +37,8 @@
 
 static int drm_notifier(void *priv);
 
+static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
+
 /**
  * Lock ioctl.
  *
@@ -170,6 +172,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
  *
  * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction.
  */
+static
 int drm_lock_take(struct drm_lock_data *lock_data,
 		  unsigned int context)
 {
@@ -206,7 +209,6 @@ int drm_lock_take(struct drm_lock_data *lock_data,
 	}
 	return 0;
 }
-EXPORT_SYMBOL(drm_lock_take);
 
 /**
  * This takes a lock forcibly and hands it to context.	Should ONLY be used
@@ -274,7 +276,6 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
 	wake_up_interruptible(&lock_data->lock_queue);
 	return 0;
 }
-EXPORT_SYMBOL(drm_lock_free);
 
 /**
  * If we get here, it means that the process has called DRM_IOCTL_LOCK
@@ -337,7 +338,6 @@ void drm_idlelock_take(struct drm_lock_data *lock_data)
 	}
 	spin_unlock_bh(&lock_data->spinlock);
 }
-EXPORT_SYMBOL(drm_idlelock_take);
 
 void drm_idlelock_release(struct drm_lock_data *lock_data)
 {
@@ -357,8 +357,6 @@ void drm_idlelock_release(struct drm_lock_data *lock_data)
 	}
 	spin_unlock_bh(&lock_data->spinlock);
 }
-EXPORT_SYMBOL(drm_idlelock_release);
-
 
 int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv)
 {
@@ -367,5 +365,3 @@ int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv)
 		_DRM_LOCK_IS_HELD(master->lock.hw_lock->lock) &&
 		master->lock.file_priv == file_priv);
 }
-
-EXPORT_SYMBOL(drm_i_have_hw_lock);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 07514bf..0798ec5 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1234,7 +1234,6 @@ extern int drm_lock(struct drm_device *dev, void *data,
 		    struct drm_file *file_priv);
 extern int drm_unlock(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv);
-extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
 extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context);
 extern void drm_idlelock_take(struct drm_lock_data *lock_data);
 extern void drm_idlelock_release(struct drm_lock_data *lock_data);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 13/14] drm: drop return value of drm_free_agp
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (11 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 12/14] drm: don't export dri1 locking functions Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-23 20:53 ` [PATCH 14/14] drm: kill agp indirection mess Daniel Vetter
  13 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

No caller (rightly) cares about it, so drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_memory.c |    4 ++--
 include/drm/drmP.h           |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index 7732268..70ca27e 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -106,9 +106,9 @@ DRM_AGP_MEM *drm_alloc_agp(struct drm_device * dev, int pages, u32 type)
 }
 
 /** Wrapper around agp_free_memory() */
-int drm_free_agp(DRM_AGP_MEM * handle, int pages)
+void drm_free_agp(DRM_AGP_MEM * handle, int pages)
 {
-	return drm_agp_free_memory(handle) ? 0 : -EINVAL;
+	drm_agp_free_memory(handle);
 }
 EXPORT_SYMBOL(drm_free_agp);
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 0798ec5..eb80d54 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1167,8 +1167,8 @@ extern int drm_mem_info(char *buf, char **start, off_t offset,
 			int request, int *eof, void *data);
 extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
 
+extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
 extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type);
-extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
 extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
 extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
 				       struct page **pages,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 14/14] drm: kill agp indirection mess
  2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
                   ` (12 preceding siblings ...)
  2010-08-23 20:53 ` [PATCH 13/14] drm: drop return value of drm_free_agp Daniel Vetter
@ 2010-08-23 20:53 ` Daniel Vetter
  2010-08-24 15:05   ` Kristian Høgsberg
  13 siblings, 1 reply; 17+ messages in thread
From: Daniel Vetter @ 2010-08-23 20:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

There's no point in jumping through two indirections. So kill one
and call the kernels agp functions directly.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_agpsupport.c |   40 +++----------------------------------
 drivers/gpu/drm/drm_memory.c     |   12 ++--------
 include/drm/drmP.h               |    5 ----
 3 files changed, 7 insertions(+), 50 deletions(-)

diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index ba38e01..252fdb9 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -193,7 +193,7 @@ int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
  * \return zero on success or a negative number on failure.
  *
  * Verifies the AGP device is present and has been acquired, allocates the
- * memory via alloc_agp() and creates a drm_agp_mem entry for it.
+ * memory via agp_allocate_memory() and creates a drm_agp_mem entry for it.
  */
 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
 {
@@ -211,7 +211,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
 
 	pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
 	type = (u32) request->type;
-	if (!(memory = drm_alloc_agp(dev, pages, type))) {
+	if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) {
 		kfree(entry);
 		return -ENOMEM;
 	}
@@ -423,38 +423,6 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
 	return head;
 }
 
-/** Calls agp_allocate_memory() */
-DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data * bridge,
-				     size_t pages, u32 type)
-{
-	return agp_allocate_memory(bridge, pages, type);
-}
-
-/** Calls agp_free_memory() */
-int drm_agp_free_memory(DRM_AGP_MEM * handle)
-{
-	if (!handle)
-		return 0;
-	agp_free_memory(handle);
-	return 1;
-}
-
-/** Calls agp_bind_memory() */
-int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start)
-{
-	if (!handle)
-		return -EINVAL;
-	return agp_bind_memory(handle, start);
-}
-
-/** Calls agp_unbind_memory() */
-int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
-{
-	if (!handle)
-		return -EINVAL;
-	return agp_unbind_memory(handle);
-}
-
 /**
  * Binds a collection of pages into AGP memory at the given offset, returning
  * the AGP memory structure containing them.
@@ -474,7 +442,7 @@ drm_agp_bind_pages(struct drm_device *dev,
 
 	DRM_DEBUG("\n");
 
-	mem = drm_agp_allocate_memory(dev->agp->bridge, num_pages,
+	mem = agp_allocate_memory(dev->agp->bridge, num_pages,
 				      type);
 	if (mem == NULL) {
 		DRM_ERROR("Failed to allocate memory for %ld pages\n",
@@ -487,7 +455,7 @@ drm_agp_bind_pages(struct drm_device *dev,
 	mem->page_count = num_pages;
 
 	mem->is_flushed = true;
-	ret = drm_agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
+	ret = agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
 	if (ret != 0) {
 		DRM_ERROR("Failed to bind AGP memory: %d\n", ret);
 		agp_free_memory(mem);
diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index 70ca27e..c9b8050 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -99,29 +99,23 @@ static void *agp_remap(unsigned long offset, unsigned long size,
 	return addr;
 }
 
-/** Wrapper around agp_allocate_memory() */
-DRM_AGP_MEM *drm_alloc_agp(struct drm_device * dev, int pages, u32 type)
-{
-	return drm_agp_allocate_memory(dev->agp->bridge, pages, type);
-}
-
 /** Wrapper around agp_free_memory() */
 void drm_free_agp(DRM_AGP_MEM * handle, int pages)
 {
-	drm_agp_free_memory(handle);
+	agp_free_memory(handle);
 }
 EXPORT_SYMBOL(drm_free_agp);
 
 /** Wrapper around agp_bind_memory() */
 int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start)
 {
-	return drm_agp_bind_memory(handle, start);
+	return agp_bind_memory(handle, start);
 }
 
 /** Wrapper around agp_unbind_memory() */
 int drm_unbind_agp(DRM_AGP_MEM * handle)
 {
-	return drm_agp_unbind_memory(handle);
+	return agp_unbind_memory(handle);
 }
 EXPORT_SYMBOL(drm_unbind_agp);
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index eb80d54..30e827a 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1168,7 +1168,6 @@ extern int drm_mem_info(char *buf, char **start, off_t offset,
 extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
 
 extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
-extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type);
 extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
 extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
 				       struct page **pages,
@@ -1328,10 +1327,6 @@ extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
 extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
 extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
 			struct drm_file *file_priv);
-extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type);
-extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
-extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
-extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
 extern void drm_agp_chipset_flush(struct drm_device *dev);
 
 				/* Stub support (drm_stub.h) */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 14/14] drm: kill agp indirection mess
  2010-08-23 20:53 ` [PATCH 14/14] drm: kill agp indirection mess Daniel Vetter
@ 2010-08-24 15:05   ` Kristian Høgsberg
  2010-08-24 16:20     ` Daniel Vetter
  0 siblings, 1 reply; 17+ messages in thread
From: Kristian Høgsberg @ 2010-08-24 15:05 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: dri-devel

On Mon, Aug 23, 2010 at 4:53 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> There's no point in jumping through two indirections. So kill one
> and call the kernels agp functions directly.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_agpsupport.c |   40 +++----------------------------------
>  drivers/gpu/drm/drm_memory.c     |   12 ++--------
>  include/drm/drmP.h               |    5 ----
>  3 files changed, 7 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
> index ba38e01..252fdb9 100644
> --- a/drivers/gpu/drm/drm_agpsupport.c
> +++ b/drivers/gpu/drm/drm_agpsupport.c
> @@ -193,7 +193,7 @@ int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
>  * \return zero on success or a negative number on failure.
>  *
>  * Verifies the AGP device is present and has been acquired, allocates the
> - * memory via alloc_agp() and creates a drm_agp_mem entry for it.
> + * memory via agp_allocate_memory() and creates a drm_agp_mem entry for it.
>  */
>  int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
>  {
> @@ -211,7 +211,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
>
>        pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
>        type = (u32) request->type;
> -       if (!(memory = drm_alloc_agp(dev, pages, type))) {
> +       if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) {
>                kfree(entry);
>                return -ENOMEM;
>        }
> @@ -423,38 +423,6 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
>        return head;
>  }
>
> -/** Calls agp_allocate_memory() */
> -DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data * bridge,
> -                                    size_t pages, u32 type)
> -{
> -       return agp_allocate_memory(bridge, pages, type);
> -}
> -
> -/** Calls agp_free_memory() */
> -int drm_agp_free_memory(DRM_AGP_MEM * handle)
> -{
> -       if (!handle)
> -               return 0;
> -       agp_free_memory(handle);
> -       return 1;
> -}
> -
> -/** Calls agp_bind_memory() */
> -int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start)
> -{
> -       if (!handle)
> -               return -EINVAL;
> -       return agp_bind_memory(handle, start);
> -}
> -
> -/** Calls agp_unbind_memory() */
> -int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
> -{
> -       if (!handle)
> -               return -EINVAL;
> -       return agp_unbind_memory(handle);
> -}
> -
>  /**
>  * Binds a collection of pages into AGP memory at the given offset, returning
>  * the AGP memory structure containing them.
> @@ -474,7 +442,7 @@ drm_agp_bind_pages(struct drm_device *dev,
>
>        DRM_DEBUG("\n");
>
> -       mem = drm_agp_allocate_memory(dev->agp->bridge, num_pages,
> +       mem = agp_allocate_memory(dev->agp->bridge, num_pages,
>                                      type);
>        if (mem == NULL) {
>                DRM_ERROR("Failed to allocate memory for %ld pages\n",
> @@ -487,7 +455,7 @@ drm_agp_bind_pages(struct drm_device *dev,
>        mem->page_count = num_pages;
>
>        mem->is_flushed = true;
> -       ret = drm_agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
> +       ret = agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
>        if (ret != 0) {
>                DRM_ERROR("Failed to bind AGP memory: %d\n", ret);
>                agp_free_memory(mem);
> diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
> index 70ca27e..c9b8050 100644
> --- a/drivers/gpu/drm/drm_memory.c
> +++ b/drivers/gpu/drm/drm_memory.c
> @@ -99,29 +99,23 @@ static void *agp_remap(unsigned long offset, unsigned long size,
>        return addr;
>  }
>
> -/** Wrapper around agp_allocate_memory() */
> -DRM_AGP_MEM *drm_alloc_agp(struct drm_device * dev, int pages, u32 type)
> -{
> -       return drm_agp_allocate_memory(dev->agp->bridge, pages, type);
> -}
> -
>  /** Wrapper around agp_free_memory() */
>  void drm_free_agp(DRM_AGP_MEM * handle, int pages)
>  {
> -       drm_agp_free_memory(handle);
> +       agp_free_memory(handle);
>  }
>  EXPORT_SYMBOL(drm_free_agp);
>
>  /** Wrapper around agp_bind_memory() */
>  int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start)
>  {
> -       return drm_agp_bind_memory(handle, start);
> +       return agp_bind_memory(handle, start);
>  }
>
>  /** Wrapper around agp_unbind_memory() */
>  int drm_unbind_agp(DRM_AGP_MEM * handle)
>  {
> -       return drm_agp_unbind_memory(handle);
> +       return agp_unbind_memory(handle);
>  }
>  EXPORT_SYMBOL(drm_unbind_agp);

Any reason to keep these last three wrappers around?

Kristian
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 14/14] drm: kill agp indirection mess
  2010-08-24 15:05   ` Kristian Høgsberg
@ 2010-08-24 16:20     ` Daniel Vetter
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2010-08-24 16:20 UTC (permalink / raw)
  To: Kristian Høgsberg; +Cc: Daniel Vetter, dri-devel

On Tue, Aug 24, 2010 at 11:05:04AM -0400, Kristian Høgsberg wrote:
> >  /** Wrapper around agp_unbind_memory() */
> >  int drm_unbind_agp(DRM_AGP_MEM * handle)
> >  {
> > -       return drm_agp_unbind_memory(handle);
> > +       return agp_unbind_memory(handle);
> >  }
> >  EXPORT_SYMBOL(drm_unbind_agp);
> 
> Any reason to keep these last three wrappers around?

That would amount to completely ripping out the drm agp abstraction
(including DRM_AGP_MEM #defines and friends). A decently-sized patch
series touching lots of drivers, drm core (for the generic mapping stuff)
and the innards of ttm/gem.

But yeah, if people want this I can certainly prep patches. There's
already

#define DRM_AGP_MEM		struct agp_memory
#define DRM_AGP_KERN		struct agp_kern_info

so the whole thing can be accomplished without a flag day.

> Kristian

Cheers, Daniel

-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-08-24 16:18 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23 20:53 [PATCH 00/14] various drm core cleanups Daniel Vetter
2010-08-23 20:53 ` [PATCH 01/14] drm: don't export drm_sg_alloc Daniel Vetter
2010-08-23 20:53 ` [PATCH 02/14] drm: kill kernel_context_switch callbacks Daniel Vetter
2010-08-23 20:53 ` [PATCH 03/14] drm: kill dma_ready callbacks Daniel Vetter
2010-08-23 20:53 ` [PATCH 04/14] drm: kill procfs callbacks Daniel Vetter
2010-08-23 20:53 ` [PATCH 05/14] drm: kill drm_map_ofs callbacks Daniel Vetter
2010-08-23 20:53 ` [PATCH 06/14] drm: kill get_reg_ofs callback Daniel Vetter
2010-08-23 20:53 ` [PATCH 07/14] drm: kill context_ctor callback Daniel Vetter
2010-08-23 20:53 ` [PATCH 08/14] drm: don't export drm_get_drawable_info Daniel Vetter
2010-08-23 20:53 ` [PATCH 09/14] drm: replace drawable ioctl by noops Daniel Vetter
2010-08-23 20:53 ` [PATCH 10/14] drm: kill dev->timer Daniel Vetter
2010-08-23 20:53 ` [PATCH 11/14] drm: kill gem_free_object_unlocked driver callback Daniel Vetter
2010-08-23 20:53 ` [PATCH 12/14] drm: don't export dri1 locking functions Daniel Vetter
2010-08-23 20:53 ` [PATCH 13/14] drm: drop return value of drm_free_agp Daniel Vetter
2010-08-23 20:53 ` [PATCH 14/14] drm: kill agp indirection mess Daniel Vetter
2010-08-24 15:05   ` Kristian Høgsberg
2010-08-24 16:20     ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.