xf86: gate consType on CONFIG_BSD_CONSOLE, not CSRG_BASED

The xf86Info.consType field and the BSD console-driver-type constants
(PCCONS/SYSCONS/PCVT/WSCONS/...) are the BSD console machinery consumed
by hw/xfree86/os-support/bsd/console_*.c and bsd_VTsw.c. They were
gated on the opaque grab-bag macro CSRG_BASED ("Computer Systems
Research Group", i.e. BSD-derived) OR'd with __FreeBSD_kernel__.

Introduce a self-documenting meson flag CONFIG_BSD_CONSOLE (following
the existing CONFIG_WSCONS/CONFIG_UDEV/... convention) set to exactly
`csrg_based or host_machine.system() == 'kfreebsd'` — i.e. the same set
of platforms the old `CSRG_BASED || __FreeBSD_kernel__` guard matched —
and use it at all three sites (struct field, constants, initializer).

Behaviour / ABI:
  - The flag is true on precisely the same platforms as before, so the
    xf86InfoRec layout is unchanged everywhere. On Linux (and every
    non-BSD target) CONFIG_BSD_CONSOLE is undefined just as CSRG_BASED
    was, so consType stays absent and the struct offsets — hence the
    driver ABI, incl. the nvidia blob — are untouched.
  - Fixes a latent inconsistency on GNU/kFreeBSD: the struct field was
    present there (via __FreeBSD_kernel__) but xf86Globals.c initialised
    .consType only under #ifdef CSRG_BASED, so it defaulted to 0 instead
    of -1. Both are now driven by the single CONFIG_BSD_CONSOLE flag, so
    field presence and initialiser always agree.

Verified: Linux -Dwerror=true build configures (dix-config.h gets
`#undef CONFIG_BSD_CONSOLE`) and links Xorg cleanly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2026-07-01 20:34:42 +02:00 • committed by Enrico Weigelt
commit 7103c74da1
3 changed files with 9 additions and 3 deletions

View file

@ -66,7 +66,7 @@ typedef struct {
/* graphics part */
ScreenPtr currentScreen;
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
#ifdef CONFIG_BSD_CONSOLE
int consType; /* Which console driver? */
#endif
@ -110,7 +110,7 @@ typedef struct {
#define XCOMP ((unsigned long) 0x00008000)
/* BSD console driver types (consType) */
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
#ifdef CONFIG_BSD_CONSOLE
#define PCCONS 0
#define CODRV011 1
#define CODRV01X 2