From 99a18a64957ab84ff0f43fd51a1b048a4ebc049c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 26 Jun 2025 12:01:06 +0200 Subject: [PATCH 1/2] xfree86: compat: re-add TimeCheck() for proprietary nvidia driver Yet another very internal function that the proprietary Nvidia driver is using for unknown reasons. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/compat/meson.build | 1 + hw/xfree86/compat/timercheck.c | 23 +++++++++++++++++++++++ os/WaitFor.c | 4 +--- os/osdep.h | 3 +++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 hw/xfree86/compat/timercheck.c diff --git a/hw/xfree86/compat/meson.build b/hw/xfree86/compat/meson.build index b3835efdc..ea64e7f0e 100644 --- a/hw/xfree86/compat/meson.build +++ b/hw/xfree86/compat/meson.build @@ -3,6 +3,7 @@ srcs_xorg_compat = [ 'log.c', 'nvidiabug.c', 'ones.c', + 'timercheck.c', 'xf86Helper.c', ] diff --git a/hw/xfree86/compat/timercheck.c b/hw/xfree86/compat/timercheck.c new file mode 100644 index 000000000..a434e5685 --- /dev/null +++ b/hw/xfree86/compat/timercheck.c @@ -0,0 +1,23 @@ +#include + +#include + +#include "os/osdep.h" + +#include "xf86_compat.h" + +/* + * needed for NVidia proprietary driver 570.x and 575.x version + * force the server to see if any timer callbacks should be called + * + * this function had been obsolete and removed long ago, but NVidia folks + * still didn't do basic maintenance and fixed their driver + */ + +_X_EXPORT void TimerCheck(void); + +void TimerCheck(void) { + xf86NVidiaBugObsoleteFunc("TimerCheck()"); + + DoTimers(GetTimeInMillis()); +} diff --git a/os/WaitFor.c b/os/WaitFor.c index 973a3495d..32b9b5b03 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -105,7 +105,6 @@ struct _OsTimerRec { }; static void DoTimer(OsTimerPtr timer, CARD32 now); -static void DoTimers(CARD32 now); static void CheckAllTimers(void); static volatile struct xorg_list timers; @@ -276,8 +275,7 @@ DoTimer(OsTimerPtr timer, CARD32 now) TimerSet(timer, 0, newTime, timer->callback, timer->arg); } -static void -DoTimers(CARD32 now) +void DoTimers(CARD32 now) { OsTimerPtr timer; diff --git a/os/osdep.h b/os/osdep.h index ff41f2482..bf3c00f3b 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -225,4 +225,7 @@ Ones(unsigned long mask) #define LIMITCLIENTS 256 /* Must be a power of 2 and <= MAXCLIENTS */ +/* run timers that are expired at timestamp `now` */ +void DoTimers(CARD32 now); + #endif /* _OSDEP_H_ */ From a0a9863efb81b1841d56238a940ca434659dd3f0 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 26 Jun 2025 13:46:08 +0200 Subject: [PATCH 2/2] xfree86: compat: re-add GEInitEvent() for proprietary nvidia driver Yet another very internal function that the proprietary Nvidia driver is using for unknown reasons. NVidia really needs a separate function for just for some trivial struct initialization and don't manage to add three simple lines to their code, so we have to make an extra function for them. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/compat/geeventinit.c | 28 ++++++++++++++++++++++++++++ hw/xfree86/compat/meson.build | 1 + 2 files changed, 29 insertions(+) create mode 100644 hw/xfree86/compat/geeventinit.c diff --git a/hw/xfree86/compat/geeventinit.c b/hw/xfree86/compat/geeventinit.c new file mode 100644 index 000000000..53dc2cc42 --- /dev/null +++ b/hw/xfree86/compat/geeventinit.c @@ -0,0 +1,28 @@ +#include + +#include +#include + +#include "os/osdep.h" + +#include "xf86_compat.h" + +/* + * needed for NVidia proprietary driver 570.x and 575.x version + * + * they really need special functions for trivial struct initialization :p + * + * this function had been obsolete and removed long ago, but NVidia folks + * still didn't do basic maintenance and fixed their driver + */ + +_X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension); + +void GEInitEvent(xGenericEvent *ev, int extension) +{ + xf86NVidiaBugObsoleteFunc("GEInitEvent()"); + + ev->type = GenericEvent; + ev->extension = extension; + ev->length = 0; +} diff --git a/hw/xfree86/compat/meson.build b/hw/xfree86/compat/meson.build index ea64e7f0e..22c253b5a 100644 --- a/hw/xfree86/compat/meson.build +++ b/hw/xfree86/compat/meson.build @@ -1,5 +1,6 @@ srcs_xorg_compat = [ 'clientexception.c', + 'geeventinit.c', 'log.c', 'nvidiabug.c', 'ones.c',