Commit Graph

8882 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 27b5530107 xfree86: drop remains of old USL compiler
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1286>
2024-02-19 09:21:36 +00:00
Enrico Weigelt, metux IT consult 6dafe3dbe6 drop remains of support for old Sun compilers
With transition from autoconf to meson, these aren't actually supported
anymore, and re-adding it isn't planned. Thus the now dead code pathes
can be completely removed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1286>
2024-02-19 09:21:36 +00:00
Yusuf Khan db3aa4e03b hw/xfree86: fix NULL pointer refrence to mode name
Potentially, the pointer to the mode name could be unset, this can
occur with the xf86-video-nv DDX, in that case there isnt much we can do
except check if the next mode is any better.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
2024-02-19 03:51:25 +00:00
Enrico Weigelt, metux IT consult a2e7904b1d fix: unused readIntVec()
[585/699] Compiling C object hw/xfree86/int10/libint10.so.p/generic.c.o
../hw/xfree86/int10/generic.c:103:1: warning: ‘readIntVec’ defined but not used [-Wunused-function]
  103 | readIntVec(struct pci_device *dev, unsigned char *buf, int len)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-19 01:02:32 +00:00
Enrico Weigelt, metux IT consult 8d2117abeb hw: xwayland: fix build if neither gbm nor eglstream available
glamor needs to be disabled if neither gbm nor eglstream is available,
otherwise build breaks.

Closes: xorg/xserver#1631
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-19 00:53:30 +00:00
Enrico Weigelt, metux IT consult 374ee7acd7 xkb: drop defining XKBSRV_NEED_FILE_FUNCS
No need to define XKBSRV_NEED_FILE_FUNCS, for about 15 years now
(since XKBsrv.h isn't used anymore), so drop it.

Fixes: e5f002edde
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-19 00:44:15 +00:00
Matthieu Herrb 0d4a7ed684 bsd_init.c: fix build on OpenBSD
isolate NetBSD specific VGAPCVTID ioctl(2) call.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
2024-02-19 00:40:04 +00:00
Matthieu Herrb 238f8edcaf xfree86/bsd: fix build on NetBSD/amd64.
The IOPL function for 64 bit systems is x86_64_iopl() there
2024-02-18 00:03:45 +00:00
Matthieu Herrb 59dac6af45 Add full prototypes in hw/xfree86/os-support/bsd/bsd-video.c
Trivial functions without parameters -> (void)
2024-02-17 23:50:59 +00:00
Enrico Weigelt 442aec2219 include: move BUG_*() macros to separate header
Yet another step of uncluttering includes: move out the BUG_* macros
into a separate header, which then is included as-needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-15 23:33:46 +00:00
Alan Coopersmith a8bb924af1 os: Assume all supported non-WIN32 platforms have seteuid & saved_ids
Removes fallback code to fork and exec a "cat" command to read files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-02-10 00:05:54 +00:00
Florian Weimer f0a187f55d xwayland: Use correct pointer types on i386
And other 32-bit architectures, where uint32_t and CARD32 are
not the same type.  Otherwise the build will fail with GCC 14
with errors like:

../hw/xwayland/xwayland-glamor.c: In function ‘xwl_glamor_get_formats’:
../hw/xwayland/xwayland-glamor.c:291:43: error: passing argument 3 of ‘xwl_get_formats_for_device’ from incompatible pointer type [-Wincompatible-pointer-types]
  291 |                                           num_formats, formats);
      |                                           ^~~~~~~~~~~
      |                                           |
      |                                           CARD32 * {aka long unsigned int *}
../hw/xwayland/xwayland-glamor.c:238:38: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘CARD32 *’ {aka ‘long unsigned int *’}
  238 |                            uint32_t *num_formats, uint32_t **formats)
      |                            ~~~~~~~~~~^~~~~~~~~~~
../hw/xwayland/xwayland-glamor.c:291:56: error: passing argument 4 of ‘xwl_get_formats_for_device’ from incompatible pointer type [-Wincompatible-pointer-types]
  291 |                                           num_formats, formats);
      |                                                        ^~~~~~~
      |                                                        |
      |                                                        CARD32 ** {aka long unsigned int **}
../hw/xwayland/xwayland-glamor.c:238:62: note: expected ‘uint32_t **’ {aka ‘unsigned int **’} but argument is of type ‘CARD32 **’ {aka ‘long unsigned int **’}
  238 |                            uint32_t *num_formats, uint32_t **formats)
      |                                                   ~~~~~~~~~~~^~~~~~~
../hw/xwayland/xwayland-glamor.c:295:28: error: passing argument 3 of ‘xwl_get_formats’ from incompatible pointer type [-Wincompatible-pointer-types]
  295 |                            num_formats, formats);
      |                            ^~~~~~~~~~~
      |                            |
      |                            CARD32 * {aka long unsigned int *}
../hw/xwayland/xwayland-glamor.c:217:26: note: expected ‘uint32_t *’ {aka ‘unsigned int *’} but argument is of type ‘CARD32 *’ {aka ‘long unsigned int *’}
  217 |                uint32_t *num_formats, uint32_t **formats)
      |                ~~~~~~~~~~^~~~~~~~~~~
../hw/xwayland/xwayland-glamor.c:295:41: error: passing argument 4 of ‘xwl_get_formats’ from incompatible pointer type [-Wincompatible-pointer-types]
  295 |                            num_formats, formats);
      |                                         ^~~~~~~
      |                                         |
      |                                         CARD32 ** {aka long unsigned int **}
../hw/xwayland/xwayland-glamor.c:217:50: note: expected ‘uint32_t **’ {aka ‘unsigned int **’} but argument is of type ‘CARD32 **’ {aka ‘long unsigned int **’}
  217 |                uint32_t *num_formats, uint32_t **formats)
      |                                       ~~~~~~~~~~~^~~~~~~
2024-02-02 09:36:52 +01:00
Michel Dänzer abe3a08245 xwayland: Enable Present extension support also without glamor
This allows e.g.

 xfwm4 --vblank=xpresent

to hit the page flip path instead of copies.

In the future, Mesa might also use the Present extension with software
rendering.
2024-01-22 14:14:05 +00:00
Michel Dänzer 17986658bf xwayland: Add xwl_pixmap_get_wl_buffer helper
Preparation for the next commit.
2024-01-22 14:14:05 +00:00
Michel Dänzer 613e4466b4 xwayland: Handle NULL xwl_pixmap in xwl_shm_pixmap_get_wl_buffer 2024-01-22 14:14:05 +00:00
Michel Dänzer f50ed265cf xwayland: Initialize Present extension support also with rootful
Multiple benefits, in particular:

* Fullscreen windows can hit the page flip path
* X client presentation is properly synchronized to the Wayland
  compositor refresh cycle via frame events
2024-01-22 14:14:05 +00:00
Michel Dänzer e391d53076 xwayland/present: Update screen pixmap in xwl_present_execute
If the screen pixmap was also the toplevel window pixmap.

This can't happen yet, it will with the next commit though.
2024-01-22 14:14:05 +00:00
Olivier Fourdan 0cbf6d9326 xwayland: Add a -nokeymap option
By default, Xwayland (as any Wayland client) uses the keymap set by the
Wayland compositor using the standard Wayland protocol.

There are some specific uses cases where a user would want to let the
X11 clients control the keymap. However, the Wayland compositor may
(re)send the keymap at any time, overriding whatever change was made
using the X11 mechanisms.

Add a new "-nokeymap" option to Xwayland to instruct Xwayland to simply
ignore the standard Wayland mechanism to set the keymap, hence leaving
the control entirely to the X11 clients.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-01-22 13:01:18 +00:00
José Expósito e89edec497 ephyr: Fix incompatible pointer type build error
Fix a compilation error on 32 bits architectures with gcc 14:

  ephyr_glamor_xv.c: In function ‘ephyr_glamor_xv_init’:
  ephyr_glamor_xv.c:154:31: error: assignment to ‘SetPortAttributeFuncPtr’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int,  int,  void *)’} from incompatible pointer type ‘int (*)(KdScreenInfo *, Atom,  INT32,  void *)’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int,  long int,  void *)’} [-Wincompatible-pointer-types]
    154 |     adaptor->SetPortAttribute = ephyr_glamor_xv_set_port_attribute;
        |                               ^
  ephyr_glamor_xv.c:155:31: error: assignment to ‘GetPortAttributeFuncPtr’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int,  int *, void *)’} from incompatible pointer type ‘int (*)(KdScreenInfo *, Atom,  INT32 *, void *)’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int,  long int *, void *)’} [-Wincompatible-pointer-types]
    155 |     adaptor->GetPortAttribute = ephyr_glamor_xv_get_port_attribute;
        |                               ^

Build error logs:
https://koji.fedoraproject.org/koji/taskinfo?taskID=111964273

Signed-off-by: José Expósito <jexposit@redhat.com>
2024-01-19 14:42:48 +01:00
Simon Ser d7f1909e7c xwayland/glamor/gbm: make wl_drm optional
Build on top of [1] to use linux-dmabuf to grab the main device
when wl_drm is unavailable. Fixes Xwayland glamor on top of latest
wlroots commit which has dropped wl_drm support [2].

[1]: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/818
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4397

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 10:59:53 +00:00
Simon Ser 4beb4f26ef xwayland/glamor/gbm: use Bool for true/false fields
This makes it more obvious what the values mean.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 10:59:53 +00:00
Michel Dänzer 3ddb81b15e xwayland: Update screen pixmap for root window in xwl_window_set_pixmap
If the old window pixmap was the screen pixmap.

Fixes screen->GetScreenPixmap() returning a stale pointer to a destroyed
pixmap with rootful Xwayland. It would result in a crash after resizing
the Xwayland window, or at the latest when shutting down.

Fixes: 6779ec5bf6 ("xwayland: Use window pixmap as a window buffer")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1621
2024-01-17 18:12:37 +01:00
Olivier Fourdan 2ef0f1116c ephyr,xwayland: Use the proper private key for cursor
The cursor in DIX is actually split in two parts, the cursor itself and
the cursor bits, each with their own devPrivates.

The cursor itself includes the cursor bits, meaning that the cursor bits
devPrivates in within structure of the cursor.

Both Xephyr and Xwayland were using the private key for the cursor bits
to store the data for the cursor, and when using XSELINUX which comes
with its own special devPrivates, the data stored in that cursor bits'
devPrivates would interfere with the XSELINUX devPrivates data and the
SELINUX security ID would point to some other unrelated data, causing a
crash in the XSELINUX code when trying to (re)use the security ID.

CVE-2024-0409

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-01-16 09:26:01 +01:00
Michel Dänzer cad42fcb08 xwayland: Destroy old window pixmap in xwl_window_recycle_pixmap
We were leaking it.

Fixes: 6779ec5bf6 ("xwayland: Use window pixmap as a window buffer")
2024-01-12 17:06:39 +00:00
Michel Dänzer 8f66c15694 glamor: Make glamor_set_alu take a DrawablePtr
Preparation for the following commit, no functional change intended.
2024-01-11 10:03:10 +00:00
Olivier Fourdan 4805d901c3 xwayland: Add the output name for fullscreen rootful
This adds a new command line option "-output" to specify on which output
Xwayland should be starting fullscreen when rootful.

That allows to run multiple instances of Xwayland rootful fullscreen on
multiple outputs.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan 87ca6dcb43 xwayland: Check for the screen output name for fullscreen
When putting the (root) window fullscreen, first search for an output
with the specified name, if any.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan 2e317e0242 xwayland: Check for fullscreen on output name change
At startup, the names of the Wayland outputs are not yet known,
therefore we cannot rely on those when running fullscreen rootful.

Make sure to check the fullscreen state once the Wayland output name
changes.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan 01e31f5d95 xwayland: Add an output name for fullscreen
Add a output name to the xwl_screen.

This is preparation work for fullscreen rootful on a specific output,
no functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan d99e98ad68 xwayland: Add a function to search for xwl_output by name
Add a convenient function to search for an xwl_output based on its
XRandR name.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan 0fede76cc3 xwayland: Do not update the outputs when rootful
When running rootful, we do not need to apply the output changes, these
are there just to track the names and show up as disconnected in XRandR.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan 060f1f1154 xwayland: Always create the XrandR CRTCs
When running rootful, Xwayland would simply skip the creation of the CRTC
for the "real" outputs.

Instead, create the CRTC regardless of all outputs in rootful mode, but
mark them as disconnected when running rootful.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan f0124485e1 xwayland: Use the output serial for the fixed output
The fixed output is called "XWAYLAND0", yet if the compositor does not
support Wayland output names, the "real" output names may collide with
the fixed output name.

Use the same output serial as with the (default) real output names to
avoid reusing the same names.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan a6bbc9663d xwayland: Use simpler initialization syntax
Use the simpler form `{ 0 }` instead of `{ '\0', }` for the
initialization of the output name buffer.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Olivier Fourdan e1e3bef7f8 xwayland: Use a helper function for fullscreen update
Move the code which may update the fullscreen state of the rootful
window to a dedicated helper function.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2024-01-11 08:45:33 +00:00
Michel Dänzer 777c3e0000 xwayland: Return NULL from xwl_window_buffer_get_available
If there's no available window buffer.

This allows keeping xwl_window_buffer->damage_region empty for a newly
allocated xwl_window_buffer in xwl_window_buffers_get_pixmap, instead
of first populating it in xwl_window_buffer_add_damage_region and then
emptying it again.
2024-01-10 17:31:42 +00:00
Michel Dänzer 6779ec5bf6 xwayland: Use window pixmap as a window buffer
Assuming the same number of window buffers, this results in one less
pixmap per toplevel window, saving pixmap storage.

v2:
* Preserve xwl_window_buffer_get_available behaviour (Olivier Fourdan)
v3:
* Leave RegionEmpty call where it was in xwl_window_buffers_get_pixmap,
  so it takes effect for a newly allocated struct xwl_window_buffer.
* Consolidate xwl_window_buffer->pixmap assignment in the same place.
2024-01-10 17:31:42 +00:00
Michel Dänzer 2b577c2e3b xwayland: Drop xwl_window_buffers_recycle
Use xwl_window_buffers_dispose instead. The pixmaps will need to be
re-created anyway, so keeping around the xwl_window_buffers doesn't
buy much. And dropping this makes the next commit simpler.

Also fold xwl_window_buffer_destroy_pixmap into its only remaining
caller,  xwl_window_buffer_maybe_dispose.

v2: (Olivier Fourdan)
* Fix up indentation in xwl_window_set_window_pixmap
* Leave xwl_window_buffer_destroy_pixmap helper
2024-01-10 17:31:42 +00:00
Michel Dänzer 2879032ecc xwayland: Rename helper to xwl_window_buffer_maybe_dispose
To make it clearer that it doesn't always dispose of the
xwl_window_buffer, only if the reference count drops to 0.
2024-01-10 17:31:42 +00:00
Michel Dänzer 114f060de5 xwayland: Make copy_pixmap_area return void
GetScratchGC can't really fail without a bug elsewhere. Just FatalError
in that case, so we'd get a bug report if it ever happens, instead of
trying to limp along.
2024-01-10 17:31:42 +00:00
Peter Hutterer 7f7adfdef8 xwayland: override the XTest sendEventsProc for all devices
Otherwise only XTest events on the XTest device get handled, XTest
requests on real devices are still processed as normal events.
2024-01-09 00:45:31 +00:00
Luke Dashjr 5f48efa2bd Xvfb: Support up to 13 mouse buttons
Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
2024-01-08 11:16:11 +00:00
Olivier Fourdan 7fdef970c4 build: Switch to meson 0.56
And replace the deprecated meson API accordingly.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2024-01-08 10:38:05 +00:00
Dongwon Kim 995e60a919 modesetting: Correct coordinate info of dirty clips for front-buffer flushing
A clip should represent the area that is covering the current FB associated
with the CRTC. So making sure each input rect covers any area in the FB is
the first thing to do. If that is the case, the size and coordinates should
be adjusted based on the partial area in the FB the each rect covers. The size
elements need to be truncated if the rect's size exceeds FB's for the CRTC.
Then offsets should be applied to coordinates if the CRTC's offsets aren't 0.
And coordinate transposing and inversion are needed in case the rotated image
is assigned to the FB.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
2024-01-04 17:51:30 +00:00
Izumi Tsutsui 15624bb5bc Revert "xfree86: Remove -flippixels"
This reverts commit d1c00c859c except
hw/xfree86/common/xf86str.h that was not used by -flipPixels option.
2024-01-03 19:43:16 +00:00
xurui 3268a83ae1 xwayland: Use do-while loop
Signed-off-by: xurui <xurui@kylinos.cn>
2024-01-03 16:36:20 +08:00
Chia-Lin Kao (AceLan) f59871587e hw/xfree86: re-calculate the clock and refresh rate
xserver fails to generate useable resolutions with 90Hz framerate
panels(encounter the same issue with 3 different 2.5k resolution
panels). All the resolutions shown by xrandr lead to blank screen except
the one written in EDID.
Ville Syrjälä from Intel provides a method to calculate the preferred
clock and refresh rate from the existing resolution table and this
works for the issue.

v2. xf86ModeVRefresh might return 0, need to check it before use it.
v3. reported by Markus on launchpad that the issue is not devided by 0,
it's the "preferred" being accessed unconditionally.
BugLink: https://launchpad.net/bugs/1999852

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1388
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
2023-12-22 05:02:05 +00:00
Olivier Fourdan 1bf4d60acd xwayland: Pass the correct oeffis device types
Xwayland uses OEFFIS_DEVICE_ALL_DEVICES to get all possible device types
enabled.

Be more selective and specify explicitly keyboard and pointer instead of
relying on what "all devices" translates to in the stack.

See-also: https://gitlab.gnome.org/GNOME/mutter/-/issues/3194
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2023-12-18 08:26:06 +00:00
Alexander Volkov f1bd82552b ephyr: Send RRCrtcChangeNotify events on resize
After resizing Xephyr's window RRGetCrtcInfo returns the changed size,
but the RRCrtcChangeNotify event is not sent.
Call RRGetInfo(pScreen, TRUE) to update the current mode and send
notifications to clients.
2023-12-17 19:21:55 +00:00
Twaik Yont 43a7bb3c92 xvfb: Use RROutputSetPhysicalSize to set physical size of display
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1532
Signed-off-by: Twaik Yont <twaikyont@gmail.com>
2023-12-17 19:09:18 +00:00