From 60b4bd181bbdc794c7f3547f67df916132aa111e Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 13 Sep 2011 14:31:24 -0500 Subject: [PATCH 01/14] x86emu: There is no NO_INLINE implementation of unaligned access here. Patch produced with: unifdef -UNO_INLINE -B This change isn't relevant to the similar code in hw/xfree86/common/compiler.h, because x86emu is expected to someday move out of xserver entirely and so should not depend on any xserver headers. Also, some platforms apparently do have NO_INLINE versions of compiler.h. Signed-off-by: Jamey Sharp Reviewed-by: Jeremy Huddleston Reviewed-by: Matt Turner --- hw/xfree86/x86emu/sys.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/xfree86/x86emu/sys.c b/hw/xfree86/x86emu/sys.c index 602b0bbee4..f389767f18 100644 --- a/hw/xfree86/x86emu/sys.c +++ b/hw/xfree86/x86emu/sys.c @@ -49,7 +49,6 @@ #include #endif -# ifndef NO_INLINE # ifdef __GNUC__ /* Define some packed structures to use with unaligned accesses */ @@ -139,7 +138,6 @@ static __inline__ void stw_u(u16 val, u16 *p) } # endif /* __GNUC__ */ -# endif /* NO_INLINE */ /*------------------------- Global Variables ------------------------------*/ X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */ From 76636f30f7cf2344f4038c59bf292db19be33d53 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 13 Sep 2011 13:10:10 -0500 Subject: [PATCH 02/14] configure.ac: Remove unused XORG_OS_PCI variable. This is the last mention after ccfaf82367c9d057fd8314ce36b47f0a8eb696b6 quit using the variable. Signed-off-by: Jamey Sharp Reviewed-by: Jeremy Huddleston Reviewed-by: Gaetan Nadon Tiago Vignatti posted an identical patch in June 2010, which I only noticed after getting the above reviews. His patch was: Signed-off-by: Tiago Vignatti Reviewed-by: Mikhail Gusarov --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2ac1f2ec68..bc34c72100 100644 --- a/configure.ac +++ b/configure.ac @@ -1698,9 +1698,6 @@ if test "x$XORG" = xyes; then if test "x$SUPPORT_PC98" = xyes; then AC_DEFINE(SUPPORT_PC98, 1, [Support PC98]) fi - if test "x$XORG_OS_PCI" = x ; then - XORG_OS_PCI=$XORG_OS - fi if test "x$DGA" = xauto; then PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no]) fi From 9eb22ebf46b77c15e53017a37c7ef605521dc164 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 13 Sep 2011 16:30:06 -0500 Subject: [PATCH 03/14] configure.ac: XORG_OS is not used, so delete it. Signed-off-by: Jamey Sharp Reviewed-by: Jeremy Huddleston Reviewed-by: Gaetan Nadon --- configure.ac | 8 -------- 1 file changed, 8 deletions(-) diff --git a/configure.ac b/configure.ac index bc34c72100..6c4fffda1b 100644 --- a/configure.ac +++ b/configure.ac @@ -1573,7 +1573,6 @@ if test "x$XORG" = xyes; then if test "x$LNXAPM" = xyes; then XORG_CFLAGS="$XORG_CFLAGS -DXF86PM" fi - XORG_OS="linux" XORG_OS_SUBDIR="linux" xorg_bus_linuxpci="yes" linux_acpi="no" @@ -1593,12 +1592,10 @@ if test "x$XORG" = xyes; then esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) - XORG_OS="freebsd" XORG_OS_SUBDIR="bsd" xorg_bus_bsdpci="yes" ;; netbsd*) - XORG_OS="netbsd" XORG_OS_SUBDIR="bsd" xorg_bus_bsdpci="yes" ;; @@ -1607,12 +1604,10 @@ if test "x$XORG" = xyes; then -o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then XORG_CFLAGS="$XORG_CFLAGS -DXF86PM" fi - XORG_OS="openbsd" XORG_OS_SUBDIR="bsd" xorg_bus_bsdpci="yes" ;; solaris*) - XORG_OS="solaris" XORG_OS_SUBDIR="solaris" XORG_CFLAGS="$XORG_CFLAGS -DXF86PM" # Use the same stubs as BSD for old functions, since we now @@ -1664,14 +1659,12 @@ if test "x$XORG" = xyes; then fi ;; gnu*) - XORG_OS="gnu" XORG_OS_SUBDIR="hurd" # Use the same stubs as BSD for old functions, since we now # use libpciaccess for PCI xorg_bus_bsdpci="yes" ;; *) - XORG_OS="unknown" XORG_OS_SUBDIR="unknown" AC_MSG_ERROR([m4_text_wrap(m4_join([ ], [Your OS is unknown. Xorg currently only supports Linux,], @@ -1726,7 +1719,6 @@ if test "x$XORG" = xyes; then AC_SUBST([XORG_LIBS]) AC_SUBST([XORG_SYS_LIBS]) AC_SUBST([XORG_INCS]) - AC_SUBST([XORG_OS]) AC_SUBST([XORG_OS_SUBDIR]) AC_SUBST([XORG_CFLAGS]) From 6ad7bb69eebd5e5b4068bd9aa0b9a7168f075006 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 13 Sep 2011 17:45:19 -0500 Subject: [PATCH 04/14] Remove PC98 support. Gaetan Nadon wrote: Alan Coopersmith wrote: "I think we recently dropped PC98 support from the X server, so I'd be okay with dropping the documentation now". Let's make them be right, shall we? Signed-off-by: Jamey Sharp Reviewed-by: Jeremy Huddleston Acked-by: Gaetan Nadon Acked-by: Alan Coopersmith --- configure.ac | 15 --------------- hw/xfree86/common/xf86.h | 1 - hw/xfree86/common/xf86Config.c | 30 ------------------------------ hw/xfree86/common/xf86Globals.c | 3 --- hw/xfree86/common/xf86Helper.c | 10 ---------- hw/xfree86/common/xf86Privstr.h | 3 --- hw/xfree86/int10/helper_exec.c | 2 +- hw/xfree86/int10/helper_mem.c | 3 --- hw/xfree86/man/xorg.conf.man | 6 ------ include/xorg-config.h.in | 3 --- 10 files changed, 1 insertion(+), 75 deletions(-) diff --git a/configure.ac b/configure.ac index 6c4fffda1b..93cd6a96f1 100644 --- a/configure.ac +++ b/configure.ac @@ -582,9 +582,6 @@ AC_ARG_ENABLE(install-libxf86config, AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]), [SYMBOL_VISIBILITY=$enableval], [SYMBOL_VISIBILITY=auto]) -AC_ARG_ENABLE(pc98, AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]), - [SUPPORT_PC98=$enableval], - [SUPPORT_PC98=auto]) dnl GLX build options AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]), @@ -1654,9 +1651,6 @@ if test "x$XORG" = xyes; then XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)' fi AC_SUBST([SOLARIS_ASM_CFLAGS]) - if test "x$SUPPORT_PC98" = xauto; then - SUPPORT_PC98="no" - fi ;; gnu*) XORG_OS_SUBDIR="hurd" @@ -1679,18 +1673,9 @@ if test "x$XORG" = xyes; then xorg_bus_sparc="yes" ;; i*86) - if test "x$SUPPORT_PC98" = xauto; then - SUPPORT_PC98="yes" - fi ;; esac - if test "x$SUPPORT_PC98" = xauto; then - SUPPORT_PC98="no" - fi - if test "x$SUPPORT_PC98" = xyes; then - AC_DEFINE(SUPPORT_PC98, 1, [Support PC98]) - fi if test "x$DGA" = xauto; then PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no]) fi diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 54332e3811..e1e0cd7e0a 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -263,7 +263,6 @@ extern _X_EXPORT Bool xf86GetVidModeEnabled(void); extern _X_EXPORT Bool xf86GetModInDevAllowNonLocal(void); extern _X_EXPORT Bool xf86GetModInDevEnabled(void); extern _X_EXPORT Bool xf86GetAllowMouseOpenFail(void); -extern _X_EXPORT Bool xf86IsPc98(void); extern _X_EXPORT void xf86DisableRandR(void); extern _X_EXPORT CARD32 xorgGetVersion(void); extern _X_EXPORT CARD32 xf86GetModuleVersion(pointer module); diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 58b30dd687..3aa923a280 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -676,7 +676,6 @@ typedef enum { FLAG_DPMS_SUSPENDTIME, FLAG_DPMS_OFFTIME, FLAG_PIXMAP, - FLAG_PC98, FLAG_NOPM, FLAG_XINERAMA, FLAG_LOG, @@ -724,8 +723,6 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER, {0}, FALSE }, - { FLAG_PC98, "PC98", OPTV_BOOLEAN, - {0}, FALSE }, { FLAG_NOPM, "NoPM", OPTV_BOOLEAN, {0}, FALSE }, { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, @@ -756,21 +753,6 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, }; -#ifdef SUPPORT_PC98 -static Bool -detectPC98(void) -{ - unsigned char buf[2]; - - if (xf86ReadBIOS(0xf8000, 0xe80, buf, 2) != 2) - return FALSE; - if ((buf[0] == 0x98) && (buf[1] == 0x21)) - return TRUE; - else - return FALSE; -} -#endif - static Bool configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) { @@ -1026,18 +1008,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Info.pixmap24 = Pix24DontCare; xf86Info.pix24From = X_DEFAULT; } -#ifdef SUPPORT_PC98 - if (xf86GetOptValBool(FlagOptions, FLAG_PC98, &value)) { - xf86Info.pc98 = value; - if (value) { - xf86Msg(X_CONFIG, "Japanese PC98 architecture\n"); - } - } else - if (detectPC98()) { - xf86Info.pc98 = TRUE; - xf86Msg(X_PROBED, "Japanese PC98 architecture\n"); - } -#endif #ifdef PANORAMIX from = X_DEFAULT; diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 16d55577e5..b45b114926 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -119,9 +119,6 @@ xf86InfoRec xf86Info = { .miscModInDevAllowNonLocal = FALSE, .pixmap24 = Pix24DontCare, .pix24From = X_DEFAULT, -#ifdef SUPPORT_PC98 - .pc98 = FALSE, -#endif .pmFlag = TRUE, .log = LogNone, .disableRandR = FALSE, diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index f8e6c8b41a..7c76fa8ec3 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1583,16 +1583,6 @@ xf86GetAllowMouseOpenFail(void) } -Bool -xf86IsPc98(void) -{ -#if SUPPORT_PC98 - return xf86Info.pc98; -#else - return FALSE; -#endif -} - void xf86DisableRandR(void) { diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 608f9bd194..b001f9dc5e 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -91,9 +91,6 @@ typedef struct { input device events */ Pix24Flags pixmap24; MessageType pix24From; -#ifdef SUPPORT_PC98 - Bool pc98; -#endif Bool pmFlag; Log log; Bool disableRandR; diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index ec8420040d..2efbdc5bb7 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -347,7 +347,7 @@ x_inw(CARD16 port) struct timeval tv; /* - * Emulate a PC98's timer. Typical resolution is 3.26 usec. + * Emulate a PC's timer. Typical resolution is 3.26 usec. * Approximate this by dividing by 3. */ X_GETTIMEOFDAY(&tv); diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c index 496c9a5290..9088298a90 100644 --- a/hw/xfree86/int10/helper_mem.c +++ b/hw/xfree86/int10/helper_mem.c @@ -241,9 +241,6 @@ int10_check_bios(int scrnIndex, int codeSeg, const unsigned char* vbiosMem) ((codeSeg << 4) >= SYS_SIZE)) return FALSE; - if (xf86IsPc98()) - return FALSE; - if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2)) return FALSE; diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man index f406f82bb9..8f14efb64b 100644 --- a/hw/xfree86/man/xorg.conf.man +++ b/hw/xfree86/man/xorg.conf.man @@ -634,12 +634,6 @@ are 24 and 32. Default: 32 unless driver constraints don't allow this (which is rare). Note: some clients don't behave well when this value is set to 24. .TP 7 -.BI "Option \*qPC98\*q \*q" boolean \*q -Specify that the machine is a Japanese PC\-98 machine. -This should not be enabled for anything other than the Japanese\-specific -PC\-98 architecture. -Default: auto\-detected. -.TP 7 .BI "Option \*qNoPM\*q \*q" boolean \*q Disables something to do with power management events. Default: PM enabled on platforms that support it. diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index 56ffda2104..0d1ea91429 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -136,9 +136,6 @@ /* Use SIGIO handlers for input device events by default */ #undef USE_SIGIO_BY_DEFAULT -/* Support PC98 */ -#undef SUPPORT_PC98 - /* Build with libdrm support */ #undef WITH_LIBDRM From 94b2eea86319934316bdb013f6f3940685a88a2f Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Wed, 14 Sep 2011 11:23:03 -0500 Subject: [PATCH 05/14] int10: Delete #if 0'd implementation that's older than our git history. Throughout the xserver git history, the generic portion of the int10 module has always used other methods for reading the video BIOS. For some time now it's been purely libpciaccess based. This commented-out use of xf86ReadBIOS is entirely superfluous. Signed-off-by: Jamey Sharp Reviewed-by: Jeremy Huddleston --- hw/xfree86/int10/generic.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index fe8bb69acf..994085493a 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -128,10 +128,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) int screen; legacyVGARec vga; -#if 0 - CARD32 cs; -#endif - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; options = xf86HandleInt10Options(xf86Screens[screen],entityIndex); @@ -174,17 +170,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) /* * Retrieve everything between V_BIOS and SYS_BIOS as some system BIOSes - * have executable code there. Note that xf86ReadBIOS() can only read in - * 64kB at a time. + * have executable code there. */ memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS); -#if 0 - for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) - if (xf86ReadBIOS(cs, 0, (unsigned char *)base + cs, V_BIOS_SIZE) < - V_BIOS_SIZE) - xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x%06X.\n", cs); -#endif INTPriv(pInt)->highMemory = V_BIOS; if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) { From d8d99e14b1241fd8c099d69b8d0ed0817585fe8d Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Wed, 14 Sep 2011 09:52:58 -0500 Subject: [PATCH 06/14] configure.ac: Remove unreachable check for VM86 headers. "configure --with-int10" is not a valid configuration, and the check for sys/vm86.h and sys/io.h is not used. Delete it. Signed-off-by: Jamey Sharp Reviewed-by: Alan Coopersmith Reviewed-by: Gaetan Nadon --- configure.ac | 4 ---- include/dix-config.h.in | 6 ------ 2 files changed, 10 deletions(-) diff --git a/configure.ac b/configure.ac index 93cd6a96f1..06cf9bf759 100644 --- a/configure.ac +++ b/configure.ac @@ -702,10 +702,6 @@ AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes]) AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86]) AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu]) AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub]) -if test "x$INT10" = xyes; then - dnl VM86 headers - AC_CHECK_HEADERS([sys/vm86.h sys/io.h]) -fi dnl Handle installing libxf86config AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes]) diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 4710ef8813..5facb1106d 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -209,9 +209,6 @@ */ #undef HAVE_SYS_DIR_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IO_H - /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H @@ -225,9 +222,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UTSNAME_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VM86_H - /* Define to 1 if you have the header file. */ #undef HAVE_TSLIB_H From d423012e776a81a197cde86be5c6bd471a593c39 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Fri, 21 May 2010 14:21:52 -0700 Subject: [PATCH 07/14] dmx: Fix a non-constant printf format string warning. Signed-off-by: Jamey Sharp Reviewed-by: Alan Coopersmith --- hw/dmx/input/lnx-keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c index 5bfb8813cc..5b92f3b8fd 100644 --- a/hw/dmx/input/lnx-keyboard.c +++ b/hw/dmx/input/lnx-keyboard.c @@ -429,11 +429,11 @@ static int kbdLinuxOpenVT(int vtno) { int fd = -1; int i; - const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL }; + const char *vcs[] = { "/dev/vc/", "/dev/tty", NULL }; char name[64]; /* RATS: Only used in XmuSnprintf */ for (i = 0; vcs[i]; i++) { - XmuSnprintf(name, sizeof(name), vcs[i], vtno); + XmuSnprintf(name, sizeof(name), "%s%d", vcs[i], vtno); if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) break; } if (fd < 0) From b85c10a35d44ad695797d0d19757e5f62eab4b98 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 25 May 2010 16:23:31 -0700 Subject: [PATCH 08/14] dmx: Fix some "no previous prototype" warnings by making functions static. Signed-off-by: Jamey Sharp Reviewed-by: Matt Turner --- hw/dmx/glxProxy/glxcmds.c | 41 ++++++++++++++++++++++++++++++++--- hw/dmx/glxProxy/glxscreens.c | 39 --------------------------------- hw/dmx/glxProxy/render2swap.c | 2 +- 3 files changed, 39 insertions(+), 43 deletions(-) diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index f79264ea99..a76201da08 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -59,9 +59,6 @@ extern __GLXFBConfig **__glXFBConfigs; extern int __glXNumFBConfigs; -extern __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id ); -extern __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ); -extern __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ); extern int glxIsExtensionSupported( char *ext ); extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); @@ -70,6 +67,44 @@ extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); (x) - dmxScreen->glxErrorBase + __glXerrorBase \ : (x) ) +static __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id ) +{ + int i,j; + + for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { + if ( __glXFBConfigs[j]->id == id) + return __glXFBConfigs[j]; + } + + return NULL; +} + +static __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ) +{ + int i,j; + + for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { + if ( __glXFBConfigs[j]->associatedVisualId == vid) + return __glXFBConfigs[j]; + } + + return NULL; +} + +static __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ) +{ + int i; + int j; + + for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { + if ( __glXFBConfigs[j]->id == id) + return __glXFBConfigs[j+screen+1]; + } + + return NULL; + +} + Display *GetBackEndDisplay( __GLXclientState *cl, int s ) { if (! cl->be_displays[s] ) { diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c index 4cbac6634f..01e041c8f4 100644 --- a/hw/dmx/glxProxy/glxscreens.c +++ b/hw/dmx/glxProxy/glxscreens.c @@ -326,45 +326,6 @@ char *__glXGetServerString( unsigned int name ) } - -__GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id ) -{ - int i,j; - - for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { - if ( __glXFBConfigs[j]->id == id) - return __glXFBConfigs[j]; - } - - return NULL; -} - -__GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ) -{ - int i,j; - - for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { - if ( __glXFBConfigs[j]->associatedVisualId == vid) - return __glXFBConfigs[j]; - } - - return NULL; -} - -__GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ) -{ - int i; - int j; - - for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { - if ( __glXFBConfigs[j]->id == id) - return __glXFBConfigs[j+screen+1]; - } - - return NULL; - -} - int glxIsExtensionSupported( char *ext ) { return( strstr(ExtensionsString, ext) != NULL ); diff --git a/hw/dmx/glxProxy/render2swap.c b/hw/dmx/glxProxy/render2swap.c index 81bb501eaa..da9b565de8 100644 --- a/hw/dmx/glxProxy/render2swap.c +++ b/hw/dmx/glxProxy/render2swap.c @@ -32,7 +32,7 @@ #include "unpack.h" #include "g_disptab.h" -GLint __glEvalComputeK(GLenum target) +static GLint __glEvalComputeK(GLenum target) { switch (target) { case GL_MAP1_VERTEX_4: From 53a4744b69ab76ecabdde5dabfb56830570c0f4e Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sat, 18 Sep 2010 01:23:12 +0200 Subject: [PATCH 09/14] XineramaInitData ignores its argument. Quit passing one. Also fix up XineramaInitData's caller, XineramaReinitData. Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp Signed-off-by: Josh Triplett Reviewed-by: Alan Coopersmith --- Xext/panoramiX.c | 12 ++++++------ Xext/panoramiXsrv.h | 2 +- hw/dmx/dmxextension.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 00afe94f16..425c10ce41 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -388,7 +388,7 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void)) return TRUE; } -static void XineramaInitData(ScreenPtr pScreen) +static void XineramaInitData(void) { int i, w, h; @@ -397,7 +397,7 @@ static void XineramaInitData(ScreenPtr pScreen) BoxRec TheBox; RegionRec ScreenRegion; - pScreen = screenInfo.screens[i]; + ScreenPtr pScreen = screenInfo.screens[i]; TheBox.x1 = pScreen->x; TheBox.x2 = TheBox.x1 + pScreen->width; @@ -414,7 +414,7 @@ static void XineramaInitData(ScreenPtr pScreen) PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height; FOR_NSCREENS_FORWARD_SKIP(i) { - pScreen = screenInfo.screens[i]; + ScreenPtr pScreen = screenInfo.screens[i]; w = pScreen->x + pScreen->width; h = pScreen->y + pScreen->height; @@ -425,10 +425,10 @@ static void XineramaInitData(ScreenPtr pScreen) } } -void XineramaReinitData(ScreenPtr pScreen) +void XineramaReinitData(void) { RegionUninit(&PanoramiXScreenRegion); - XineramaInitData(pScreen); + XineramaInitData(); } /* @@ -525,7 +525,7 @@ void PanoramiXExtensionInit(int argc, char *argv[]) return; } - XineramaInitData(pScreen); + XineramaInitData(); /* * Put our processes into the ProcVector diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h index 6fc903b884..39d495203d 100644 --- a/Xext/panoramiXsrv.h +++ b/Xext/panoramiXsrv.h @@ -19,7 +19,7 @@ extern _X_EXPORT PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); extern _X_EXPORT int XineramaDeleteResource(pointer, XID); -extern _X_EXPORT void XineramaReinitData(ScreenPtr); +extern _X_EXPORT void XineramaReinitData(void); extern _X_EXPORT RESTYPE XRC_DRAWABLE; extern _X_EXPORT RESTYPE XRT_WINDOW; diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index db5709ee6a..80d11ee89b 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -455,7 +455,7 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y) pScreen->y = dmxScreen->rootYOrigin; /* Recalculate the Xinerama regions and data structs */ - XineramaReinitData(pScreen); + XineramaReinitData(); /* Adjust each of the root window's children */ if (!idx) ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff); From df4eeb1256c7c5e7a3f88f10da2915c7a07a8db8 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 8 Jun 2010 13:58:04 -0700 Subject: [PATCH 10/14] xnest: Delete unused nClipRects GC-private field. This field was never read at any time in the git history. Signed-off-by: Jamey Sharp Reviewed-by: Alan Coopersmith --- hw/xnest/GC.c | 3 --- hw/xnest/XNGC.h | 1 - 2 files changed, 4 deletions(-) diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c index 7968b4f6f0..48fe4dcbcb 100644 --- a/hw/xnest/GC.c +++ b/hw/xnest/GC.c @@ -81,7 +81,6 @@ xnestCreateGC(GCPtr pGC) xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay, xnestDefaultDrawables[pGC->depth], 0L, NULL); - xnestGCPriv(pGC)->nClipRects = 0; return True; } @@ -282,7 +281,6 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects) pGC->clientClipType = type; pGC->clientClip = pValue; - xnestGCPriv(pGC)->nClipRects = nRects; } void @@ -294,7 +292,6 @@ xnestDestroyClip(GCPtr pGC) pGC->clientClipType = CT_NONE; pGC->clientClip = NULL; - xnestGCPriv(pGC)->nClipRects = 0; } void diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h index 9f10456118..c4a6cef772 100644 --- a/hw/xnest/XNGC.h +++ b/hw/xnest/XNGC.h @@ -19,7 +19,6 @@ is" without express or implied warranty. typedef struct { XlibGC gc; - int nClipRects; } xnestPrivGC; extern DevPrivateKeyRec xnestGCPrivateKeyRec; From 87cc83474d9890d14d9bc60926a97bd0d5b059af Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sun, 18 Sep 2011 20:47:04 -0500 Subject: [PATCH 11/14] Replace XmuSnprintf with snprintf. Alan Coopersmith explains: XmuSnprintf() can be replaced by snprintf() now. (It was a implementation X provided for it's libraries to use in the days before all platforms we cared about had snprintf in libc.) Reported-by: walter harms Signed-off-by: Jamey Sharp Reviewed-by: Alan Coopersmith --- hw/dmx/config/xdmxconfig.c | 23 +++++++++++------------ hw/dmx/dmxclient.h | 1 - hw/dmx/dmxinit.c | 11 ++++++----- hw/dmx/dmxprop.c | 9 +++++---- hw/dmx/doc/dmx.xml | 2 +- hw/dmx/examples/dmxwininfo.c | 3 +-- hw/dmx/input/dmxinputinit.c | 6 +++--- hw/dmx/input/lnx-keyboard.c | 4 ++-- hw/dmx/input/usb-common.c | 4 ++-- 9 files changed, 31 insertions(+), 32 deletions(-) diff --git a/hw/dmx/config/xdmxconfig.c b/hw/dmx/config/xdmxconfig.c index 2de7f2b85b..3165ba0007 100644 --- a/hw/dmx/config/xdmxconfig.c +++ b/hw/dmx/config/xdmxconfig.c @@ -49,7 +49,6 @@ #include #include #include -#include #include "Canvas.h" #include "dmxparse.h" @@ -199,8 +198,8 @@ static void dmxConfigDataUpdate(void) XtVaSetValues(ndbutton1, XtNsensitive, False, NULL); } else { name = dmxConfigCurrent->name; - XmuSnprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : ""); - XmuSnprintf(cdimbuf, sizeof(cdimbuf), "%dx%d", + snprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : ""); + snprintf(cdimbuf, sizeof(cdimbuf), "%dx%d", dmxConfigWallWidth, dmxConfigWallHeight); XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL); XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL); @@ -219,22 +218,22 @@ static void dmxConfigDataUpdate(void) XtVaSetValues(ddbutton, XtNsensitive, False, NULL); } else { name = dmxConfigCurrentDisplay->name; - XmuSnprintf(nambuf, sizeof(nambuf), "%s", name ? name : ""); - XmuSnprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", + snprintf(nambuf, sizeof(nambuf), "%s", name ? name : ""); + snprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", dmxConfigCurrentDisplay->scrnWidth, dmxConfigCurrentDisplay->scrnHeight, dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+', dmxConfigCurrentDisplay->scrnX, dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+', dmxConfigCurrentDisplay->scrnY); - XmuSnprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", + snprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", dmxConfigCurrentDisplay->rootWidth, dmxConfigCurrentDisplay->rootHeight, dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+', dmxConfigCurrentDisplay->rootX, dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+', dmxConfigCurrentDisplay->rootY); - XmuSnprintf(offbuf, sizeof(offbuf), "@%dx%d", + snprintf(offbuf, sizeof(offbuf), "@%dx%d", dmxConfigCurrentDisplay->rootXOrigin, dmxConfigCurrentDisplay->rootYOrigin); XtVaSetValues(namebox, XtNlabel, nambuf, XtNsensitive, True, NULL); @@ -596,14 +595,14 @@ static void dmxConfigCanCallback(Widget w, XtPointer closure, static void dmxConfigECCallback(Widget w, XtPointer closure, XtPointer callData) { - char buf[256]; /* RATS: Only used in XmuSnprintf */ + char buf[256]; /* RATS: Only used in snprintf */ if (!dmxConfigCurrent) return; dmxConfigSetPopupPosition(ecpopup); XtVaSetValues(ecdialog0, XtNvalue, dmxConfigCurrent->name ? dmxConfigCurrent->name : "", NULL); - XmuSnprintf(buf, sizeof(buf), "%dx%d", + snprintf(buf, sizeof(buf), "%dx%d", dmxConfigCurrent->width, dmxConfigCurrent->height); XtVaSetValues(ecdialog1, XtNvalue, buf, NULL); XtPopup(ecpopup, XtGrabExclusive); @@ -692,7 +691,7 @@ static void dmxConfigECCanCallback(Widget w, XtPointer closure, static void dmxConfigEDCallback(Widget w, XtPointer closure, XtPointer callData) { - char buf[256]; /* RATS: Only used in XmuSnprintf */ + char buf[256]; /* RATS: Only used in snprintf */ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return; dmxConfigSetPopupPosition(edpopup); @@ -701,7 +700,7 @@ static void dmxConfigEDCallback(Widget w, XtPointer closure, ? dmxConfigCurrentDisplay->name : "", NULL); - XmuSnprintf(buf, sizeof(buf), "%dx%d%c%d%c%d", + snprintf(buf, sizeof(buf), "%dx%d%c%d%c%d", dmxConfigCurrentDisplay->scrnWidth, dmxConfigCurrentDisplay->scrnHeight, dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+', @@ -709,7 +708,7 @@ static void dmxConfigEDCallback(Widget w, XtPointer closure, dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+', dmxConfigCurrentDisplay->scrnY); XtVaSetValues(eddialog1, XtNvalue, buf, NULL); - XmuSnprintf(buf, sizeof(buf), "@%dx%d", + snprintf(buf, sizeof(buf), "@%dx%d", dmxConfigCurrentDisplay->rootXOrigin, dmxConfigCurrentDisplay->rootYOrigin); XtVaSetValues(eddialog2, XtNvalue, buf, NULL); diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h index c45f71fc0b..f0f235f61a 100644 --- a/hw/dmx/dmxclient.h +++ b/hw/dmx/dmxclient.h @@ -82,7 +82,6 @@ typedef XID KeySym64; #include #include #include -#include /* For XmuSnprintf */ #include diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index bc1509b35e..165476c5f8 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -56,6 +56,7 @@ #include "dmxpict.h" #include /* For gettimeofday */ +#include /* For XmuGetHostname */ #include "dixstruct.h" #ifdef PANORAMIX #include "panoramiXsrv.h" @@ -131,7 +132,7 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev) /* Find major opcode name */ if (ev->request_code < 128) { - XmuSnprintf(request, sizeof(request), "%d", ev->request_code); + snprintf(request, sizeof(request), "%d", ev->request_code); XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); } else { for (ext = dpy->ext_procs; @@ -145,8 +146,8 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev) /* Find minor opcode name */ if (ev->request_code >= 128 && ext) { - XmuSnprintf(request, sizeof(request), "%d", ev->request_code); - XmuSnprintf(request, sizeof(request), "%s.%d", + snprintf(request, sizeof(request), "%d", ev->request_code); + snprintf(request, sizeof(request), "%s.%d", ext->name, ev->minor_code); XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); dmxLog(dmxWarning, " Minor opcode: %d (%s)\n", @@ -515,7 +516,7 @@ static const char *dmxExecOS(void) if (!initialized++) { memset(buffer, 0, sizeof(buffer)); uname(&u); - XmuSnprintf(buffer, sizeof(buffer)-1, "%s %s %s", + snprintf(buffer, sizeof(buffer)-1, "%s %s %s", u.sysname, u.release, u.version); } return buffer; @@ -530,7 +531,7 @@ static const char *dmxBuildCompiler(void) if (!initialized++) { memset(buffer, 0, sizeof(buffer)); #if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__) - XmuSnprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d", + snprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); #endif } diff --git a/hw/dmx/dmxprop.c b/hw/dmx/dmxprop.c index d4618e3fa5..b4695dd5de 100644 --- a/hw/dmx/dmxprop.c +++ b/hw/dmx/dmxprop.c @@ -62,6 +62,7 @@ #include "dmx.h" #include "dmxprop.h" #include "dmxlog.h" +#include /* For XmuGetHostname */ /** Holds the window id of all DMX windows on the backend X server. */ #define DMX_ATOMNAME "DMX_NAME" @@ -87,7 +88,7 @@ static const unsigned char *dmxPropertyIdentifier(void) if (initialized++) return (unsigned char *)buf; XmuGetHostname(hostname, sizeof(hostname)); - XmuSnprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display); + snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display); return (unsigned char *)buf; } @@ -319,7 +320,7 @@ void dmxPropertyWindow(DMXScreenInfo *dmxScreen) Display *dpy = dmxScreen->beDisplay; Window win = dmxScreen->scrnWin; DMXScreenInfo *other; - char buf[128]; /* RATS: only used with XmuSnprintf */ + char buf[128]; /* RATS: only used with snprintf */ if (!dpy) return; /* FIXME: What should be done here if Xdmx is started @@ -336,12 +337,12 @@ void dmxPropertyWindow(DMXScreenInfo *dmxScreen) other->index, other->name, other->scrnWin); } - XmuSnprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index, + snprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index, (long unsigned)win); XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8, PropModeAppend, (unsigned char *)buf, strlen(buf)); - XmuSnprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index); + snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index); XChangeProperty(dpy, win, atom, XA_STRING, 8, PropModeAppend, (unsigned char *)buf, strlen(buf)); } diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml index 8dbb7d86fa..ce472c2bfa 100644 --- a/hw/dmx/doc/dmx.xml +++ b/hw/dmx/doc/dmx.xml @@ -3392,7 +3392,7 @@ Unrepaired warnings are as follows: Fixed-size buffers are used in many areas, but code has been - added to protect against buffer overflows (e.g., XmuSnprint). + added to protect against buffer overflows (e.g., snprintf). The only instances that have not yet been fixed are in config/xdmxconfig.c (which is not part of the Xdmx server) and input/usb-common.c. diff --git a/hw/dmx/examples/dmxwininfo.c b/hw/dmx/examples/dmxwininfo.c index 6cf1d411e7..3d027d5309 100644 --- a/hw/dmx/examples/dmxwininfo.c +++ b/hw/dmx/examples/dmxwininfo.c @@ -39,7 +39,6 @@ #include #include #include -#include #include static const char *FontName = "fixed"; @@ -80,7 +79,7 @@ EventLoop(Display *dpy, Window win, GC gc) y += 20; for (i = 0; i < count; i++) { char str[500]; - XmuSnprintf(str, sizeof(str), + snprintf(str, sizeof(str), "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d", winInfo[i].screen, winInfo[i].pos.width, winInfo[i].pos.height, diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 1b067c7254..16ecae38d4 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -671,9 +671,9 @@ static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal) } switch (dmxLocal->type) { - case DMX_LOCAL_KEYBOARD: XmuSnprintf(buf, LEN, "Keyboard%d", k++); break; - case DMX_LOCAL_MOUSE: XmuSnprintf(buf, LEN, "Mouse%d", m++); break; - default: XmuSnprintf(buf, LEN, "Other%d", o++); break; + case DMX_LOCAL_KEYBOARD: snprintf(buf, LEN, "Keyboard%d", k++); break; + case DMX_LOCAL_MOUSE: snprintf(buf, LEN, "Mouse%d", m++); break; + default: snprintf(buf, LEN, "Other%d", o++); break; } return buf; diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c index 5b92f3b8fd..06e9ec7223 100644 --- a/hw/dmx/input/lnx-keyboard.c +++ b/hw/dmx/input/lnx-keyboard.c @@ -430,10 +430,10 @@ static int kbdLinuxOpenVT(int vtno) int fd = -1; int i; const char *vcs[] = { "/dev/vc/", "/dev/tty", NULL }; - char name[64]; /* RATS: Only used in XmuSnprintf */ + char name[64]; /* RATS: Only used in snprintf */ for (i = 0; vcs[i]; i++) { - XmuSnprintf(name, sizeof(name), "%s%d", vcs[i], vtno); + snprintf(name, sizeof(name), "%s%d", vcs[i], vtno); if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) break; } if (fd < 0) diff --git a/hw/dmx/input/usb-common.c b/hw/dmx/input/usb-common.c index 25479aea67..944033eba6 100644 --- a/hw/dmx/input/usb-common.c +++ b/hw/dmx/input/usb-common.c @@ -272,7 +272,7 @@ device. */ void usbInit(DevicePtr pDev, usbType type) { GETPRIV; - char name[64]; /* RATS: Only used in XmuSnprintf */ + char name[64]; /* RATS: Only used in snprintf */ int i, j, k; char buf[256] = { 0, }; /* RATS: Use ok */ int version; @@ -284,7 +284,7 @@ void usbInit(DevicePtr pDev, usbType type) if (priv->fd >=0) return; for (i = 0; i < 32; i++) { - XmuSnprintf(name, sizeof(name), "/dev/input/event%d", i); + snprintf(name, sizeof(name), "/dev/input/event%d", i); if ((priv->fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) { ioctl(priv->fd, EVIOCGVERSION, &version); ioctl(priv->fd, EVIOCGNAME(sizeof(buf)), buf); From c96a43888ceae72bf89c66de911120c0b6b7a71a Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sat, 10 Jul 2010 09:28:47 -0700 Subject: [PATCH 12/14] Revert "Bug #6924: Restore the ABI for DrawableRec and ColormapRec to the state" This reverts commit bc0c56c407117d1545e20d21f7d30eb3472d618b since we're breaking ABI anyway. Conflicts: ChangeLog dix/colormap.c dix/pixmap.c dix/window.c include/pixmapstr.h Signed-off-by: Jamey Sharp Reviewed-by: Aaron Plattner --- dix/colormap.c | 7 ------- include/colormapst.h | 17 ++--------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/dix/colormap.c b/dix/colormap.c index 0e1feb6c4f..038457d3d5 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -287,13 +287,6 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, if (!pmap) return BadAlloc; } -#if defined(_XSERVER64) - pmap->pad0 = 0; - pmap->pad1 = 0; -#if (X_BYTE_ORDER == X_LITTLE_ENDIAN) - pmap->pad2 = 0; -#endif -#endif pmap->red = (EntryPtr)((char *)pmap + sizeof(ColormapRec)); sizebytes = size * sizeof(Entry); pmap->clientPixelsRed = (Pixel **)((char *)pmap->red + sizebytes); diff --git a/include/colormapst.h b/include/colormapst.h index b597e2c60c..bb79c86d25 100644 --- a/include/colormapst.h +++ b/include/colormapst.h @@ -48,8 +48,6 @@ SOFTWARE. #ifndef CMAPSTRUCT_H #define CMAPSTRUCT_H 1 -#include - #include "colormap.h" #include "screenint.h" #include "privates.h" @@ -91,26 +89,15 @@ typedef struct _CMEntry Bool fShared; } Entry; -/* - * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor +/* COLORMAPs can be used for either Direct or Pseudo color. PseudoColor * only needs one cell table, we arbitrarily pick red. We keep track - * of that table with freeRed, numPixelsRed, and clientPixelsRed - * - * The padN variables are unfortunate ABI BC. See fdo bug #6924. - */ + * of that table with freeRed, numPixelsRed, and clientPixelsRed */ typedef struct _ColormapRec { VisualPtr pVisual; short class; /* PseudoColor or DirectColor */ -#if defined(_LP64) - short pad0; - XID pad1; -#endif XID mid; /* client's name for colormap */ -#if defined(_LP64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN) - XID pad2; -#endif ScreenPtr pScreen; /* screen map is associated with */ short flags; /* 1 = IsDefault * 2 = AllAllocated */ From 8f69c935f6d06ad92fd0e8d9fcb3cde86cd258f5 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Fri, 17 Sep 2010 02:27:59 +0200 Subject: [PATCH 13/14] Eliminate MAXSCREENS-sized CursorScreenKey array. Use new per-screen privates API instead. Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp Signed-off-by: Josh Triplett Reviewed-by: Peter Hutterer --- dix/cursor.c | 2 +- dix/dispatch.c | 2 +- hw/dmx/dmxcursor.h | 4 ++-- hw/xfree86/modes/xf86Cursors.c | 4 ++-- hw/xfree86/ramdac/xf86Cursor.c | 6 +++--- hw/xfree86/ramdac/xf86HWCurs.c | 4 ++-- hw/xnest/XNCursor.h | 4 ++-- include/cursor.h | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dix/cursor.c b/dix/cursor.c index c191c1e887..f29cb11258 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -72,7 +72,7 @@ typedef struct _GlyphShare { static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL; -DevPrivateKeyRec cursorScreenDevPriv[MAXSCREENS]; +DevScreenPrivateKeyRec cursorScreenDevPriv; #ifdef XFIXES static CARD32 cursorSerial; diff --git a/dix/dispatch.c b/dix/dispatch.c index 192c8c34e4..2d17adfbe0 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3911,7 +3911,7 @@ AddScreen( return -1; } - dixRegisterPrivateKey(&cursorScreenDevPriv[i], PRIVATE_CURSOR, 0); + dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen, PRIVATE_CURSOR, 0); return i; } diff --git a/hw/dmx/dmxcursor.h b/hw/dmx/dmxcursor.h index 5242268c1a..fc2e118e0d 100644 --- a/hw/dmx/dmxcursor.h +++ b/hw/dmx/dmxcursor.h @@ -64,9 +64,9 @@ extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor); extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor); #define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) ((dmxCursorPrivPtr) \ - dixLookupPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen))) + dixLookupScreenPrivate(&(_pCursor)->devPrivates, CursorScreenKey, _pScreen)) #define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \ - dixSetPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen), v) + dixSetScreenPrivate(&(_pCursor)->devPrivates, CursorScreenKey, _pScreen, v) #endif /* DMXCURSOR_H */ diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 0667447445..23c48eb9ee 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -252,7 +252,7 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg) CursorPtr cursor = xf86_config->cursor; int c; CARD8 *bits = cursor ? - dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen)) + dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen) : NULL; /* Save ARGB versions of these colors */ @@ -650,7 +650,7 @@ xf86_reload_cursors (ScreenPtr screen) if (cursor) { - void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen)); + void *src = dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen); #ifdef ARGB_CURSOR if (cursor->bits->argb && cursor_info->LoadCursorARGB) (*cursor_info->LoadCursorARGB) (scrn, cursor); diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index 24c91cc379..1e0f7e0b74 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -273,7 +273,7 @@ xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs) &pScreen->devPrivates, xf86CursorScreenKey); if (pCurs->refcnt <= 1) - dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL); + dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL); return (*ScreenPriv->spriteFuncs->RealizeCursor)(pDev, pScreen, pCurs); } @@ -286,8 +286,8 @@ xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, &pScreen->devPrivates, xf86CursorScreenKey); if (pCurs->refcnt <= 1) { - free(dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen))); - dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL); + free(dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen)); + dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL); } return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pDev, pScreen, pCurs); diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c index dd2b78f981..f9b09fc9a8 100644 --- a/hw/xfree86/ramdac/xf86HWCurs.c +++ b/hw/xfree86/ramdac/xf86HWCurs.c @@ -123,7 +123,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) return; } - bits = dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen)); + bits = dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen); x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX; y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY; @@ -133,7 +133,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) #endif if (!bits) { bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs); - dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), bits); + dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, bits); } if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h index d3b18bd3a8..473b2017f7 100644 --- a/hw/xnest/XNCursor.h +++ b/hw/xnest/XNCursor.h @@ -30,10 +30,10 @@ typedef struct { } xnestPrivCursor; #define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \ - dixLookupPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen))) + dixLookupScreenPrivate(&(pCursor)->devPrivates, CursorScreenKey, pScreen)) #define xnestSetCursorPriv(pCursor, pScreen, v) \ - dixSetPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen), v) + dixSetScreenPrivate(&(pCursor)->devPrivates, CursorScreenKey, pScreen, v) #define xnestCursor(pCursor, pScreen) \ (xnestGetCursorPriv(pCursor, pScreen)->cursor) diff --git a/include/cursor.h b/include/cursor.h index 59978d4cad..394383a04c 100644 --- a/include/cursor.h +++ b/include/cursor.h @@ -63,8 +63,8 @@ struct _DeviceIntRec; typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; -extern _X_EXPORT DevPrivateKeyRec cursorScreenDevPriv[MAXSCREENS]; -#define CursorScreenKey(pScreen) (cursorScreenDevPriv + (pScreen)->myNum) +extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv; +#define CursorScreenKey (&cursorScreenDevPriv) extern _X_EXPORT CursorPtr rootCursor; From 0f380a5005f800572773cd4667ce43c7459cc467 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 14 Sep 2010 18:35:21 -0700 Subject: [PATCH 14/14] Fix pixmap double-frees on error paths. If AddResource fails, it will automatically free the object that was passed to it by calling the appropriate deleteFunc; and of course FreeResource also calls the deleteFunc. In both cases it's wrong to call the destroy hook manually. Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp Signed-off-by: Josh Triplett Reviewed-by: Peter Hutterer Reviewed-by: Aaron Plattner --- Xext/shm.c | 6 +----- dix/dispatch.c | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Xext/shm.c b/Xext/shm.c index b08af821bf..4141a8fe6f 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -991,7 +991,6 @@ CreatePmap: pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = newPix->info[j].id; if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) { - (*pScreen->DestroyPixmap)(pMap); result = BadAlloc; break; } @@ -1002,10 +1001,8 @@ CreatePmap: } if(result == BadAlloc) { - while(j--) { - (*pScreen->DestroyPixmap)(pMap); + while(j--) FreeResource(newPix->info[j].id, RT_NONE); - } free(newPix); } else AddResource(stuff->pid, XRT_PIXMAP, newPix); @@ -1110,7 +1107,6 @@ CreatePmap: { return Success; } - pDraw->pScreen->DestroyPixmap(pMap); } return BadAlloc; } diff --git a/dix/dispatch.c b/dix/dispatch.c index 2d17adfbe0..34213cf164 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1419,7 +1419,6 @@ CreatePmap: } if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) return Success; - (*pDraw->pScreen->DestroyPixmap)(pMap); } return BadAlloc; }