From 967ae609b658aca8c88fc76498b0b103024b3749 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 1 Aug 2025 10:22:10 +0200 Subject: [PATCH] dix: drop DDXBEFORERESET symbol Reduce complexity for things that really don't matter much: The ddxBeforeReset() function is called when the Xserver going to reset (new server generation). Right now, the only DDX really needing that is Xwin, on all the others it's just no-op. We've got an extra complicated build logic, which ifdef's out this all when Xwin isn't built at all. The saving is extremely minimal - just skipping few stub functions, which in most sessions aren't even called. Therefore, get rid of this extra complexity that isn't giving us any notable gain. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dispatch.c | 2 -- hw/kdrive/ephyr/ephyrinit.c | 7 ------- hw/kdrive/ephyr/meson.build | 1 + hw/stubs/ddxBeforeReset.c | 12 ++++++++++++ hw/vfb/InitOutput.c | 8 -------- hw/vfb/meson.build | 1 + hw/xfree86/common/meson.build | 1 + hw/xfree86/common/xf86Init.c | 7 ------- hw/xnest/Init.c | 8 -------- hw/xnest/meson.build | 1 + hw/xquartz/meson.build | 1 + hw/xwin/InitOutput.c | 3 --- include/meson.build | 1 - 13 files changed, 17 insertions(+), 36 deletions(-) create mode 100644 hw/stubs/ddxBeforeReset.c diff --git a/dix/dispatch.c b/dix/dispatch.c index f4934028b..f004241f2 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -576,9 +576,7 @@ Dispatch(void) } dispatchException &= ~DE_PRIORITYCHANGE; } -#if defined(DDXBEFORERESET) ddxBeforeReset(); -#endif KillAllClients(); dispatchException &= ~DE_RESET; SmartScheduleLatencyLimited = 0; diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index f65cef052..c1bcb9fea 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -111,13 +111,6 @@ ddxInputThreadInit(void) } #endif -#ifdef DDXBEFORERESET -void -ddxBeforeReset(void) -{ -} -#endif - void ddxUseMsg(void) { diff --git a/hw/kdrive/ephyr/meson.build b/hw/kdrive/ephyr/meson.build index 11d0b17c0..42ec9dab2 100644 --- a/hw/kdrive/ephyr/meson.build +++ b/hw/kdrive/ephyr/meson.build @@ -4,6 +4,7 @@ srcs = [ 'ephyrcursor.c', 'ephyr_draw.c', 'hostx.c', + '../../stubs/ddxBeforeReset.c', ] xephyr_dep = [ diff --git a/hw/stubs/ddxBeforeReset.c b/hw/stubs/ddxBeforeReset.c new file mode 100644 index 000000000..fa29fab23 --- /dev/null +++ b/hw/stubs/ddxBeforeReset.c @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#include + +#include "os/ddx_priv.h" + +void +ddxBeforeReset(void) +{ +} diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 6a7ca7c55..fff4b2d5a 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -269,14 +269,6 @@ OsVendorFatalError(const char *f, va_list args) { } -#if defined(DDXBEFORERESET) -void -ddxBeforeReset(void) -{ - return; -} -#endif - #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ diff --git a/hw/vfb/meson.build b/hw/vfb/meson.build index 7332866b3..891bb75b4 100644 --- a/hw/vfb/meson.build +++ b/hw/vfb/meson.build @@ -3,6 +3,7 @@ srcs = [ 'InitOutput.c', '../../mi/miinitext.c', '../../mi/miinitext.h', + '../stubs/ddxBeforeReset.c', ] xvfb_server = executable( diff --git a/hw/xfree86/common/meson.build b/hw/xfree86/common/meson.build index 91f0bed1f..3d1f5fd8e 100644 --- a/hw/xfree86/common/meson.build +++ b/hw/xfree86/common/meson.build @@ -22,6 +22,7 @@ srcs_xorg_common = [ 'xf86Mode.c', 'xorgHelper.c', 'xf86Extensions.c', + '../../stubs/ddxBeforeReset.c', ] xorg_sdk_headers = [ diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 29a9f69fa..f9a3d994d 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1325,13 +1325,6 @@ xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) return 0; } -#ifdef DDXBEFORERESET -void -ddxBeforeReset(void) -{ -} -#endif - #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c index 1eb49b645..0e9ca69e6 100644 --- a/hw/xnest/Init.c +++ b/hw/xnest/Init.c @@ -166,14 +166,6 @@ OsVendorFatalError(const char *f, va_list args) return; } -#if defined(DDXBEFORERESET) -void -ddxBeforeReset(void) -{ - return; -} -#endif - #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting the input thread. */ diff --git a/hw/xnest/meson.build b/hw/xnest/meson.build index 28dc78396..d01b871db 100644 --- a/hw/xnest/meson.build +++ b/hw/xnest/meson.build @@ -18,6 +18,7 @@ srcs = [ '../../mi/miinitext.h', 'xcb.c', 'xkb.c', + '../stubs/ddxBeforeReset.c', ] xcb_dep = dependency('xcb', required: true) diff --git a/hw/xquartz/meson.build b/hw/xquartz/meson.build index d8dd7cd98..925e0b98c 100644 --- a/hw/xquartz/meson.build +++ b/hw/xquartz/meson.build @@ -55,6 +55,7 @@ srcs_libxquartz = [ 'quartzRandR.c', '../../mi/miinitext.c', '../../mi/miinitext.h', + '../stubs/ddxBeforeReset.c', ] libxquartz_defs = [ diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 29517a575..cf873c31b 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -143,12 +143,10 @@ void XwinExtensionInit(void) LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE); } -#if defined(DDXBEFORERESET) /* * Called right before KillAllClients when the server is going to reset, * allows us to shutdown our separate threads cleanly. */ - void ddxBeforeReset(void) { @@ -156,7 +154,6 @@ ddxBeforeReset(void) winClipboardShutdown(); } -#endif #if INPUTTHREAD /** This function is called in Xserver/os/inputthread.c when starting diff --git a/include/meson.build b/include/meson.build index fca546f25..b115d3a3c 100644 --- a/include/meson.build +++ b/include/meson.build @@ -266,7 +266,6 @@ conf_data.set('HAVE_LIBUNWIND', get_option('libunwind')) conf_data.set('HAVE_APM', (build_apm or build_acpi) ? '1' : false) conf_data.set('HAVE_ACPI', build_acpi ? '1' : false) -conf_data.set('DDXBEFORERESET', build_xwin ? '1' : false) enable_debugging = get_option('buildtype') == 'debug' conf_data.set('DEBUG', enable_debugging ? '1' : false)