Commit Graph

10024 Commits

Author SHA1 Message Date
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
b-aaz
52a357dbf3 xfree86: os-support: Deal with DFBSD correctly.
In DragonFlyBSD the host_machine.system() variable is set to 'dragonfly' and does not end with 'bsd'. Changed a check to correctly detect 'dragonfly' as a member of BSD OSs.

bsd/bsd_kmod.c is used for dealing with kernel modules on FreeBSD, enabled this file for DragonFlyBSD too, because they both have the same APIs in this context.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-09-15 10:27:07 +02:00
stefan11111
b11c28b13e modesetting: handle pitch when painting the hardware cursor
The cursor pitch can depend on crtc.

Since we only use the sizes reported by SIZE_HINTS,
we can allocate a small cache for pitches in each crtc.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-15 09:06:52 +02:00
Enrico Weigelt, metux IT consult
56c4d68140 treewide: drop ScreenInfoPtr parameter from InitOutput()
Nobody's using this pointer anymore, everybody's using the global
screenInfo structure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 19:49:23 +02:00
Enrico Weigelt, metux IT consult
358f76f2ad treewide: fix misleading firstScreen variable naming to masterScreen
Follow-up on renaming dixGetFirstScreenPtr() to dixGetMasterScreen():
also rename the target variables for correct technical terminology.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
b0ffa7b286 treewide: rename dixGetFirstScreenPtr() to dixGetMasterScreen() for correct semantics
In Xinerama/Panoramix configuration there's one screen that's having special
meaning - it's used for simulating as the frontend for all client operations:
the clients (should) only talk to that screen, while panoramix subsystem is
proxying those operations to all the other screens (with certain changed
applied, eg. coordinate transformations).

Historically, this screen happens to be the first one in the system (some of
it's proc's are hooked up in order to achieve desired behaviour). That's why it
used to be accessed via screenInfo.screens[0] - that already had been encapsulated
into a tiny helper `dixGetFirstScreen()`.

a) the correct terminus technicus for a situation where one device (or SW entity)
   entirely controlling others is a master-slave-relationship: the controlling
   device/entity is `master`, the controlled ones are `slave` (to that specific
   master).

b) the term "first screen" is inacurate and misleading here: what the caller's are
   actually interest in isn't the first entry in the screen array, but the screen
   that's controlling the others. With upcoming refactoring of the Xinerama/Panoramix
   subsystem, this might well be a different array index than 0.

c) the term `default` also wouldn't match: `default` implies there's a real practical
   choice, and such value applies when no explicit choice has been made. But in this
   case, it practically doesn't make sense (except perhaps for debugging purpose)
   for a client to use any different screen.

Therefore fixing the function name to the correct technical terminology.
(for sake of patch readability, renaming corresponding variables is left to
subsequent patches).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
e16c608d73 xfree86: dri2: ProcDRI2Connect(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 09:51:23 +02:00
Enrico Weigelt, metux IT consult
dd20d5c0d1 xquartz: appledri: use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 09:50:51 +02:00
Enrico Weigelt, metux IT consult
6148bee17d xfree86: dga: ProcXDGASetMode(): use x_rpcbuf_t
Use x_rpcbuf_t for 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-12 09:40:04 +02:00
Enrico Weigelt, metux IT consult
31b110cf28 xfree86: dri: ProcXF86DRIGetDeviceInfo() 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-11 16:18:58 +02:00
Enrico Weigelt, metux IT consult
74f93c4022 xfree86: common: move out private definitions from xf86platformBus.h
Private definitions should not pollute public / SDK headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 16:15:14 +02:00
Enrico Weigelt, metux IT consult
850aebf5bc xwin: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:50:02 +02:00
Enrico Weigelt, metux IT consult
c49bcbdcc6 xfree86: dri: ProcXF86DRIGetClientDriverName() fix uninitialized variable
The clientDriverName variable might be left uninitialized when
DRIGetClientDriverName() fails.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:40:28 +02:00
Alan Coopersmith
db07dbf914 modesetting: fix modesetting symbol test when glx is disabled
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-09-11 11:32:07 +02:00
Alan Coopersmith
b641d8e33e modesetting: Fix builds with pciaccess or udev_kms disabled
CI meson-disable-options builds were failing with:
```
../hw/xfree86/drivers/modesetting/driver.c:127:5: error: ‘ms_device_match’
 undeclared here (not in a function)
  127 |     ms_device_match,
      |     ^~~~~~~~~~~~~~~
../hw/xfree86/drivers/modesetting/driver.c: In function ‘ms_get_drm_master_fd’:
../hw/xfree86/drivers/modesetting/driver.c:1179:19: error: variable ‘pEnt’
 set but not used [-Werror=unused-but-set-variable]
 1179 |     EntityInfoPtr pEnt;
      |                   ^~~~
../hw/xfree86/drivers/modesetting/driver.c: At top level:
../hw/xfree86/drivers/modesetting/driver.c:84:13: error: ‘ms_pci_probe’
 used but never defined [-Werror]
   84 | static Bool ms_pci_probe(DriverPtr driver,
      |             ^~~~~~~~~~~~
../hw/xfree86/drivers/modesetting/driver.c:313:1: error: ‘probe_hw_pci’
 defined but not used [-Werror=unused-function]
  313 | probe_hw_pci(const char *dev, struct pci_device *pdev)
      | ^~~~~~~~~~~~
```
Fixes: a72bdf17 ("modesetting: rewrite probing based on fbdev.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-09-11 11:32:07 +02:00
callmetango
d8b7a3e46c xfree86: loader: search module dirs only once
Only specify the top module directories since the loader is recursing
into the subdirectories either way.

Fixes: #991
Signed-off-by: callmetango <callmetango@users.noreply.github.com>
2025-09-11 11:29:39 +02:00
Enrico Weigelt, metux IT consult
2404643489 xnest: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:23:48 +02:00
Enrico Weigelt, metux IT consult
4131dd2950 vfb: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:23:34 +02:00
Enrico Weigelt, metux IT consult
07820e4a7d xfree86: dri: ProcXF86DRIOpenConnection() 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-11 11:23:15 +02:00
Enrico Weigelt, metux IT consult
e2e8e78cd2 xfree86: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:14:19 +02:00
Enrico Weigelt, metux IT consult
c3b443b3b6 xquartz: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:14:07 +02:00
Enrico Weigelt, metux IT consult
7fb1989cec xquartz: replace malloc() by calloc()
It's in general safer to clear out all the memory on allocation,
in order to prevent potential leaks or undefined behaviour on
uninitialized data.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:13:44 +02:00
Enrico Weigelt, metux IT consult
2cb5aac7a3 xfree86: dri: ProcXF86DRIGetClientDriverName() 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-11 11:10:43 +02:00
Enrico Weigelt, metux IT consult
6bc438ab5a treewide: use inline helper for accessing first screen
Instead of everybody directly accessing the (internal) screenInfo struct,
let those consumers only interested in first screen use a little helper.

Also caching the value if it's needed several times.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:45:05 +02:00
Enrico Weigelt, metux IT consult
cdbf824d70 kdrive: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 10:37:45 +02:00
Enrico Weigelt, metux IT consult
a324351f67 treewide: drop unnecessary includes of Xi/eglobals.h
Dropping include by sources that don't use anything from this header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-09 14:41:10 +02:00
Enrico Weigelt, metux IT consult
e3d9f4c3ef xfree86: dga: use canonical loop index in DGAClientStateChange()
Naming all index variables on looping over screens `walkScreenIdx`,
in order to make transition to upcoming generic screen walk macros easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-09 10:01:18 +02:00
stefan11111
7d48a9a41e modesetting: Fix memory leak
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-09 09:46:05 +02:00
b-aaz
8d4c9270ea xf86AutoConfig: Enabled autoselction of the scfb driver for DragonFlyBSD.
scfb driver is the native frame-buffer driver used on both FreeBSD and DragonFlyBSD,
It was not enabled as a fallback on DragonFlyBSD, so enabled it.

The driver:
https://github.com/rayddteam/xf86-video-scfb
Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-09-08 17:39:48 +02:00
stefan11111
6415fdf2db kdrive: bring back Xfbdev
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-08 17:35:36 +02:00
b-aaz
99bc9e7800 Fixed the check for __builtin_popcountl for old compilers.
Old compilers used on some platforms (e.g. DragonFlyBSD) do not support __has_builtin, so now we fall back to #if define if __has_builtin is not found.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-09-08 17:29:45 +02:00
Enrico Weigelt, metux IT consult
e3122e411c xfree86: dga: simplify DGAClientStateChange()
Simply do the action on matched screen inside the loop instead of
saving the found client and acting on it later (if found).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-08 09:59:11 +02:00
Enrico Weigelt, metux IT consult
9feb398a7c config: fix inttype mismatches on device major/minor numbers
System headers define them as unsigned.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 20:31:59 +02:00
Enrico Weigelt, metux IT consult
1b91049083 kdrive: KdCursorOffScreen(): canonical screen iterator index
in preparation of upcoming generic screen iterator macros, already
rename the index variable to what the macro will be using.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 08:49:26 +02:00
Enrico Weigelt, metux IT consult
4d66d6f9ac xfree86: dga: ProcXDGAQueryModes(): use x_rpcbuf_t
Use x_rpcbuf_t for 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-05 08:48:29 +02:00
Enrico Weigelt, metux IT consult
553f13fdca xfree86: dri: ProcXF86DRIGetDrawableInfo(): cache screen pointer
Cache the screen pointer in local variable, instead of fetching it
from global array several times. Follow-up commits will use some
inline helper for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:22:23 +02:00
Enrico Weigelt, metux IT consult
b8bfb5792a kdrive: KdCursorOffScreen(): move dx and dy into local scope
These are just used locally and always assigned at loop body start,
so it's cleaner to declare them locally inside the loop body.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:06:33 +02:00
Enrico Weigelt, metux IT consult
e2d9dc4054 kdrive: fix KdCursorOffScreen()
Bug slipped through: we have to substract the coordinates from the walked
screen to the current one, instead of the walked one from itself :o

Fixes: 97d72431cf
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 17:12:54 +02:00
Enrico Weigelt, metux IT consult
015fd1c4ee xquartz: dri: use X_SEND_REPLY_SIMPLE() for simple replies
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 12:51:58 +02:00
Enrico Weigelt, metux IT consult
a389034c2d xfree86: dga: ProcXDGAOpenFramebuffer() use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 12:49:29 +02:00
Enrico Weigelt, metux IT consult
9f8a9f4f8c xfree86: dga: use X_SEND_REPLY_SIMPLE() for simple replies
Use the X_SEND_REPLY_SIMPLE() macro for simple replies.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 16:56:57 +02:00
Enrico Weigelt, metux IT consult
48cb1118ee treewide: drop unnecessary pixmap field initialization
The PixmapRec is already calloc()'ed, so no need for additional zero-writes
into individual fields. This also removes some unncessary #ifdefs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 13:31:52 +02:00
Enrico Weigelt, metux IT consult
89b900063e xfree86: DGA: remove obsolete comment
Forgotten to remove an obsolete comment when ancient DGA-1.0 was removed.

Fixes: 4615067264
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 12:49:54 +02:00