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.
This commit is contained in:
Kevin E Martin 2004-07-31 04:23:21 +00:00
parent 326729ebca
commit 25bd6ff4a6
6 changed files with 96 additions and 31 deletions

View File

@ -283,9 +283,6 @@ extern Bool dmxUseXKB; /**< True if the XKB
* servers */ * servers */
extern int dmxDepth; /**< Requested depth if extern int dmxDepth; /**< Requested depth if
* non-zero */ * non-zero */
extern Bool dmxNoRender; /**< True if the RENDER
* extension should be
* disabled */
#ifdef GLXEXT #ifdef GLXEXT
extern Bool dmxGLXProxy; /**< True if glxProxy extern Bool dmxGLXProxy; /**< True if glxProxy
* support is enabled */ * support is enabled */

View File

@ -101,8 +101,6 @@ Bool dmxUseXKB = TRUE;
int dmxDepth = 0; int dmxDepth = 0;
Bool dmxNoRender = FALSE;
#ifndef GLXEXT #ifndef GLXEXT
static Bool dmxGLXProxy = FALSE; static Bool dmxGLXProxy = FALSE;
#else #else
@ -625,7 +623,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
} }
/* Make sure that the command-line arguments are sane. */ /* 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 /* Currently it is not possible to support GLX and Render
* extensions with dynamic screen addition/removal due to the * extensions with dynamic screen addition/removal due to the
* state that each extension keeps, which cannot be restored. */ * state that each extension keeps, which cannot be restored. */
@ -804,7 +802,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
#ifdef RENDER #ifdef RENDER
/* Initialize the render extension */ /* Initialize the render extension */
if (!dmxNoRender) if (!noRenderExtension)
dmxInitRender(); dmxInitRender();
#endif #endif
@ -939,7 +937,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if (++i < argc) dmxDepth = atoi(argv[i]); if (++i < argc) dmxDepth = atoi(argv[i]);
retval = 2; retval = 2;
} else if (!strcmp(argv[i], "-norender")) { } else if (!strcmp(argv[i], "-norender")) {
dmxNoRender = TRUE; noRenderExtension = TRUE;
retval = 1; retval = 1;
#ifdef GLXEXT #ifdef GLXEXT
} else if (!strcmp(argv[i], "-noglxproxy")) { } else if (!strcmp(argv[i], "-noglxproxy")) {

View File

@ -379,13 +379,6 @@ Bool dmxCreateWindow(WindowPtr pWindow)
return ret; return ret;
} }
#ifndef RENDER
static Bool dmxDestroyPictureList(WindowPtr pWindow)
{
return TRUE;
}
#endif
/** Destroy \a pWindow on the back-end server. */ /** Destroy \a pWindow on the back-end server. */
Bool dmxBEDestroyWindow(WindowPtr pWindow) Bool dmxBEDestroyWindow(WindowPtr pWindow)
{ {
@ -409,16 +402,21 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
ScreenPtr pScreen = pWindow->drawable.pScreen; ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
Bool ret = TRUE; Bool ret = TRUE;
Bool needSync = FALSE;
#ifdef GLXEXT #ifdef GLXEXT
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
#endif #endif
DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); 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 */ /* Destroy window on back-end server */
if (dmxDestroyPictureList(pWindow) || dmxBEDestroyWindow(pWindow)) { needSync |= dmxBEDestroyWindow(pWindow);
dmxSync(dmxScreen, FALSE); if (needSync) dmxSync(dmxScreen, FALSE);
}
#ifdef GLXEXT #ifdef GLXEXT
if (pWinPriv->swapGroup && pWinPriv->windowDestroyed) if (pWinPriv->swapGroup && pWinPriv->windowDestroyed)

View File

@ -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 $ */ /* $XFree86: xc/programs/Xserver/include/globals.h,v 1.3 1999/09/25 14:38:21 dawes Exp $ */
#ifndef _XSERV_GLOBAL_H_ #ifndef _XSERV_GLOBAL_H_
@ -49,5 +49,12 @@ extern Bool PanoramiXWindowExposureSent;
extern Bool PanoramiXOneExposeRequest; extern Bool PanoramiXOneExposeRequest;
#endif #endif
#ifdef RENDER
extern Bool noRenderExtension;
#endif
#ifdef XEVIE
extern Bool noXevieExtension;
#endif
#endif /* _XSERV_GLOBAL_H_ */ #endif /* _XSERV_GLOBAL_H_ */

View File

@ -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 $ */ /* $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 #ifdef XKB
extern Bool noXkbExtension; extern Bool noXkbExtension;
#endif #endif
#ifdef RENDER
#ifdef DMXSERVER extern Bool noRenderExtension;
extern Bool dmxNoRender; #endif
#ifdef XEVIE
extern Bool noXevieExtension;
#endif #endif
#ifndef XFree86LOADER #ifndef XFree86LOADER
@ -281,6 +283,52 @@ extern void XFixesExtensionInit(INITARGS);
extern void DamageExtensionInit(INITARGS); extern void DamageExtensionInit(INITARGS);
#endif #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 #ifndef XFree86LOADER
/*ARGSUSED*/ /*ARGSUSED*/
@ -409,10 +457,7 @@ InitExtensions(argc, argv)
#endif #endif
#endif #endif
#ifdef RENDER #ifdef RENDER
#ifdef DMXSERVER if (!noRenderExtension) RenderExtensionInit();
if (!dmxNoRender)
#endif
RenderExtensionInit();
#endif #endif
#ifdef RANDR #ifdef RANDR
RRExtensionInit(); RRExtensionInit();
@ -424,7 +469,7 @@ InitExtensions(argc, argv)
DMXExtensionInit(); DMXExtensionInit();
#endif #endif
#ifdef XEVIE #ifdef XEVIE
XevieExtensionInit(); if (!noXevieExtension) XevieExtensionInit();
#endif #endif
#ifdef XFIXES #ifdef XFIXES
XFixesExtensionInit(); XFixesExtensionInit();
@ -549,7 +594,7 @@ static ExtensionModule staticExtensions[] = {
{ XFree86BigfontExtensionInit, XF86BIGFONTNAME, NULL, NULL, NULL }, { XFree86BigfontExtensionInit, XF86BIGFONTNAME, NULL, NULL, NULL },
#endif #endif
#ifdef RENDER #ifdef RENDER
{ RenderExtensionInit, "RENDER", NULL, NULL, NULL }, { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
#endif #endif
#ifdef RANDR #ifdef RANDR
{ RRExtensionInit, "RANDR", NULL, NULL, NULL }, { RRExtensionInit, "RANDR", NULL, NULL, NULL },
@ -561,7 +606,7 @@ static ExtensionModule staticExtensions[] = {
{ XFixesExtensionInit, "XFIXES", NULL, NULL }, { XFixesExtensionInit, "XFIXES", NULL, NULL },
#endif #endif
#ifdef XEVIE #ifdef XEVIE
{ XevieExtensionInit, "XEVIE", NULL, NULL }, { XevieExtensionInit, "XEVIE", &noXevieExtension, NULL },
#endif #endif
{ NULL, NULL, NULL, NULL, NULL } { NULL, NULL, NULL, NULL, NULL }
}; };

View File

@ -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 $ */ /* $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 #ifdef RENDER
#include "picture.h" #include "picture.h"
Bool noRenderExtension = FALSE;
#endif #endif
#define X_INCLUDE_NETDB_H #define X_INCLUDE_NETDB_H
@ -137,6 +138,10 @@ Bool PanoramiXWindowExposureSent = FALSE;
Bool PanoramiXOneExposeRequest = FALSE; Bool PanoramiXOneExposeRequest = FALSE;
#endif #endif
#ifdef XEVIE
Bool noXevieExtension = TRUE;
#endif
int auditTrailLevel = 1; int auditTrailLevel = 1;
Bool Must_have_memory = FALSE; 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; extern char dispatchExceptionAtReset;
/* Extension enable/disable in miinitext.c */
extern Bool EnableDisableExtension(char *name, Bool enable);
OsSigHandlerPtr OsSigHandlerPtr
OsSignal(sig, handler) OsSignal(sig, handler)
int sig; int sig;
@ -549,6 +557,8 @@ void UseMsg(void)
ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n"); ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n");
ErrorF("-schedInterval int Set scheduler interval in msec\n"); ErrorF("-schedInterval int Set scheduler interval in msec\n");
#endif #endif
ErrorF("+extension name Enable extension\n");
ErrorF("-extension name Disable extension\n");
#ifdef XDMCP #ifdef XDMCP
XdmcpUseMsg(); XdmcpUseMsg();
#endif #endif
@ -999,6 +1009,16 @@ ProcessCommandLine(int argc, char *argv[])
UseMsg (); UseMsg ();
} }
#endif #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 else
{ {
ErrorF("Unrecognized option: %s\n", argv[i]); ErrorF("Unrecognized option: %s\n", argv[i]);