Mesa (master): st/xorg: Add a customizable option to disable 3D.

Thomas Hellstrom thomash at kemper.freedesktop.org
Wed Jun 9 11:51:42 UTC 2010


Module: Mesa
Branch: master
Commit: 2e27bf8b7c150987fc6cf6523edf21f9ac921bff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e27bf8b7c150987fc6cf6523edf21f9ac921bff

Author: Thomas Hellstrom <thellstrom at vmware.com>
Date:   Tue Jun  8 03:28:37 2010 +0200

st/xorg: Add a customizable option to disable 3D.

If no customizer is present, 3D will be enabled by default.
Otherwise the option will default to the customizer value.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>

---

 src/gallium/state_trackers/xorg/xorg_driver.c  |   18 +++++++++++++++---
 src/gallium/state_trackers/xorg/xorg_tracker.h |    2 ++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 6b6e200..a7e5763 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -80,7 +80,8 @@ typedef enum
     OPTION_2D_ACCEL,
     OPTION_DEBUG_FALLBACK,
     OPTION_THROTTLE_SWAP,
-    OPTION_THROTTLE_DIRTY
+    OPTION_THROTTLE_DIRTY,
+    OPTION_3D_ACCEL
 } drv_option_enums;
 
 static const OptionInfoRec drv_options[] = {
@@ -89,6 +90,7 @@ static const OptionInfoRec drv_options[] = {
     {OPTION_DEBUG_FALLBACK, "DebugFallback", OPTV_BOOLEAN, {0}, FALSE},
     {OPTION_THROTTLE_SWAP, "SwapThrottling", OPTV_BOOLEAN, {0}, FALSE},
     {OPTION_THROTTLE_DIRTY, "DirtyThrottling", OPTV_BOOLEAN, {0}, FALSE},
+    {OPTION_3D_ACCEL, "3DAccel", OPTV_BOOLEAN, {0}, FALSE},
     {-1, NULL, OPTV_NONE, {0}, FALSE}
 };
 
@@ -315,7 +317,8 @@ drv_init_resource_management(ScrnInfoPtr pScrn)
 	return TRUE;
 
     if (ms->api) {
-	ms->screen = ms->api->create_screen(ms->api, ms->fd);
+	ms->screen = ms->no3D ? NULL :
+	    ms->api->create_screen(ms->api, ms->fd);
 
 	if (ms->screen)
 	    return TRUE;
@@ -646,12 +649,21 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     CustomizerPtr cust = ms->cust;
     MessageType from_st;
     MessageType from_dt;
+    MessageType from_3D;
+    Bool use3D;
 
     if (!drv_init_drm(pScrn)) {
 	FatalError("Could not init DRM");
 	return FALSE;
     }
 
+    use3D = cust ? !cust->no_3d : TRUE;
+    from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
+				&use3D) ?
+	X_CONFIG : X_PROBED;
+
+    ms->no3D = !use3D;
+
     if (!drv_init_resource_management(pScrn)) {
 	FatalError("Could not init resource management (!pipe_screen && !libkms)");
 	return FALSE;
@@ -764,7 +776,7 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fallback debugging is %s\n",
 	       ms->debug_fallback ? "enabled" : "disabled");
 #ifdef DRI2
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is %s\n",
+    xf86DrvMsg(pScrn->scrnIndex, from_3D, "3D Acceleration is %s\n",
 	       ms->screen ? "enabled" : "disabled");
 #else
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is disabled\n");
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 25da9b1..df56ad1 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -76,6 +76,7 @@ typedef struct _CustomizerRec
 {
     Bool dirty_throttling;
     Bool swap_throttling;
+    Bool no_3d;
     Bool (*winsys_screen_init)(struct _CustomizerRec *cust, int fd);
     Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
     Bool (*winsys_enter_vt)(struct _CustomizerRec *cust);
@@ -104,6 +105,7 @@ typedef struct _modesettingRec
     Bool swapThrottling;
     Bool dirtyThrottling;
     CloseScreenProcPtr CloseScreen;
+    Bool no3D;
 
     /* Broken-out options. */
     OptionInfoPtr Options;




More information about the mesa-commit mailing list