xf86-video-intel: Branch 'modesetting' - src/i810_driver.c src/i810_video.c src/i810_wmark.c src/i830_accel.c src/i830_exa.c src/i830_rotate.c src/i830_sdvo.c src/i830_tv.c src/i830_video.c src/i830_xaa.c

Jesse Barnes jbarnes at kemper.freedesktop.org
Sat Jan 6 18:22:06 EET 2007


 src/i810_driver.c |   45 +++++++++++++++++++++++----------------------
 src/i810_video.c  |    4 ++--
 src/i810_wmark.c  |   14 +++++++-------
 src/i830_accel.c  |   10 ++++++----
 src/i830_exa.c    |   10 +++++-----
 src/i830_rotate.c |    4 ++--
 src/i830_sdvo.c   |    2 +-
 src/i830_tv.c     |    4 ++--
 src/i830_video.c  |    6 +++---
 src/i830_xaa.c    |    1 -
 10 files changed, 51 insertions(+), 49 deletions(-)

New commits:
diff-tree 4c790f614ecba1f6468e51779cfaf0e36b6b17ad (from 5a793b0dcf2d5de408b55073858fcfba6d99f994)
Author: Jesse Barnes <jbarnes at nietzche.virtuousgeek.org>
Date:   Sat Jan 6 08:21:36 2007 -0800

    More sparse cleanups:
      NULL vs. 0
      make some variables static
      remove redundant variables
    
    There are only a few sparse warnings left now: some bitfield warnings
    and a few 'mixing code and declarations' warnings from the ring macros.

diff --git a/src/i810_driver.c b/src/i810_driver.c
index 6ba0030..7574fb5 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -381,7 +381,7 @@ static int i810_pitches[] = {
 #endif
 #endif
 
-int I830EntityIndex = -1;
+static int I830EntityIndex = -1;
 
 #ifdef XFree86LOADER
 
@@ -400,7 +400,7 @@ static XF86ModuleVersionInfo i810VersRec
    {0, 0, 0, 0}
 };
 
-_X_EXPORT XF86ModuleData i810ModuleData = { &i810VersRec, i810Setup, 0 };
+_X_EXPORT XF86ModuleData i810ModuleData = { &i810VersRec, i810Setup, NULL };
 
 static pointer
 i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
@@ -468,7 +468,7 @@ I810FreeRec(ScrnInfoPtr pScrn)
    if (!pScrn->driverPrivate)
       return;
    xfree(pScrn->driverPrivate);
-   pScrn->driverPrivate = 0;
+   pScrn->driverPrivate = NULL;
 }
 #endif
 
@@ -577,7 +577,8 @@ I810Probe(DriverPtr drv, int flags)
 
 	 /* Allocate new ScrnInfoRec and claim the slot */
 	 if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
-					  I810PciChipsets, 0, 0, 0, 0, 0))) {
+					  I810PciChipsets, NULL, NULL, NULL,
+					  NULL, NULL))) {
 	    EntityInfoPtr pEnt;
 
 	    pEnt = xf86GetEntityInfo(usedChips[i]);
@@ -609,23 +610,23 @@ I810Probe(DriverPtr drv, int flags)
     	       if (I830EntityIndex < 0)					
 		  I830EntityIndex = xf86AllocateEntityPrivateIndex();	
 
-    	       pPriv = xf86GetEntityPrivate(pScrn->entityList[0],		
+    	       pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
 						I830EntityIndex);	
-    	       if (!pPriv->ptr) {						
-		  pPriv->ptr = xnfcalloc(sizeof(I830EntRec), 1);		
-		  pI830Ent = pPriv->ptr;					
-		  pI830Ent->lastInstance = -1;				
-    	       } else {							
-		  pI830Ent = pPriv->ptr;					
+    	       if (!pPriv->ptr) {
+		  pPriv->ptr = xnfcalloc(sizeof(I830EntRec), 1);
+		  pI830Ent = pPriv->ptr;
+		  pI830Ent->lastInstance = -1;
+    	       } else {
+		   pI830Ent = pPriv->ptr;
     	       }
-								
-    	       /*								
-     	        * Set the entity instance for this instance of the driver.	
-     	        * For dual head per card, instance 0 is the "master" 	
-     	        * instance, driving the primary head, and instance 1 is 	
-     	        * the "slave".						
-     	        */								
-    	       pI830Ent->lastInstance++;					
+
+    	       /*
+		* Set the entity instance for this instance of the driver.
+     	        * For dual head per card, instance 0 is the "master"
+     	        * instance, driving the primary head, and instance 1 is
+     	        * the "slave".
+     	        */
+    	       pI830Ent->lastInstance++;
                xf86SetEntityInstanceForScreen(pScrn,			
 			pScrn->entityList[0], pI830Ent->lastInstance);	
 	       I830InitpScrn(pScrn);
@@ -746,7 +747,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags
    pI810->PciTag = pciTag(pI810->PciInfo->bus, pI810->PciInfo->device,
 			  pI810->PciInfo->func);
 
-   if (xf86RegisterResources(pI810->pEnt->index, 0, ResNone))
+   if (xf86RegisterResources(pI810->pEnt->index, NULL, ResNone))
       return FALSE;
    pScrn->racMemFlags = RAC_FB | RAC_COLORMAP;
 
@@ -1222,7 +1223,7 @@ I810UnmapMMIO(ScrnInfoPtr pScrn)
 
    xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->MMIOBase,
 		   I810_REG_SIZE);
-   pI810->MMIOBase = 0;
+   pI810->MMIOBase = NULL;
 }
 
 static Bool
@@ -1232,7 +1233,7 @@ I810UnmapMem(ScrnInfoPtr pScrn)
 
    xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->FbBase,
 		   pI810->FbMapSize);
-   pI810->FbBase = 0;
+   pI810->FbBase = NULL;
    I810UnmapMMIO(pScrn);
    return TRUE;
 }
diff --git a/src/i810_video.c b/src/i810_video.c
index e65a7f6..b3dc90e 100644
--- a/src/i810_video.c
+++ b/src/i810_video.c
@@ -1301,7 +1301,7 @@ I810GetSurfaceAttribute(
     Atom attribute,
     INT32 *value
 ){
-    return I810GetPortAttribute(pScrn, attribute, value, 0);
+    return I810GetPortAttribute(pScrn, attribute, value, NULL);
 }
 
 static int
@@ -1310,7 +1310,7 @@ I810SetSurfaceAttribute(
     Atom attribute,
     INT32 value
 ){
-    return I810SetPortAttribute(pScrn, attribute, value, 0);
+    return I810SetPortAttribute(pScrn, attribute, value, NULL);
 }
 
 
diff --git a/src/i810_wmark.c b/src/i810_wmark.c
index 6540cbb..85d55ef 100644
--- a/src/i810_wmark.c
+++ b/src/i810_wmark.c
@@ -57,7 +57,7 @@ struct wm_info {
    unsigned int wm;
 };
 
-struct wm_info i810_wm_8_100[] = {
+static struct wm_info i810_wm_8_100[] = {
    {0, 0x22003000},
    {25.2, 0x22003000},
    {28.0, 0x22003000},
@@ -87,7 +87,7 @@ struct wm_info i810_wm_8_100[] = {
    {202.5, 0x2220e000}
 };
 
-struct wm_info i810_wm_16_100[] = {
+static struct wm_info i810_wm_16_100[] = {
    {0, 0x22004000},
    {25.2, 0x22006000},
    {28.0, 0x22006000},
@@ -118,7 +118,7 @@ struct wm_info i810_wm_16_100[] = {
    {202.5, 0x22416000}
 };
 
-struct wm_info i810_wm_24_100[] = {
+static struct wm_info i810_wm_24_100[] = {
    {0, 0x22006000},
    {25.2, 0x22009000},
    {28.0, 0x22009000},
@@ -149,13 +149,13 @@ struct wm_info i810_wm_24_100[] = {
    {202.5, 0x44419000}
 };
 
-struct wm_info i810_wm_32_100[] = {
+static struct wm_info i810_wm_32_100[] = {
    {0, 0x2210b000},
    {60, 0x22415000},			/* 0x314000 works too */
    {80, 0x22419000}			/* 0x518000 works too */
 };
 
-struct wm_info i810_wm_8_133[] = {
+static struct wm_info i810_wm_8_133[] = {
    {0, 0x22003000},
    {25.2, 0x22003000},
    {28.0, 0x22003000},
@@ -185,7 +185,7 @@ struct wm_info i810_wm_8_133[] = {
    {202.5, 0x2220e000}
 };
 
-struct wm_info i810_wm_16_133[] = {
+static struct wm_info i810_wm_16_133[] = {
    {0, 0x22004000},
    {25.2, 0x22006000},
    {28.0, 0x22006000},
@@ -216,7 +216,7 @@ struct wm_info i810_wm_16_133[] = {
    {202.5, 0x22416000}
 };
 
-struct wm_info i810_wm_24_133[] = {
+static struct wm_info i810_wm_24_133[] = {
    {0, 0x22006000},
    {25.2, 0x22009000},
    {28.0, 0x22009000},
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 2260b71..5fdd101 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -180,10 +180,12 @@ I830EmitFlush(ScrnInfoPtr pScrn)
    if (IS_I965G(pI830))
       flags = 0;
 
-   BEGIN_LP_RING(2);
-   OUT_RING(MI_FLUSH | flags);
-   OUT_RING(MI_NOOP);		/* pad to quadword */
-   ADVANCE_LP_RING();
+   {
+       BEGIN_LP_RING(2);
+       OUT_RING(MI_FLUSH | flags);
+       OUT_RING(MI_NOOP);		/* pad to quadword */
+       ADVANCE_LP_RING();
+   }
 }
 
 void
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 9356c79..e9ded73 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -57,9 +57,9 @@ do { 							\
 } while(0) 
 #endif
 
-float scale_units[2][2];
+static float scale_units[2][2];
 
-const int I830CopyROP[16] =
+const static int I830CopyROP[16] =
 {
    ROP_0,               /* GXclear */
    ROP_DSa,             /* GXand */
@@ -79,7 +79,7 @@ const int I830CopyROP[16] =
    ROP_1                /* GXset */
 };
 
-const int I830PatternROP[16] =
+const static int I830PatternROP[16] =
 {
     ROP_0,
     ROP_DPa,
@@ -111,8 +111,8 @@ union intfloat {
 	OUT_RING(tmp.ui);			\
 } while(0)				
 
-Bool is_transform[2];
-PictTransform *transform[2];
+static Bool is_transform[2];
+static PictTransform *transform[2];
 
 extern Bool I830EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
 extern Bool I830EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr, 
diff --git a/src/i830_rotate.c b/src/i830_rotate.c
index 9fa3290..2afd712 100644
--- a/src/i830_rotate.c
+++ b/src/i830_rotate.c
@@ -827,7 +827,7 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod
    if (pI830->rotation != RR_Rotate_0)
       shadowAdd (pScrn->pScreen, 
 		 (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen),
-		 func, I830WindowLinear, pI830->rotation, 0);
+		 func, I830WindowLinear, pI830->rotation, NULL);
 
    if (I830IsPrimary(pScrn)) {
       if (pI830->rotation != RR_Rotate_0)
@@ -1045,7 +1045,7 @@ BAIL0:
    if (pI830->rotation != RR_Rotate_0)
       shadowAdd (pScrn->pScreen, 
 		 (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen),
-		 func, I830WindowLinear, pI830->rotation, 0);
+		 func, I830WindowLinear, pI830->rotation, NULL);
 
    if (I830IsPrimary(pScrn)) {
       if (pI830->rotation != RR_Rotate_0)
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 19b4b93..ea62ad9 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -124,7 +124,7 @@ static Bool i830_sdvo_write_byte(xf86Out
 
 #define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd}
 /** Mapping of command numbers to names, for debug output */
-const struct _sdvo_cmd_name {
+const static struct _sdvo_cmd_name {
     CARD8 cmd;
     char *name;
 } sdvo_cmd_names[] = {
diff --git a/src/i830_tv.c b/src/i830_tv.c
index 5cf36a5..ad3b262 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -155,7 +155,7 @@ typedef struct {
  * These values account for -1s required.
  */
 
-const tv_mode_t tv_modes[] = {
+const static tv_mode_t tv_modes[] = {
     {
 	.name		= "NTSC 480i",
 	.oversample	= TV_OVERSAMPLE_8X,
@@ -945,7 +945,7 @@ i830_tv_get_modes(xf86OutputPtr output)
 {
     ScrnInfoPtr	    pScrn = output->scrn;
     I830Ptr	    pI830 = I830PTR(pScrn);
-    DisplayModePtr  new, first = NULL, *tail = &first;;
+    DisplayModePtr  new, first = NULL, *tail = &first;
     int		    i;
 
     (void) pI830;
diff --git a/src/i830_video.c b/src/i830_video.c
index f031a87..6b76faa 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2695,13 +2695,13 @@ I830FreeSurface(XF86SurfacePtr surface)
 static int
 I830GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value)
 {
-   return I830GetPortAttribute(pScrn, attribute, value, 0);
+   return I830GetPortAttribute(pScrn, attribute, value, NULL);
 }
 
 static int
 I830SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value)
 {
-   return I830SetPortAttribute(pScrn, attribute, value, 0);
+   return I830SetPortAttribute(pScrn, attribute, value, NULL);
 }
 
 static int
@@ -2880,10 +2880,10 @@ i830_crtc_dpms_video(xf86CrtcPtr crtc, B
       /* Check we have an LFP connected */
       if (i830PipeHasType(xf86_config->crtc[pPriv->pipe],
 			  I830_OUTPUT_LVDS)) {
+	 int vtotal_reg = pPriv->pipe ? VTOTAL_A : VTOTAL_B;
 	 size = pPriv->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC);
 	 hsize = (size >> 16) & 0x7FF;
 	 vsize = size & 0x7FF;
-	 int vtotal_reg = pPriv->pipe ? VTOTAL_A : VTOTAL_B;
 	 active = INREG(vtotal_reg) & 0x7FF;
 
 	 if (vsize < active && hsize > 1024)
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
index 9c994d3..cad9c71 100644
--- a/src/i830_xaa.c
+++ b/src/i830_xaa.c
@@ -214,7 +214,6 @@ I830XAAInit(ScreenPtr pScreen)
 
     {
 	Bool shared_accel = FALSE;
-	int i;
 
 	for(i = 0; i < pScrn->numEntities; i++) {
 	    if(xf86IsEntityShared(pScrn->entityList[i]))



More information about the xorg-commit mailing list