Commit Graph

10066 Commits

Author SHA1 Message Date
stefan11111
8b8cde2cb2 modesetting: add "CursorSize" option
On certain setups, it might still be useful to force a particular cursor
size via xorg.conf.
For example, if on a system the automatic probes fail, or if the user wants
a particular cursor size, that is higher that the minimum size.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-21 16:12:46 +02:00
stefan11111
cf092cd469 modesetting: probe using the old method if SIZE_HINTS isn't available
On most cards, SIZE_HINTS isn't available.
Without this, most users would have to set the fallback cursor size themselves,
or rely on the 64x64 default.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-21 16:12:46 +02:00
stefan11111
6f7731c44c modesetting: Fix cursor buffer not getting cleared when the pitch changes.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-21 16:12:46 +02:00
Alan Coopersmith
e446fdc14a xfree86: add missing headers to build sun_init.c on Solaris/SPARC
Fixes: 0f715b4ca4 ("xfree86: os-support: move hidden Solaris-specific symbols out of public header")
Fixes: e2fa0d2ae0 ("fix including <sys/mman.h>")

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>

Further explanation about this commit by @alanc:

This particular set of `#ifdefs` matches the ones around the code using the fbio ioctls and mmap calls in the `xf86CloseConsole()` code later in the file:
c62cd2feaa/hw/xfree86/os-support/solaris/sun_init.c (L281)
reflecting the lack of /dev/fb style drivers on x86 systems on Solaris.
2025-10-21 10:25:32 +02:00
Alan Coopersmith
855aa4ef86 xfree86: Fix -Wdiscarded-qualifiers warnings in SPARC Sbus probe code
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-21 10:25:32 +02:00
Alan Coopersmith
c179700b99 xfree86: fix meson build on 64-bit Solaris/SPARC systems
For cpu_family(), meson returns "sparc" for 32-bit sparc,
and "sparc64" for 64-bit sparc, regardless of the OS in use.

For cpu(), meson returns values like "sun4v" on Solaris/SPARC,
and doesn't promise stability of the values, or portability across
OS'es, unlike cpu_family().

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-21 10:25:32 +02:00
kohnish
166dec4701 Fix missing include and signature mismatch on gentoo linux 2025-10-20 10:25:28 +02:00
stefan11111
214d0e67de xfree86/common: Match drivers "modesetting" and "nvidia" on nvidia cards
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-14 10:39:22 +02:00
stefan11111
036432980b modesetting: Initialize the cursor image with the smallest size supported by all CRTCs.
We try to find the smallest size we can use for the cursor image.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-13 14:01:04 +02:00
stefan11111
702625f028 modesetting: use MAX macro in more places
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-13 14:01:04 +02:00
stefan11111
4984b12967 modesetting: Use the same cursor mask interleave as other drivers
There is no explanation for these values, but the one we are
currently using doesn't work.

Use the values from vendor-speciffic drivers, which do work.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-02 18:49:40 +02:00
stefan11111
bbcf22183a modesetting: Only use the querried fallback if both querries succeed
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-02 18:49:40 +02:00
stefan11111
25cae34122 modesetting: add braces around an if
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-02 18:49:40 +02:00
stefan11111
d5162b4493 modesetting: Handle cursor images and buffers smaller than 64x64 correctly
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-02 18:49:40 +02:00
stefan11111
5752116343 modesetting: Clear the cursor buffer explicitly
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-02 18:49:40 +02:00
Enrico Weigelt, metux IT consult
a41273572f xfree86: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-01 14:46:26 +02:00
Enrico Weigelt, metux IT consult
962580a15a treewide: macros lambda-esque screen iteration
iterating over screen list via lambda-esque macros calls like this

    DIX_FOR_EACH_SCREEN({
        do_something
    });

withing the body, the iterator variables `walkScreenIdx` and `walkScreen`
are defined and can be directly used (read-only). the code inside the body
is running in a separate scope.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-01 11:40:34 +02:00
Enrico Weigelt, metux IT consult
b2a85f070d xwin: dri: inline byte-swapping
No need for having extra functions and redundant code when it can
be done with just few LoC.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 12:34:42 +02:00
Enrico Weigelt, metux IT consult
9a2dc644b7 xquartz: applewm: drop redundant dispatcher for swapped case
There's nothing actually do be done by the swapped dispatcher, the
original already does everything on its own.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:24:43 +02:00
Enrico Weigelt, metux IT consult
9353255c9d xquartz: appledri: inline byte-swapping
No need for having lots of extra functions and redundant dispatcher,
when it can be done by directly inlining those few LoC.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:24:28 +02:00
Enrico Weigelt, metux IT consult
338f8c0b06 xquartz: prepare DarwinAdjustScreenOrigins() for new screen iterators
* the pScreenInfo isn't needed: we're always getting global screenInfo
  passed in here (there's only one, globally, anyways)
* use the common iterator variable names
* handle first and auxillary screens all in the same loop
  (we can just branch by idx)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:10:01 +02:00
Enrico Weigelt, metux IT consult
ca484055c7 dix: unexport screen saver parameters
Not used by any external drivers, so no need to keep them in public
SDK headers. Since they're never used by drivers, it's effectively
not an ABI change, so can safely be done within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:01:21 +02:00
Enrico Weigelt, metux IT consult
21fb27735a os: unexport XNFreallocarray()
Not used by any drivers, no no need to keep it in public SDK.
Since it's not used by drivers, it's effectively not an ABI change,
so can be done within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 10:53:15 +02:00
Enrico Weigelt, metux IT consult
f29fb6bb62 present: unexport symbols not used by drivers
these symbols aren't used by any external drivers (not even proprietary
Nvidia), so no need to keep them exported any longer:

 * present_check_flips
 * present_register_complete_notify
 * present_can_window_flip
 * uint32_t FakeScreenFps

Since it's not any *effective* ABI change, can go into current ABI-25 line.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 17:09:43 +02:00
Enrico Weigelt, metux IT consult
0e723d3b1e xfree86: xv: fix missed hooking of WindowDestroy
Forgot to register window destroy hook - that's leading to crash:

    https://github.com/X11Libre/xserver/issues/959

Fixes: b60581e393
Bug: https://github.com/X11Libre/xserver/issues/959
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 17:04:56 +02:00
Enrico Weigelt, metux IT consult
caa3e1685a xfree86: dga: drop unnecessary swapped request handler
The request handler already refusing non-local access, so no need
for any extra swapped handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 15:57:13 +02:00
Enrico Weigelt, metux IT consult
9d1f0a555d xfree86: dri: drop unnecessary swapped request handler
The request handler already refusing non-local access, so no need
for any extra swapped handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 15:57:01 +02:00
Enrico Weigelt, metux IT consult
dcaaa4a355 xfree86: drop XF86XvScreenKey field
Not used by any drivers anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 14:27:53 +02:00
Enrico Weigelt, metux IT consult
bd41233e47 vfb: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 13:49:14 +02:00
Enrico Weigelt, metux IT consult
2112cbb876 xwin: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 13:49:05 +02:00
Enrico Weigelt, metux IT consult
6996fe65af kdrive: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 13:14:05 +02:00
Enrico Weigelt, metux IT consult
5cdfe6e5ab os: move enum ExitCode into private header
Not used by any external drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 09:37:05 +02:00
Enrico Weigelt, metux IT consult
36facd71b5 dix: move request/response related functions to new request_priv.h header
Move functions/macros dealing with request parsing or reply assembly/write
out of the big dix_priv.h into their own headers. This new header will also
get more of those function/macros soon (yet still in the pipeline).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:32:50 +02:00
stefan11111
0cfe43853e os: hw/xfree86/x86emu: Silence warnings on gcc
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-22 12:12:48 +02:00
stefan11111
f252e04a78 fbdevhw: Restore accel flags when unmapping mmio
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-22 11:57:41 +02:00
stefan11111
e3aff38742 fbdevhw: Fix -Wunused-result warning in fbdev_open_pci
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-22 11:57:41 +02:00
stefan11111
4b54da3fc6 fbdevhw: handle 2 digit framebuffer devices in the fallback probe
According to linux's Documentation/admin-guide/devices.txt,
framebuffers are named /dev/fb[0-31].
As such, we have to handle 2 digit numbers in framebuffer devices.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-19 14:03:30 +02:00
stefan11111
698d8a631a fbdevhw: Only accept framebuffers that match the passed pci device in the pci probe
The pci probe was broken already, lots of pci devices were not detected as such.
Since fixing it properly required a bit of extra code complexity,
and those devices would be detected on the fallback probe, I didn't
bother fixing it untill now.

However, there is another problem created by this.
The pci probe was accepting the device passed by the user without
doing any checks on it.
This means that in multi-card setups, fbdevhw might claim the
wrong pci slot.
Fixing this requires fixing the pci probe in order to try and determine
whether the device passed by the user is the same as the pci device
passed to the pci probe.

This commit fixes the pci probe.
If no device is passed by the user, the probe finds a pci framebuffer device.
If a device is passed, the pci probe only return TRUE if the pci device
passed to it is the same as the device passed by the user.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-19 14:03:30 +02:00
stefan11111
c6d39ecc3f fbdevhw: Use a wrapper around open()
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-19 14:03:30 +02:00
Enrico Weigelt, metux IT consult
d1deec0008 xfree86: platform bus: move raw device list to internal header
These xf86_num_platform_devices and xf86_platform_devices fields aren't
_X_EXPORTED, so no drivers can use them - and none are trying so.

Thus move them to internal / non-sdk header.

Not an ABI change.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-19 14:02:30 +02:00
stefan11111
74102a1126 modesetting: Only paint as much of the cursor image as needed
We often use very large cursor sizes, compared to the sizes of the
curor glyphs, e.g. 64x64 cursors and 16x16 or smaller glyphs.

This patch makes is so that we only paint the size of the new
cursor glyph and clear the old one if needed, instead of painting
the entire cursor buffer, which is often far larger than the glyphs.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-19 14:02:03 +02:00
stefan11111
460c5b7d6c modesetting: fix edge cases in cursor size calculations
Split from https://github.com/X11Libre/xserver/pull/840

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-19 14:01:04 +02:00
stefan11111
ccc81e1b14 fbdevhw: Print a better error message
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 15:53:03 +02:00
stefan11111
4296a31161 fbdevhw: document the FRAMEBUFFER envvar
Follow-up after https://github.com/X11Libre/xserver/pull/399

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 15:53:03 +02:00
stefan11111
e432e4a8b0 fbdevhw: Use more consistent naming
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 15:53:03 +02:00
stefan11111
da8a57809e fbdevhw: don't reject pci devices on the fallback probe
Now that we know the root couse of what this code tried to fix,
we can safely remove it.

Fixes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/-/issues/9
Fixes: fc78bcca21
Fixes: a8e41a8190
Fixes: 728b54528d
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1798
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1826

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 15:53:03 +02:00
Enrico Weigelt, metux IT consult
765d0de418 xfree86: dri: ProcXF86DRIGetDrawableInfo() use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-15 11:28:34 +02:00
stefan11111
d09b3dae3e hw/xfree86/common: remove {fb,platform,pci,sbus}SlotClaimed
These were global variables that were tracking how many
slots of one kind were claimed by drivers,
or if slots of one kind were claimed by drivers.

There were used inconsistently, sometimes they were `int`'s,
sometimes they were `Bool`'s.

All they were doing was to kill the server in various circumstances,
that were often incorrect and lead to bug reports, and guard against
a very speciffic kind of driver code error in `xf86ClaimFbSlot`,
that was also prone to false-positives.

Now that both these uses were removed,
these globals are no longer used, so we can remove them.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 11:19:20 +02:00
stefan11111
d3fd8c385b hw/xfree86/common: remove broken checks from xf86ClaimFbSlot
The intent of both these checks, I assume,
is that drivers don't claim 2 slots at once (fb, pci, plarform).
If we actually want to implement checking like this,
we would have to put a {fb,pci,platform}SlotClaimed in each driver struct.
We could definitely do that, but it seems weird
to single out this error to protect against.
By design, drivers are able to execute arbitrary code.
Nothing is stopping them from doing `*(volatile char*)0=0;`
in preinit or in one of the probes.

If we do decide to keep these checks, we have to be careful of corner cases.
What happens if a driver is used with multiple cards, one pci one not?
We could also keep track of how many slots a driver claims,
and reject any further claims after the count reaches 1.
We would still have to make that counter per driver and per card.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 11:19:20 +02:00
stefan11111
22d963bc4d hw/xfree86/common: remove xf86PostProbe
A long time ago, this function used to initialize
various screen resources.
Now, this function just kills the X server in various circumstances
for no good reason.

Fixes: fc78bcca21
Fixes: 728b54528d
Fixes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/-/issues/9
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 11:19:20 +02:00