diff options
author | Kevin E Martin <kem@kem.org> | 2004-07-31 04:23:21 +0000 |
---|---|---|
committer | Kevin E Martin <kem@kem.org> | 2004-07-31 04:23:21 +0000 |
commit | 25bd6ff4a622d09fb0c247b7c40281744c61431e (patch) | |
tree | 7ae6338cd31a4e6134195ace92de42e075abdad3 | |
parent | 326729ebca863c99cf913445126294a3c6d3db5d (diff) |
Add new extension enable/disable feature. This code is a small step in the
right direction -- i.e., moving towards full run-time config of
extensions. Currently, only XTEST, XINERAMA, RENDER, XKB, and XEVIE are
supported.
-rw-r--r-- | hw/dmx/dmx.h | 3 | ||||
-rw-r--r-- | hw/dmx/dmxinit.c | 8 | ||||
-rw-r--r-- | hw/dmx/dmxwindow.c | 18 | ||||
-rw-r--r-- | include/globals.h | 9 | ||||
-rw-r--r-- | mi/miinitext.c | 67 | ||||
-rw-r--r-- | os/utils.c | 22 |
6 files changed, 96 insertions, 31 deletions
diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h index 759e5e11f..18e75de90 100644 --- a/hw/dmx/dmx.h +++ b/hw/dmx/dmx.h @@ -283,9 +283,6 @@ extern Bool dmxUseXKB; /**< True if the XKB * servers */ extern int dmxDepth; /**< Requested depth if * non-zero */ -extern Bool dmxNoRender; /**< True if the RENDER - * extension should be - * disabled */ #ifdef GLXEXT extern Bool dmxGLXProxy; /**< True if glxProxy * support is enabled */ diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index 71dfb5197..00ce18425 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -101,8 +101,6 @@ Bool dmxUseXKB = TRUE; int dmxDepth = 0; -Bool dmxNoRender = FALSE; - #ifndef GLXEXT static Bool dmxGLXProxy = FALSE; #else @@ -625,7 +623,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) } /* Make sure that the command-line arguments are sane. */ - if (dmxAddRemoveScreens && (!dmxNoRender || dmxGLXProxy)) { + if (dmxAddRemoveScreens && (!noRenderExtension || dmxGLXProxy)) { /* Currently it is not possible to support GLX and Render * extensions with dynamic screen addition/removal due to the * state that each extension keeps, which cannot be restored. */ @@ -804,7 +802,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) #ifdef RENDER /* Initialize the render extension */ - if (!dmxNoRender) + if (!noRenderExtension) dmxInitRender(); #endif @@ -939,7 +937,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) if (++i < argc) dmxDepth = atoi(argv[i]); retval = 2; } else if (!strcmp(argv[i], "-norender")) { - dmxNoRender = TRUE; + noRenderExtension = TRUE; retval = 1; #ifdef GLXEXT } else if (!strcmp(argv[i], "-noglxproxy")) { diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c index e83b0d3bb..2db72d795 100644 --- a/hw/dmx/dmxwindow.c +++ b/hw/dmx/dmxwindow.c @@ -379,13 +379,6 @@ Bool dmxCreateWindow(WindowPtr pWindow) return ret; } -#ifndef RENDER -static Bool dmxDestroyPictureList(WindowPtr pWindow) -{ - return TRUE; -} -#endif - /** Destroy \a pWindow on the back-end server. */ Bool dmxBEDestroyWindow(WindowPtr pWindow) { @@ -409,16 +402,21 @@ Bool dmxDestroyWindow(WindowPtr pWindow) ScreenPtr pScreen = pWindow->drawable.pScreen; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; Bool ret = TRUE; + Bool needSync = FALSE; #ifdef GLXEXT dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); #endif DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); +#ifdef RENDER + /* Destroy any picture list associated with this window */ + needSync |= dmxDestroyPictureList(pWindow); +#endif + /* Destroy window on back-end server */ - if (dmxDestroyPictureList(pWindow) || dmxBEDestroyWindow(pWindow)) { - dmxSync(dmxScreen, FALSE); - } + needSync |= dmxBEDestroyWindow(pWindow); + if (needSync) dmxSync(dmxScreen, FALSE); #ifdef GLXEXT if (pWinPriv->swapGroup && pWinPriv->windowDestroyed) diff --git a/include/globals.h b/include/globals.h index 359f2eee2..1a22bb6f9 100644 --- a/include/globals.h +++ b/include/globals.h @@ -1,4 +1,4 @@ -/* $XdotOrg$ */ +/* $XdotOrg: xc/programs/Xserver/include/globals.h,v 1.2 2004/04/23 19:54:23 eich Exp $ */ /* $XFree86: xc/programs/Xserver/include/globals.h,v 1.3 1999/09/25 14:38:21 dawes Exp $ */ #ifndef _XSERV_GLOBAL_H_ @@ -49,5 +49,12 @@ extern Bool PanoramiXWindowExposureSent; extern Bool PanoramiXOneExposeRequest; #endif +#ifdef RENDER +extern Bool noRenderExtension; +#endif + +#ifdef XEVIE +extern Bool noXevieExtension; +#endif #endif /* _XSERV_GLOBAL_H_ */ diff --git a/mi/miinitext.c b/mi/miinitext.c index 5f762c13f..6afc66ea0 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/mi/miinitext.c,v 1.5 2004/07/29 18:49:42 stukreit Exp $ */ +/* $XdotOrg: xc/programs/Xserver/mi/miinitext.c,v 1.6 2004/07/31 01:37:47 stukreit Exp $ */ /* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.67 2003/01/12 02:44:27 dawes Exp $ */ /*********************************************************** @@ -95,9 +95,11 @@ extern Bool noTestExtensions; #ifdef XKB extern Bool noXkbExtension; #endif - -#ifdef DMXSERVER -extern Bool dmxNoRender; +#ifdef RENDER +extern Bool noRenderExtension; +#endif +#ifdef XEVIE +extern Bool noXevieExtension; #endif #ifndef XFree86LOADER @@ -281,6 +283,52 @@ extern void XFixesExtensionInit(INITARGS); extern void DamageExtensionInit(INITARGS); #endif +/* The following is only a small first step towards run-time + * configurable extensions. + */ +typedef struct { + char *name; + Bool *disablePtr; +} ExtensionToggle; + +static ExtensionToggle ExtensionToggleList[] = +{ + { "XTEST", &noTestExtensions }, +#ifdef PANORAMIX + { "XINERAMA", &noPanoramiXExtension }, +#endif +#ifdef RENDER + { "RENDER", &noRenderExtension }, +#endif +#ifdef XKB + { "XKEYBOARD", &noXkbExtension }, +#endif +#ifdef XEVIE + { "XEVIE", &noXevieExtension }, +#endif + { NULL, NULL } +}; + +Bool EnableDisableExtension(char *name, Bool enable) +{ + ExtensionToggle *ext = &ExtensionToggleList[0]; + + for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) { + if (strcmp(name, ext->name) == 0) { + *ext->disablePtr = !enable; + return TRUE; + } + } + + ErrorF("Extension \"%s\" is not recognized\n", name); + ErrorF("Only the following extensions can be run-time %s:\n", + enable ? "enabled" : "disabled"); + for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) + ErrorF(" %s\n", ext->name); + + return FALSE; +} + #ifndef XFree86LOADER /*ARGSUSED*/ @@ -409,10 +457,7 @@ InitExtensions(argc, argv) #endif #endif #ifdef RENDER -#ifdef DMXSERVER - if (!dmxNoRender) -#endif - RenderExtensionInit(); + if (!noRenderExtension) RenderExtensionInit(); #endif #ifdef RANDR RRExtensionInit(); @@ -424,7 +469,7 @@ InitExtensions(argc, argv) DMXExtensionInit(); #endif #ifdef XEVIE - XevieExtensionInit(); + if (!noXevieExtension) XevieExtensionInit(); #endif #ifdef XFIXES XFixesExtensionInit(); @@ -549,7 +594,7 @@ static ExtensionModule staticExtensions[] = { { XFree86BigfontExtensionInit, XF86BIGFONTNAME, NULL, NULL, NULL }, #endif #ifdef RENDER - { RenderExtensionInit, "RENDER", NULL, NULL, NULL }, + { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL }, #endif #ifdef RANDR { RRExtensionInit, "RANDR", NULL, NULL, NULL }, @@ -561,7 +606,7 @@ static ExtensionModule staticExtensions[] = { { XFixesExtensionInit, "XFIXES", NULL, NULL }, #endif #ifdef XEVIE - { XevieExtensionInit, "XEVIE", NULL, NULL }, + { XevieExtensionInit, "XEVIE", &noXevieExtension, NULL }, #endif { NULL, NULL, NULL, NULL, NULL } }; diff --git a/os/utils.c b/os/utils.c index 30dcd5f73..eccb2b37a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/os/utils.c,v 1.2 2004/04/23 19:54:28 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/os/utils.c,v 1.3 2004/06/19 21:56:01 gisburn Exp $ */ /* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */ /* @@ -119,6 +119,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifdef RENDER #include "picture.h" +Bool noRenderExtension = FALSE; #endif #define X_INCLUDE_NETDB_H @@ -137,6 +138,10 @@ Bool PanoramiXWindowExposureSent = FALSE; Bool PanoramiXOneExposeRequest = FALSE; #endif +#ifdef XEVIE +Bool noXevieExtension = TRUE; +#endif + int auditTrailLevel = 1; Bool Must_have_memory = FALSE; @@ -170,6 +175,9 @@ char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ extern char dispatchExceptionAtReset; +/* Extension enable/disable in miinitext.c */ +extern Bool EnableDisableExtension(char *name, Bool enable); + OsSigHandlerPtr OsSignal(sig, handler) int sig; @@ -549,6 +557,8 @@ void UseMsg(void) ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n"); ErrorF("-schedInterval int Set scheduler interval in msec\n"); #endif + ErrorF("+extension name Enable extension\n"); + ErrorF("-extension name Disable extension\n"); #ifdef XDMCP XdmcpUseMsg(); #endif @@ -999,6 +1009,16 @@ ProcessCommandLine(int argc, char *argv[]) UseMsg (); } #endif + else if ( strcmp( argv[i], "+extension") == 0) + { + if (++i >= argc || !EnableDisableExtension(argv[i], TRUE)) + UseMsg(); + } + else if ( strcmp( argv[i], "-extension") == 0) + { + if (++i >= argc || !EnableDisableExtension(argv[i], FALSE)) + UseMsg(); + } else { ErrorF("Unrecognized option: %s\n", argv[i]); |