All of lore.kernel.org
 help / color / mirror / Atom feed
* [BK tree] [drm] remove counter macros..
@ 2004-09-21 10:50 Dave Airlie
  2004-09-21 12:09 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2004-09-21 10:50 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel


Hi Linus,

This just another macro removal, the counter macros are gone...

Please do a

	bk pull bk://drm.bkbits.net/drm-2.6

This will include the latest DRM changes and will update the following files:

 drivers/char/drm/drm_drv.h  |   50 ++++++++------------------------------------
 drivers/char/drm/i810.h     |    6 -----
 drivers/char/drm/i810_dma.c |    6 +++++
 drivers/char/drm/i830.h     |    6 -----
 drivers/char/drm/i830_dma.c |    5 ++++
 drivers/char/drm/i915.h     |    6 -----
 drivers/char/drm/i915_dma.c |    6 +++++
 drivers/char/drm/mga.h      |    5 ----
 drivers/char/drm/mga_dma.c  |    5 ++++
 drivers/char/drm/sis.h      |    2 -
 10 files changed, 32 insertions(+), 65 deletions(-)

through these ChangeSets:

<airlied@starflyer.(none)> (04/09/20 1.1941)
   drm: drop __HAVE_COUNTER macros

   This removes all the __HAVE_COUNTER macro and replaces them with
   the driver setting the values in its register_fns.

   Signed-off-by: Dave Airlie <airlied@linux.ie>

diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h
--- a/drivers/char/drm/drm_drv.h	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/drm_drv.h	Tue Sep 21 20:45:46 2004
@@ -52,10 +52,6 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */

-#ifndef __HAVE_COUNTERS
-#define __HAVE_COUNTERS			0
-#endif
-
 #ifndef DRIVER_IOCTLS
 #define DRIVER_IOCTLS
 #endif
@@ -195,41 +191,6 @@
 			return i;
 	}

-	dev->counters  = 6 + __HAVE_COUNTERS;
-	dev->types[0]  = _DRM_STAT_LOCK;
-	dev->types[1]  = _DRM_STAT_OPENS;
-	dev->types[2]  = _DRM_STAT_CLOSES;
-	dev->types[3]  = _DRM_STAT_IOCTLS;
-	dev->types[4]  = _DRM_STAT_LOCKS;
-	dev->types[5]  = _DRM_STAT_UNLOCKS;
-#ifdef __HAVE_COUNTER6
-	dev->types[6]  = __HAVE_COUNTER6;
-#endif
-#ifdef __HAVE_COUNTER7
-	dev->types[7]  = __HAVE_COUNTER7;
-#endif
-#ifdef __HAVE_COUNTER8
-	dev->types[8]  = __HAVE_COUNTER8;
-#endif
-#ifdef __HAVE_COUNTER9
-	dev->types[9]  = __HAVE_COUNTER9;
-#endif
-#ifdef __HAVE_COUNTER10
-	dev->types[10] = __HAVE_COUNTER10;
-#endif
-#ifdef __HAVE_COUNTER11
-	dev->types[11] = __HAVE_COUNTER11;
-#endif
-#ifdef __HAVE_COUNTER12
-	dev->types[12] = __HAVE_COUNTER12;
-#endif
-#ifdef __HAVE_COUNTER13
-	dev->types[13] = __HAVE_COUNTER13;
-#endif
-#ifdef __HAVE_COUNTER14
-	dev->types[14] = __HAVE_COUNTER14;
-#endif
-
 	for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ )
 		atomic_set( &dev->counts[i], 0 );

@@ -510,7 +471,16 @@

 	/* dev_priv_size can be changed by a driver in driver_register_fns */
 	dev->dev_priv_size = sizeof(u32);
-
+
+	/* the DRM has 6 basic counters - drivers add theirs in register_fns */
+	dev->counters = 6;
+	dev->types[0]  = _DRM_STAT_LOCK;
+	dev->types[1]  = _DRM_STAT_OPENS;
+	dev->types[2]  = _DRM_STAT_CLOSES;
+	dev->types[3]  = _DRM_STAT_IOCTLS;
+	dev->types[4]  = _DRM_STAT_LOCKS;
+	dev->types[5]  = _DRM_STAT_UNLOCKS;
+
 	DRM(init_fn_table)(dev);

 	DRM(driver_register_fns)(dev);
diff -Nru a/drivers/char/drm/i810.h b/drivers/char/drm/i810.h
--- a/drivers/char/drm/i810.h	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/i810.h	Tue Sep 21 20:45:46 2004
@@ -74,10 +74,4 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus,    1, 0 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_I810_FLIP)] =    { i810_flip_bufs,  1, 0 }

-#define __HAVE_COUNTERS         4
-#define __HAVE_COUNTER6         _DRM_STAT_IRQ
-#define __HAVE_COUNTER7         _DRM_STAT_PRIMARY
-#define __HAVE_COUNTER8         _DRM_STAT_SECONDARY
-#define __HAVE_COUNTER9         _DRM_STAT_DMA
-
 #endif
diff -Nru a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
--- a/drivers/char/drm/i810_dma.c	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/i810_dma.c	Tue Sep 21 20:45:46 2004
@@ -1412,5 +1412,11 @@
 	dev->fn_tbl.release = i810_driver_release;
 	dev->fn_tbl.dma_quiescent = i810_driver_dma_quiescent;
 	dev->fn_tbl.reclaim_buffers = i810_reclaim_buffers;
+
+	dev->counters += 4;
+	dev->types[6] = _DRM_STAT_IRQ;
+	dev->types[7] = _DRM_STAT_PRIMARY;
+	dev->types[8] = _DRM_STAT_SECONDARY;
+	dev->types[9] = _DRM_STAT_DMA;
 }

diff -Nru a/drivers/char/drm/i830.h b/drivers/char/drm/i830.h
--- a/drivers/char/drm/i830.h	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/i830.h	Tue Sep 21 20:45:46 2004
@@ -73,12 +73,6 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_I830_GETPARAM)] = { i830_getparam,  1, 0 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_I830_SETPARAM)] = { i830_setparam,  1, 0 }

-#define __HAVE_COUNTERS         4
-#define __HAVE_COUNTER6         _DRM_STAT_IRQ
-#define __HAVE_COUNTER7         _DRM_STAT_PRIMARY
-#define __HAVE_COUNTER8         _DRM_STAT_SECONDARY
-#define __HAVE_COUNTER9         _DRM_STAT_DMA
-
 /* Driver will work either way: IRQ's save cpu time when waiting for
  * the card, but are subject to subtle interactions between bios,
  * hardware and the driver.
diff -Nru a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
--- a/drivers/char/drm/i830_dma.c	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/i830_dma.c	Tue Sep 21 20:45:46 2004
@@ -1615,5 +1615,10 @@
 	dev->fn_tbl.irq_uninstall = i830_driver_irq_uninstall;
 	dev->fn_tbl.irq_handler = i830_driver_irq_handler;
 #endif
+	dev->counters += 4;
+	dev->types[6] = _DRM_STAT_IRQ;
+	dev->types[7] = _DRM_STAT_PRIMARY;
+	dev->types[8] = _DRM_STAT_SECONDARY;
+	dev->types[9] = _DRM_STAT_DMA;
 }

diff -Nru a/drivers/char/drm/i915.h b/drivers/char/drm/i915.h
--- a/drivers/char/drm/i915.h	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/i915.h	Tue Sep 21 20:45:46 2004
@@ -45,12 +45,6 @@
         [DRM_IOCTL_NR(DRM_IOCTL_I915_INIT_HEAP)] = { i915_mem_init_heap, 1, 1 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_I915_CMDBUFFER)] = { i915_cmdbuffer, 1, 0 }

-#define __HAVE_COUNTERS         4
-#define __HAVE_COUNTER6         _DRM_STAT_IRQ
-#define __HAVE_COUNTER7         _DRM_STAT_PRIMARY
-#define __HAVE_COUNTER8         _DRM_STAT_SECONDARY
-#define __HAVE_COUNTER9         _DRM_STAT_DMA
-
 /* We use our own dma mechanisms, not the drm template code.  However,
  * the shared IRQ code is useful to us:
  */
diff -Nru a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
--- a/drivers/char/drm/i915_dma.c	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/i915_dma.c	Tue Sep 21 20:45:46 2004
@@ -746,4 +746,10 @@
 	dev->fn_tbl.irq_postinstall = i915_driver_irq_postinstall;
 	dev->fn_tbl.irq_uninstall = i915_driver_irq_uninstall;
 	dev->fn_tbl.irq_handler = i915_driver_irq_handler;
+
+	dev->counters += 4;
+	dev->types[6] = _DRM_STAT_IRQ;
+	dev->types[7] = _DRM_STAT_PRIMARY;
+	dev->types[8] = _DRM_STAT_SECONDARY;
+	dev->types[9] = _DRM_STAT_DMA;
 }
diff -Nru a/drivers/char/drm/mga.h b/drivers/char/drm/mga.h
--- a/drivers/char/drm/mga.h	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/mga.h	Tue Sep 21 20:45:46 2004
@@ -60,9 +60,4 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)]    = { mga_dma_blit,    1, 0 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_MGA_GETPARAM)]= { mga_getparam,    1, 0 },

-#define __HAVE_COUNTERS         3
-#define __HAVE_COUNTER6         _DRM_STAT_IRQ
-#define __HAVE_COUNTER7         _DRM_STAT_PRIMARY
-#define __HAVE_COUNTER8         _DRM_STAT_SECONDARY
-
 #endif
diff -Nru a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
--- a/drivers/char/drm/mga_dma.c	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/mga_dma.c	Tue Sep 21 20:45:46 2004
@@ -819,4 +819,9 @@
 	dev->fn_tbl.irq_postinstall = mga_driver_irq_postinstall;
 	dev->fn_tbl.irq_uninstall = mga_driver_irq_uninstall;
 	dev->fn_tbl.irq_handler = mga_driver_irq_handler;
+
+	dev->counters += 3;
+	dev->types[6] = _DRM_STAT_IRQ;
+	dev->types[7] = _DRM_STAT_PRIMARY;
+	dev->types[8] = _DRM_STAT_SECONDARY;
 }
diff -Nru a/drivers/char/drm/sis.h b/drivers/char/drm/sis.h
--- a/drivers/char/drm/sis.h	Tue Sep 21 20:45:46 2004
+++ b/drivers/char/drm/sis.h	Tue Sep 21 20:45:46 2004
@@ -58,6 +58,4 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_SIS_AGP_FREE)]	= { sis_ioctl_agp_free,	1, 0 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_SIS_FB_INIT)]	= { sis_fb_init,	1, 1 }

-#define __HAVE_COUNTERS		5
-
 #endif

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

* Re: [BK tree] [drm] remove counter macros..
  2004-09-21 10:50 [BK tree] [drm] remove counter macros Dave Airlie
@ 2004-09-21 12:09 ` Christoph Hellwig
  2004-09-21 12:21   ` Dave Airlie
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2004-09-21 12:09 UTC (permalink / raw)
  To: Dave Airlie; +Cc: torvalds, linux-kernel

While I definitly approve this patch is there a specific reason for this
array instead of individual members like

	lock_cnt, open_cnt, close_cnt, etc..?

also the optional counters seem to be largely overlapping, why not always
all four thta exist and if some drivers don't want to update them they'd
just not update them

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

* Re: [BK tree] [drm] remove counter macros..
  2004-09-21 12:09 ` Christoph Hellwig
@ 2004-09-21 12:21   ` Dave Airlie
  2004-09-21 12:25     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2004-09-21 12:21 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: torvalds, linux-kernel


Well this was only a direct macro removal, I'm contemplating removing the
counters as to be honest I'm not sure any drm developer as actually used
them since day one .. (and maybe not even then)... but I'll leave that for
another time, as there might be a wierd use of them somewhere...

Once I drop the ioctl macro, I'll probably start going back to see what
stuff is probably not of any use anymore.. (counters are fairly high on
that list..)..

Dave.

On Tue, 21 Sep 2004, Christoph Hellwig wrote:

> While I definitly approve this patch is there a specific reason for this
> array instead of individual members like
>
> 	lock_cnt, open_cnt, close_cnt, etc..?
>
> also the optional counters seem to be largely overlapping, why not always
> all four thta exist and if some drivers don't want to update them they'd
> just not update them
>

-- 
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at skynet.ie
pam_smb / Linux DECstation / Linux VAX / ILUG person


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

* Re: [BK tree] [drm] remove counter macros..
  2004-09-21 12:21   ` Dave Airlie
@ 2004-09-21 12:25     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2004-09-21 12:25 UTC (permalink / raw)
  To: Dave Airlie; +Cc: Christoph Hellwig, torvalds, linux-kernel

On Tue, Sep 21, 2004 at 01:21:38PM +0100, Dave Airlie wrote:
> 
> Well this was only a direct macro removal,

Sure, and I really like the patch.  But seeing code posted is the best
place for further suggestions in that area.

> I'm contemplating removing the
> counters as to be honest I'm not sure any drm developer as actually used
> them since day one .. (and maybe not even then)... but I'll leave that for
> another time, as there might be a wierd use of them somewhere...

Sounds like a good idea.  Especially as dev->counts are atomic_ts that are
rather expensive.


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

end of thread, other threads:[~2004-09-21 12:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 10:50 [BK tree] [drm] remove counter macros Dave Airlie
2004-09-21 12:09 ` Christoph Hellwig
2004-09-21 12:21   ` Dave Airlie
2004-09-21 12:25     ` Christoph Hellwig

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.