xf86-video-r128: Branch 'master' - 6 commits

Connor Behan cbehan at kemper.freedesktop.org
Fri Jul 18 12:25:18 PDT 2014


 src/r128.h            |  202 +++++++++++++++++++++++---------------------------
 src/r128_accel.c      |   28 ++----
 src/r128_crtc.c       |    5 -
 src/r128_cursor.c     |   14 +--
 src/r128_dga.c        |    6 -
 src/r128_dri.c        |   20 +---
 src/r128_driver.c     |   92 ++++++----------------
 src/r128_exa_render.c |    8 -
 src/r128_output.c     |   24 +++--
 src/r128_probe.c      |    1 
 src/r128_probe.h      |   17 +---
 src/r128_reg.h        |   14 +--
 src/r128_video.c      |   14 +--
 13 files changed, 189 insertions(+), 256 deletions(-)

New commits:
commit 0d901460b375599c727928634d5f1067d2279844
Author: Connor Behan <connor.behan at gmail.com>
Date:   Wed Jul 16 17:47:44 2014 -0700

    Use standard integers
    
    To fix another warning, we need to be consistent about when we use
    CARD32 an when we use uint32_t. Xorg developers have decided on the
    latter as a convention.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>

diff --git a/src/r128.h b/src/r128.h
index b9fcc0a..f361c2a 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -151,105 +151,105 @@ typedef struct {        /* All values in XCLKS    */
 
 typedef struct {
 				/* Common registers */
-    CARD32     ovr_clr;
-    CARD32     ovr_wid_left_right;
-    CARD32     ovr_wid_top_bottom;
-    CARD32     ov0_scale_cntl;
-    CARD32     mpp_tb_config;
-    CARD32     mpp_gp_config;
-    CARD32     subpic_cntl;
-    CARD32     viph_control;
-    CARD32     i2c_cntl_1;
-    CARD32     gen_int_cntl;
-    CARD32     cap0_trig_cntl;
-    CARD32     cap1_trig_cntl;
-    CARD32     bus_cntl;
-    CARD32     config_cntl;
+    uint32_t   ovr_clr;
+    uint32_t   ovr_wid_left_right;
+    uint32_t   ovr_wid_top_bottom;
+    uint32_t   ov0_scale_cntl;
+    uint32_t   mpp_tb_config;
+    uint32_t   mpp_gp_config;
+    uint32_t   subpic_cntl;
+    uint32_t   viph_control;
+    uint32_t   i2c_cntl_1;
+    uint32_t   gen_int_cntl;
+    uint32_t   cap0_trig_cntl;
+    uint32_t   cap1_trig_cntl;
+    uint32_t   bus_cntl;
+    uint32_t   config_cntl;
 
 				/* Other registers to save for VT switches */
-    CARD32     dp_datatype;
-    CARD32     gen_reset_cntl;
-    CARD32     clock_cntl_index;
-    CARD32     amcgpio_en_reg;
-    CARD32     amcgpio_mask;
+    uint32_t   dp_datatype;
+    uint32_t   gen_reset_cntl;
+    uint32_t   clock_cntl_index;
+    uint32_t   amcgpio_en_reg;
+    uint32_t   amcgpio_mask;
 
 				/* CRTC registers */
-    CARD32     crtc_gen_cntl;
-    CARD32     crtc_ext_cntl;
-    CARD32     dac_cntl;
-    CARD32     crtc_h_total_disp;
-    CARD32     crtc_h_sync_strt_wid;
-    CARD32     crtc_v_total_disp;
-    CARD32     crtc_v_sync_strt_wid;
-    CARD32     crtc_offset;
-    CARD32     crtc_offset_cntl;
-    CARD32     crtc_pitch;
+    uint32_t   crtc_gen_cntl;
+    uint32_t   crtc_ext_cntl;
+    uint32_t   dac_cntl;
+    uint32_t   crtc_h_total_disp;
+    uint32_t   crtc_h_sync_strt_wid;
+    uint32_t   crtc_v_total_disp;
+    uint32_t   crtc_v_sync_strt_wid;
+    uint32_t   crtc_offset;
+    uint32_t   crtc_offset_cntl;
+    uint32_t   crtc_pitch;
 
 				/* CRTC2 registers */
-    CARD32     crtc2_gen_cntl;
-    CARD32     crtc2_h_total_disp;
-    CARD32     crtc2_h_sync_strt_wid;
-    CARD32     crtc2_v_total_disp;
-    CARD32     crtc2_v_sync_strt_wid;
-    CARD32     crtc2_offset;
-    CARD32     crtc2_offset_cntl;
-    CARD32     crtc2_pitch;
+    uint32_t   crtc2_gen_cntl;
+    uint32_t   crtc2_h_total_disp;
+    uint32_t   crtc2_h_sync_strt_wid;
+    uint32_t   crtc2_v_total_disp;
+    uint32_t   crtc2_v_sync_strt_wid;
+    uint32_t   crtc2_offset;
+    uint32_t   crtc2_offset_cntl;
+    uint32_t   crtc2_pitch;
 
 				/* Flat panel registers */
-    CARD32     fp_crtc_h_total_disp;
-    CARD32     fp_crtc_v_total_disp;
-    CARD32     fp_gen_cntl;
-    CARD32     fp_h_sync_strt_wid;
-    CARD32     fp_horz_stretch;
-    CARD32     fp_panel_cntl;
-    CARD32     fp_v_sync_strt_wid;
-    CARD32     fp_vert_stretch;
-    CARD32     lvds_gen_cntl;
-    CARD32     tmds_crc;
-    CARD32     tmds_transmitter_cntl;
+    uint32_t   fp_crtc_h_total_disp;
+    uint32_t   fp_crtc_v_total_disp;
+    uint32_t   fp_gen_cntl;
+    uint32_t   fp_h_sync_strt_wid;
+    uint32_t   fp_horz_stretch;
+    uint32_t   fp_panel_cntl;
+    uint32_t   fp_v_sync_strt_wid;
+    uint32_t   fp_vert_stretch;
+    uint32_t   lvds_gen_cntl;
+    uint32_t   tmds_crc;
+    uint32_t   tmds_transmitter_cntl;
 
 				/* Computed values for PLL */
-    CARD32     dot_clock_freq;
-    CARD32     pll_output_freq;
+    uint32_t   dot_clock_freq;
+    uint32_t   pll_output_freq;
     int        feedback_div;
     int        post_div;
 
 				/* PLL registers */
-    CARD32     ppll_ref_div;
-    CARD32     ppll_div_3;
-    CARD32     htotal_cntl;
+    uint32_t   ppll_ref_div;
+    uint32_t   ppll_div_3;
+    uint32_t   htotal_cntl;
 
 				/* Computed values for PLL2 */
-    CARD32     dot_clock_freq_2;
-    CARD32     pll_output_freq_2;
+    uint32_t   dot_clock_freq_2;
+    uint32_t   pll_output_freq_2;
     int        feedback_div_2;
     int        post_div_2;
 
 				/* PLL2 registers */
-    CARD32     p2pll_ref_div;
-    CARD32     p2pll_div_0;
-    CARD32     htotal_cntl2;
+    uint32_t   p2pll_ref_div;
+    uint32_t   p2pll_div_0;
+    uint32_t   htotal_cntl2;
 
 				/* DDA register */
-    CARD32     dda_config;
-    CARD32     dda_on_off;
+    uint32_t   dda_config;
+    uint32_t   dda_on_off;
 
 				/* DDA2 register */
-    CARD32     dda2_config;
-    CARD32     dda2_on_off;
+    uint32_t   dda2_config;
+    uint32_t   dda2_on_off;
 
 				/* Pallet */
     Bool       palette_valid;
-    CARD32     palette[256];
-    CARD32     palette2[256];
+    uint32_t   palette[256];
+    uint32_t   palette2[256];
 } R128SaveRec, *R128SavePtr;
 
 typedef struct {
-    CARD16        reference_freq;
-    CARD16        reference_div;
+    uint16_t      reference_freq;
+    uint16_t      reference_div;
     unsigned      min_pll_freq;
     unsigned      max_pll_freq;
-    CARD16        xclk;
+    uint16_t      xclk;
 } R128PLLRec, *R128PLLPtr;
 
 typedef struct {
@@ -305,14 +305,14 @@ typedef struct {
 
     void              *MMIO;        /* Map of MMIO region                    */
     void              *FB;          /* Map of frame buffer                   */
-    CARD8             *VBIOS;       /* Video BIOS for mode validation on FPs */
+    uint8_t           *VBIOS;       /* Video BIOS for mode validation on FPs */
     int               FPBIOSstart;  /* Start of the flat panel info          */
 
-    CARD32            MemCntl;
-    CARD32            BusCntl;
+    uint32_t          MemCntl;
+    uint32_t          BusCntl;
     unsigned long     FbMapSize;    /* Size of frame buffer, in bytes        */
 
-    CARD8             BIOSDisplay;  /* Device the BIOS is set to display to  */
+    uint8_t           BIOSDisplay;  /* Device the BIOS is set to display to  */
 
     Bool              HasPanelRegs; /* Current chip can connect to a FP      */
 
@@ -356,7 +356,7 @@ typedef struct {
 				/* Computed values for Rage 128 */
     int               pitch;
     int               datatype;
-    CARD32            dp_gui_master_cntl;
+    uint32_t          dp_gui_master_cntl;
 
 				/* Saved values for ScreenToScreenCopy */
     int               xdir;
@@ -477,18 +477,18 @@ typedef struct {
     int               log2TexGran;
 
 				/* Saved scissor values */
-    CARD32            sc_left;
-    CARD32            sc_right;
-    CARD32            sc_top;
-    CARD32            sc_bottom;
+    uint32_t          sc_left;
+    uint32_t          sc_right;
+    uint32_t          sc_top;
+    uint32_t          sc_bottom;
 
-    CARD32            re_top_left;
-    CARD32            re_width_height;
+    uint32_t          re_top_left;
+    uint32_t          re_width_height;
 
-    CARD32            aux_sc_cntl;
+    uint32_t          aux_sc_cntl;
 
     int               irq;
-    CARD32            gen_int_cntl;
+    uint32_t          gen_int_cntl;
 
     Bool              DMAForXv;
 #endif
@@ -643,7 +643,7 @@ extern void	   R128DoPrepareCopy(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
 
 #define R128_VERBOSE	0
 
-#define RING_LOCALS	CARD32 *__head; int __count;
+#define RING_LOCALS	uint32_t *__head; int __count;
 
 #define R128CCE_REFRESH(pScrn, info)					\
 do {									\
@@ -684,12 +684,12 @@ do {									\
       xf86DrvMsg( pScrn->scrnIndex, X_INFO,				\
 		  "ADVANCE_RING() used: %d+%d=%d/%d\n",			\
 		  info->indirectBuffer->used - info->indirectStart,	\
-		  __count * (int)sizeof(CARD32),			\
+		  __count * (int)sizeof(uint32_t),			\
 		  info->indirectBuffer->used - info->indirectStart +	\
-		  __count * (int)sizeof(CARD32),			\
+		  __count * (int)sizeof(uint32_t),			\
 		  info->indirectBuffer->total - info->indirectStart );	\
    }									\
-   info->indirectBuffer->used += __count * (int)sizeof(CARD32);		\
+   info->indirectBuffer->used += __count * (int)sizeof(uint32_t);		\
 } while (0)
 
 #define OUT_RING( x ) do {						\
diff --git a/src/r128_accel.c b/src/r128_accel.c
index 4d666c7..99bfb20 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -145,9 +145,9 @@ void R128EngineReset(ScrnInfoPtr pScrn)
 {
     R128InfoPtr   info      = R128PTR(pScrn);
     unsigned char *R128MMIO = info->MMIO;
-    CARD32        clock_cntl_index;
-    CARD32        mclk_cntl;
-    CARD32        gen_reset_cntl;
+    uint32_t      clock_cntl_index;
+    uint32_t      mclk_cntl;
+    uint32_t      gen_reset_cntl;
 
     R128EngineFlush(pScrn);
 
@@ -161,7 +161,7 @@ void R128EngineReset(ScrnInfoPtr pScrn)
     OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl | R128_SOFT_RESET_GUI);
     INREG(R128_GEN_RESET_CNTL);
     OUTREG(R128_GEN_RESET_CNTL,
-	gen_reset_cntl & (CARD32)(~R128_SOFT_RESET_GUI));
+	gen_reset_cntl & (uint32_t)(~R128_SOFT_RESET_GUI));
     INREG(R128_GEN_RESET_CNTL);
 
     OUTPLL(R128_MCLK_CNTL,        mclk_cntl);
@@ -450,7 +450,7 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn,
 {
     R128InfoPtr   info      = R128PTR(pScrn);
     unsigned char *R128MMIO = info->MMIO;
-    CARD32        pat       = *(CARD32 *)(pointer)pattern;
+    uint32_t      pat       = *(uint32_t *)(pointer)pattern;
 
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
 # define PAT_SHIFT(pat,n) pat << n
@@ -847,10 +847,10 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
 {
     R128InfoPtr     info      = R128PTR(pScrn);
     unsigned char   *R128MMIO = info->MMIO;
-    CARD32          *p        = (pointer)info->scratch_buffer[bufno];
+    uint32_t        *p        = (pointer)info->scratch_buffer[bufno];
     int             i;
     int             left      = info->scanline_words;
-    volatile CARD32 *d;
+    volatile uint32_t *d;
 
     if (info->scanline_direct) return;
     --info->scanline_h;
@@ -977,10 +977,10 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
 {
     R128InfoPtr     info      = R128PTR(pScrn);
     unsigned char   *R128MMIO = info->MMIO;
-    CARD32          *p        = (pointer)info->scratch_buffer[bufno];
+    uint32_t        *p        = (pointer)info->scratch_buffer[bufno];
     int             i;
     int             left      = info->scanline_words;
-    volatile CARD32 *d;
+    volatile uint32_t *d;
 
     if (info->scanline_direct) return;
     --info->scanline_h;
@@ -1438,7 +1438,7 @@ static void R128CCESetupForDashedLine(ScrnInfoPtr pScrn,
 				   int length, unsigned char *pattern)
 {
     R128InfoPtr   info      = R128PTR(pScrn);
-    CARD32        pat       = *(CARD32 *)(pointer)pattern;
+    uint32_t      pat       = *(uint32_t *)(pointer)pattern;
     RING_LOCALS;
 
     R128CCE_REFRESH( pScrn, info );
diff --git a/src/r128_crtc.c b/src/r128_crtc.c
index e48e4d5..5f076cd 100644
--- a/src/r128_crtc.c
+++ b/src/r128_crtc.c
@@ -189,7 +189,7 @@ static void r128_crtc_mode_commit(xf86CrtcPtr crtc)
     r128_crtc_dpms(crtc, DPMSModeOn);
 }
 
-static void r128_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size)
+static void r128_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green, uint16_t *blue, int size)
 {
     R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
     int i;
diff --git a/src/r128_cursor.c b/src/r128_cursor.c
index ad6752f..d42bea6 100644
--- a/src/r128_cursor.c
+++ b/src/r128_cursor.c
@@ -179,18 +179,18 @@ void r128_crtc_load_cursor_image(xf86CrtcPtr crtc, unsigned char *src)
 
     R128InfoPtr   info      = R128PTR(pScrn);
     unsigned char *R128MMIO = info->MMIO;
-    CARD32        *s        = (pointer)src;
-    CARD32        *d        = (pointer)(info->FB + r128_crtc->cursor_offset + pScrn->fbOffset);
-    CARD32        save1     = 0;
-    CARD32        save2     = 0;
+    uint32_t      *s        = (pointer)src;
+    uint32_t      *d        = (pointer)(info->FB + r128_crtc->cursor_offset + pScrn->fbOffset);
+    uint32_t      save1     = 0;
+    uint32_t      save2     = 0;
     int           y;
 
     if (crtc_id == 0) {
 	save1 = INREG(R128_CRTC_GEN_CNTL);
-	OUTREG(R128_CRTC_GEN_CNTL, save1 & (CARD32)~R128_CRTC_CUR_EN);
+	OUTREG(R128_CRTC_GEN_CNTL, save1 & (uint32_t)~R128_CRTC_CUR_EN);
     } else if (crtc_id == 1) {
 	save2 = INREG(R128_CRTC2_GEN_CNTL);
-	OUTREG(R128_CRTC2_GEN_CNTL, save2 & (CARD32)~R128_CRTC2_CUR_EN);
+	OUTREG(R128_CRTC2_GEN_CNTL, save2 & (uint32_t)~R128_CRTC2_CUR_EN);
     }
 
 #if X_BYTE_ORDER == X_BIG_ENDIAN
@@ -255,7 +255,7 @@ Bool R128CursorInit(ScreenPtr pScreen)
     void*		  osArea  = NULL;
 #endif
     xf86CrtcConfigPtr     xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    CARD32                cursor_offset = 0;
+    uint32_t              cursor_offset = 0;
     int                   cpp = info->CurrentLayout.pixel_bytes;
     int                   width;
     int                   width_bytes;
diff --git a/src/r128_dga.c b/src/r128_dga.c
index d7fee02..bb4a1a6 100644
--- a/src/r128_dga.c
+++ b/src/r128_dga.c
@@ -332,7 +332,7 @@ R128_FillRect (
 ){
     R128InfoPtr info = R128PTR(pScrn);
 
-    (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0));
+    (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (uint32_t)(~0));
     (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h);
 
     if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel)
@@ -351,7 +351,7 @@ R128_BlitRect(
     int ydir = (srcy < dsty) ? -1 : 1;
 
     (*info->accel->SetupForScreenToScreenCopy)(
-	pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1);
+	pScrn, xdir, ydir, GXcopy, (uint32_t)(~0), -1);
     (*info->accel->SubsequentScreenToScreenCopy)(
 	pScrn, srcx, srcy, dstx, dsty, w, h);
 
@@ -375,7 +375,7 @@ R128_BlitTransRect(
     info->XAAForceTransBlit = TRUE;
 
     (*info->accel->SetupForScreenToScreenCopy)(
-	pScrn, xdir, ydir, GXcopy, (CARD32)(~0), color);
+	pScrn, xdir, ydir, GXcopy, (uint32_t)(~0), color);
 
     info->XAAForceTransBlit = FALSE;
 
diff --git a/src/r128_dri.c b/src/r128_dri.c
index f924331..467cd88 100644
--- a/src/r128_dri.c
+++ b/src/r128_dri.c
@@ -397,7 +397,7 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
     pboxSave = pbox = REGION_RECTS(prgn);
     nboxSave = nbox = REGION_NUM_RECTS(prgn);
 
-    (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, (CARD32)(-1));
+    (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, (uint32_t)(-1));
     for (; nbox; nbox--, pbox++) {
 	(*info->accel->SubsequentSolidFillRect)(pScrn,
 						pbox->x1 + info->fbX,
@@ -415,7 +415,7 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx)
     nbox = nboxSave;
 
     /* FIXME: this needs to consider depth tiling. */
-    (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, (CARD32)(-1));
+    (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, (uint32_t)(-1));
     for (; nbox; nbox--, pbox++)
 	(*info->accel->SubsequentSolidFillRect)(pScrn,
 						pbox->x1 + info->depthX,
@@ -647,7 +647,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen)
 static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen)
 {
     unsigned char *R128MMIO = info->MMIO;
-    CARD32 chunk;
+    uint32_t chunk;
     int ret;
     int flags;
 
@@ -1413,12 +1413,12 @@ static void R128DRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
     if (!info->useEXA) {
 	(*info->accel->SetupForScreenToScreenCopy)(pScrn,
 					       1, 1, GXcopy,
-					       (CARD32)(-1), -1);
+					       (uint32_t)(-1), -1);
     }
 #endif
 #ifdef USE_EXA
     if (info->useEXA) {
-        CARD32 src_pitch_offset, dst_pitch_offset, datatype;
+        uint32_t src_pitch_offset, dst_pitch_offset, datatype;
 
 	R128GetPixmapOffsetPitch(pPix, &src_pitch_offset);
 	dst_pitch_offset = src_pitch_offset + (info->backOffset >> 5);
@@ -1465,7 +1465,7 @@ static void R128EnablePageFlip(ScreenPtr pScreen)
 	if (!info->useEXA) {
 	    (*info->accel->SetupForScreenToScreenCopy)(pScrn,
 						   1, 1, GXcopy,
-						   (CARD32)(-1), -1);
+						   (uint32_t)(-1), -1);
 
 	    (*info->accel->SubsequentScreenToScreenCopy)(pScrn,
 						     0,
@@ -1478,7 +1478,7 @@ static void R128EnablePageFlip(ScreenPtr pScreen)
 #endif
 #ifdef USE_EXA
 	if (info->useEXA) {
-	    CARD32 src_pitch_offset, dst_pitch_offset, datatype;
+	    uint32_t src_pitch_offset, dst_pitch_offset, datatype;
 
 	    R128GetPixmapOffsetPitch(pPix, &src_pitch_offset);
 	    dst_pitch_offset = src_pitch_offset + (info->backOffset >> 5);
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 6cd669a..c541bfa 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -657,8 +657,8 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
 	pll->max_pll_freq   = 25000;
 	pll->xclk           = 10300;
     } else {
-	CARD16 bios_header    = R128_BIOS16(0x48);
-	CARD16 pll_info_block = R128_BIOS16(bios_header + 0x30);
+	uint16_t bios_header    = R128_BIOS16(0x48);
+	uint16_t pll_info_block = R128_BIOS16(bios_header + 0x30);
 	R128TRACE(("Header at 0x%04x; PLL Information at 0x%04x\n",
 		   bios_header, pll_info_block));
 
@@ -1634,7 +1634,7 @@ static void R128LoadPalette(ScrnInfoPtr pScrn, int numColors,
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     int i, j;
     int c, index;
-    CARD16 lut_r[256], lut_g[256], lut_b[256];
+    uint16_t lut_r[256], lut_g[256], lut_b[256];
 
     for (c = 0; c < xf86_config->num_crtc; c++) {
         xf86CrtcPtr crtc = xf86_config->crtc[c];
@@ -2404,7 +2404,7 @@ void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
     OUTREG(R128_TMDS_CRC,              restore->tmds_crc);
     OUTREG(R128_TMDS_TRANSMITTER_CNTL, restore->tmds_transmitter_cntl);
     OUTREG(R128_FP_PANEL_CNTL,         restore->fp_panel_cntl);
-    OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl & ~(CARD32)R128_FP_BLANK_DIS);
+    OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl & ~(uint32_t)R128_FP_BLANK_DIS);
 }
 
 /* Write LVDS registers */
@@ -2412,7 +2412,7 @@ void R128RestoreLVDSRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
 {
     R128InfoPtr   info      = R128PTR(pScrn);
     unsigned char *R128MMIO = info->MMIO;
-    CARD32        tmp;
+    uint32_t      tmp;
 
     tmp = INREG(R128_LVDS_GEN_CNTL);
     if ((tmp & (R128_LVDS_ON | R128_LVDS_BLON)) ==
@@ -2421,7 +2421,7 @@ void R128RestoreLVDSRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
     } else {
 	if (restore->lvds_gen_cntl & (R128_LVDS_ON | R128_LVDS_BLON)) {
 	    OUTREG(R128_LVDS_GEN_CNTL,
-		   restore->lvds_gen_cntl & (CARD32)~R128_LVDS_BLON);
+		   restore->lvds_gen_cntl & (uint32_t)~R128_LVDS_BLON);
 	    usleep(R128PTR(pScrn)->PanelPwrDly * 1000);
 	    OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
 	} else {
@@ -3643,7 +3643,7 @@ ModeStatus R128ValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
 		    if (R128_BIOS16(j+5)) j  = R128_BIOS16(j+5);
 		    else                  j += 9;
 
-		    mode->Clock = (CARD32)R128_BIOS16(j) * 10;
+		    mode->Clock = (uint32_t)R128_BIOS16(j) * 10;
 
 		    mode->HDisplay   = mode->CrtcHDisplay   =
 			((R128_BIOS16(j+10) & 0x01ff)+1)*8;
diff --git a/src/r128_exa_render.c b/src/r128_exa_render.c
index f00daf7..c0d3688 100644
--- a/src/r128_exa_render.c
+++ b/src/r128_exa_render.c
@@ -40,8 +40,8 @@
 static struct {
     Bool dst_alpha;
     Bool src_alpha;
-    CARD32 sblend;
-    CARD32 dblend;
+    uint32_t sblend;
+    uint32_t dblend;
 } R128BlendOp[] = {
     /* Clear */
     {0, 0, R128_ALPHA_BLEND_ZERO        , R128_ALPHA_BLEND_ZERO},
@@ -582,9 +582,9 @@ R128CCEPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
     return TRUE;
 }
 
-typedef union { float f; CARD32 i; } fi_type;
+typedef union { float f; uint32_t i; } fi_type;
 
-static inline CARD32
+static inline uint32_t
 R128FloatAsInt(float val)
 {
 	fi_type fi;
diff --git a/src/r128_output.c b/src/r128_output.c
index e5306d6..7bb2e2a 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -234,7 +234,7 @@ static R128MonitorType R128DisplayDDCConnected(xf86OutputPtr output)
 
     R128MonitorType MonType = MT_NONE;
     xf86MonPtr *MonInfo = &output->MonInfo;
-    CARD32 mask1, mask2;
+    uint32_t mask1, mask2;
 
     if (r128_output->type == OUTPUT_LVDS) {
         return MT_LCD;
@@ -346,7 +346,7 @@ static void R128I2CPutBits(I2CBusPtr b, int Clock, int data)
     R128I2CBusPtr pR128I2CBus = b->DriverPrivate.ptr;
 
     val = INREG(pR128I2CBus->ddc_reg)
-              & ~(CARD32)(pR128I2CBus->put_clk_mask | pR128I2CBus->put_data_mask);
+              & ~(uint32_t)(pR128I2CBus->put_clk_mask | pR128I2CBus->put_data_mask);
     val |= (Clock ? 0 : pR128I2CBus->put_clk_mask);
     val |= (data  ? 0 : pR128I2CBus->put_data_mask);
     OUTREG(pR128I2CBus->ddc_reg, val);
diff --git a/src/r128_probe.h b/src/r128_probe.h
index 426840a..40fe82b 100644
--- a/src/r128_probe.h
+++ b/src/r128_probe.h
@@ -129,11 +129,11 @@ typedef enum
 } R128OutputType;
 
 typedef struct {
-    CARD32 ddc_reg;
-    CARD32 put_clk_mask;
-    CARD32 put_data_mask;
-    CARD32 get_clk_mask;
-    CARD32 get_data_mask;
+    uint32_t ddc_reg;
+    uint32_t put_clk_mask;
+    uint32_t put_data_mask;
+    uint32_t get_clk_mask;
+    uint32_t get_data_mask;
 } R128I2CBusRec, *R128I2CBusPtr;
 
 typedef struct _R128CrtcPrivateRec {
@@ -144,9 +144,9 @@ typedef struct _R128CrtcPrivateRec {
     ExaOffscreenArea *rotate_mem_exa;
 #endif
     int crtc_id;
-    CARD32 cursor_offset;
+    uint32_t cursor_offset;
     /* Lookup table values to be set when the CRTC is enabled */
-    CARD8 lut_r[256], lut_g[256], lut_b[256];
+    uint8_t lut_r[256], lut_g[256], lut_b[256];
 } R128CrtcPrivateRec, *R128CrtcPrivatePtr;
 
 typedef struct {
diff --git a/src/r128_reg.h b/src/r128_reg.h
index 9ba0de5..eee5fb1 100644
--- a/src/r128_reg.h
+++ b/src/r128_reg.h
@@ -57,12 +57,12 @@
 #define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val)
 #define OUTREG(addr, val)   MMIO_OUT32(R128MMIO, addr, val)
 
-#define ADDRREG(addr)       ((volatile CARD32 *)(pointer)(R128MMIO + (addr)))
+#define ADDRREG(addr)       ((volatile uint32_t *)(pointer)(R128MMIO + (addr)))
 
 
 #define OUTREGP(addr, val, mask)   \
     do {                           \
-	CARD32 tmp = INREG(addr);  \
+	uint32_t tmp = INREG(addr);  \
 	tmp &= (mask);             \
 	tmp |= ((val) & ~(mask));  \
 	OUTREG(addr, tmp);         \
@@ -78,7 +78,7 @@
 
 #define OUTPLLP(pScrn, addr, val, mask)                                   \
     do {                                                                  \
-	CARD32 tmp = INPLL(pScrn, addr);                                  \
+	uint32_t tmp = INPLL(pScrn, addr);                                  \
 	tmp &= (mask);                                                    \
 	tmp |= ((val) & ~(mask));                                         \
 	OUTPLL(addr, tmp);                                                \
@@ -94,7 +94,7 @@
 	OUTREG(R128_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b));        \
     } while (0)
 
-#define OUTPAL_NEXT_CARD32(v)                                             \
+#define OUTPAL_NEXT_uint32_t(v)                                             \
     do {                                                                  \
 	OUTREG(R128_PALETTE_DATA, (v & 0x00ffffff));                      \
     } while (0)
@@ -114,12 +114,12 @@
 
 #define PAL_SELECT(idx)                                                   \
     do {                                                                  \
-	CARD32 tmp = INREG(R128_DAC_CNTL);                                \
+	uint32_t tmp = INREG(R128_DAC_CNTL);                                \
 	if (idx) {                                                        \
 	    OUTREG(R128_DAC_CNTL, tmp | R128_DAC_PALETTE_ACC_CTL);        \
 	} else {                                                          \
 	    OUTREG(R128_DAC_CNTL, tmp &                                   \
-		   (CARD32)~R128_DAC_PALETTE_ACC_CTL);                    \
+		   (uint32_t)~R128_DAC_PALETTE_ACC_CTL);                    \
 	}                                                                 \
     } while (0)
 
diff --git a/src/r128_video.c b/src/r128_video.c
index 6439a24..bcf36fc 100644
--- a/src/r128_video.c
+++ b/src/r128_video.c
@@ -59,8 +59,8 @@ typedef struct {
    void*         BufferHandle;
    int		 videoOffset;
    RegionRec     clip;
-   CARD32        colorKey;
-   CARD32        videoStatus;
+   uint32_t      colorKey;
+   uint32_t      videoStatus;
    Time          offTime;
    Time          freeTime;
    int           ecp_div;
@@ -405,7 +405,7 @@ R128DMA(
 #define BUFSIZE (R128_BUFFER_SIZE - R128_HOSTDATA_BLIT_OFFSET)
 #define MAXPASSES (MAXHEIGHT/(BUFSIZE/(MAXWIDTH*2))+1)
 
-    unsigned char *fb = (CARD8*)info->FB;
+    unsigned char *fb = (uint8_t*)info->FB;
     unsigned char *buf;
     int err=-1, i, idx, offset, hpass, passes, srcpassbytes, dstpassbytes;
     int sizes[MAXPASSES], list[MAXPASSES];
@@ -572,7 +572,7 @@ R128CopyData420(
 }
 
 
-static CARD32
+static uint32_t
 R128AllocateMemory(
    ScrnInfoPtr pScrn,
    void **mem_struct,
@@ -841,14 +841,14 @@ R128PutImage(
 ){
    R128InfoPtr info = R128PTR(pScrn);
    R128PortPrivPtr pPriv = (R128PortPrivPtr)data;
-   unsigned char *fb = (CARD8*)info->FB;
+   unsigned char *fb = (uint8_t*)info->FB;
    INT32 xa, xb, ya, yb;
    int new_size, offset, s1offset, s2offset, s3offset;
    int srcPitch, srcPitch2, dstPitch;
    int d1line, d2line, d3line, d1offset, d2offset, d3offset;
    int top, left, npixels, nlines;
    BoxRec dstBox;
-   CARD32 tmp;
+   uint32_t tmp;
 
    /* Currently, the video is only visible on the first monitor.
     * In the future we could try to make this smarter, or just implement
@@ -858,7 +858,7 @@ R128PutImage(
 
 #if X_BYTE_ORDER == X_BIG_ENDIAN
    unsigned char *R128MMIO = info->MMIO;
-   CARD32 config_cntl = INREG(R128_CONFIG_CNTL);
+   uint32_t config_cntl = INREG(R128_CONFIG_CNTL);
 
    /* We need to disable byte swapping, or the data gets mangled */
    OUTREG(R128_CONFIG_CNTL, config_cntl &
commit b632e89b923179b16d0d38128209427f666b963c
Author: Connor Behan <connor.behan at gmail.com>
Date:   Wed Jul 16 02:20:18 2014 -0700

    Remove pointless output
    
    This removes a debug line to fix a compiler warning and make the
    crtc1 and crtc2 code more symmetric. The number of bits per pixel is
    easy to find out anyway.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>

diff --git a/src/r128_driver.c b/src/r128_driver.c
index d17951d..6cd669a 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -3126,22 +3126,20 @@ Bool R128InitCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr save,
     int    hsync_wid;
     int    hsync_fudge;
     int    vsync_wid;
-    int    bytpp;
     int    hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 };
 
     switch (info->CurrentLayout.pixel_code) {
-    case 4:  format = 1; bytpp = 0; break;
-    case 8:  format = 2; bytpp = 1; break;
-    case 15: format = 3; bytpp = 2; break;      /*  555 */
-    case 16: format = 4; bytpp = 2; break;      /*  565 */
-    case 24: format = 5; bytpp = 3; break;      /*  RGB */
-    case 32: format = 6; bytpp = 4; break;      /* xRGB */
+    case 4:  format = 1; break;
+    case 8:  format = 2; break;
+    case 15: format = 3; break;      /*  555 */
+    case 16: format = 4; break;      /*  565 */
+    case 24: format = 5; break;      /*  RGB */
+    case 32: format = 6; break;      /* xRGB */
     default:
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel);
 	return FALSE;
     }
-    R128TRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp));
 
     hsync_fudge = hsync_fudge_default[format-1];
 
commit 866d0ad5295a7ca819b990f607d3e68582144b3b
Author: Connor Behan <connor.behan at gmail.com>
Date:   Wed Jul 16 17:39:59 2014 -0700

    Cleanup info struct
    
    This removes some dead code from info. It also fixes some indentation
    errors that were likely caused by sed.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>

diff --git a/src/r128.h b/src/r128.h
index 0308130..b9fcc0a 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -296,7 +296,6 @@ typedef struct {
     PCITAG            PciTag;
 #endif
     int               Chipset;
-    Bool              Primary;
 
     Bool              FBDev;
 
@@ -306,27 +305,20 @@ typedef struct {
 
     void              *MMIO;        /* Map of MMIO region                    */
     void              *FB;          /* Map of frame buffer                   */
+    CARD8             *VBIOS;       /* Video BIOS for mode validation on FPs */
+    int               FPBIOSstart;  /* Start of the flat panel info          */
 
     CARD32            MemCntl;
     CARD32            BusCntl;
     unsigned long     FbMapSize;    /* Size of frame buffer, in bytes        */
-    int               Flags;        /* Saved copy of mode flags              */
 
     CARD8             BIOSDisplay;  /* Device the BIOS is set to display to  */
 
     Bool              HasPanelRegs; /* Current chip can connect to a FP      */
-    CARD8             *VBIOS;       /* Video BIOS for mode validation on FPs */
-    int               FPBIOSstart;  /* Start of the flat panel info          */
 
 				/* Computed values for FPs */
     int               PanelXRes;
     int               PanelYRes;
-    int               HOverPlus;
-    int               HSyncWidth;
-    int               HBlank;
-    int               VOverPlus;
-    int               VSyncWidth;
-    int               VBlank;
     int               PanelPwrDly;
 
     R128PLLRec        pll;
@@ -343,7 +335,6 @@ typedef struct {
     XAAInfoRecPtr     accel;
 #endif
     Bool              accelOn;
-
     Bool	      useEXA;
     Bool	      RenderAccel;
 #ifdef USE_EXA
@@ -352,10 +343,6 @@ typedef struct {
     struct r128_2d_state state_2d;
 #endif
 
-    xf86CursorInfoPtr cursor;
-    unsigned long     cursor_start;
-    unsigned long     cursor_end;
-
     /*
      * XAAForceTransBlit is used to change the behavior of the XAA
      * SetupForScreenToScreenCopy function, to make it DGA-friendly.
@@ -405,19 +392,19 @@ typedef struct {
     Bool              directRenderingEnabled;
     DRIInfoPtr        pDRIInfo;
     int               drmFD;
-    drm_context_t        drmCtx;
+    drm_context_t     drmCtx;
     int               numVisualConfigs;
     __GLXvisualConfig *pVisualConfigs;
     R128ConfigPrivPtr pVisualConfigsPriv;
 
-    drm_handle_t         fbHandle;
+    drm_handle_t      fbHandle;
 
     drmSize           registerSize;
-    drm_handle_t         registerHandle;
+    drm_handle_t      registerHandle;
 
     Bool              IsPCI;            /* Current card is a PCI card */
     drmSize           pciSize;
-    drm_handle_t         pciMemHandle;
+    drm_handle_t      pciMemHandle;
     drmAddress        PCI;              /* Map */
 
     Bool              allowPageFlip;    /* Enable 3d page flipping */
@@ -425,7 +412,7 @@ typedef struct {
     int               drmMinor;
 
     drmSize           agpSize;
-    drm_handle_t         agpMemHandle;     /* Handle from drmAgpAlloc */
+    drm_handle_t      agpMemHandle;     /* Handle from drmAgpAlloc */
     unsigned long     agpOffset;
     drmAddress        AGP;              /* Map */
     int               agpMode;
@@ -438,20 +425,20 @@ typedef struct {
 
 				/* CCE ring buffer data */
     unsigned long     ringStart;        /* Offset into AGP space */
-    drm_handle_t         ringHandle;       /* Handle from drmAddMap */
+    drm_handle_t      ringHandle;       /* Handle from drmAddMap */
     drmSize           ringMapSize;      /* Size of map */
     int               ringSize;         /* Size of ring (in MB) */
     drmAddress        ring;             /* Map */
     int               ringSizeLog2QW;
 
     unsigned long     ringReadOffset;   /* Offset into AGP space */
-    drm_handle_t         ringReadPtrHandle; /* Handle from drmAddMap */
+    drm_handle_t      ringReadPtrHandle;/* Handle from drmAddMap */
     drmSize           ringReadMapSize;  /* Size of map */
     drmAddress        ringReadPtr;      /* Map */
 
 				/* CCE vertex/indirect buffer data */
     unsigned long     bufStart;        /* Offset into AGP space */
-    drm_handle_t         bufHandle;       /* Handle from drmAddMap */
+    drm_handle_t      bufHandle;       /* Handle from drmAddMap */
     drmSize           bufMapSize;      /* Size of map */
     int               bufSize;         /* Size of buffers (in MB) */
     drmAddress        buf;             /* Map */
@@ -460,7 +447,7 @@ typedef struct {
 
 				/* CCE AGP Texture data */
     unsigned long     agpTexStart;      /* Offset into AGP space */
-    drm_handle_t         agpTexHandle;     /* Handle from drmAddMap */
+    drm_handle_t      agpTexHandle;     /* Handle from drmAddMap */
     drmSize           agpTexMapSize;    /* Size of map */
     int               agpTexSize;       /* Size of AGP tex space (in MB) */
     drmAddress        agpTex;           /* Map */
diff --git a/src/r128_dri.c b/src/r128_dri.c
index 2c905a4..f924331 100644
--- a/src/r128_dri.c
+++ b/src/r128_dri.c
@@ -1525,9 +1525,6 @@ static void R128DRITransitionTo3d(ScreenPtr pScreen)
     R128EnablePageFlip(pScreen);
 
     info->have3DWindows = 1;
-
-    if (info->cursor_start)
-        xf86ForceHWCursor(pScreen, TRUE);
 }
 
 static void R128DRITransitionTo2d(ScreenPtr pScreen)
@@ -1550,7 +1547,4 @@ static void R128DRITransitionTo2d(ScreenPtr pScreen)
     }
 
     info->have3DWindows = 0;
-
-    if (info->cursor_start)
-        xf86ForceHWCursor(pScreen, FALSE);
 }
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 3cd3773..d17951d 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -2238,9 +2238,6 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
 	if (R128CursorInit(pScreen)) {
 	    int width, height;
 
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		       "Using hardware cursor (scanline %ld)\n",
-		       info->cursor_start / pScrn->displayWidth);
 	    if (xf86QueryLargestOffscreenArea(pScreen, &width, &height,
 					      0, 0, 0)) {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -2253,7 +2250,6 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
 	}
     } else {
-	info->cursor_start = 0;
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
     }
 
@@ -3064,12 +3060,6 @@ Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save,
             mode->HDisplay = mode->CrtcHDisplay = info->PanelXRes;
         if(info->PanelYRes < mode->CrtcVDisplay)
             mode->VDisplay = mode->CrtcVDisplay = info->PanelYRes;
-        mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank;
-        mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus;
-        mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth;
-        mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank;
-        mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus;
-        mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth;
     }
 
     save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
@@ -3834,9 +3824,6 @@ static Bool R128CloseScreen(CLOSE_SCREEN_ARGS_DECL)
     if (info->scratch_save)      free(info->scratch_save);
     info->scratch_save           = NULL;
 
-    if (info->cursor)            xf86DestroyCursorInfoRec(info->cursor);
-    info->cursor                 = NULL;
-
     if (info->DGAModes)          free(info->DGAModes);
     info->DGAModes               = NULL;
 
commit d05123eab19705d23310d06a299e61093abbe6cc
Author: Connor Behan <connor.behan at gmail.com>
Date:   Wed Jul 16 17:23:37 2014 -0700

    Cleanup entity struct
    
    This moves HasCRTC2 into the entity to make it more similar to radeon.
    It also removes IsDRIEnabled for being dead code.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>

diff --git a/src/r128.h b/src/r128.h
index d01b5c1..0308130 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -520,7 +520,6 @@ typedef struct {
     R128BIOSConnector BiosConnector[R128_MAX_BIOS_CONNECTOR];
 
     /****** Added for dualhead support *******************/
-    BOOL              HasCRTC2;     /* M3/M4 */
     BOOL              IsSecondary;  /* second Screen */
     BOOL	      IsPrimary;    /* primary Screen */
     BOOL              UseCRT;       /* force use CRT port as primary */
diff --git a/src/r128_crtc.c b/src/r128_crtc.c
index 9c3d0a9..e48e4d5 100644
--- a/src/r128_crtc.c
+++ b/src/r128_crtc.c
@@ -388,7 +388,6 @@ static const xf86CrtcFuncsRec r128_crtc_funcs = {
 Bool R128AllocateControllers(ScrnInfoPtr pScrn, int mask)
 {
     R128EntPtr pR128Ent = R128EntPriv(pScrn);
-    R128InfoPtr info = R128PTR(pScrn);
 
     if (mask & 1) {
         if (pR128Ent->Controller[0])
@@ -407,7 +406,7 @@ Bool R128AllocateControllers(ScrnInfoPtr pScrn, int mask)
     }
 
     if (mask & 2) {
-        if (!info->HasCRTC2)
+        if (!pR128Ent->HasCRTC2)
             return TRUE;
 
         pR128Ent->pCrtc[1] = xf86CrtcCreate(pScrn, &r128_crtc_funcs);
diff --git a/src/r128_driver.c b/src/r128_driver.c
index c62a1af..3cd3773 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -469,8 +469,9 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		   "Video BIOS not found!\n");
     }
+    R128EntPtr pR128Ent = R128EntPriv(pScrn);
 
-        if(info->HasCRTC2)
+        if(pR128Ent->HasCRTC2)
         {                    
              if(info->IsSecondary)
              {  
@@ -480,7 +481,6 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
 
                  if(info->DisplayType > MT_NONE)
                  {
-                     R128EntPtr pR128Ent = R128EntPriv(pScrn);
                      pR128Ent->HasSecondary = TRUE;
 
                  }
@@ -771,6 +771,7 @@ static Bool R128PreInitWeight(ScrnInfoPtr pScrn)
 static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
 {
     R128InfoPtr   info      = R128PTR(pScrn);
+    R128EntPtr    pR128Ent  = R128EntPriv(pScrn);
     unsigned char *R128MMIO = info->MMIO;
     EntityInfoPtr pEnt      = info->pEnt;
     GDevPtr       dev       = pEnt->device;
@@ -865,7 +866,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
     } else {
         info->isDFP = FALSE;
         info->isPro2 = FALSE;
-        info->HasCRTC2 = FALSE;
+        pR128Ent->HasCRTC2 = FALSE;
 	switch (info->Chipset) {
 	/* R128 Pro and Pro2 can have DFP, we will deal with it.
 	   No support for dual-head/xinerama yet.
@@ -918,7 +919,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
 	case PCI_CHIP_RAGE128ML: 
 			info->HasPanelRegs = TRUE;  
 			/* which chips support dualhead? */
-			info->HasCRTC2 = TRUE;  
+			pR128Ent->HasCRTC2 = TRUE;
 			break;
 	case PCI_CHIP_RAGE128RE:
 	case PCI_CHIP_RAGE128RF:
@@ -1428,7 +1429,6 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
 	    info->IsPrimary = TRUE;
             xf86SetPrimInitDone(pScrn->entityList[0]);
             pR128Ent->pPrimaryScrn = pScrn;
-            pR128Ent->IsDRIEnabled = FALSE;
             pR128Ent->BypassSecondary = FALSE;
             pR128Ent->HasSecondary = FALSE;
             pR128Ent->RestorePrimary = FALSE;
@@ -1872,13 +1872,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
                         "section in your XFConfig file.\n");
                 }
                 else
-                info->directRenderingEnabled =
-                    R128DRIScreenInit(pScreen);
-                if(xf86IsEntityShared(pScrn->entityList[0]))
-                {
-                    R128EntPtr pR128Ent = R128EntPriv(pScrn);
-                    pR128Ent->IsDRIEnabled = info->directRenderingEnabled;
-                }
+                info->directRenderingEnabled = R128DRIScreenInit(pScreen);
             }
 	}
     }
@@ -2854,6 +2848,7 @@ static void R128Save(ScrnInfoPtr pScrn)
 static void R128Restore(ScrnInfoPtr pScrn)
 {
     R128InfoPtr   info      = R128PTR(pScrn);
+    R128EntPtr    pR128Ent  = R128EntPriv(pScrn);
     unsigned char *R128MMIO = info->MMIO;
     R128SavePtr   restore   = &info->SavedReg;
 
@@ -2873,7 +2868,7 @@ static void R128Restore(ScrnInfoPtr pScrn)
         OUTREG(R128_DP_DATATYPE,      restore->dp_datatype);
 
         R128RestoreCommonRegisters(pScrn, restore);
-        if (info->HasCRTC2) {
+        if (pR128Ent->HasCRTC2) {
             R128RestoreDDA2Registers(pScrn, restore);
             R128RestoreCrtc2Registers(pScrn, restore);
             R128RestorePLL2Registers(pScrn, restore);
diff --git a/src/r128_output.c b/src/r128_output.c
index d7a1c55..e5306d6 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -400,13 +400,14 @@ void R128SetOutputType(ScrnInfoPtr pScrn, R128OutputPrivatePtr r128_output)
 
 void R128SetupGenericConnectors(ScrnInfoPtr pScrn)
 {
-    R128InfoPtr info = R128PTR(pScrn);
+    R128InfoPtr info    = R128PTR(pScrn);
+    R128EntPtr pR128Ent = R128EntPriv(pScrn);
 
-    if (!info->HasCRTC2 && !info->isDFP) {
+    if (!pR128Ent->HasCRTC2 && !info->isDFP) {
         info->BiosConnector[0].ConnectorType = CONNECTOR_VGA;
         info->BiosConnector[0].valid = TRUE;
         return;
-    } else if (!info->HasCRTC2) {
+    } else if (!pR128Ent->HasCRTC2) {
         info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_D;
 	info->BiosConnector[0].valid = TRUE;
 	return;
@@ -421,7 +422,8 @@ void R128SetupGenericConnectors(ScrnInfoPtr pScrn)
 
 Bool R128SetupConnectors(ScrnInfoPtr pScrn)
 {
-    R128InfoPtr info = R128PTR(pScrn);
+    R128InfoPtr info    = R128PTR(pScrn);
+    R128EntPtr pR128Ent = R128EntPriv(pScrn);
     xf86OutputPtr output;
     int num_vga = 0;
     int num_dvi = 0;
@@ -476,7 +478,7 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
             output->doubleScanAllowed = TRUE;
             output->driver_private = r128_output;
 	    output->possible_clones = 0;
-	    if (conntype == CONNECTOR_LVDS || !info->HasCRTC2)
+	    if (conntype == CONNECTOR_LVDS || !pR128Ent->HasCRTC2)
 	        output->possible_crtcs = 1;
 	    else
 	        output->possible_crtcs = 2;
diff --git a/src/r128_probe.c b/src/r128_probe.c
index e623bc9..348d15b 100644
--- a/src/r128_probe.c
+++ b/src/r128_probe.c
@@ -288,7 +288,6 @@ r128_get_scrninfo(int entity_num)
                 R128EntPtr pR128Ent;
                 pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
                 pR128Ent = pPriv->ptr;
-                pR128Ent->IsDRIEnabled = FALSE;
                 pR128Ent->BypassSecondary = FALSE;
                 pR128Ent->HasSecondary = FALSE;
                 pR128Ent->IsSecondaryRestored = FALSE;
diff --git a/src/r128_probe.h b/src/r128_probe.h
index 95988ec..426840a 100644
--- a/src/r128_probe.h
+++ b/src/r128_probe.h
@@ -170,9 +170,8 @@ typedef struct _R128OutputPrivateRec {
 
 typedef struct
 {
-    Bool IsDRIEnabled;
-
     Bool HasSecondary;
+    Bool HasCRTC2;
     Bool BypassSecondary;
     /*These two registers are used to make sure the CRTC2 is
       retored before CRTC_EXT, otherwise it could lead to blank screen.*/
commit c95ce4251921f09101911ca5c4ff3940c38cc6b5
Author: Connor Behan <connor.behan at gmail.com>
Date:   Wed Jul 16 01:29:19 2014 -0700

    Get entity without code duplication
    
    This fixes the parts of the code that were not using the helper function
    to find the entity.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>

diff --git a/src/r128_accel.c b/src/r128_accel.c
index 7ffd15f..4d666c7 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -1853,12 +1853,8 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
 
     if(xf86IsEntityShared(pScrn->entityList[0]))
     {
-        DevUnion* pPriv;
-        R128EntPtr pR128Ent;
-        pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
-                getR128EntityIndex());
-        pR128Ent = pPriv->ptr;
-        
+        R128EntPtr pR128Ent = R128EntPriv(pScrn);
+
         /*if there are more than one devices sharing this entity, we
           have to assign this call back, otherwise the XAA will be
           disabled */
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 4c03060..c62a1af 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -241,9 +241,7 @@ static Bool R128MapMMIO(ScrnInfoPtr pScrn)
         /* If the primary screen has already mapped the MMIO region,
            use its pointer instead of mapping it a second time. */
         if (info->IsSecondary) {
-            DevUnion* pPriv = xf86GetEntityPrivate(pScrn->entityList[0], 
-                                                   getR128EntityIndex());
-            R128EntPtr pR128Ent = pPriv->ptr;
+            R128EntPtr pR128Ent = R128EntPriv(pScrn);
             R128InfoPtr info0 = R128PTR(pR128Ent->pPrimaryScrn);
             info->MMIO=info0->MMIO;
             if (info->MMIO) return TRUE;
@@ -482,11 +480,7 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
 
                  if(info->DisplayType > MT_NONE)
                  {
-                     DevUnion* pPriv;
-                     R128EntPtr pR128Ent;
-                     pPriv = xf86GetEntityPrivate(pScrn->entityList[0], 
-                         getR128EntityIndex());
-                     pR128Ent = pPriv->ptr;
+                     R128EntPtr pR128Ent = R128EntPriv(pScrn);
                      pR128Ent->HasSecondary = TRUE;
 
                  }
@@ -506,11 +500,7 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
                      If something on CRT port, treat it as primary*/
                      if(xf86IsEntityShared(pScrn->entityList[0]))
                      {
-                         DevUnion* pPriv;
-                         R128EntPtr pR128Ent;
-                         pPriv = xf86GetEntityPrivate(pScrn->entityList[0], 
-                             getR128EntityIndex());
-                         pR128Ent = pPriv->ptr;
+                         R128EntPtr pR128Ent = R128EntPriv(pScrn);
                          pR128Ent->BypassSecondary = TRUE;
                      }
 
@@ -1427,24 +1417,16 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
     {
         if(xf86IsPrimInitDone(pScrn->entityList[0]))
         {
-            DevUnion* pPriv;
-            R128EntPtr pR128Ent;
+            R128EntPtr pR128Ent = R128EntPriv(pScrn);
             info->IsSecondary = TRUE;
-            pPriv = xf86GetEntityPrivate(pScrn->entityList[0], 
-                    getR128EntityIndex());
-            pR128Ent = pPriv->ptr;
             if(pR128Ent->BypassSecondary) return FALSE;
             pR128Ent->pSecondaryScrn = pScrn;
         }
         else
         {
-            DevUnion* pPriv;
-            R128EntPtr pR128Ent;
+            R128EntPtr pR128Ent = R128EntPriv(pScrn);
 	    info->IsPrimary = TRUE;
             xf86SetPrimInitDone(pScrn->entityList[0]);
-            pPriv = xf86GetEntityPrivate(pScrn->entityList[0], 
-                    getR128EntityIndex());
-            pR128Ent = pPriv->ptr;
             pR128Ent->pPrimaryScrn = pScrn;
             pR128Ent->IsDRIEnabled = FALSE;
             pR128Ent->BypassSecondary = FALSE;
@@ -1894,11 +1876,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
                     R128DRIScreenInit(pScreen);
                 if(xf86IsEntityShared(pScrn->entityList[0]))
                 {
-                    DevUnion* pPriv;
-                    R128EntPtr pR128Ent;
-                    pPriv = xf86GetEntityPrivate(pScrn->entityList[0], 
-                        getR128EntityIndex());
-                    pR128Ent = pPriv->ptr;
+                    R128EntPtr pR128Ent = R128EntPriv(pScrn);
                     pR128Ent->IsDRIEnabled = info->directRenderingEnabled;
                 }
             }
commit e9ea36390ea0478c4b867df3bffdf2b122e0cb15
Author: Connor Behan <connor.behan at gmail.com>
Date:   Wed Jul 16 00:57:18 2014 -0700

    Change register name
    
    Surely this is a typo.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>

diff --git a/src/r128_output.c b/src/r128_output.c
index 79c80bf..d7a1c55 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -186,8 +186,8 @@ void R128DPMSSetOn(xf86OutputPtr output)
         save->lvds_gen_cntl |=     (R128_LVDS_ON | R128_LVDS_BLON);
         break;
     case MT_DFP:
-        OUTREGP(R128_FP_GEN_CNTL,  (R128_FP_FPON | R128_FP_TDMS_EN), ~(R128_FP_FPON | R128_FP_TDMS_EN));
-        save->fp_gen_cntl   |=     (R128_FP_FPON | R128_FP_TDMS_EN);
+        OUTREGP(R128_FP_GEN_CNTL,  (R128_FP_FPON | R128_FP_TMDS_EN), ~(R128_FP_FPON | R128_FP_TMDS_EN));
+        save->fp_gen_cntl   |=     (R128_FP_FPON | R128_FP_TMDS_EN);
         break;
     case MT_CRT:
         OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_CRT_ON, ~R128_CRTC_CRT_ON);
@@ -213,8 +213,8 @@ void R128DPMSSetOff(xf86OutputPtr output)
         save->lvds_gen_cntl &=         ~(R128_LVDS_BLON | R128_LVDS_ON);
         break;
     case MT_DFP:
-        OUTREGP(R128_FP_GEN_CNTL,   0, ~(R128_FP_FPON | R128_FP_TDMS_EN));
-        save->fp_gen_cntl   &=         ~(R128_FP_FPON | R128_FP_TDMS_EN);
+        OUTREGP(R128_FP_GEN_CNTL,   0, ~(R128_FP_FPON | R128_FP_TMDS_EN));
+        save->fp_gen_cntl   &=         ~(R128_FP_FPON | R128_FP_TMDS_EN);
         break;
     case MT_CRT:
         OUTREGP(R128_CRTC_EXT_CNTL, 0, ~(R128_CRTC_CRT_ON));
diff --git a/src/r128_reg.h b/src/r128_reg.h
index dac22e6..9ba0de5 100644
--- a/src/r128_reg.h
+++ b/src/r128_reg.h
@@ -599,7 +599,7 @@
 #define R128_FP_GEN_CNTL                  0x0284
 #       define R128_FP_FPON                  (1 << 0)
 #       define R128_FP_BLANK_DIS             (1 << 1)
-#       define R128_FP_TDMS_EN               (1 <<  2)
+#       define R128_FP_TMDS_EN               (1 <<  2)
 #       define R128_FP_DETECT_SENSE          (1 <<  8)
 #       define R128_FP_SEL_CRTC2             (1 << 13)
 #       define R128_FP_CRTC_DONT_SHADOW_VPAR (1 << 16)


More information about the xorg-commit mailing list