Skip to contentSkip to conversation

Add Gallium (radeong) support via an xorg.conf option, disabled by default.

PATCH In review Robert Hooker 2 participants 2 messages Jun 15, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add Gallium (radeong) support via an xorg.conf option, disabled by default.

The r300 gallium driver in mesa is built as radeong_dri.so and the DDX is hardcoded to use r300 as the DRI driver name for that generation. this patch allows radeong to be used if specified in an xorg.conf with this option:

Option "Gallium" "True"

This only affects DRI2 since the gallium driver requires it, and has the benefit of being able to coexist with the classic mesa driver.

src/radeon.h +2 -0
index 56bc076..aede629 100644
@@ -224,6 +224,7 @@ typedef enum {
     OPTION_FORCE_LOW_POWER,
     OPTION_DYNAMIC_PM,
     OPTION_NEW_PLL,
+    OPTION_GALLIUM,
     OPTION_ZAPHOD_HEADS
 } RADEONOpts;
 
@@ -917,6 +918,7 @@ typedef struct {
 
     /* accel */
     Bool              RenderAccel; /* Render */
+    Bool              useGallium;
     Bool              allowColorTiling;
     Bool              tilingEnabled; /* mirror of sarea->tiling_enabled */
     struct radeon_accel_state *accel_state;
src/radeon_dri2.c +3 -1
index 7d5205e..5cb5699 100644
@@ -776,7 +776,9 @@ radeon_dri2_screen_init(ScreenPtr pScreen)
 
     if ( (info->ChipFamily >= CHIP_FAMILY_R600) ) {
         dri2_info.driverName = R600_DRIVER_NAME;
-    } else if ( (info->ChipFamily >= CHIP_FAMILY_R300) ) {
+    } else if ( info->ChipFamily >= CHIP_FAMILY_R300 && info->useGallium ) {
+        dri2_info.driverName = R300G_DRIVER_NAME;
+    } else if ( info->ChipFamily >= CHIP_FAMILY_R300 ) {
         dri2_info.driverName = R300_DRIVER_NAME;
     } else if ( info->ChipFamily >= CHIP_FAMILY_R200 ) {
         dri2_info.driverName = R200_DRIVER_NAME;
src/radeon_driver.c +1 -0
index 7167ea0..563bc88 100644
@@ -205,6 +206,7 @@ static const OptionInfoRec RADEONOptions[] = {
     { OPTION_FORCE_LOW_POWER,	"ForceLowPowerMode", OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_DYNAMIC_PM,	"DynamicPM",       OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_NEW_PLL,	        "NewPLL",        OPTV_BOOLEAN, {0}, FALSE },
+    { OPTION_GALLIUM,          "Gallium",       OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_ZAPHOD_HEADS,      "ZaphodHeads",     OPTV_STRING,  {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
src/radeon_kms.c +14 -0
index c6a3df7..42b875e 100644
@@ -69,6 +69,7 @@ const OptionInfoRec RADEONOptions_KMS[] = {
     { OPTION_TVSTD,          "TVStandard",       OPTV_STRING,  {0}, FALSE },
     { OPTION_EXA_VSYNC,      "EXAVSync",         OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_EXA_PIXMAPS,    "EXAPixmaps",	 OPTV_BOOLEAN,   {0}, FALSE },
+    { OPTION_GALLIUM,        "Gallium",          OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_ZAPHOD_HEADS,   "ZaphodHeads",      OPTV_STRING,  {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
@@ -426,6 +427,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
     DevUnion* pPriv;
     Gamma  zeros = { 0.0, 0.0, 0.0 };
     Bool colorTilingDefault;
+    Bool galliumAllowed;
 
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
 		   "RADEONPreInit_KMS\n");
@@ -482,6 +484,18 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
     if (!radeon_alloc_dri(pScrn))
 	return FALSE;
 
+    galliumAllowed = info->ChipFamily >= CHIP_FAMILY_R300 &&
+                         info->ChipFamily < CHIP_FAMILY_R600;
+
+    info->useGallium = xf86ReturnOptValBool(info->Options,
+                                        OPTION_GALLIUM, FALSE);
+
+    if (info->useGallium && !galliumAllowed) {
+        xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Gallium is not supported on this GPU, disabling\n");
+        info->useGallium = FALSE;
+    } else if (info->useGallium)
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using Gallium for DRI.\n");
+
     colorTilingDefault = info->ChipFamily >= CHIP_FAMILY_R300 &&
                          info->ChipFamily <= CHIP_FAMILY_RS740;
 
src/radeon_version.h +1 -0
index 129046d..d4c4fd5 100644
@@ -37,6 +37,7 @@
 #define RADEON_NAME          "RADEON"
 #define RADEON_DRIVER_NAME   "radeon"
 #define R200_DRIVER_NAME     "r200"
+#define R300G_DRIVER_NAME    "radeong"
 #define R300_DRIVER_NAME     "r300"
 #define R600_DRIVER_NAME     "r600"
 
man/radeon.man +7 -0
@@ -370,6 +370,13 @@ R/RV/RS2xx and RS3xx when usig XAA.  The default is to
 .B enable
 Render acceleration.
 .TP
+.BI "Option \*qGallium\*q \*q" boolean \*q
+Enables or disables the usage of the alternate Gallium DRI driver
+(radeong_dri.so). It is supported only on R300-R500 generation cards and
+requires KMS/DRI2. This is considered a highly experimental option, don't use
+it unless you know what you are doing. The default is 
+.B off.
+.TP
 .BI "Option \*qAccelMethod\*q \*q" "string" \*q
 Chooses between available acceleration architectures.  Valid options are
 .B XAA
Signature · 1 line
1.7.1
#1 lore raw
Quoted 10 lines · Robert Hooker

The r300 gallium driver in mesa is built as radeong_dri.so and the DDX is hardcoded to use r300 as the DRI driver name for that generation. this patch allows radeong to be used if specified in an xorg.conf with this option:

Option "Gallium" "True"

This only affects DRI2 since the gallium driver requires it, and has the benefit of being able to coexist with the classic mesa driver.

See http://bugs.freedesktop.org/show_bug.cgi?id=27328#c1 :

IMHO xorg.conf would be both overkill and insufficient: the r300g binary should just be called what it is, namely r300_dri.so, and then the distro could choose the default via the installation path / symlinks / whatever, and the user could override it per application via $LIBGL_DRIVERS_PATH.

Signature · 6 lines
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel