xf86-video-ati: Branch 'kms-only' - 2 commits

Dave Airlie airlied at kemper.freedesktop.org
Sat Jun 16 01:28:12 PDT 2012


 src/Makefile.am        |    3 
 src/drmmode_display.c  |   33 ++++++++
 src/radeon.h           |    7 -
 src/radeon_driver.c    |  186 -------------------------------------------------
 src/radeon_exa_funcs.c |    5 -
 src/radeon_kms.c       |  140 ++++++++++++++++++++++++++++++++++++
 src/radeon_probe.h     |    6 -
 7 files changed, 173 insertions(+), 207 deletions(-)

New commits:
commit dd4ab5aba9047d522dbcfe8a341c368312e1a471
Author: Dave Airlie <airlied at redhat.com>
Date:   Sat Jun 16 08:47:32 2012 +0100

    radeon: migrate remainder of radeon_driver.c to rest of driver
    
    This helps make a few more things static and the driver generally
    smaller.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/Makefile.am b/src/Makefile.am
index 3755e82..5c09554 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,8 +57,7 @@ radeon_drv_la_LTLIBRARIES = radeon_drv.la
 radeon_drv_la_LDFLAGS = -module -avoid-version
 radeon_drv_ladir = @moduledir@/drivers
 radeon_drv_la_SOURCES = \
-	radeon_accel.c \
-	radeon_driver.c radeon_video.c \
+	radeon_accel.c radeon_video.c \
 	radeon_misc.c radeon_probe.c \
 	radeon_textured_video.c radeon_xvmc.c \
 	$(RADEON_EXA_SOURCES) \
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 481eb2f..27569e5 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -48,6 +48,39 @@
 #include <X11/extensions/dpms.h>
 #endif
 
+static Bool
+RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
+{
+    int i = 0;
+    char s1[20];
+
+    do {
+	switch(*s) {
+	case ',':
+  	    s1[i] = '\0';
+	    i = 0;
+	    if (strcmp(s1, output_name) == 0)
+		return TRUE;
+	    break;
+	case ' ':
+	case '\t':
+	case '\n':
+	case '\r':
+	    break;
+	default:
+	    s1[i] = *s;
+	    i++;
+	    break;
+	}
+    } while(*s++);
+
+    s1[i] = '\0';
+    if (strcmp(s1, output_name) == 0)
+	return TRUE;
+
+    return FALSE;
+}
+
 static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
 					  int width, int height,
 					  int depth, int bpp,
diff --git a/src/radeon.h b/src/radeon.h
index 35efd54..742a6f8 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -494,13 +494,6 @@ extern void RADEONWaitForVLine(ScrnInfoPtr pScrn, PixmapPtr pPix,
 
 /* radeon_driver.c */
 extern RADEONEntPtr RADEONEntPriv(ScrnInfoPtr pScrn);
-extern Bool
-RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name);
-
-Bool RADEONGetRec(ScrnInfoPtr pScrn);
-void RADEONFreeRec(ScrnInfoPtr pScrn);
-Bool RADEONPreInitVisual(ScrnInfoPtr pScrn);
-Bool RADEONPreInitWeight(ScrnInfoPtr pScrn);
 
 /* radeon_exa.c */
 extern unsigned eg_tile_split(unsigned tile_split);
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 3e39b4b..599d07d 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -103,189 +103,3 @@
 
 #include "atipciids.h"
 
-extern _X_EXPORT int gRADEONEntityIndex;
-
-static int getRADEONEntityIndex(void)
-{
-    return gRADEONEntityIndex;
-}
-
-RADEONEntPtr RADEONEntPriv(ScrnInfoPtr pScrn)
-{
-    DevUnion     *pPriv;
-    RADEONInfoPtr  info   = RADEONPTR(pScrn);
-    pPriv = xf86GetEntityPrivate(info->pEnt->index,
-                                 getRADEONEntityIndex());
-    return pPriv->ptr;
-}
-
-/* Allocate our private RADEONInfoRec */
-Bool RADEONGetRec(ScrnInfoPtr pScrn)
-{
-    if (pScrn->driverPrivate) return TRUE;
-
-    pScrn->driverPrivate = xnfcalloc(sizeof(RADEONInfoRec), 1);
-    return TRUE;
-}
-
-/* Free our private RADEONInfoRec */
-void RADEONFreeRec(ScrnInfoPtr pScrn)
-{
-    RADEONInfoPtr  info;
-
-    if (!pScrn || !pScrn->driverPrivate) return;
-
-    info = RADEONPTR(pScrn);
-
-    if (info->accel_state) {
-	free(info->accel_state);
-	info->accel_state = NULL;
-    }
-
-    free(pScrn->driverPrivate);
-    pScrn->driverPrivate = NULL;
-}
-
-/* This is called by RADEONPreInit to set up the default visual */
-Bool RADEONPreInitVisual(ScrnInfoPtr pScrn)
-{
-    RADEONInfoPtr  info = RADEONPTR(pScrn);
-
-    if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb))
-	return FALSE;
-
-    switch (pScrn->depth) {
-    case 8:
-    case 15:
-    case 16:
-    case 24:
-	break;
-
-    default:
-	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		   "Given depth (%d) is not supported by %s driver\n",
-		   pScrn->depth, RADEON_DRIVER_NAME);
-	return FALSE;
-    }
-
-    xf86PrintDepthBpp(pScrn);
-
-    info->pix24bpp                   = xf86GetBppFromDepth(pScrn,
-							   pScrn->depth);
-    info->pixel_bytes  = pScrn->bitsPerPixel / 8;
-
-    if (info->pix24bpp == 24) {
-	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		   "Radeon does NOT support 24bpp\n");
-	return FALSE;
-    }
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Pixel depth = %d bits stored in %d byte%s (%d bpp pixmaps)\n",
-	       pScrn->depth,
-	       info->pixel_bytes,
-	       info->pixel_bytes > 1 ? "s" : "",
-	       info->pix24bpp);
-
-    if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE;
-
-    if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
-	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		   "Default visual (%s) is not supported at depth %d\n",
-		   xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
-	return FALSE;
-    }
-    return TRUE;
-}
-
-/* This is called by RADEONPreInit to handle all color weight issues */
-Bool RADEONPreInitWeight(ScrnInfoPtr pScrn)
-{
-    RADEONInfoPtr  info = RADEONPTR(pScrn);
-
-				/* Save flag for 6 bit DAC to use for
-				   setting CRTC registers.  Otherwise use
-				   an 8 bit DAC, even if xf86SetWeight sets
-				   pScrn->rgbBits to some value other than
-				   8. */
-    info->dac6bits = FALSE;
-
-    if (pScrn->depth > 8) {
-	rgb  defaultWeight = { 0, 0, 0 };
-
-	if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
-    } else {
-	pScrn->rgbBits = 8;
-    }
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Using %d bits per RGB (%d bit DAC)\n",
-	       pScrn->rgbBits, info->dac6bits ? 6 : 8);
-
-    return TRUE;
-}
-
-Bool
-RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
-{
-    int i = 0;
-    char s1[20];
-
-    do {
-	switch(*s) {
-	case ',':
-  	    s1[i] = '\0';
-	    i = 0;
-	    if (strcmp(s1, output_name) == 0)
-		return TRUE;
-	    break;
-	case ' ':
-	case '\t':
-	case '\n':
-	case '\r':
-	    break;
-	default:
-	    s1[i] = *s;
-	    i++;
-	    break;
-	}
-    } while(*s++);
-
-    s1[i] = '\0';
-    if (strcmp(s1, output_name) == 0)
-	return TRUE;
-
-    return FALSE;
-}
-
-#ifdef X_XF86MiscPassMessage
-Bool RADEONHandleMessage(int scrnIndex, const char* msgtype,
-                                   const char* msgval, char** retmsg)
-{
-    ErrorF("RADEONHandleMessage(%d, \"%s\", \"%s\", retmsg)\n", scrnIndex,
-		    msgtype, msgval);
-    *retmsg = "";
-    return 0;
-}
-#endif
-
-#ifndef HAVE_XF86MODEBANDWIDTH
-/** Calculates the memory bandwidth (in MiB/sec) of a mode. */
-_X_HIDDEN unsigned int
-xf86ModeBandwidth(DisplayModePtr mode, int depth)
-{
-    float a_active, a_total, active_percent, pixels_per_second;
-    int bytes_per_pixel = (depth + 7) / 8;
-
-    if (!mode->HTotal || !mode->VTotal || !mode->Clock)
-	return 0;
-
-    a_active = mode->HDisplay * mode->VDisplay;
-    a_total = mode->HTotal * mode->VTotal;
-    active_percent = a_active / a_total;
-    pixels_per_second = active_percent * mode->Clock * 1000.0;
-
-    return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
-}
-#endif
-
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 288f936..4c13a00 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -617,9 +617,6 @@ Bool RADEONDrawInit(ScreenPtr pScreen)
 #ifdef RENDER
     if (info->RenderAccel) {
 	if (IS_R300_3D || IS_R500_3D) {
-	    if ((info->ChipFamily < CHIP_FAMILY_RS400)
-		|| (info->directRenderingEnabled)
-		) {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration "
 			       "enabled for R300/R400/R500 type cards.\n");
 		info->accel_state->exa->CheckComposite = R300CheckComposite;
@@ -627,8 +624,6 @@ Bool RADEONDrawInit(ScreenPtr pScreen)
 		    R300PrepareComposite;
 		info->accel_state->exa->Composite = RadeonComposite;
 		info->accel_state->exa->DoneComposite = RadeonDoneComposite;
-	    } else
-		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EXA Composite requires CP on R5xx/IGP\n");
 	} else if (IS_R200_3D) {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration "
 			       "enabled for R200 type cards.\n");
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 9a31c31..cf9e8a8 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -36,6 +36,7 @@
 #include "radeon_probe.h"
 #include "micmap.h"
 
+#include "radeon_version.h"
 #include "shadow.h"
 
 #include "atipciids.h"
@@ -147,6 +148,43 @@ static int getRADEONEntityIndex(void)
     return gRADEONEntityIndex;
 }
 
+
+RADEONEntPtr RADEONEntPriv(ScrnInfoPtr pScrn)
+{
+    DevUnion     *pPriv;
+    RADEONInfoPtr  info   = RADEONPTR(pScrn);
+    pPriv = xf86GetEntityPrivate(info->pEnt->index,
+                                 getRADEONEntityIndex());
+    return pPriv->ptr;
+}
+
+/* Allocate our private RADEONInfoRec */
+static Bool RADEONGetRec(ScrnInfoPtr pScrn)
+{
+    if (pScrn->driverPrivate) return TRUE;
+
+    pScrn->driverPrivate = xnfcalloc(sizeof(RADEONInfoRec), 1);
+    return TRUE;
+}
+
+/* Free our private RADEONInfoRec */
+static void RADEONFreeRec(ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr  info;
+
+    if (!pScrn || !pScrn->driverPrivate) return;
+
+    info = RADEONPTR(pScrn);
+
+    if (info->accel_state) {
+	free(info->accel_state);
+	info->accel_state = NULL;
+    }
+
+    free(pScrn->driverPrivate);
+    pScrn->driverPrivate = NULL;
+}
+
 static void *
 radeonShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
 		   CARD32 *size, void *closure)
@@ -280,6 +318,85 @@ static Bool RADEONIsAccelWorking(ScrnInfoPtr pScrn)
     return FALSE;
 }
 
+/* This is called by RADEONPreInit to set up the default visual */
+static Bool RADEONPreInitVisual(ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr  info = RADEONPTR(pScrn);
+
+    if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb))
+	return FALSE;
+
+    switch (pScrn->depth) {
+    case 8:
+    case 15:
+    case 16:
+    case 24:
+	break;
+
+    default:
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		   "Given depth (%d) is not supported by %s driver\n",
+		   pScrn->depth, RADEON_DRIVER_NAME);
+	return FALSE;
+    }
+
+    xf86PrintDepthBpp(pScrn);
+
+    info->pix24bpp                   = xf86GetBppFromDepth(pScrn,
+							   pScrn->depth);
+    info->pixel_bytes  = pScrn->bitsPerPixel / 8;
+
+    if (info->pix24bpp == 24) {
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		   "Radeon does NOT support 24bpp\n");
+	return FALSE;
+    }
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+	       "Pixel depth = %d bits stored in %d byte%s (%d bpp pixmaps)\n",
+	       pScrn->depth,
+	       info->pixel_bytes,
+	       info->pixel_bytes > 1 ? "s" : "",
+	       info->pix24bpp);
+
+    if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE;
+
+    if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		   "Default visual (%s) is not supported at depth %d\n",
+		   xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+	return FALSE;
+    }
+    return TRUE;
+}
+
+/* This is called by RADEONPreInit to handle all color weight issues */
+static Bool RADEONPreInitWeight(ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr  info = RADEONPTR(pScrn);
+
+				/* Save flag for 6 bit DAC to use for
+				   setting CRTC registers.  Otherwise use
+				   an 8 bit DAC, even if xf86SetWeight sets
+				   pScrn->rgbBits to some value other than
+				   8. */
+    info->dac6bits = FALSE;
+
+    if (pScrn->depth > 8) {
+	rgb  defaultWeight = { 0, 0, 0 };
+
+	if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
+    } else {
+	pScrn->rgbBits = 8;
+    }
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+	       "Using %d bits per RGB (%d bit DAC)\n",
+	       pScrn->rgbBits, info->dac6bits ? 6 : 8);
+
+    return TRUE;
+}
+
 static Bool RADEONPreInitAccel_KMS(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr  info = RADEONPTR(pScrn);
@@ -1390,3 +1507,24 @@ ModeStatus RADEONValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
    }
     return MODE_OK;
 }
+
+#ifndef HAVE_XF86MODEBANDWIDTH
+/** Calculates the memory bandwidth (in MiB/sec) of a mode. */
+_X_HIDDEN unsigned int
+xf86ModeBandwidth(DisplayModePtr mode, int depth)
+{
+    float a_active, a_total, active_percent, pixels_per_second;
+    int bytes_per_pixel = (depth + 7) / 8;
+
+    if (!mode->HTotal || !mode->VTotal || !mode->Clock)
+	return 0;
+
+    a_active = mode->HDisplay * mode->VDisplay;
+    a_total = mode->HTotal * mode->VTotal;
+    active_percent = a_active / a_total;
+    pixels_per_second = active_percent * mode->Clock * 1000.0;
+
+    return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
+}
+#endif
+
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index db4535c..576f722 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -128,12 +128,6 @@ typedef struct
     int dri2_info_cnt;
 } RADEONEntRec, *RADEONEntPtr;
 
-/* radeon_driver.c */
-#ifdef X_XF86MiscPassMessage
-extern Bool                 RADEONHandleMessage(int, const char*, const char*,
-					        char**);
-#endif
-
 extern const OptionInfoRec *RADEONOptionsWeak(void);
 
 extern Bool                 RADEONPreInit_KMS(ScrnInfoPtr, int);
commit a19237fad2492d70777167c631f4e6e1fae0e908
Author: Dave Airlie <airlied at redhat.com>
Date:   Sat Jun 16 08:19:35 2012 +0100

    radeon: avoid including large static struct twice.
    
    Just extern this in the one file that needs access.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 7180c60..9a31c31 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -48,7 +48,6 @@
 #include <X11/extensions/dpms.h>
 #endif
 
-#include "radeon_chipset_gen.h"
 #include "radeon_chipinfo_gen.h"
 
 #define CURSOR_WIDTH	64
@@ -58,6 +57,7 @@
 #include "radeon_cs_gem.h"
 #include "radeon_vbo.h"
 
+extern SymTabRec *RADEONChipsets;
 static Bool radeon_setup_kernel_mem(ScreenPtr pScreen);
 
 const OptionInfoRec RADEONOptions_KMS[] = {


More information about the xorg-commit mailing list