xserver: Branch 'master' - 3 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 6 15:50:20 UTC 2025
config/config.c | 4 -
config/hal.c | 7 +-
config/hotplug_priv.h | 87 +++++++++++++++++++++++++++
config/udev.c | 3
dix/main.c | 2
hw/kdrive/src/kdrive.c | 5 -
hw/kdrive/src/kinput.c | 12 +--
hw/xfree86/common/xf86Bus.c | 3
hw/xfree86/common/xf86Init.c | 6 -
hw/xfree86/common/xf86platformBus.c | 39 +++++++++++-
hw/xfree86/common/xf86platformBus.h | 44 ++-----------
hw/xfree86/drivers/modesetting/driver.c | 1
hw/xfree86/os-support/linux/systemd-logind.c | 1
hw/xfree86/os-support/shared/drm_platform.c | 3
hw/xfree86/os-support/xf86_os_support.h | 3
include/hotplug.h | 51 ---------------
16 files changed, 161 insertions(+), 110 deletions(-)
New commits:
commit a0326994cc5a4bb673fcd8d1803a2d26cc00b443
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Tue Mar 5 13:31:16 2024 +0100
config: unexport config_pre_init()
This function isn't used by any drivers/modules, so no need to export it.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
diff --git a/config/hotplug_priv.h b/config/hotplug_priv.h
index 879617f5d..6377c2f60 100644
--- a/config/hotplug_priv.h
+++ b/config/hotplug_priv.h
@@ -82,4 +82,6 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
struct xf86_platform_device *
xf86_find_platform_device_by_devnum(int major, int minor);
+void config_pre_init(void);
+
#endif /* _XSERVER_HOTPLUG_PRIV_H */
diff --git a/include/hotplug.h b/include/hotplug.h
index 359bac959..1b9e63c04 100644
--- a/include/hotplug.h
+++ b/include/hotplug.h
@@ -28,7 +28,6 @@
#include <X11/Xfuncproto.h>
-extern _X_EXPORT void config_pre_init(void);
extern _X_EXPORT void config_init(void);
extern _X_EXPORT void config_fini(void);
commit e67f2a5eb5ae9683b5a3238bf0a93066f2e6eab2
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Mon Feb 12 19:07:33 2024 +0100
include: move out private definitions from hotplug.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to private header.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
diff --git a/config/config.c b/config/config.c
index 270631af8..d75f1f453 100644
--- a/config/config.c
+++ b/config/config.c
@@ -26,9 +26,11 @@
#include <dix-config.h>
#include <unistd.h>
+
+#include "config/hotplug_priv.h"
+
#include "os.h"
#include "inputstr.h"
-#include "hotplug.h"
#include "config-backends.h"
#include "systemd-logind.h"
diff --git a/config/hal.c b/config/hal.c
index 5210b4aaa..e9fda38e8 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -26,16 +26,17 @@
#include <dix-config.h>
-#include <dbus/dbus.h>
-#include <hal/libhal.h>
#include <string.h>
#include <sys/select.h>
+#include <dbus/dbus.h>
+#include <hal/libhal.h>
+
+#include "config/hotplug_priv.h"
#include "config/dbus-core.h"
#include "input.h"
#include "inputstr.h"
-#include "hotplug.h"
#include "config-backends.h"
#include "os.h"
diff --git a/config/hotplug_priv.h b/config/hotplug_priv.h
new file mode 100644
index 000000000..879617f5d
--- /dev/null
+++ b/config/hotplug_priv.h
@@ -0,0 +1,85 @@
+/* SPDX-License-Identifier: MIT OR X11
+ *
+ * Copyright © 2024 Enrico Weigelt, metux IT consult <info at metux.net>
+ */
+/*
+ * Copyright © 2006-2007 Daniel Stone
+ *
+ * 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 (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Daniel Stone <daniel at fooishbar.org>
+ */
+#ifndef _XSERVER_HOTPLUG_PRIV_H
+#define _XSERVER_HOTPLUG_PRIV_H
+
+#include <X11/Xfuncproto.h>
+
+#include "hotplug.h"
+#include "list.h"
+
+/* Bump this each time you add something to the struct
+ * so that drivers can easily tell what is available
+ */
+#define ODEV_ATTRIBUTES_VERSION 1
+
+struct OdevAttributes {
+ /* path to kernel device node - Linux e.g. /dev/dri/card0 */
+ char *path;
+
+ /* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
+ char *syspath;
+
+ /* DRI-style bus id */
+ char *busid;
+
+ /* Server managed FD */
+ int fd;
+
+ /* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
+ int major;
+
+ /* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
+ int minor;
+
+ /* kernel driver name */
+ char *driver;
+};
+
+/* Note starting with xserver 1.16 this function never fails */
+struct OdevAttributes *
+config_odev_allocate_attributes(void);
+
+void
+config_odev_free_attributes(struct OdevAttributes *attribs);
+
+typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
+void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
+
+#ifdef CONFIG_UDEV_KMS
+void NewGPUDeviceRequest(struct OdevAttributes *attribs);
+void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
+#endif
+
+#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
+
+struct xf86_platform_device *
+xf86_find_platform_device_by_devnum(int major, int minor);
+
+#endif /* _XSERVER_HOTPLUG_PRIV_H */
diff --git a/config/udev.c b/config/udev.c
index 19f887c7a..83226638d 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -29,9 +29,10 @@
#include <ctype.h>
#include <unistd.h>
+#include "config/hotplug_priv.h"
+
#include "input.h"
#include "inputstr.h"
-#include "hotplug.h"
#include "config-backends.h"
#include "os.h"
#include "globals.h"
diff --git a/dix/main.c b/dix/main.c
index 793ac778b..4861dabe1 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -84,6 +84,7 @@ Equipment Corporation.
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
+#include "config/hotplug_priv.h"
#include "dix/callback_priv.h"
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
@@ -111,7 +112,6 @@ Equipment Corporation.
#include "cursorstr.h"
#include "selection.h"
#include "servermd.h"
-#include "hotplug.h"
#include "dixfont.h"
#include "extnsionst.h"
#include "privates.h"
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 9144091a4..e2eb847d7 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -22,6 +22,7 @@
#include <dix-config.h>
+#include "config/hotplug_priv.h"
#include "dix/screenint_priv.h"
#include "os/cmdline.h"
#include "os/ddx_priv.h"
@@ -50,10 +51,6 @@
#include <execinfo.h>
#endif
-#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
-#include <hotplug.h>
-#endif
-
/* This stub can be safely removed once we can
* split input and GPU parts in hotplug.h et al. */
#include <systemd-logind.h>
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 8b4b99d61..ad5d4b047 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -37,7 +37,11 @@
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
+#include "config/hotplug_priv.h"
#include "dix/input_priv.h"
+#include "mi/mi_priv.h"
+#include "mi/mipointer_priv.h"
+#include "os/cmdline.h"
#include "xkbsrv.h"
#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
@@ -49,14 +53,6 @@
#include "inpututils.h"
#include "optionstr.h"
-#include "mi/mi_priv.h"
-#include "mi/mipointer_priv.h"
-#include "os/cmdline.h"
-
-#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
-#include <hotplug.h>
-#endif
-
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
struct KdConfigDevice {
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 7d778c4dd..af1a8d715 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -37,6 +37,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
+
+#include "config/hotplug_priv.h"
+
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 7346bbcb1..bcfaf8d1d 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -48,8 +48,11 @@
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
#include "config/dbus-core.h"
+#include "config/hotplug_priv.h"
#include "dix/input_priv.h"
#include "dix/screenint_priv.h"
#include "mi/mi_priv.h"
@@ -71,8 +74,6 @@
#include "xf86cmap.h"
#include "xorgVersion.h"
#include "mipointer.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
#include "xf86Extensions.h"
#include "xf86DDC.h"
#include "xf86Xinput.h"
@@ -96,7 +97,6 @@
#include <linux/major.h>
#include <sys/sysmacros.h>
#endif
-#include <hotplug.h>
void (*xf86OSPMClose) (void) = NULL;
static Bool xorgHWOpenConsole = FALSE;
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 1a4465cd3..2962c8b21 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -37,10 +37,10 @@
#include <fcntl.h>
#include <unistd.h>
+#include "config/hotplug_priv.h"
#include "dix/screenint_priv.h"
#include "os.h"
-#include "hotplug.h"
#include "systemd-logind.h"
#include "loaderProcs.h"
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index 0e512d586..b9933f405 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -24,7 +24,6 @@
#ifndef XF86_PLATFORM_BUS_H
#define XF86_PLATFORM_BUS_H
-#include "hotplug.h"
#include "xf86MatchDrivers.h"
struct xf86_platform_device {
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 3a06fd95d..21358d9d5 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -40,6 +40,7 @@
#include <X11/extensions/randr.h>
#include <X11/extensions/Xv.h>
+#include "config/hotplug_priv.h"
#include "dix/dix_priv.h"
#include "xf86.h"
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index c6a24fc7b..791834627 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include "config/dbus-core.h"
+#include "config/hotplug_priv.h"
#include "os.h"
#include "linux.h"
diff --git a/hw/xfree86/os-support/shared/drm_platform.c b/hw/xfree86/os-support/shared/drm_platform.c
index a404aadcc..f6291e44d 100644
--- a/hw/xfree86/os-support/shared/drm_platform.c
+++ b/hw/xfree86/os-support/shared/drm_platform.c
@@ -10,6 +10,8 @@
#include <errno.h>
#include <string.h>
+#include "config/hotplug_priv.h"
+
/* Linux platform device support */
#include "xf86_OSproc.h"
@@ -18,7 +20,6 @@
#include "xf86platformBus.h"
#include "xf86Bus.h"
-#include "hotplug.h"
#include "systemd-logind.h"
static Bool
diff --git a/hw/xfree86/os-support/xf86_os_support.h b/hw/xfree86/os-support/xf86_os_support.h
index a2fc99912..b9aebb0a2 100644
--- a/hw/xfree86/os-support/xf86_os_support.h
+++ b/hw/xfree86/os-support/xf86_os_support.h
@@ -53,6 +53,9 @@ void xf86OSInitVidMem(VidMemInfoPtr);
#ifdef XSERVER_PLATFORM_BUS
#include "hotplug.h"
+
+struct OdevAttributes;
+
void
xf86PlatformDeviceProbe(struct OdevAttributes *attribs);
diff --git a/include/hotplug.h b/include/hotplug.h
index 6fe76c806..359bac959 100644
--- a/include/hotplug.h
+++ b/include/hotplug.h
@@ -26,58 +26,10 @@
#ifndef HOTPLUG_H
#define HOTPLUG_H
-#include "list.h"
+#include <X11/Xfuncproto.h>
extern _X_EXPORT void config_pre_init(void);
extern _X_EXPORT void config_init(void);
extern _X_EXPORT void config_fini(void);
-/* Bump this each time you add something to the struct
- * so that drivers can easily tell what is available
- */
-#define ODEV_ATTRIBUTES_VERSION 1
-
-struct OdevAttributes {
- /* path to kernel device node - Linux e.g. /dev/dri/card0 */
- char *path;
-
- /* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
- char *syspath;
-
- /* DRI-style bus id */
- char *busid;
-
- /* Server managed FD */
- int fd;
-
- /* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
- int major;
-
- /* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
- int minor;
-
- /* kernel driver name */
- char *driver;
-};
-
-/* Note starting with xserver 1.16 this function never fails */
-struct OdevAttributes *
-config_odev_allocate_attributes(void);
-
-void
-config_odev_free_attributes(struct OdevAttributes *attribs);
-
-typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
-void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
-
-#ifdef CONFIG_UDEV_KMS
-void NewGPUDeviceRequest(struct OdevAttributes *attribs);
-void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
-#endif
-
-#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
-
-struct xf86_platform_device *
-xf86_find_platform_device_by_devnum(int major, int minor);
-
#endif /* HOTPLUG_H */
commit dda06aff96559d4deb2d624e2dfe870b5e3f54e9
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Thu Apr 18 12:51:06 2024 +0200
xfree86: common: make _xf86_get_platform_device_attrib() a real function
Doing so that struct OdevAttributes doesn't need to be exposed to
drivers anymore. It really doesn't seem to be a hot path, so not
inlining anymore shouldn't have any practical performance impact.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 2a2387ed7..1a4465cd3 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -821,4 +821,39 @@ void xf86platformPrimary(void)
}
}
}
-#endif
+
+char *
+_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_PATH:
+ return xf86_platform_device_odev_attributes(device)->path;
+ case ODEV_ATTRIB_SYSPATH:
+ return xf86_platform_device_odev_attributes(device)->syspath;
+ case ODEV_ATTRIB_BUSID:
+ return xf86_platform_device_odev_attributes(device)->busid;
+ case ODEV_ATTRIB_DRIVER:
+ return xf86_platform_device_odev_attributes(device)->driver;
+ default:
+ assert(FALSE);
+ return NULL;
+ }
+}
+
+int
+_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_FD:
+ return xf86_platform_device_odev_attributes(device)->fd;
+ case ODEV_ATTRIB_MAJOR:
+ return xf86_platform_device_odev_attributes(device)->major;
+ case ODEV_ATTRIB_MINOR:
+ return xf86_platform_device_odev_attributes(device)->minor;
+ default:
+ assert(FALSE);
+ return 0;
+ }
+}
+
+#endif /* XSERVER_PLATFORM_BUS */
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index 9979106a1..0e512d586 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -76,7 +76,6 @@ xf86_platform_odev_attributes(int index)
return device->attribs;
}
-#ifndef _XORG_CONFIG_H_
/*
* Define the legacy API only for external builds
*/
@@ -96,6 +95,14 @@ xf86_platform_odev_attributes(int index)
/* kernel driver name */
#define ODEV_ATTRIB_DRIVER 7
+_X_EXPORT char *
+_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]);
+
+_X_EXPORT int
+_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0]);
+
+#ifndef _XORG_CONFIG_H_
+
/* Protect against a mismatch attribute type by generating a compiler
* error using a negative array size when an incorrect attribute is
* passed
@@ -108,24 +115,6 @@ xf86_platform_odev_attributes(int index)
#define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0)
-static inline char *
-_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
-{
- switch (attrib) {
- case ODEV_ATTRIB_PATH:
- return xf86_platform_device_odev_attributes(device)->path;
- case ODEV_ATTRIB_SYSPATH:
- return xf86_platform_device_odev_attributes(device)->syspath;
- case ODEV_ATTRIB_BUSID:
- return xf86_platform_device_odev_attributes(device)->busid;
- case ODEV_ATTRIB_DRIVER:
- return xf86_platform_device_odev_attributes(device)->driver;
- default:
- assert(FALSE);
- return NULL;
- }
-}
-
#define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib))
#define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR)
@@ -133,22 +122,6 @@ _xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib
#define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def))
#define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0)
-static inline int
-_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
-{
- switch (attrib) {
- case ODEV_ATTRIB_FD:
- return xf86_platform_device_odev_attributes(device)->fd;
- case ODEV_ATTRIB_MAJOR:
- return xf86_platform_device_odev_attributes(device)->major;
- case ODEV_ATTRIB_MINOR:
- return xf86_platform_device_odev_attributes(device)->minor;
- default:
- assert(FALSE);
- return 0;
- }
-}
-
#define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def))
#endif
More information about the xorg-commit
mailing list