From 45b1e6e0bb11338a3b154dd67e8a96eb7cb2bd76 Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 26 Jun 2025 18:58:51 -0500 Subject: [PATCH 01/12] Update loader.c to add ABI Mismatch Warning for NVIDIA Driver makes the -IgnoreABI flag assumed and adds a new warning in logs to show ABI mismatch. It warns in the log of the mismatch and returns true instead of killing X with this modification. It is unknown how long the latest nvidia driver will continue working with IgnoreABI, but I think its a worthy feature to add in the interm of a better solution. --- hw/xfree86/loader/loader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c index 5af7a54f3..4595cffde 100644 --- a/hw/xfree86/loader/loader.c +++ b/hw/xfree86/loader/loader.c @@ -157,7 +157,14 @@ LoaderSetOptions(unsigned long opts) Bool LoaderShouldIgnoreABI(void) { - return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; + LogMessage(X_WARNING, + "ABI mismatch detected possibly from an NVIDIA driver. Attempting to continue loading X...\n" + "Expected ABI versions: ANSIC=%d, VideoDriver=%d, XInput=%d, Extension=%d\n", + LoaderVersionInfo.ansicVersion, + LoaderVersionInfo.videodrvVersion, + LoaderVersionInfo.xinputVersion, + LoaderVersionInfo.extensionVersion); + return TRUE; } int From e18514cc97f4efdf68d736d15811ffa1982ac5eb Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 27 Jun 2025 19:39:01 -0500 Subject: [PATCH 02/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index be9335dd5..7dfbf60c9 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -417,6 +417,8 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, { int vercode[4]; long ver = data->xf86version; + /* Always ignore ABI mismatches by default */ + LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; MessageType errtype; LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", @@ -458,26 +460,18 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, vermaj = GET_ABI_MAJOR(ver); vermin = GET_ABI_MINOR(ver); if (abimaj != vermaj) { - if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) - errtype = X_WARNING; - else - errtype = X_ERROR; - LogMessageVerb(errtype, 0, "%s: module ABI major version (%d) " - "doesn't match the server's version (%d)\n", - module, abimaj, vermaj); - if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)) - return FALSE; - } - else if (abimin > vermin) { - if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) - errtype = X_WARNING; - else - errtype = X_ERROR; - LogMessageVerb(errtype, 0, "%s: module ABI minor version (%d) " - "is newer than the server's version (%d)\n", - module, abimin, vermin); - if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)) - return FALSE; + /* Always warn, never error out and crash X server */ + LogMessageVerb(X_WARNING, 0, + "%s: module ABI major version (%d) " + "doesn't match the server's version (%d)\n", + module, abimaj, vermaj); + } + else if (abimin > vermin) { + /* Ditto for minor‐version */ + LogMessageVerb(X_WARNING, 0, + "%s: module ABI minor version (%d) " + "is newer than the server's version (%d)\n", + module, abimin, vermin); } } } From 3ecbbad3333d6a9d2eb1dd2f38668466b498230b Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 27 Jun 2025 19:40:46 -0500 Subject: [PATCH 03/12] Delete old hw/xfree86/loader/loader.c changes --- hw/xfree86/loader/loader.c | 192 ------------------------------------- 1 file changed, 192 deletions(-) delete mode 100644 hw/xfree86/loader/loader.c diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c deleted file mode 100644 index 4595cffde..000000000 --- a/hw/xfree86/loader/loader.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 1995-1998 by Metro Link, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Metro Link, Inc. not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Metro Link, Inc. makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "loader.h" -#include "loaderProcs.h" - -#ifdef HAVE_DLFCN_H - -#include -#include - -#else -#error i have no dynamic linker and i must scream -#endif - -#ifndef XORG_NO_SDKSYMS -extern void *xorg_symbols[]; -#endif - -void -LoaderInit(void) -{ -#ifndef XORG_NO_SDKSYMS - LogMessageVerb(X_INFO, 2, "Loader magic: %p\n", (void *) xorg_symbols); -#endif - LogMessageVerb(X_INFO, 2, "Module ABI versions:\n"); - LogMessageVerb(X_NONE, 2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, - GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), - GET_ABI_MINOR(LoaderVersionInfo.ansicVersion)); - LogMessageVerb(X_NONE, 2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV, - GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion), - GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion)); - LogMessageVerb(X_NONE, 2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT, - GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion), - GET_ABI_MINOR(LoaderVersionInfo.xinputVersion)); - LogMessageVerb(X_NONE, 2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, - GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), - GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); -} - -/* Public Interface to the loader. */ - -void * -LoaderOpen(const char *module, int *errmaj) -{ - void *ret; - -#if defined(DEBUG) - ErrorF("LoaderOpen(%s)\n", module); -#endif - - LogMessage(X_INFO, "Loading %s\n", module); - - if (!(ret = dlopen(module, RTLD_LAZY | RTLD_GLOBAL))) { - LogMessage(X_ERROR, "Failed to load %s: %s\n", module, dlerror()); - if (errmaj) - *errmaj = LDR_NOLOAD; - return NULL; - } - - return ret; -} - -void * -LoaderSymbol(const char *name) -{ - static void *global_scope = NULL; - void *p; - - p = dlsym(RTLD_DEFAULT, name); - if (p != NULL) - return p; - - if (!global_scope) - global_scope = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); - - if (global_scope) - return dlsym(global_scope, name); - - return NULL; -} - -void * -LoaderSymbolFromModule(void *handle, const char *name) -{ - ModuleDescPtr mod = handle; - return dlsym(mod->handle, name); -} - -void -LoaderUnload(const char *name, void *handle) -{ - LogMessageVerb(X_INFO, 1, "Unloading %s\n", name); - if (handle) - dlclose(handle); -} - -unsigned long LoaderOptions = 0; - -void -LoaderSetOptions(unsigned long opts) -{ - LoaderOptions |= opts; -} - -Bool -LoaderShouldIgnoreABI(void) -{ - LogMessage(X_WARNING, - "ABI mismatch detected possibly from an NVIDIA driver. Attempting to continue loading X...\n" - "Expected ABI versions: ANSIC=%d, VideoDriver=%d, XInput=%d, Extension=%d\n", - LoaderVersionInfo.ansicVersion, - LoaderVersionInfo.videodrvVersion, - LoaderVersionInfo.xinputVersion, - LoaderVersionInfo.extensionVersion); - return TRUE; -} - -int -LoaderGetABIVersion(const char *abiclass) -{ - struct { - const char *name; - int version; - } classes[] = { - {ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, - {ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, - {ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, - {ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, - {NULL, 0} - }; - int i; - - for (i = 0; classes[i].name; i++) { - if (!strcmp(classes[i].name, abiclass)) { - return classes[i].version; - } - } - - return 0; -} From 86f4c9da393b2b4278ad0c6c088112b52c075fb5 Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 27 Jun 2025 19:42:06 -0500 Subject: [PATCH 04/12] Create loader.c --- hw/xfree86/loader/loader.c | 185 +++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 hw/xfree86/loader/loader.c diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c new file mode 100644 index 000000000..5af7a54f3 --- /dev/null +++ b/hw/xfree86/loader/loader.c @@ -0,0 +1,185 @@ +/* + * Copyright 1995-1998 by Metro Link, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Metro Link, Inc. not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Metro Link, Inc. makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Copyright (c) 1997-2003 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include +#include "os.h" +#include "loader.h" +#include "loaderProcs.h" + +#ifdef HAVE_DLFCN_H + +#include +#include + +#else +#error i have no dynamic linker and i must scream +#endif + +#ifndef XORG_NO_SDKSYMS +extern void *xorg_symbols[]; +#endif + +void +LoaderInit(void) +{ +#ifndef XORG_NO_SDKSYMS + LogMessageVerb(X_INFO, 2, "Loader magic: %p\n", (void *) xorg_symbols); +#endif + LogMessageVerb(X_INFO, 2, "Module ABI versions:\n"); + LogMessageVerb(X_NONE, 2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, + GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), + GET_ABI_MINOR(LoaderVersionInfo.ansicVersion)); + LogMessageVerb(X_NONE, 2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV, + GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion), + GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion)); + LogMessageVerb(X_NONE, 2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT, + GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion), + GET_ABI_MINOR(LoaderVersionInfo.xinputVersion)); + LogMessageVerb(X_NONE, 2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, + GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), + GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); +} + +/* Public Interface to the loader. */ + +void * +LoaderOpen(const char *module, int *errmaj) +{ + void *ret; + +#if defined(DEBUG) + ErrorF("LoaderOpen(%s)\n", module); +#endif + + LogMessage(X_INFO, "Loading %s\n", module); + + if (!(ret = dlopen(module, RTLD_LAZY | RTLD_GLOBAL))) { + LogMessage(X_ERROR, "Failed to load %s: %s\n", module, dlerror()); + if (errmaj) + *errmaj = LDR_NOLOAD; + return NULL; + } + + return ret; +} + +void * +LoaderSymbol(const char *name) +{ + static void *global_scope = NULL; + void *p; + + p = dlsym(RTLD_DEFAULT, name); + if (p != NULL) + return p; + + if (!global_scope) + global_scope = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); + + if (global_scope) + return dlsym(global_scope, name); + + return NULL; +} + +void * +LoaderSymbolFromModule(void *handle, const char *name) +{ + ModuleDescPtr mod = handle; + return dlsym(mod->handle, name); +} + +void +LoaderUnload(const char *name, void *handle) +{ + LogMessageVerb(X_INFO, 1, "Unloading %s\n", name); + if (handle) + dlclose(handle); +} + +unsigned long LoaderOptions = 0; + +void +LoaderSetOptions(unsigned long opts) +{ + LoaderOptions |= opts; +} + +Bool +LoaderShouldIgnoreABI(void) +{ + return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; +} + +int +LoaderGetABIVersion(const char *abiclass) +{ + struct { + const char *name; + int version; + } classes[] = { + {ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, + {ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, + {ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, + {ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, + {NULL, 0} + }; + int i; + + for (i = 0; classes[i].name; i++) { + if (!strcmp(classes[i].name, abiclass)) { + return classes[i].version; + } + } + + return 0; +} From 31b6c6a18e85b6695b6e0270684cfdc200e083d5 Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 27 Jun 2025 19:53:39 -0500 Subject: [PATCH 05/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 7dfbf60c9..aeeb25358 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -417,8 +417,11 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, { int vercode[4]; long ver = data->xf86version; - /* Always ignore ABI mismatches by default */ +/* Only ignore ABI mismatches for NVIDIA proprietary driver */ + if (data->vendor && + (strstr(data->vendor, "NVIDIA") != NULL || { LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; +} MessageType errtype; LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", From 8de65804ac41109cce80b6702ac7c3bab0d688f0 Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 27 Jun 2025 22:14:07 -0500 Subject: [PATCH 06/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index aeeb25358..764ca380b 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -422,8 +422,6 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, (strstr(data->vendor, "NVIDIA") != NULL || { LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; } - MessageType errtype; - LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", data->modname ? data->modname : "UNKNOWN!", data->vendor ? data->vendor : "UNKNOWN!"); From e0854fdb90380834043987b00f638200041ce702 Mon Sep 17 00:00:00 2001 From: Collin Date: Mon, 30 Jun 2025 15:21:11 -0500 Subject: [PATCH 07/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 764ca380b..aeeb25358 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -422,6 +422,8 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, (strstr(data->vendor, "NVIDIA") != NULL || { LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; } + MessageType errtype; + LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", data->modname ? data->modname : "UNKNOWN!", data->vendor ? data->vendor : "UNKNOWN!"); From e0032239d295cddb7c377cdcc260af48f658b006 Mon Sep 17 00:00:00 2001 From: Collin Date: Mon, 30 Jun 2025 15:34:06 -0500 Subject: [PATCH 08/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index aeeb25358..7d5dcf96f 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -415,13 +415,11 @@ static Bool CheckVersion(const char *module, XF86ModuleVersionInfo * data, const XF86ModReqInfo * req) { - int vercode[4]; long ver = data->xf86version; -/* Only ignore ABI mismatches for NVIDIA proprietary driver */ - if (data->vendor && - (strstr(data->vendor, "NVIDIA") != NULL || { - LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; -} + /* Only ignore ABI mismatches for NVIDIA proprietary driver */ + if (data->vendor && strstr(data->vendor, "NVIDIA") != NULL) { + LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; + } MessageType errtype; LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", From 0f00859f033534470af53963773852462f6c3c93 Mon Sep 17 00:00:00 2001 From: Collin Date: Mon, 30 Jun 2025 15:41:17 -0500 Subject: [PATCH 09/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 7d5dcf96f..91b2aaf8b 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -416,12 +416,11 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, const XF86ModReqInfo * req) { long ver = data->xf86version; + int vercode[4]; /* Only ignore ABI mismatches for NVIDIA proprietary driver */ if (data->vendor && strstr(data->vendor, "NVIDIA") != NULL) { LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL; } - MessageType errtype; - LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n", data->modname ? data->modname : "UNKNOWN!", data->vendor ? data->vendor : "UNKNOWN!"); From 7f334d506447098cadac981232bb5a13c54d233e Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Mon, 30 Jun 2025 13:50:11 +0300 Subject: [PATCH 10/12] kdrive: add KdOsInit Kdrive X servers used to do the OS-speciffic init part using KdOsInit. This was changed in modern Xorg because Xephyr is the only kdrive X server there, so there was no need to keep this generic. Since we want to eventually add Xfbdev, we need to add this back. Signed-off-by: stefan11111 --- hw/kdrive/src/kdrive.c | 21 +++++++++++++++++++++ hw/kdrive/src/kdrive.h | 15 +++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 36bda4153..4637bb6be 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -91,6 +91,14 @@ const char *kdGlobalXkbLayout = NULL; const char *kdGlobalXkbVariant = NULL; const char *kdGlobalXkbOptions = NULL; + +/* + * Carry arguments from InitOutput through driver initialization + * to KdScreenInit + */ + +KdOsFuncs *kdOsFuncs = NULL; + void KdDisableScreen(ScreenPtr pScreen) { @@ -517,6 +525,19 @@ KdProcessArgument(int argc, char **argv, int i) return 0; } +void +KdOsInit(KdOsFuncs * pOsFuncs) +{ + kdOsFuncs = pOsFuncs; + if (pOsFuncs) { + if (serverGeneration == 1) { + KdDoSwitchCmd("start"); + if (pOsFuncs->Init) + (*pOsFuncs->Init) (); + } + } +} + static Bool KdAllocatePrivates(ScreenPtr pScreen) { diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index a4b7576d0..7ce181f42 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -278,6 +278,16 @@ int KdAddConfigKeyboard(char *pointer); int KdAddKeyboard(KdKeyboardInfo * ki); void KdRemoveKeyboard(KdKeyboardInfo * ki); +typedef struct _KdOsFuncs { + int (*Init) (void); /* Only called when the X server is started, when serverGeneration == 1 */ + void (*Enable) (void); + Bool (*SpecialKey) (KeySym); + void (*Disable) (void); + void (*Fini) (void); + void (*pollEvents) (void); + void (*Bell) (int, int, int); +} KdOsFuncs; + typedef struct _KdPointerMatrix { int matrix[2][3]; } KdPointerMatrix; @@ -289,6 +299,8 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec; extern Bool kdEmulateMiddleButton; extern Bool kdDisableZaphod; +extern KdOsFuncs *kdOsFuncs; + #define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey)) #define KdSetScreenPriv(pScreen,v) \ @@ -345,6 +357,9 @@ void int KdProcessArgument(int argc, char **argv, int i); +void + KdOsInit(KdOsFuncs * pOsFuncs); + void KdOsAddInputDrivers(void); From c623ec22662899fe75d445272e2c6f725f5a8ac6 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Mon, 30 Jun 2025 14:16:23 +0300 Subject: [PATCH 11/12] kdrive: ephyr: initialize OS specific callback vectors These will be used by subsequent commits for generic Kdrive functions calling back into the OS specific parts Signed-off-by: stefan11111 --- hw/kdrive/ephyr/ephyrinit.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index fd5e73f82..f65cef052 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -370,6 +370,23 @@ ddxProcessArgument(int argc, char **argv, int i) return KdProcessArgument(argc, argv, i); } +static int +EphyrInit(void) +{ + /* + * make sure at least one screen + * has been added to the system. + */ + if (!KdCardInfoLast()) { + processScreenArg("640x480", NULL); + } + return hostx_init(); +} + +KdOsFuncs EphyrOsFuncs = { + .Init = EphyrInit, +}; + void OsVendorInit(void) { @@ -381,12 +398,7 @@ OsVendorInit(void) if (hostx_want_host_cursor()) ephyrFuncs.initCursor = &ephyrCursorInit; - if (serverGeneration == 1) { - if (!KdCardInfoLast()) { - processScreenArg("640x480", NULL); - } - hostx_init(); - } + KdOsInit(&EphyrOsFuncs); } KdCardFuncs ephyrFuncs = { From 8921ce74662cd64155da2f094187d8a6ac973ae6 Mon Sep 17 00:00:00 2001 From: Collin Date: Wed, 2 Jul 2025 10:49:14 -0500 Subject: [PATCH 12/12] Update loadmod.c --- hw/xfree86/loader/loadmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 58b35acbd..d3266edb6 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -415,8 +415,8 @@ static Bool CheckVersion(const char *module, XF86ModuleVersionInfo * data, const XF86ModReqInfo * req) { - long ver = data->xf86version; int vercode[4]; + long ver = data->xf86version; /* Only ignore ABI mismatches for NVIDIA proprietary driver */ if (data->vendor && strstr(data->vendor, "NVIDIA") != NULL) { LoaderOptions |= LDR_OPT_ABI_MISMATCH_NONFATAL;