Compare commits

...

1110 commits

Author SHA1 Message Date
Mikhail Dmitrichenko
f83807647e os: avoid closing null fd at Fopen
In `Fopen` function variable `iop` may store NULL as a result of `fopen`
call. In this case, if later privileges couldn't be restored (`seteuid`
call fails), further `fclose(iop)` call will cause runtime error.

This commit adds check `iop` for NULL before calling `fclose` to prevent
potential NULL pointer dereference.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2115>
2025-12-19 03:32:35 +00:00
Liu Heng
7fb5e00ad8 xwayland: Fix incorrect pointer coordinates in enter events
Xwayland was sending incorrect pointer coordinates to X clients on
pointer enter events.

This was caused by calling CheckMotion() with a NULL event, which
prevented the pointer sprite hot coordinates from being updated
properly.

Fix this by constructing a proper DeviceEvent of type ET_Enter in
pointer_handle_enter, initializing it with the current timestamp
and EVENT_SOURCE_FOCUS, and passing it to CheckMotion() instead
of NULL.

This ensures the pointer sprite coordinates are correctly updated
when the pointer enters a window.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2113>
2025-12-16 10:51:34 +08:00
Alan Coopersmith
ac42c39145 dix: set errorValue correctly when XID lookup fails in ChangeGCXIDs()
dixLookupResourceByType always overwrites the pointer passed in as the
first arg, so we shouldn't use the union it's in after that to get the
requested XID value to put in the errorValue.

Closes: #1857
Fixes: 2d7eb4a19 ("Pre-validate ChangeGC XIDs.")
Reported-by: Mouse <mouse@Rodents-Montreal.ORG>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2111>
2025-12-08 05:52:19 +00:00
stefan11111
eccee47185 glamor: fix Option "GlxVendorLibrary"
The old code tried to use a screen pointer that was uninitialized and set to NULL.
This caused it to segfault when this option was set.

When this option was used with the modesetting driver, `glamor_egl_init`
is called indirectly in the driver PreInit proc.

`xf86ScrnToScreen(scrn)` then returns NULL.

This patch moves setting the gl vendor later in the initialization process,
when we already have a non-null pScreen.

Minimal reproducer:
```
$ cat /etc/X11/xorg.conf.d/99-screen.conf
Section "Screen"
	Identifier "Default"
	Option "GlxVendorLibrary" "Name"
EndSection
```

Backtrace:
```
| #0  in abort ()
| #1  in OsAbort () at os/utils.c:1361
| #2  in AbortServer () at os/log.c:879
| #3  FatalError () at os/log.c:1017
| #4  in OsSigHandler () at os/osinit.c:156
| #5  OsSigHandler () at os/osinit.c:110
| #6  <signal handler called>
| #7  in __pthread_kill_implementation () from /lib64/libc.so.6
| #8  in raise () from /lib64/libc.so.6
| #9  in abort () from /lib64/libc.so.6
| #10 in __assert_fail_base.cold () from /lib64/libc.so.6
| #11 in xf86ScrnToScreen () at hw/xfree86/common/xf86Helper.c:1734
| #12 in glamor_egl_init () at glamor/glamor_egl.c:1108
| #13 in try_enable_glamor () at hw/xfree86/drivers/modesetting/driver.c:984
| #14 PreInit () at hw/xfree86/drivers/modesetting/driver.c:1211
| #15 in InitOutput () at hw/xfree86/common/xf86Init.c:478
| #16 in dix_main () at dix/main.c:190
| #17 main () at dix/stubmain.c:34
```

Fixes: a449bb4c5 - glamor_egl: add support of GlxVendorLibrary option

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2096>
2025-11-27 10:28:03 +00:00
Alan Coopersmith
a5047d4a65 Create a SECURITY.md file
Provide information on where to report or learn of security bugs,
and what we do or do not consider to be a security bug.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2103>
2025-11-18 17:08:42 -08:00
kohnish
0060b91b49 Revert "dix: unexport dixLookupProperty()"
This reverts commit fb697dd644.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2101>
2025-11-17 21:33:26 +01:00
kohnish
9a4c322c4b Revert "dix: unexport DeleteAllWindowProperties()"
This reverts commit b0272692a1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2101>
2025-11-17 21:33:26 +01:00
Alan Coopersmith
3e9baa20f3 glamor: avoid double free in glamor_make_pixmap_exportable()
Reported by gcc 15.1:

../glamor/glamor_egl.c:320:9:
 warning: double-‘free’ of ‘modifiers’ [CWE-415] [-Wanalyzer-double-free]
[...]
           │  732 |│        free(*modifiers);
           │      |│        ~~~~~~~~~~~~~~~~
           │      |│        |
           │      |└───────>(25) ...to here
           │      |         (26) first ‘free’ here
[...]
    │  320 |         free(modifiers);
    │      |         ~~~~~~~~~~~~~~~
    │      |         |
    │      |         (28) ⚠️  second ‘free’ here; first ‘free’ was at (26)

Fixes: cef12efc1 ("glamor: Implement GetSupportedModifiers")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
6a4ec30af4 glamor: avoid null dereference in glamor_composite_clipped_region()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_render.c:1577:21:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
c6522229b8 glamor: avoid null dereference in glamor_dash_setup()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_dash.c:152:10:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
84cf20e6dd glamor: handle allocation failures in glamor_largepixmap.c
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:130:17:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘clipped_regions’

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:235:13:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘result_regions’

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:365:9:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘clipped_regions’

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:1175:9:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘source_pixmap_priv’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
a79bdc495e glamor: silence false positive in glamor_validate_gc()
We know that if gc->tileIsPixel is false, then gc->tile.pixmap must be
a valid pixmap, but gcc's static analyzer doesn't and needs to be told.

Silences false positive reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_core.c:205:19:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-02 11:52:32 -08:00
Alan Coopersmith
cc647f2367 glamor: handle allocation failure in glamor_create_pixmap()
Reported by gcc 15.1:

../glamor/glamor.c: In function ‘glamor_create_pixmap’:
../glamor/glamor.c:233:23: warning: potential null pointer dereference
 [-Wnull-dereference]
  233 |     pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
      |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../glamor/glamor.c:228:26: warning: potential null pointer dereference
 [-Wnull-dereference]
  228 |     pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-02 11:52:32 -08:00
Alan Coopersmith
69b48423bd glamor: handle potential NULL return from GetPictureScreenIfSet()
Unlike GetPictureScreen(), GetPictureScreenIfSet() checks if the
private key is registered, and returns NULL if it is not.

Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../glamor/glamor.c:926:5:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ps’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-02 11:52:32 -08:00
Alan Coopersmith
f05f269f1d dri: prevent out-of-bounds read in dri3_fd_from_pixmap
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../dri3/dri3_screen.c:143:13:
 warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
xwayland-24.1.6/redhat-linux-build/../dri3/dri3_screen.c:143:13:
 danger: out-of-bounds read from byte 16 till byte 19
 but ‘fds’ ends at byte 16
141|           int i;
142|           for (i = 0; i < num_fds; i++)
143|->             close(fds[i]);
144|           return -1;
145|       }

Only possible if fds_from_pixmap returns a value > 4, but the analyzer
doesn't know the interface is defined not to do that.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2085>
2025-11-01 21:55:42 +00:00
Olivier Fourdan
475d9f49ac xkb: Prevent overflow in XkbSetCompatMap()
The XkbCompatMap structure stores its "num_si" and "size_si" fields
using an unsigned short.

However, the function _XkbSetCompatMap() will store the sum of the
input data "firstSI" and "nSI" in both XkbCompatMap's "num_si" and
"size_si" without first checking if the sum overflows the maximum
unsigned short value, leading to a possible overflow.

To avoid the issue, check whether the sum does not exceed the maximum
unsigned short value, or return a "BadValue" error otherwise.

CVE-2025-62231, ZDI-CAN-27560

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Olivier Fourdan
10c94238bd xkb: Free the XKB resource when freeing XkbInterest
XkbRemoveResourceClient() would free the XkbInterest data associated
with the device, but not the resource associated with it.

As a result, when the client terminates, the resource delete function
gets called and accesses already freed memory:

 | Invalid read of size 8
 |   at 0x5BC0C0: XkbRemoveResourceClient (xkbEvents.c:1047)
 |   by 0x5B3391: XkbClientGone (xkb.c:7094)
 |   by 0x4DF138: doFreeResource (resource.c:890)
 |   by 0x4DFB50: FreeClientResources (resource.c:1156)
 |   by 0x4A9A59: CloseDownClient (dispatch.c:3550)
 |   by 0x5E0A53: ClientReady (connection.c:601)
 |   by 0x5E4FEF: ospoll_wait (ospoll.c:657)
 |   by 0x5DC834: WaitForSomething (WaitFor.c:206)
 |   by 0x4A1BA5: Dispatch (dispatch.c:491)
 |   by 0x4B0070: dix_main (main.c:277)
 |   by 0x4285E7: main (stubmain.c:34)
 | Address 0x1893e278 is 184 bytes inside a block of size 928 free'd
 |   at 0x4842E43: free (vg_replace_malloc.c:989)
 |   by 0x49C1A6: CloseDevice (devices.c:1067)
 |   by 0x49C522: CloseOneDevice (devices.c:1193)
 |   by 0x49C6E4: RemoveDevice (devices.c:1244)
 |   by 0x5873D4: remove_master (xichangehierarchy.c:348)
 |   by 0x587921: ProcXIChangeHierarchy (xichangehierarchy.c:504)
 |   by 0x579BF1: ProcIDispatch (extinit.c:390)
 |   by 0x4A1D85: Dispatch (dispatch.c:551)
 |   by 0x4B0070: dix_main (main.c:277)
 |   by 0x4285E7: main (stubmain.c:34)
 | Block was alloc'd at
 |   at 0x48473F3: calloc (vg_replace_malloc.c:1675)
 |   by 0x49A118: AddInputDevice (devices.c:262)
 |   by 0x4A0E58: AllocDevicePair (devices.c:2846)
 |   by 0x5866EE: add_master (xichangehierarchy.c:153)
 |   by 0x5878C2: ProcXIChangeHierarchy (xichangehierarchy.c:493)
 |   by 0x579BF1: ProcIDispatch (extinit.c:390)
 |   by 0x4A1D85: Dispatch (dispatch.c:551)
 |   by 0x4B0070: dix_main (main.c:277)
 |   by 0x4285E7: main (stubmain.c:34)

To avoid that issue, make sure to free the resources when freeing the
device XkbInterest data.

CVE-2025-62230, ZDI-CAN-27545

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Olivier Fourdan
99790a2c92 xkb: Make the RT_XKBCLIENT resource private
Currently, the resource in only available to the xkb.c source file.

In preparation for the next commit, to be able to free the resources
from XkbRemoveResourceClient(), make that variable private instead.

This is related to:

CVE-2025-62230, ZDI-CAN-27545

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Olivier Fourdan
5a4286b13f present: Fix use-after-free in present_create_notifies()
Using the Present extension, if an error occurs while processing and
adding the notifications after presenting a pixmap, the function
present_create_notifies() will clean up and remove the notifications
it added.

However, there are two different code paths that can lead to an error
creating the notify, one being before the notify is being added to the
list, and another one after the notify is added.

When the error occurs before it's been added, it removes the elements up
to the last added element, instead of the actual number of elements
which were added.

As a result, in case of error, as with an invalid window for example, it
leaves a dangling pointer to the last element, leading to a use after
free case later:

 |  Invalid write of size 8
 |     at 0x5361D5: present_clear_window_notifies (present_notify.c:42)
 |     by 0x534A56: present_destroy_window (present_screen.c:107)
 |     by 0x41E441: xwl_destroy_window (xwayland-window.c:1959)
 |     by 0x4F9EC9: compDestroyWindow (compwindow.c:622)
 |     by 0x51EAC4: damageDestroyWindow (damage.c:1592)
 |     by 0x4FDC29: DbeDestroyWindow (dbe.c:1291)
 |     by 0x4EAC55: FreeWindowResources (window.c:1023)
 |     by 0x4EAF59: DeleteWindow (window.c:1091)
 |     by 0x4DE59A: doFreeResource (resource.c:890)
 |     by 0x4DEFB2: FreeClientResources (resource.c:1156)
 |     by 0x4A9AFB: CloseDownClient (dispatch.c:3567)
 |     by 0x5DCC78: ClientReady (connection.c:603)
 |   Address 0x16126200 is 16 bytes inside a block of size 2,048 free'd
 |     at 0x4841E43: free (vg_replace_malloc.c:989)
 |     by 0x5363DD: present_destroy_notifies (present_notify.c:111)
 |     by 0x53638D: present_create_notifies (present_notify.c:100)
 |     by 0x5368E9: proc_present_pixmap_common (present_request.c:164)
 |     by 0x536A7D: proc_present_pixmap (present_request.c:189)
 |     by 0x536FA9: proc_present_dispatch (present_request.c:337)
 |     by 0x4A1E4E: Dispatch (dispatch.c:561)
 |     by 0x4B00F1: dix_main (main.c:284)
 |     by 0x42879D: main (stubmain.c:34)
 |   Block was alloc'd at
 |     at 0x48463F3: calloc (vg_replace_malloc.c:1675)
 |     by 0x5362A1: present_create_notifies (present_notify.c:81)
 |     by 0x5368E9: proc_present_pixmap_common (present_request.c:164)
 |     by 0x536A7D: proc_present_pixmap (present_request.c:189)
 |     by 0x536FA9: proc_present_dispatch (present_request.c:337)
 |     by 0x4A1E4E: Dispatch (dispatch.c:561)
 |     by 0x4B00F1: dix_main (main.c:284)
 |     by 0x42879D: main (stubmain.c:34)

To fix the issue, count and remove the actual number of notify elements
added in case of error.

CVE-2025-62229, ZDI-CAN-27238

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Takashi Yano
3b39aebf98 Fix mach64 driver crash
Due to lack of iopl(3), mach64 driver crashes when ior(BUS_CNTL) is
called. Since BUS_CNTL is out of the range 0x0000-0x03ff, ioperm(0,
1024, 1) is not sufficient and the ior() causes access violation.
This patch reintroduce iopl(3) call in the function hwEnableIO().

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1110521
Fixes: a0f738a673 ("Fixed ioperm calls in hwEnableIO")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2052>
2025-10-25 20:34:53 +00:00
Alan Coopersmith
ed92eae84d dix: avoid memory leak in ProcListProperties()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../dix/property.c:584:5:
 warning[-Wanalyzer-malloc-leak]: leak of ‘pAtoms’

Can happen if, and only if, XaceHookPropertyAccess() blocks access
to all properties, so that numProps ends up zero on the second loop.

Fixes: 39f337fd4 ("dix: ProcListProperties: skip unneeded work if numProps is 0")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-10-17 18:04:36 +00:00
Alan Coopersmith
c9fa8a8da1 dix: handle allocation failure in ChangeWindowDeviceCursor()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../dix/window.c:3495:9:
 warning[-Wanalyzer-possible-null-dereference]:
 dereference of possibly-NULL ‘pNewNode’
xwayland-24.1.6/redhat-linux-build/../dix/window.c:3494:20:
 acquire_memory: this call could return NULL

Fixes: 95e1a8805 ("Xi: Adding ChangeDeviceCursor request" in xorg 1.10.0)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-10-17 18:04:36 +00:00
Alan Coopersmith
cf49354b60 dix: assert that size of buffers to swap is a multiple of the swap size
If we're swapping 4-byte integers or 2-byte integers, make sure the size
of the buffer doesn't have any bytes left over, since we won't correctly
handle those bytes.

Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../dix/swaprep.c:99:22:
 warning[-Wanalyzer-allocation-size]:
 allocated buffer size is not a multiple of the pointee's size

xwayland-24.1.6/redhat-linux-build/../dix/swaprep.c:146:22:
 warning[-Wanalyzer-allocation-size]:
 allocated buffer size is not a multiple of the pointee's size

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-10-17 18:04:36 +00:00
Alan Coopersmith
15496a5e3d dix: avoid null dereference if wOtherInputMasks() returns NULL
The wOtherInputMasks(win) macro will return NULL if
win->optional is NULL.

Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../dix/gestures.c:242:9:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’
xwayland-24.1.6/redhat-linux-build/../dix/touch.c:765:9:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’
xwayland-24.1.6/redhat-linux-build/../dix/touch.c:782:9:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-10-17 18:04:36 +00:00
Alan Coopersmith
dedceb52bc dix: handle allocation failure in DeviceFocusEvent()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../dix/enterleave.c:786:5:
 warning[-Wanalyzer-possible-null-dereference]:
 dereference of possibly-NULL ‘xi2event’

Fixes: 3f37923a7 ("Xi: send XI2 focus events." in Xorg 1.10.0)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-10-17 18:04:36 +00:00
stefan11111
7e6c55cc9f composite: Only copy bits from the parent pixmap when absolutely necessary
Since 1e728c3e88 ,
Whenever we allocate a composite pixmap, we perform an expensive CopyArea call from the parent pixmap.

This leads to very bad performance when using a framebuffer driver without shadowfb.

My guess is that this call ends up reading memory from the framebuffer memory directly, which is very slow.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1814

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2073>
2025-10-13 11:58:35 +03:00
Michel Dänzer
6f31791945 xwayland: Ignore non-InputOutput children in window_get_client_toplevel
InputOnly windows aren't relevant here.

E.g. mutter-x11-frames uses GTK4, which creates a 1x1 InputOnly child
window, which previously prevented this code from working as intended.

v2: (Olivier Fourdan)
* Rename output_child -> input_output_child.
* Add comment in get_single_input_output_child explaining why we return
  NULL if input_output_child is already non-NULL.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2069>
2025-10-10 08:26:49 +00:00
Michel Dänzer
105b5f2402 xwayland: Add heuristic for WM windows based on reparenting
If the WM client reparents a window, mark the new parent as a WM window.

This helps with current mutter, where decoration windows are created by
a separate mutter-x11-frames client instead of the WM client. There
might be other compositors doing something similar now or in the future.

v2:
* Skip the whole unwrap-and-call-down dance in xwl_reparent_window if
  xwl_screen->ReparentWindow is NULL.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2069>
2025-10-10 08:26:49 +00:00
Michel Dänzer
66984ab8ae xwayland: Take viewport scale into account for the input region
This is necessary because the input region is specified in surface
coordinates.

Fixes: a4ed100c0c ("xwayland: Set wl_surface input region:)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2071>
2025-10-08 08:03:38 +00:00
Alan Coopersmith
0ee6039053 Xi: handle allocation failure in add_master_func()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xi/xibarriers.c:729:5:
 warning[-Wanalyzer-null-dereference]:
 dereference of NULL ‘AllocBarrierDevice()’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2075>
2025-10-07 23:35:38 +00:00
Alan Coopersmith
19c6195e71 Xi: handle allocation failure in ProcXListInputDevices()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xi/listdev.c:171:5:
 warning[-Wanalyzer-possible-null-dereference]:
 dereference of possibly-NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xi/listdev.c:379:23:
 acquire_memory: this call could return NULL

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2075>
2025-10-07 23:35:38 +00:00
Alan Coopersmith
7b18313e2a Xi: handle allocation failure in ProcXGetDeviceDontPropagateList()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xi/getprop.c:163:25:
 warning[-Wanalyzer-possible-null-dereference]:
 dereference of possibly-NULL ‘buf’
xwayland-24.1.6/redhat-linux-build/../Xi/getprop.c:121:19:
 acquire_memory: this call could return NULL

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2075>
2025-10-07 23:35:38 +00:00
Alan Coopersmith
90c8429d35 Xi: set value for led_values in CopySwapKbdFeedback()
(The existing setting of led_mask is probably wrong, but has been set
 like this since X11R5 and going back as far as the first version in
 the X Consortium source control archives.)

Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xi/getfctl.c:108:9:
 warning[-Wanalyzer-use-of-uninitialized-value]:
 use of uninitialized value ‘*k2.led_values’
108|->         swapl(&k2->led_values);

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2075>
2025-10-07 23:35:38 +00:00
Alan Coopersmith
7b7bcf9231 Xi: avoid null dereference if wOtherInputMasks() returns NULL
The wOtherInputMasks(win) macro will return NULL if
win->optional is NULL.

Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xi/exevents.c:1390:13:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

xwayland-24.1.6/redhat-linux-build/../Xi/exevents.c:1404:13:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

xwayland-24.1.6/redhat-linux-build/../Xi/exevents.c:2293:9:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

xwayland-24.1.6/redhat-linux-build/../Xi/exevents.c:3244:22:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘inputMasks’

xwayland-24.1.6/redhat-linux-build/../Xi/exevents.c:3338:9:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2075>
2025-10-07 23:35:38 +00:00
Alan Coopersmith
04ef51dae6 Xext/xtest: avoid null dereference in ProcXTestFakeInput()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:383:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:383:14: danger: dereference of NULL ‘dev’

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:395:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:395:14: danger: dereference of NULL ‘dev’

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:426:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext
/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:426:14: danger: dereference of NULL ‘dev’

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:440:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:440:9: danger: dereference of NULL ‘dev’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
21cbc56c43 Xext/xselinux: avoid memory leak in SELinuxAtomToSID()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:142:13: warning[-Wanalyzer-malloc-leak]: leak of ‘rec’
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:133:1: enter_function: entry to ‘SELinuxAtomToSID’
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:141:15: acquire_memory: allocated here
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:69:12: branch_true: following ‘true’ branch...
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:142:13: danger: ‘rec’ leaks here; was allocated at [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
#  140|       if (!rec) {
#  141|           rec = calloc(1, sizeof(SELinuxAtomRec));
#  142|->         if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
#  143|               return BadAlloc;
#  144|       }

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
d34243606c Xext/xselinux: add fast path to ProcSELinuxListSelections()
If there's nothing to send, skip over a bunch of code to make a list
that won't be used, and hopefully make the code path clearer to both
humans and static analyzers, who raise errors as seen in #1817 of
dereferencing NULL pointers when count == 0.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
3da60c96a9 Xext/xres: avoid null dereference in ProcXResQueryClients()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/xres.c:233:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘current_clients’
xwayland-24.1.6/redhat-linux-build/../Xext/xres.c:228:23: acquire_memory: this call could return NULL

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
5e62aaaf57 Xext/vidmode: avoid null dereference if VidModeCreateMode() allocation fails
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../Xext/vidmode.c:96:5: warning[-Wanalyzer-null-argument]: use of NULL ‘VidModeCreateMode()’ where non-null expected

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
6034ce11b6 Xext/sync: Avoid dereference of invalid pointer if malloc() failed
Reported incorrectly in #1817 as:

xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2835:33: acquire_memory: allocated here
xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2843:12: danger: ‘priv’ leaks here; was allocated at [(30)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/29)

but the "leak" is really saving the pointer in an uninitalized pointer in
a structure that was already freed when the malloc of the SysCounterInfo
struct failed in SyncCreateSystemCounter(), because it returned the address
of the freed struct instead of NULL to indicate failure.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
304d21854d Xext/sync: avoid null dereference in init_system_idle_counter()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2835:33: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2837:28: danger: ‘priv’ could be NULL: unchecked value from [(30)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/29)
# 2835|           IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
# 2836|
# 2837|->         priv->value_less = priv->value_greater = NULL;
# 2838|           priv->deviceid = deviceid;
# 2839|

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:07 +00:00
Alan Coopersmith
0211de37b3 Xext/sync: avoid null dereference if SysCounterGetPrivate() returns NULL
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2664:9: danger: dereference of NULL ‘SysCounterGetPrivate(pCounter)’
# 2662|           SyncCounter *counter = pCounter;
# 2663|           IdleCounterPriv *priv = SysCounterGetPrivate(counter);
# 2664|->         deviceid = priv->deviceid;
# 2665|       }
# 2666|       else

xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2677:14: danger: dereference of NULL ‘SysCounterGetPrivate(pCounter)’
# 2675|       SyncCounter *counter = pCounter;
# 2676|       IdleCounterPriv *priv = SysCounterGetPrivate(counter);
# 2677|->     int64_t *less = priv->value_less;
# 2678|       int64_t *greater = priv->value_greater;
# 2679|       int64_t idle, old_idle;

xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2767:14: danger: dereference of NULL ‘SysCounterGetPrivate(pCounter)’
# 2765|       SyncCounter *counter = pCounter;
# 2766|       IdleCounterPriv *priv = SysCounterGetPrivate(counter);
# 2767|->     int64_t *less = priv->value_less;
# 2768|       int64_t *greater = priv->value_greater;
# 2769|       int64_t idle;

xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2800:14: danger: dereference of NULL ‘SysCounterGetPrivate(pCounter)’
# 2798|       SyncCounter *counter = pCounter;
# 2799|       IdleCounterPriv *priv = SysCounterGetPrivate(counter);
# 2800|->     int64_t *less = priv->value_less;
# 2801|       int64_t *greater = priv->value_greater;
# 2802|       Bool registered = (less || greater);

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:06 +00:00
Alan Coopersmith
87e53afd9c Xext/shm: avoid null dereference in ShmInitScreenPriv()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/shm.c:213:23: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/shm.c:214:9: danger: ‘screen_priv’ could be NULL: unchecked value from [(19)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/18)
#  212|       if (!screen_priv) {
#  213|           screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
#  214|->         screen_priv->CloseScreen = pScreen->CloseScreen;
#  215|           dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
#  216|           pScreen->CloseScreen = ShmCloseScreen;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:05 +00:00
Alan Coopersmith
d9389873d6 Strip trailing whitespace from source files
Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`

`git diff -w` & `git diff -b` show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2074>
2025-10-05 11:56:48 -07:00
Alan Coopersmith
5210495f7d 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-03 10:55:17 -07:00
Alan Coopersmith
a8f8ec7e7d meson: fix build if shmfence is enabled but dri3 & xwayland are not
glamor_sync.c calls miSyncShmScreenInit if HAVE_XSHMFENCE is defined,
but it was only being built if either dri3 or xwayland were enabled.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-03 10:55:17 -07:00
Alan Coopersmith
c62cd2feaa xfree86: add missing headers to build sun_init.c on Solaris/SPARC
Fixes: 0f715b4ca ("xfree86: os-support: move hidden Solaris-specific symbols out of public header")
Fixes: e2fa0d2ae ("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>
2025-10-03 10:55:17 -07:00
Alan Coopersmith
908f0a488d 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-03 10:55:17 -07:00
Alan Coopersmith
3ec5f6bcc3 os: Use EVP APIs when building with OpenSSL 3
Avoids deprecation warnings for old SHA1 APIs in OpenSSL 3.0 and later

Closes: #1845
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2066>
2025-09-29 17:35:28 +00:00
Alan Coopersmith
7013984b5f test: add unit tests for x_sha1_* functions in os/xsha1.c
Simple confirmation of known values, not exhaustive testing.

Tested with SHA-1 implementations from:
 - libcrypto (OpenSSL 3)
 - libgcrypt
 - libnettle
 - Solaris libmd

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2066>
2025-09-29 17:35:28 +00:00
Alan Coopersmith
23c103d41f panoramix: avoid null dereference in PanoramiXConsolidate()
Reported in #1817:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:820:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘root’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:819:12: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:820:5: danger: ‘root’ could be NULL: unchecked value from (1)
818|
819|       root = malloc(sizeof(PanoramiXRes));
820|->     root->type = XRT_WINDOW;
821|       defmap = malloc(sizeof(PanoramiXRes));
822|       defmap->type = XRT_COLORMAP;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]

xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:822:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘defmap’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:821:14: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:822:5: danger: ‘defmap’ could be NULL: unchecked value from (1)
820|       root->type = XRT_WINDOW;
821|       defmap = malloc(sizeof(PanoramiXRes));
822|->     defmap->type = XRT_COLORMAP;
823|       saver = malloc(sizeof(PanoramiXRes));
824|       saver->type = XRT_WINDOW;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:824:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘saver’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:823:13: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:824:5: danger: ‘saver’ could be NULL: unchecked value from (1)
822|       defmap->type = XRT_COLORMAP;
823|       saver = malloc(sizeof(PanoramiXRes));
824|->     saver->type = XRT_WINDOW;
825|
826|       FOR_NSCREENS(i) {

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2065>
2025-09-20 16:45:59 -07:00
Alan Coopersmith
537b56ccca panoramix: avoid null dereference in PanoramiXMaybeAddDepth()
Reported in #1817:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:748:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘PanoramiXDepths’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:802:1: enter_function: entry to ‘PanoramiXConsolidate’
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:813:17: branch_true: following ‘true’ branch...
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: branch_true: ...to here
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: call_function: calling ‘PanoramiXMaybeAddDepth’ from ‘PanoramiXConsolidate’
746|       PanoramiXDepths = reallocarray(PanoramiXDepths,
747|                                      PanoramiXNumDepths, sizeof(DepthRec));
748|->     PanoramiXDepths[j].depth = pDepth->depth;
749|       PanoramiXDepths[j].numVids = 0;
750|       PanoramiXDepths[j].vids = NULL;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2065>
2025-09-20 16:35:46 -07:00
Mikhail Dmitrichenko
dd5c2595a4 dix: avoid null ptr deref at doListFontsWithInfo
In the doListFontsWithInfo function in dixfonts.c, when a font alias is
encountered (err == FontNameAlias), the code saves the current state
and allocates memory for c->savedName.

If the malloc(namelen + 1) call fails, c->savedName remains NULL,
but c->haveSaved is still set to TRUE. Later, when a font is
successfully resolved (err == Successful), the code uses c->savedName
without checking if it is NULL, so there is potential null ptr
dereference. XNFalloc will check result of malloc and stop
program execution if allocation was failed.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1842
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2062>
2025-09-20 22:05:27 +00:00
Mikhail Dmitrichenko
8d25a89143 os: avoid potential out-of-bounds access at logVHdrMessageVerb
The LogVHdrMessageVerb function may access an array out of bounds in a
specific edge case. Specifically, the line:

newline = (buf[len - 1] == '\n');

can result in accessing buf[-1] if len == 0, which is undefined behavior.

Commit adds check to avoid access out of bounds at pointed line.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1841
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2061>
2025-09-20 21:59:34 +00:00
Mikhail Dmitrichenko
b096785df4 xwayland: Fix search of duplicate lease names
Commit d36f66f15d ("Check for duplicate output names") would walk the
list of existing outputs and leases to check that no other existing
output has the same name.

The change however, inadvertently reused the regular screen outputs when
searching the leased names.

Fix this by using the lease name, not the regular output names that we
already checked just above.

Found by SAST tool Svace.

Fixes: d36f66f15d - xwayland: Check for duplicate output names
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1843
Reviewed-by Olivier Fourdan <ofourdan@redhat.com>

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2063>
2025-09-18 09:55:47 +00:00
Nicolas Guichard
bcc0587ab9 xwayland: Fix minimum wl_compositor protocol version
Commit 54f8fc4090 introduced the use of
wl_surface::set_buffer_scale, which is only available starting with
version 3 of the wl_compositor protocol. Because we already prefer
version 4 when available, this went unnoticed but broke versions 1, 2
and 3 when reaching the wl_surface::set_buffer_scale call.

This restores functionality for version 3 and properly document that
versions 1 and 2 are not supported anymore.

Signed-off-by: Nicolas Guichard <nicolas.guichard@kdab.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1862>
2025-09-18 11:40:44 +02:00
Ian Forbes
afc8b781d8 xwayland: Try harder to find a top-level for root grabs
The commit referenced below partially resolved an issue with grabs being made
on the root window. Unfortunately it assumes that the application uses
the same client for all windows. VMware Workstation uses nested windows
for each VM, each of which runs its own process with this own client.
Theses windows are managed by the GUI which is the top level for the
application and maps the windows based on which tab is selected.

Because the VM windows issue a grab on the root window and don't share
the same client as the GUI, grabs don't work properly with global shortcut
inhibition being completely broken.

Getting the parent top-level of the nested windows fixes this issue.

Fixes: c7730cfe55 ("xwayland: Translate keyboard grabs on the root window")
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2016>
2025-09-12 07:47:39 +00:00
Alan Coopersmith
b644922366 Revert "dix: unexport rootCursor"
This reverts commit a2f72755a9.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:39 +00:00
Alan Coopersmith
b858cb5ccd Revert "dix: unexport cursor refcounting functions"
This reverts commit 4aadbeb8aa.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:39 +00:00
Alan Coopersmith
1d2a590cfb Revert "dix: unexport cursor allocation functions"
This reverts commit 24f3c4a508.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:39 +00:00
Alan Coopersmith
cfdcd22199 Revert "dix: unexport ServerBitsFromGlyph()"
This reverts commit 974cd2b5f2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:38 +00:00
Alan Coopersmith
e85fe61714 Revert "dix: unexport CursorMetricsFromGlyph()"
This reverts commit 0c354e9166.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:38 +00:00
Alan Coopersmith
7b87dff067 Revert "dix: unexport CheckCursorConfinement()"
This reverts commit 24d1c08441.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:38 +00:00
Alan Coopersmith
774da7dfc0 Revert "dix: unexport NewCurrentScreen()"
This reverts commit bd3c252710.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:37 +00:00
Alan Coopersmith
b75173a283 Revert "dix: unexport PointerConfinedToScreen()"
This reverts commit 9673886fac.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:37 +00:00
Alan Coopersmith
066b377fc9 Revert "dix: unexport GetSpritePosition()"
This reverts commit eb81769b58.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:37 +00:00
Alan Coopersmith
372ca9114c Revert "dix: drop superfluous XineramaGetCursorScreen()"
This reverts commit 6c7c4fdc7e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:36 +00:00
Alan Coopersmith
777de747b9 meson.build: include Xephyr in output of which ddx we're building
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2059>
2025-08-31 12:43:56 -07:00
Alan Coopersmith
cc7b0b7681 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-08-30 10:01:32 -07:00
Alan Coopersmith
48acd1ae78 xwayland: fix builds with xace disabled
CI meson-disable-options builds were failing with:
../hw/xwayland/xwayland-screen.c: In function ‘xwl_close_screen’:
../hw/xwayland/xwayland-screen.c:246:5: error: implicit declaration of
 function ‘XaceDeleteCallback’; did you mean ‘DeleteCallback’?
 [-Werror=implicit-function-declaration]
  246 |     XaceDeleteCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, screen);
      |     ^~~~~~~~~~~~~~~~~~
      |     DeleteCallback

../hw/xwayland/xwayland-screen.c:246:24: error: ‘XACE_PROPERTY_ACCESS’
 undeclared (first use in this function)
  246 |     XaceDeleteCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, screen);
      |                        ^~~~~~~~~~~~~~~~~~~~

../hw/xwayland/xwayland-screen.c: In function ‘xwl_screen_init’:
../hw/xwayland/xwayland-screen.c:1174:5: error: implicit declaration of
 function ‘XaceRegisterCallback’ [-Werror=implicit-function-declaration]
 1174 |     XaceRegisterCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, pScreen);
      |     ^~~~~~~~~~~~~~~~~~~~

../hw/xwayland/xwayland-screen.c:1174:26: error: ‘XACE_PROPERTY_ACCESS’
 undeclared (first use in this function)
 1174 |     XaceRegisterCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, pScreen);
      |                          ^~~~~~~~~~~~~~~~~~~~

Fixes: a07c2cda9 ("xwayland: Add an XACE property access handler")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
ec14ecf751 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: a72bdf170 ("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-08-30 10:01:32 -07:00
Alan Coopersmith
7b15321b3b meson: don't build xselinux if xace is disabled
xselinux requires xace to build

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
6611caf828 dix: Fix builds with meson -Dxace=false -Dwerror=true
CI meson-disable-options builds were failing with:
../dix/events.c: In function ‘CoreEnterLeaveEvent’:
../dix/events.c:4723:19: error: unused variable ‘client’
 [-Werror=unused-variable]
 4723 |         ClientPtr client = grab ? rClient(grab) : wClient(pWin);
      |                   ^~~~~~
../dix/events.c: In function ‘CoreFocusEvent’:
../dix/events.c:4834:19: error: unused variable ‘client’
 [-Werror=unused-variable]
 4834 |         ClientPtr client = wClient(pWin);
      |                   ^~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
8bbf497e22 Xace: provide definitions of new hook functions when xace is disabled
Building with -Dxace=false was generating many failures of the form:

../dix/cursor.c: In function ‘AllocARGBCursor’:
../dix/cursor.c:281:10: error: implicit declaration of function
 ‘XaceHookResourceAccess’; did you mean ‘XaceHookPropertyAccess’?
 [-Werror=implicit-function-declaration]
  281 |     rc = XaceHookResourceAccess(client, cid, X11_RESTYPE_CURSOR,
      |          ^~~~~~~~~~~~~~~~~~~~~~
      |          XaceHookPropertyAccess

Fixes: ae3c57333 ("xace: typesafe hook function for XACE_RESOURCE_ACCESS")
Fixes: 9524ffee8 ("xace: typesafe hook function for XACE_DEVICE_ACCESS")
Fixes: 67e468c8b ("xace: typesafe hook function for XACE_SEND_ACCESS")
Fixes: 3dfe00d5e ("xace: typesafe hook function for XACE_RECEIVE_ACCESS")
Fixes: 922b7685d ("xace: typesafe hook function for XACE_CLIENT_ACCESS")
Fixes: 0f6bb23bc ("xace: typesafe hook function for XACE_EXT_ACCESS")
Fixes: 47d6c3ad7 ("xace: typesafe hook function for XACE_SERVER_ACCESS")
Fixes: 51d8bcfc0 ("xace: typesafe hook function for XACE_SCREEN_ACCESS")
Fixes: 305f2d59d ("xace: typesafe hook function for XACE_SCREENSAVER_ACCESS")
Fixes: 591d95c79 ("xace: typesafe hook function for XACE_AUTH_AVAIL")
Fixes: facdaae4e ("xace: typesafe hook function for XACE_KEY_AVAIL")

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
6f6a635363 ci: run builds with most options enabled and most options disabled
We have too many options to run an exhaustive matrix of the combinations,
but this should at least help us catch code that won't compile in many
of the ifdef paths we don't go down in the default configs.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
d03c84b57f xfree86: Fix builds with gcc -Wpedantic
../hw/xfree86/loader/loadmod.c:85:33: warning: ISO C forbids empty
 initializer braces before C23 [-Wpedantic]
   85 | static int ModuleDuplicated[] = { };
      |                                 ^
../hw/xfree86/loader/loadmod.c:85:12: error: zero or negative size array
 ‘ModuleDuplicated’
   85 | static int ModuleDuplicated[] = { };
      |            ^~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2054>
2025-08-23 15:38:40 +00:00
Alan Coopersmith
dcd1ffa0c2 Revert "Xext: shape: clean up Xinerama dispatch"
This reverts commit a57db845bb.

It breaks when building with -Dxinerama=false:

../Xext/shape.c: In function ‘ProcShapeRectangles’:
../Xext/shape.c:318:12: error: too few arguments to function
 ‘ShapeRectangles’; expected 2, have 1
  318 |     return ShapeRectangles(client);
      |            ^~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2055>
2025-08-19 23:56:27 +00:00
Alan Coopersmith
e6ec0bfde8 xf86bigfont: fix -Werror=unused-variable build failure
../Xext/xf86bigfont.c: In function ‘SProcXF86BigfontQueryVersion’:
../include/dix.h:65:12: error: unused variable ‘stuff’
 [-Werror=unused-variable]
   65 |     type * stuff = (type *)client->requestBuffer;
      |            ^~~~~
../Xext/xf86bigfont.c:654:5: note: in expansion of macro ‘REQUEST’
  654 |     REQUEST(xXF86BigfontQueryVersionReq);
      |     ^~~~~~~

Fixes: 776efd3cf ("Xext: xf86bigfont: drop swapping request length fields")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 10:09:14 -07:00
Alan Coopersmith
d56c848523 xf86bigfont: Fix -Werror=missing-prototypes build failure
../Xext/xf86bigfont.c: At top level:
../Xext/xf86bigfont.c:683:1: error: no previous prototype for
 ‘XFree86BigfontExtensionInit’ [-Werror=missing-prototypes]
  683 | XFree86BigfontExtensionInit(void)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 33350ef8f ("include: move private definitions out of extinit.h")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 10:01:54 -07:00
Alan Coopersmith
4ca8b9a474 ci: enable xf86bigfont in one set of builds
Hopefully this will avoid us accepting more changesets that break it

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:54:08 -07:00
Alan Coopersmith
0617f6075b xf86bigfont: fix -Wimplicit-function-declaration error
Build breaks with gcc 14 & later when xf86bigfont is enabled:

../Xext/xf86bigfont.c: In function ‘XFree86BigfontExtensionInit’:
../Xext/xf86bigfont.c:709:28: error: implicit declaration of function
 ‘xfont2_allocate_font_private_index’;
 did you mean ‘AllocateFontPrivateIndex’? [-Wimplicit-function-declaration]
  709 |         FontShmdescIndex = xfont2_allocate_font_private_index();
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                            AllocateFontPrivateIndex

Fixes: 05a793f5b ("dix: Switch to the libXfont2 API (v2)")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:48:49 -07:00
Alan Coopersmith
faa511117d Revert "os: move AbortServer() to os/utils.c"
This reverts commit 8e8bf63908.

It failed to build if xf86bigfont was enabled:
../os/utils.c: In function ‘AbortServer’:
../os/utils.c:1555:5: error: implicit declaration of function
 ‘XF86BigfontCleanup’ [-Wimplicit-function-declaration]
 1555 |     XF86BigfontCleanup();
      |     ^~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:38:57 -07:00
Alan Coopersmith
cbe118373d Revert "Xext: xf86bigfont: split reply header and payload"
This commit doesn't compile, but wasn't noticed since xf86bigfont
isn't enabled by default, so wasn't being built in our CI builds.
(The ".type = X_Reply;" line needs to end with a , not a ;)

This reverts commit b5a3ac9527.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:08:03 -07:00
Alan Coopersmith
061690c2e6 Re-export Ones()
It's used by the nvidia driver

Fixes: 1642adec3 ("dix: unexport Ones()")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2051>
2025-08-02 17:21:00 -07:00
Alan Coopersmith
bf867b4658 Revert "os: unexport Os*() functions"
OsBlockSignals & OsReleaseSignals are required by libint10.so

This reverts commit be4c8444eb.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2049>
2025-07-20 12:41:06 -07:00
Twaik Yont
5568b0f83f os: use close-on-exec for X server socket to prevent fd leaks
In most typical Linux X servers (like Xvfb, Xephyr, or Xwayland), no child process outlives the server, so this issue rarely arises. However, in embedded X servers (based on Xvfb or Kdrive) or in custom Xorg modules, the server might launch a long-running command with regular fork+exec calls. If the X server crashes or exits while that command is still running (for example, it spawns a tombstone generator or any process that hangs or turns to zombie), the file descriptor associated with the abstract socket can remain open in the child process. This leads to the kernel refusing to allow another X server to bind the same socket until the child process terminates (because there is no explicit way to unlink abstract socket, unlike Unix socket). By marking the file descriptor as close-on-exec, we ensure it is automatically closed in child processes, preserving the ability of a new X server process to bind the socket immediately.

Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1906>
2025-07-19 21:42:37 +00:00
liuheng
9b6f72395a config: Preserve section data when parsing duplicate files
Previously, when parsing multiple configuration files containing the same
section names, only the last occurrence of each section would be retained.
Earlier definitions were silently discarded due to unconditional memory
allocation and overwriting of pointers during parsing.

This resulted in incomplete or incorrect configuration state when users
intended to merge or extend configuration through multiple files.

The section parsing functions in Files.c, Flags.c, and Module.c now
accept existing section pointers. These functions allocate new memory only
if the input pointer is NULL, preserving earlier data when re-parsing.

read.c has been updated to detect and pass existing section pointers when
encountering duplicate sections across files, preventing loss of prior content.

With these changes, the parser properly accumulates and merges configuration
data across multiple files, ensuring that all relevant settings are preserved.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/467
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2045>
2025-07-19 20:58:11 +00:00
Martin von Gagern
0d39d7a8f3 modesetting: Check for NULL mode_output before printing warning message
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1816
Signed-off-by: Martin von Gagern <gagern@google.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1938>
2025-07-19 20:52:27 +00:00
Michel Dänzer
010c00828a xwayland/present: Only flip if the window pixmap dimensions match
If they don't, attaching the new buffer changes the dimensions of the
wl_surface representing the window, which can break stuff as described
in https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2044 .

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2047>
2025-07-18 14:33:08 +00:00
Alan Coopersmith
94e01f7d5c Revert "dix: generate MakePredeclaredAtoms() from BuiltInAtoms file"
This reverts commit 44e6558934.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2048>
2025-07-16 17:14:51 -07:00
Alan Coopersmith
e923310d2f Revert "dix: unexport MakePredeclaredAtoms()"
This reverts commit b3ec0bf58a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2048>
2025-07-16 17:14:21 -07:00
Alan Coopersmith
122345d484 Revert "xkb: move XkbConvertGetByNameComponents and make it static"
This reverts commit 114c1c84b1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
d0d62a791b Revert "xkb: unexport functions from xkbfmisc.c"
This reverts commit 5d98664ec1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
f508575818 Revert "xkb: unexport functions from xkbout.c"
This reverts commit 660657a2c3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
f666efd73a Revert "xkb: unexport remaining internal declarations"
This reverts commit 3f8a5475c9.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
8540bda07a Revert "include: drop now empty xkbfile.h"
This reverts commit f8fc46cbbf.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
d8aedc5cfc Revert "xkb: drop unused XkbRF_LoadRulesByName()"
This reverts commit e38eeb4718.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
f21c9b9fc3 Revert "xkb: drop unused _XKB_RF_NAMES_PROP_MAXLEN define"
This reverts commit 975aed300e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
d74398ef1d Revert "xkb: drop unused XkbRF_Invalid define from xkbrules.h"
This reverts commit 5030f23f94.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
9cac71e660 Revert "xkb: move _XKB_RF_NAMES_PROP_ATOM define into xkbInit.c"
This reverts commit 1a9592ea4b.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
adf0fa5b19 Revert "xkb: move XkbRF_* defines into xkb/maprules.c"
This reverts commit b535fd7a4c.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
ef329d6a5c Revert "xkb: unexport XkbRF_GetComponents()"
This reverts commit d3b328ba4a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
fef268f680 Revert "xkb: unexport XkbRF_LoadRules()"
This reverts commit c376cd2c3d.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
cb285e18c0 Revert "xkb: unexport XkbRF_Create()"
This reverts commit 89475cbed4.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
dafa74fa1b Revert "xkb: unexport XkbRF_Free()"
This reverts commit 34372cb3da.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
01fa00fb90 Revert "xkb: unexport XkbRF_RulesRec struct"
This reverts commit 043dc8041c.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
396e3e7a54 Revert "xkb: unexport XkbRF_GroupRec struct"
This reverts commit 83c8a90a61.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
033936539b Revert "xkb: unexport XkbRF_RuleRec struct"
This reverts commit a82fa00835.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
950462f6e6 Revert "xkb: make XkbRF_Create() static inline"
This reverts commit 60d37d0158.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
03b1d94dc3 Revert "xkb: maprules: put some loop counters into local scope"
This reverts commit ffd7ca8af2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
1598978df2 Revert "xkb: maprules: use static struct init instead of memset()"
This reverts commit a88b17565b.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
8f184bb6ca Revert "xkb: drop obsolete parameter from XkbRF_Free()"
This reverts commit abfbc76824.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Alan Coopersmith
239b212c65 Revert "xkb: simplify loops in XkbRF_Free()"
This reverts commit a0c1eeea98.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00
Faith Ekstrand
376cef6710 glamor: Enable dma-buf on Zink
Zink badly needs dma-buf and modifiers as it can't handle BO import of
tiled buffers without modifiers.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1857>
2025-07-03 10:29:33 +00:00
Nathan Kidd
a4df686888 glx: Don't blindly write 8 bytes in GLX single replies
Previously we leaked stack when invalid enum parameters were
specified and caused __glGet*_size functions to return a 0 size.

Further, we read out-of-bounds (and leaked) when the input data was less
than 8 bytes (__glXDispSwap_GetFramebufferAttachmentParameteriv and
__glXDisp_GetRenderbufferParameteriv).

Now we only write a single element in the reply padding, and only when there
is a single element. This is what the Mesa client-side libGL expects, and
restores original GLX server behaviour, matching both pre-public (1996) SGI GLX
and XFree86 4.

The main risk of this change is if we have any error in element count or size;
previously it may not have mattered but now it does.

There are no piglit result changes from this modification using either mesa
libGLX or NVIDIA libGLX.

For performance considerations, an extra conditional and variable-length
memcpy has no meaningful impact on the indirect rendering pipeline cost.

There is still the possiblity to leak if our size checks allow an enum that
the GL implemention does not. Guarding against that requires zero-initializing
all temp storage, which wants re-evaluation of the blind 200-byte buffers
used for many calls and thus is a much bigger change.

Signed-off-by: Nathan Kidd <nkidd@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1647>
2025-07-02 13:00:47 -04:00
Nathan Kidd
29cfcf5259 glx: Fix out-of-bounds reads from negative return
The callers of these functions were casting -1 to unsigned and then
using 4GB indexes. By returning 0 we match all the other size functions.

GLX size functions return -1 to indicate error, but GL size functions return 0.

Signed-off-by: Nathan Kidd <nkidd@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1647>
2025-07-02 12:54:39 -04:00
Icenowy Zheng
eba15f1ba7 glamor: Fix dual blend on GLES3
The EXT_blend_func_extended extension on ESSL always requires explicit
request to allow two FS out variables because of limitations of the ESSL
language, which is mentioned as the No.6 issue of the extension's
specification.

Fix this by adding the extension request.

The original behavior on GLES3 is slightly against the specification of
GL_EXT_blend_func_extended extension, however Mesa and older version of
PowerVR closed drivers will just ignore this issue. Newest PowerVR
closed driver will bail out on this problem, so it deems a fix now.

Fixes: ee107cd491 ("glamor: support GLES3 shaders")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1750>
2025-06-25 17:24:43 +00:00
Vlad Zahorodnii
60f0bfe852 xwayland: Dispatch tablet tool tip events after frame events
Xwayland dispatches tablet tool tip events immediately when they arrive.

With compositors such as mutter and sway, it is not an issue because
their libinput backends synthetize axis events before tip events. In
other words, axis data and the tip status belong to different frames.

On the other hand, kwin sends axis and tip events in a single frame
(its libinput backend generates a single tip event with axis data
attached to it). Since the tip events are dispatched immediately,
they can have wrong information associated with them, for example tool
position or pressure. It results in undesired "streaks" when the user
presses the tablet tool against the tablet.

See also https://bugs.kde.org/show_bug.cgi?id=479856.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2032>
2025-06-25 11:44:07 +00:00
Marge Bot
c1a3e99ce0 Merge branch 'revert-1691' into 'master'
Revert !1691 ("os: log: consolidate sigsafe and non-sigsafe logging paths")

See merge request xorg/xserver!2036
2025-06-24 23:46:29 +00:00
Alan Coopersmith
fc4fd8f2a9 Revert "os: log: drop unused variables"
This reverts commit f5fe8a6379.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:52 +00:00
Alan Coopersmith
f421a33bb7 Revert "os: log: consolidate log formatting functions"
This reverts commit 71b8953597.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:52 +00:00
Alan Coopersmith
4916da381b Revert "os: log: make LogVMessageVerb() signal safe"
This reverts commit 5962211612.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:51 +00:00
Alan Coopersmith
6a9b2f37bb Revert "os: log: replace LogMessageVerbSigSafe() by LogMessageVerb()"
This reverts commit dd37cc4855.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:51 +00:00
Alan Coopersmith
8ff12a8e53 Revert "os: log: replace ErrorFSigSafe() by ErrorF()"
This reverts commit 2d18c353b4.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:50 +00:00
Alan Coopersmith
6dc94cb934 Revert "os: log: replace VErrorFSigSafe() by VErrorF()"
This reverts commit da22bc9ae0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:50 +00:00
Alan Coopersmith
523409ca2c Revert "xwin: drop duplicate OsVendorVErrorF()"
This reverts commit 9652bc73e2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:49 +00:00
Alan Coopersmith
ebcec3629c Revert "os: log: replace VErrorF() by LogVMessageVerb()"
This reverts commit f4eb217f11.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2036>
2025-06-24 23:40:49 +00:00
Alan Coopersmith
6a49a358e3 Revert "xfree86: common: unexport UnloadModule() and UnloadSubModule()"
This reverts commit 00f69564c5.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2037>
2025-06-24 23:23:50 +00:00
Aaron Plattner
1bec46dda1 Revert "os: unexport SetCriticalOutputPending()"
The NVIDIA driver uses this function.

This reverts commit d973c43810.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 11:23:14 -07:00
Aaron Plattner
c4470c3dca Revert "os: drop unused TimerCheck()"
The NVIDIA driver uses this function.

This reverts commit 1dc648b1b7.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 11:23:14 -07:00
Aaron Plattner
3fb85ab045 Revert "Xext: geext: drop unused GEInitEvent()"
The NVIDIA GLX extension module (libglxserver_nvidia.so) uses this
function.

This reverts commit 6fa340c578.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 11:23:14 -07:00
Aaron Plattner
d258c26626 Revert "panoramix: don't install panoramiX.h and panoramiXsrv.h"
The NVIDIA driver still supports GLX across physical screens in Xinerama
configurations, and uses the definitions in these headers to do that.

This reverts commit 3f469acb96.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 11:23:14 -07:00
Aaron Plattner
3d05f2b8a8 Revert "dix: unexport AllocColor()"
libwfb.so has a reference to this function:

 $ nm -D ./build.debug/hw/xfree86/dixmods/libwfb.so | grep AllocColor
                  U AllocColor

This reverts commit b48e4a9cb7.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 11:23:10 -07:00
Aaron Plattner
15ca09904a Revert "mi: unexport miWindowExposures()"
libwfb.so has a reference to this function:

 $ nm -D ./build.debug/hw/xfree86/dixmods/libwfb.so | grep miWindowExposures
                  U miWindowExposures

This reverts commit e424f49cdb.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 10:52:53 -07:00
Aaron Plattner
946ff9eac6 Revert "mi: unexport miExpandDirectColors()"
libwfb.so has a reference to this function:

 $ nm -D ./build.debug/hw/xfree86/dixmods/libwfb.so | grep miExpandDirectColors
                  U miExpandDirectColors

This reverts commit c3c538784a.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 10:52:27 -07:00
Aaron Plattner
d1ea5a6090 Revert "mi: unexport miCreateScreenResources()"
libwfb.so has a reference to this function:

 $ nm -D build.debug/hw/xfree86/dixmods/libwfb.so | grep miCreateScreenResources
                  U miCreateScreenResources

This reverts commit d14ae53e1f.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2025-06-24 10:52:27 -07:00
Olivier Fourdan
c34f59ee15 randr: Do not leak the provider property
When changing the RandR provider property, if the property does not
already exists, it is created.

In case of error, however, it doesn't get freed, leading to a leak of
the allocated property.

Make sure to free the RandR property in case of error if was to be
added.

Found by OpenScanHub.

Fixes: 3c3a4b767 - randr: Check for overflow in RRChangeProviderProperty()
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2035>
2025-06-24 06:32:54 +00:00
Alan Coopersmith
bfd15d6e5a Revert "xvmc: move over protocol version defines into xvmc.c"
This reverts commit a33639f975

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2034>
2025-06-22 09:17:25 -07:00
Alan Coopersmith
8006778970 Revert "xfree86: common: move private defs out of xf86sbusBus.h"
This reverts commit 50d1a98c6a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
4e315f0b94 Revert "xfree86: int10: move private defs out of xf86int10.h"
This reverts commit a0eea4e0ec.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
711fdc51f1 Revert "xfree86: common: move private defs from xf86Xinput.h to xf86Xinput_priv.h"
This reverts commit df33e1c51b.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
c692580d74 Revert "xfree86: common: move private defs out of xf86VGAarbiter.h"
This reverts commit 013eaacdd0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
d13ba4a9e5 Revert "xfree86: modes: move private definitions out of from xf86RandR12.h"
This reverts commit ac5e95be49.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
58f469947b Revert "xfree86: parser: move private defs from xf86Parser.h to xf86Parser_priv.h"
This reverts commit d4724009ce.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
98e082ffe4 Revert "xfree86: ddc: move private definitions from xf86DDC.h to xf86DDC_priv.h"
This reverts commit 00c2a8fb0a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
781a12fb8d Revert "xfree86: move private definitions out of dri2.h"
This reverts commit 1d3c26446d.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
41a55b1e2a Revert "xfree86: move private definitions out of dri.h"
This reverts commit cf03948572.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Alan Coopersmith
44c89ebf32 Revert "xfree86: sdksyms.sh: add more headers"
This reverts commit 1efb2151e3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2027>
2025-06-19 16:03:01 +00:00
Olivier Fourdan
4fc4d76b2c os: Check for integer overflow on BigRequest length
Check for another possible integer overflow once we get a complete xReq
with BigRequest.

Related to CVE-2025-49176

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Peter Harris <pharris2@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2028>
2025-06-18 11:40:54 +02:00
Marge Bot
2a0f6ec920 Merge branch 'revert-1591' into 'master'
Revert parts of !1591 ("Xext: saver: misc cleanups & tiny bugfix (#1704)")

See merge request xorg/xserver!2023
2025-06-17 21:06:02 +00:00
Alan Coopersmith
5ad38ac585 Revert "Xext: saver: skip unneeded zero init and zero-swapping"
This reverts commit 40469a9d51.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2023>
2025-06-17 21:02:03 +00:00
Alan Coopersmith
74182c52e9 Revert "Xext: saver: use explicit switch/case for dispatching"
This reverts commit 8236ef3b56.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2023>
2025-06-17 21:02:03 +00:00
Marge Bot
3e168d8e6a Merge branch 'revert-1519' into 'master'
Revert !1519 ("refactor no*Extension flags")

See merge request xorg/xserver!2022
2025-06-17 21:00:16 +00:00
Alan Coopersmith
b82110826f Revert "os: move out extension disable flags to corresponing extensions"
This reverts commit 356e18dcc6.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2022>
2025-06-17 20:54:49 +00:00
Alan Coopersmith
33a11228cf Revert "include: unexport no*Extension flags"
This reverts commit e3cbde9914.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2022>
2025-06-17 20:54:49 +00:00
Marge Bot
e610fa3234 Merge branch 'revert-xf86Msg' into 'master'
Revert !1681 ("(trivial) xfree86: use LogMessageVerb() instead of xf86MsgVerb()")

See merge request xorg/xserver!2021
2025-06-17 20:49:44 +00:00
Alan Coopersmith
d7e741665b Revert "xfree86: drop xf86MsgVerb() in favor of LogMessageVerb()"
This reverts commit 14767eccc0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:06 +00:00
Alan Coopersmith
64593971d7 Revert "xfre86: drop xf86Msg() in favor of LogMessageVerb()"
This reverts commit a136ce3d57.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:06 +00:00
Alan Coopersmith
746f249a0d Revert "xfree86: use LogMessageVerb() instead of xf86MsgVerb()"
This reverts commit 6fc4f35f62.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:05 +00:00
Alan Coopersmith
6b60f92ac2 Revert "glx: use LogMessageVerb() instead of xf86Msg()"
This reverts commit 76874498be.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:05 +00:00
Alan Coopersmith
692800af00 Revert "xfree86: i2c: use LogMessageVerb() instead of xf86Msg()"
This reverts commit 1f93ec5c33.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:05 +00:00
Alan Coopersmith
714d7ea170 Revert "xfree86: os-support: use LogMessageVerb() instead of xf86Msg()"
This reverts commit 4ba0cf1f55.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:05 +00:00
Alan Coopersmith
5b7b8f99cd Revert "xfree86: fbdevhw: use LogMessageVerb() instead of xf86Msg()"
This reverts commit 5fd918421a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:05 +00:00
Alan Coopersmith
8e8f28279d Revert "xfree86: common: use LogMessageVerb() instead of xf86Msg()"
This reverts commit bcbc7479f3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2021>
2025-06-17 20:42:05 +00:00
Marge Bot
81b14fb1a6 Merge branch 'revert-1711' into 'master'
Revert !1711 ("use dixDestroyPixmap() instead of direct driver calls")

See merge request xorg/xserver!2020
2025-06-17 20:12:22 +00:00
Alan Coopersmith
2a9c3abf3e Revert "doc: document that ScreenRec->DestroyPixmap() shouldn't be called directly"
This reverts commit 984da40fbb.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
60a224e457 Revert "Xext: saver: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 7ce19233bc.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
babe8e429d Revert "Xext: shm: use dixDestroyPixmap() instead of direct driver call"
This reverts commit c0f3b5bcef.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
dd823c7370 Revert "dix: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 5b541780c1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
2de9ed7604 Revert "composite: use dixDestroyPixmap() instead of direct driver call"
This reverts commit eb5476381a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
f0d6ec1c8a Revert "dbe: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 668d9fc40e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
b91182cc16 Revert "dri3: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 4694b8488e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
a5a89e9fa2 Revert "exa: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 9ca03e6da0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
5ead727d52 Revert "fb: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 08ec122fa7.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
6142282bfe Revert "glamor: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 7a0f8301c5.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
37d2db4398 Revert "miext: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 372a510ef0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
6f4ad392bd Revert "mi: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 4628254698.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
918a343710 Revert "randr: use dixDestroyPixmap() instead of direct driver call"
This reverts commit d2a93d0346.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
3802252040 Revert "render: use dixDestroyPixmap() instead of direct driver call"
This reverts commit c8607ca66f.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
9550b2d105 Revert "xnest: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 0a54e24721.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
51cfefd59f Revert "kdrive: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 4378656cbb.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
1b6b2bcee1 Revert "vfb: use dixDestroyPixmap() instead of direct driver call"
This reverts commit c117925ace.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
ab5e559771 Revert "xfree86: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 4d1953728e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
21de52dfbe Revert "xwayland: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 0132baa422.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
23dcedf8ba Revert "glx: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 69837185c0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
8b47b53226 Revert "exa: simplify CreatePixmap()/DestroyPixmap() handlers error pathes"
This reverts commit ee798cf212.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith
e48b1aaa97 Revert "dix: add in-code docs for dixDestroyPixmap()"
This reverts commit b61647f3a1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Olivier Fourdan
0235121c6a xfree86: Check for RandR provider functions
Changing XRandR provider properties if the driver has set no provider
function such as the modesetting driver will cause a NULL pointer
dereference and a crash of the Xorg server.

Related to CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan
3c3a4b767b randr: Check for overflow in RRChangeProviderProperty()
A client might send a request causing an integer overflow when computing
the total size to allocate in RRChangeProviderProperty().

To avoid the issue, check that total length in bytes won't exceed the
maximum integer value.

CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan
2bde9ca49a record: Check for overflow in RecordSanityCheckRegisterClients()
The RecordSanityCheckRegisterClients() checks for the request length,
but does not check for integer overflow.

A client might send a very large value for either the number of clients
or the number of protocol ranges that will cause an integer overflow in
the request length computation, defeating the check for request length.

To avoid the issue, explicitly check the number of clients against the
limit of clients (which is much lower than an maximum integer value) and
the number of protocol ranges (multiplied by the record length) do not
exceed the maximum integer value.

This way, we ensure that the final computation for the request length
will not overflow the maximum integer limit.

CVE-2025-49179

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan
d55c54cecb os: Account for bytes to ignore when sharing input buffer
When reading requests from the clients, the input buffer might be shared
and used between different clients.

If a given client sends a full request with non-zero bytes to ignore,
the bytes to ignore may still be non-zero even though the request is
full, in which case the buffer could be shared with another client who's
request will not be processed because of those bytes to ignore, leading
to a possible hang of the other client request.

To avoid the issue, make sure we have zero bytes to ignore left in the
input request when sharing the input buffer with another client.

CVE-2025-49178

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan
ab02fb96b1 xfixes: Check request length for SetClientDisconnectMode
The handler of XFixesSetClientDisconnectMode does not check the client
request length.

A client could send a shorter request and read data from a former
request.

Fix the issue by checking the request size matches.

CVE-2025-49177

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Fixes: e167299f6 - xfixes: Add ClientDisconnectMode
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan
03731b326a os: Do not overflow the integer size with BigRequest
The BigRequest extension allows requests larger than the 16-bit length
limit.

It uses integers for the request length and checks for the size not to
exceed the maxBigRequestSize limit, but does so after translating the
length to integer by multiplying the given size in bytes by 4.

In doing so, it might overflow the integer size limit before actually
checking for the overflow, defeating the purpose of the test.

To avoid the issue, make sure to check that the request size does not
overflow the maxBigRequestSize limit prior to any conversion.

The caller Dispatch() function however expects the return value to be in
bytes, so we cannot just return the converted value in case of error, as
that would also overflow the integer size.

To preserve the existing API, we use a negative value for the X11 error
code BadLength as the function only return positive values, 0 or -1 and
update the caller Dispatch() function to take that case into account to
return the error code to the offending client.

CVE-2025-49176

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:10 +02:00
Olivier Fourdan
0885e0b262 render: Avoid 0 or less animated cursors
Animated cursors use a series of cursors that the client can set.

By default, the Xserver assumes at least one cursor is specified
while a client may actually pass no cursor at all.

That causes an out-of-bound read creating the animated cursor and a
crash of the Xserver:

 | Invalid read of size 8
 |    at 0x5323F4: AnimCursorCreate (animcur.c:325)
 |    by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |  Address 0x59aa010 is 0 bytes after a block of size 0 alloc'd
 |    at 0x48468D3: reallocarray (vg_replace_malloc.c:1803)
 |    by 0x52D3DA: ProcRenderCreateAnimCursor (render.c:1802)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |
 | Invalid read of size 2
 |    at 0x5323F7: AnimCursorCreate (animcur.c:325)
 |    by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |  Address 0x8 is not stack'd, malloc'd or (recently) free'd

To avoid the issue, check the number of cursors specified and return a
BadValue error in both the proc handler (early) and the animated cursor
creation (as this is a public function) if there is 0 or less cursor.

CVE-2025-49175

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:18:58 +02:00
Alan Coopersmith
3bdb541e04 Revert "os: move BUG_*() macros to own private header"
This reverts commit 346d5f5c35.
That commit did not handle copyright/license notices correctly.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2019>
2025-06-13 17:13:54 -07:00
Alan Coopersmith
538a6dd76f Revert "xfree86: mark LoaderShouldIgnoreABI() and LoaderGetABIVersion() deprecated"
This reverts commit 4f2c6c98b7.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2017>
2025-06-13 22:48:22 +00:00
Alan Coopersmith
c7b69f1acb Revert "misc.h: drop LengthRestB() macro"
This reverts commit a6b2eb3780

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2015>
2025-06-13 22:30:27 +00:00
Alan Coopersmith
cd583932a1 Revert "misc.h: move out checked_int64_(add|subtract)"
This reverts commit de0aed0543

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2014>
2025-06-13 22:13:22 +00:00
Alan Coopersmith
55ad737a9f Revert "misc.h: move out MAXEXTENSIONS to geext.c"
This reverts commit 80593ab279.

This is a fundamental property of the X11 core protocol,
there is no benefit to hiding it, it can't change.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2013>
2025-06-13 22:03:45 +00:00
Marge Bot
ff8d250589 Merge branch 'xrandr-reverts' into 'master'
Revert "randr cleanups"

See merge request xorg/xserver!2012
2025-06-13 21:58:15 +00:00
Alan Coopersmith
e3d0666386 Revert "randr: let SProc*'s call their Proc*'s directly"
This reverts commit ed17224403.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:43 -07:00
Alan Coopersmith
c35a285398 Revert "randr: use explicit case statement instead of ProcRandrVector table"
This reverts commit 42677ae1e3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:30 -07:00
Alan Coopersmith
bc76e25994 Revert "randr: use explicit case statement instead of SProcRandrVector table"
This reverts commit 058815bed1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:17 -07:00
Alan Coopersmith
9f72353a51 Revert "randr: RRCrtcCreate(): drop unnecessary zero assigments"
This reverts commit 6d2c42d0c8.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:02 -07:00
Alan Coopersmith
160abf285c Revert "randr: use struct initializer for reply structs"
This reverts commit 7eff742ef2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:47 -07:00
Alan Coopersmith
9c53c6cf76 Revert "randr: ProcRRGetCrtcInfo(): use locally scoped variables"
This reverts commit 90abc95c85.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:36 -07:00
Alan Coopersmith
c371d11af0 Revert "randr: ProcRRGetCrtcTransform(): split reply header and payload"
This reverts commit c6f1b8a735.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:23 -07:00
Alan Coopersmith
9b753c3970 Revert "randr: ProcRRGetMonitors() use SwapLongs instead of callbacks"
This reverts commit 203f59c6d3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:00 -07:00
Alan Coopersmith
a205917752 Revert "randr: ProcRRGetMonitors(): collect reply payload in temporary buffer"
This reverts commit 1bc6ca30a9.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:42:33 -07:00
Alan Coopersmith
896d9d3be8 Revert "randr: RROutputCreate(): use calloc()"
This reverts commit 3d3137513a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:42:13 -07:00
Alan Coopersmith
9f2b9adbe3 Revert "randr: RRCreateProviderProperty(): use calloc()"
This reverts commit 05188ccec1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:41:53 -07:00
Alan Coopersmith
e77b465eb6 Revert "randr: ProcRRGetOutputProperty(): rename reply struct to "rep""
This reverts commit 53d43bd8dc.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:41:29 -07:00
Alan Coopersmith
01914b1c53 Revert "randr: ProcRRGetOutputProperty(): use SwapShort()/SwapLong()"
This reverts commit 8789be52a4.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:41:13 -07:00
Alan Coopersmith
3a76d12ef0 Revert "randr: ProcRRGetProviderProperty(): use SwapShort()/SwapLong()"
This reverts commit 62b8497999.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:40:33 -07:00
Alan Coopersmith
bddafe4001 Revert "randr: ProcRRGetCrtcGamma(): use SwapShort()/SwapLong()"
This reverts commit d9863f7cb0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:38:23 -07:00
Alan Coopersmith
6a0c430b25 Revert "randr: ProcRRListOutputProperties(): use SwapShort()/SwapLong()"
This reverts commit e3001b71b3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:38:12 -07:00
Alan Coopersmith
8650028e59 Revert "randr: ProcRRQueryOutputProperty(): use SwapShort()/SwapLong()"
This reverts commit 73467faeb2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:37:57 -07:00
Alan Coopersmith
fc7858a458 Revert "randr: RRScreenInit(): drop unnecessary zero'ing"
This reverts commit 6fad884ce7.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:36:45 -07:00
Alan Coopersmith
36af7a5f9c Revert "randr: fix RRGetCrtcTransform reply length"
This reverts commit 0ca5aaba50.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:36:22 -07:00
Alan Coopersmith
eca05b85f9 Revert "randr: fix RRGetCrtcTransform reply length, part 2"
This reverts commit 53876f1ef1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:35:44 -07:00
Olivier Fourdan
8cb078f8b6 xwayland: Do not pretend leaving the X11 surface if buttons are down
Xwayland has its own XYToWindow() handler to account for the case when
the pointer leaves an X11 surface to enter another Wayland native
window.

When that occurs, Xwayland will treat it as if the pointer had entered
the root window so that the X11 clients receive an appropriate leave
event.

When the pointer leaves the X11 surface, Xwayland will call
CheckMotion() to update the sprite coordinates and possibly the cursor.

However, if we left the surface with a button down, it means the wayland
compositor has grabbed the pointer so we will not get button release
events from the compositor.

Once the button is released, Xwayland will get a pointer enter event from
the compositor, and Xwayland will clear up the buttons pressed.

But that might confuse Xwayland in thinking the pointer has crossed the
windows and leave the wrong cursor showing in the X11 surface.

To avoid the issue, if buttons are down, do not pretend the cursor has
left the X11 surface for the root window.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1811
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2008>
2025-06-05 07:29:03 +00:00
Olivier Fourdan
8a77ab083f Revert "xwayland: Update sprite prior to clearing the focus window"
This breaks regular toplevel enter/leave events when crossing to/from a
native Wayland window.

A better fix for the original issue follows.

This reverts commit b97b459c06.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2008>
2025-06-05 07:29:03 +00:00
Alan Coopersmith
0d2213ec44 Xephyr.man: Use \- to get ASCII hyphens instead of Unicode dashes
Used in command-line arguments and email addresses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:15:13 -07:00
Alan Coopersmith
ff4f2f718b man pages: don't use .BI macro with a single argument
Clears warnings from groff -rCHECKSTYLE=10:

an.tmac: Xephyr.man:53: style: .BI expects at least 2 arguments, got 1
an.tmac: Xephyr.man:55: style: .BI expects at least 2 arguments, got 1
an.tmac: Xwayland.man:151: style: .BI expects at least 2 arguments, got 1
an.tmac: Xwayland.man:166: style: .BI expects at least 2 arguments, got 1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:10:35 -07:00
Alan Coopersmith
286578e83e XWin.man: fix typos in font change escapes
Fixes warnings from `mandoc -T lint`:

mandoc: XWin.man:332:28: WARNING: invalid escape sequence: \fp
mandoc: XWin.man:397:1: WARNING: invalid escape sequence: \fX

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:06:23 -07:00
Alan Coopersmith
bd08e04fcb man pages: remove extraneous PP macros
Clears warnings from `mandoc -T lint` of the forms:
mandoc: Xorg.man:26:2: WARNING: skipping paragraph macro: PP after SH
mandoc: Xorg.man:40:2: WARNING: skipping paragraph macro: PP empty

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:01:49 -07:00
Alan Coopersmith
6dfe3e7db6 man pages: strip trailing whitespace
Gets rid of many warnings from `mandoc -T lint` of the form:
mandoc: ./man/Xserver.man:621:7: STYLE: whitespace at end of input line

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 14:51:24 -07:00
Alan Coopersmith
7aa1f121e4 mi: use common implementation of bit counting function
Reduce a bit of unexplained magic, and use ISA extensions where available

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1984>
2025-05-20 00:34:23 +00:00
Enrico Weigelt, metux IT consult
73f3c47608 randr: fix unconditional byte-swap in ProcRRGetProviderInfo()
The list of the associated provider's capabilities was always swapped
unconditionally, while it should only be in case of client having
opposite endianess.

Fixes: 426bc0a28e
Reported-By: dasha_uwu
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1977>
2025-05-18 23:42:19 +00:00
Enrico Weigelt, metux IT consult
f0fd9f8bf4 dix: fix warning on redefinition of typedefs
| ../dix/input_priv.h:56:29: warning: redefinition of typedef 'InputOption' is a C11 feature [-Wtypedef-redefinition]
|    56 | typedef struct _InputOption InputOption;
|       |                             ^
| ../include/input.h:255:29: note: previous definition is here
|   255 | typedef struct _InputOption InputOption;
|       |                             ^
| In file included from ../hw/xfree86/common/xf86Cursor.c:36:
| ../dix/input_priv.h:57:25: warning: redefinition of typedef 'XI2Mask' is a C11 feature [-Wtypedef-redefinition]
|    57 | typedef struct _XI2Mask XI2Mask;
|       |                         ^
| ../include/input.h:256:25: note: previous definition is here
|   256 | typedef struct _XI2Mask XI2Mask;
|       |                         ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1978>
2025-05-18 17:35:31 +00:00
Olivier Fourdan
b97b459c06 xwayland: Update sprite prior to clearing the focus window
Xwayland has its own XYToWindow() handler to account for the case when
the pointer leaves an X11 surface to enter another Wayland native window
(which of course are unknown to Xwayland).

When that occurs, Xwayland will treat it as if the pointer had entered
the root window so that the X11 clients receive an appropriate leave
event.

When the pointer leaves the X11 surface, Xwayland will call
CheckMotion() to update the sprite coordinates and possibly the cursor.

However, CheckMotion() will call back into the XYToWindow() handler,
which will then pretend the window has entered the root window, and that
may cause the wrong cursor to be applied.

To avoid the issue, change the order we do things, by calling
CheckMotion() first prior to clear up the internal focus window so that
the first call to XYToWindow() will return the correct X11 window so we
get to update the cursor correctly.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1811
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1915>
2025-05-16 10:02:53 +00:00
Alan Coopersmith
37b7ea8f8a render: miindex.c does not need header guard macros
Clears warning from clang 19.1.7:

render/miindex.c:27:9: warning: macro is not used [-Wunused-macros]
   27 | #define _MIINDEX_H_
      |         ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:16 +00:00
Alan Coopersmith
f988558348 os: remove unused definition of BUGADDRESS
We stopped including this in error messages back in 2008

Clears warning from clang 19.1.7:

os/utils.c:1338:9: warning: macro is not used [-Wunused-macros]
 1338 | #define BUGADDRESS BUILDERADDR
      |         ^

Fixes: ef77e4c44 ("Remove useless commentary from environment and argument processing.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:16 +00:00
Alan Coopersmith
d1cc5a599f test: remove extra return
Clears warning from clang 19.1.7:

test/misc.c:239:12: warning: 'return' will never be executed
 [-Wunreachable-code-return]
  239 |     return 0;

Fixes: 46b579e8d ("test: switch the unit tests to something resembling a test suite")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Alan Coopersmith
14e202d6a0 xfixes: cursor.c should include header for CursorVisible & EnableCursor
Clears warnings from clang 19.1.7:

xfixes/cursor.c:132:6: warning: no previous extern declaration for
 non-static variable 'CursorVisible' [-Wmissing-variable-declarations]
  132 | Bool CursorVisible = FALSE;
      |      ^
xfixes/cursor.c:133:6: warning: no previous extern declaration for
 non-static variable 'EnableCursor' [-Wmissing-variable-declarations]
  133 | Bool EnableCursor = TRUE;
      |      ^

Fixes: 2cec3cfbf ("include: move private definitions out of input.h")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Alan Coopersmith
b490578242 os: connection.c should include header that defines GrabInProgress
Clears warning from clang 19.1.7:

os/connection.c:133:5: warning: no previous extern declaration for
 non-static variable 'GrabInProgress' [-Wmissing-variable-declarations]
  133 | int GrabInProgress = 0;
      |     ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Alan Coopersmith
0fefdc6e29 dix: tables.c should include header that defines InitialVector
Clears warning from clang 19.1.7:

dix/tables.c:59:7: warning: no previous extern declaration for non-static
 variable 'InitialVector' [-Wmissing-variable-declarations]
   59 | int (*InitialVector[3]) (ClientPtr /* client */) = {
      |       ^

Fixes: bae6cbc8c ("include: move private defs to dixstruct_priv.h")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Alan Coopersmith
062c339519 modesetting: fix typo in XF86ModuleVersionInfo initialization
Found by clang 19.1.7:

hw/xfree86/drivers/modesetting/driver.c:163:21:
 warning: initializer overrides prior initialization of this subobject
 [-Winitializer-overrides]
  163 |     ._modinfo1_   = MODINFOSTRING2,
      |                     ^~~~~~~~~~~~~~
hw/xfree86/drivers/modesetting/driver.c:162:21:
 note: previous initialization is here
  162 |     ._modinfo1_   = MODINFOSTRING1,
      |                     ^~~~~~~~~~~~~~

Fixes: 2a10eff6c ("xfree86: modsetting: use explicit field initializers for XF86ModuleData")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Alan Coopersmith
3eaa19d74b test: remove stray semi-colons after functions
Clears warnings from clang 19.1.7:

test/list.c:95:2: warning: extra ';' outside of a function [-Wextra-semi]
   95 | };
      |  ^

test/list.c:137:2: warning: extra ';' outside of a function [-Wextra-semi]
  137 | };
      |  ^

Fixes: 92788e677 ("test: add some tests for basic list manipulation.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Alan Coopersmith
f9d25189fa xfree86: make modeline2c.awk put a newline at the end of xf86DefModeSet.c
Clears warning from clang 19.1.7:
hw/xfree86/common/xf86DefModeSet.c:288:62:
 warning: no newline at end of file [-Wnewline-eof]
  288 | const int xf86NumDefaultModes = ARRAY_SIZE(xf86DefaultModes);
      |                                                              ^

Fixes: 3bf7ff703 ("Size xf86DefaultModes explicitly.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1910>
2025-04-19 17:02:15 +00:00
Peter Harris
dfbc672e85 Update mailmap for Peter Harris
My division was acquired by Rocket Software. The opentext.com email
address is no longer active.

Ref: https://investors.opentext.com/press-releases/press-releases-details/2024/OpenText-Completes-Divestiture-of-Application-Modernization-and-Connectivity-AMC-Business-to-Rocket-Software-for-2.275B/default.aspx
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1914>
2025-04-15 13:49:13 -04:00
Alan Coopersmith
845c4ae518 Xserver.man: correct list of available authorization protocols
XDM-AUTHORIZATION-2 (IPv6 capable version of -1) was never merged.
SUN-DES-1 was removed by commit 71b207a2e in 2024
MIT-KERBEROS-5 was removed by commit dfbe32b5b in 2007

Fixes: 71b207a2e ("os: drop SUN-DES-1 authentication")
Fixes: dfbe32b5b ("Remove the old Kerberos 5 authentication code.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1913>
2025-04-14 18:47:05 -07:00
Alan Coopersmith
80ad8a2c6d Xserver.man: add Xwayland(1) to list of server-specific man pages
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1913>
2025-04-14 15:56:34 -07:00
Alan Coopersmith
b9c31cc9bc Xserver.man: allow line breaks in default font path
Allows nroff to insert a line break between iterm in the font path
instead of displaying it as a single, very overlength line.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1891>
2025-04-12 17:18:37 +00:00
Peter Hutterer
cab9017485 dix: pick the right keyboard for focus FollowKeyboard
This fixes a crash when we try to send focus events and dereference
FollowKeyboardWin (0x3) as WindowPtr.

A device set to XSetDeviceFocus(FollowKeyboard) is supposed to follow
the focus of the corresponding master device. During ActivateKeyboard
a slave device is detached from the master for the duration for the grab
so we don't actually have a master to follow - leaving our oldWin set to
the FollowKeyboardWin constant. This later crashes when we try to
dereference it.

Fix this by getting the current master (if any), or the saved master (if
temporarily detached due to a grab). And if failing that, use the VCK
as fallback device - that is technically wrong but it's such a niche use
case that it shouldn't matter.

Reproducer:
     window = XCreateSimpleWindow(...)
     deviceid = any device that is IsXExtensionKeyboard device
     XSetDeviceFocus(deviceid, FollowKeyboard, ...)
     XGrabDevice(deviceid, window, ...)

Fixes: f01ee198ff ("dix: don't use inputInfo.keyboard to get the focus window in ActivateKbdGrab")

Found-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1870>
2025-04-07 15:45:50 +00:00
Enrico Weigelt, metux IT consult
c445167da6 xwayland: no need to use WriteReplyToClient()
The WriteReplyToClient() macro is used for cases where byte swapping
is implemented in a separate callback function (set in a global vector
table). Since Xwl extension doesn't have such a callback, but does the
byte swapping directly in it's request handlers, there's no need to
call the WriteReplyToClient() macro - we can use WriteToClient() instead.

Fixes: 2700bc6045 - xwayland: add support for the XWAYLAND extension
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1878>
2025-04-07 07:47:30 +00:00
Enrico Weigelt, metux IT consult
32b3328e49 kdrive: Xkdrive.man: remove stray whitespace
Tiny editorial correction: drop a stray whitespace in manpage
that sneaked in at recent editorial changes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1876>
2025-04-02 00:54:31 +00:00
Enrico Weigelt, metux IT consult
52c2cb7439 ci: fix missing runner tag on FreeBSD jobs after gitlab migration
All jobs utilizing kvm (eg. FreeBSD) need the "kvm" runner tag set.
It used to work w/o it, since all runners did have kvm, but in the
new CI there are non-kvm runners, so we really need to set the tag.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1872>
2025-04-01 18:02:55 +00:00
Alan Coopersmith
5ac0a19e7f man pages: use .BR to mark up man page references
The name of a man page is typeset in bold and the section in roman
(see man-pages(7)).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 13:36:54 -07:00
Alan Coopersmith
b4b6b19c9a Xserver.man: remove X FireWall Proxy (xfwp) info
xfwp has not been maintained in many years, with ssh X11-Forwarding
preferred instead.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 13:27:33 -07:00
Bjarni Ingi Gislason
bcf743f356 inputtestdrv.4: editorial changes for this man page
Use the correct macro for the font change of a single argument or
split the argument into two.

43:.BI Keyboard
46:.BI Pointer
52:.BI PointerAbsolute
58:.BI PointerAbsoluteProximity
62:.BI Touch
103:.BI xf86ITEventWaitForSync

-.-.

Wrong distance between sentences in the input file.

Separate the sentences and subordinate clauses; each begins on a new
line.  See man-pages(7) ("Conventions for source file layout") and
"info groff" ("Input Conventions").

19:server as input events. It supports the full set of the xf86 driver APIs
20:exposed by Xorg. The primary use cases of this input driver are various
29:is created after the driver is initialized. The paths to the socket is passed
37:Sets the path where the driver will create a named socket. Any existing file
47:Initializes a relative-mode pointer device. It will have four valuators -
53:Initializes an absolute-mode pointer device. It will have four valuators -
87:specifies the protocol version supported by it. If this version is lower than
91:to the driver. Each event is an instance of one of the
93:structs. The length field defines the full length of the struct in bytes and
96:The responses from the server follow the same structure. Each response is an
99:structs. The length field defines the full length of the struct in bytes and
104:event. After sending such event, the client must read of a
106:events. The completion of the read operation indicates that Xorg has fully

-.-.

The name of a man page is typeset in bold and the section in roman
(see man-pages(7)).

24:Please refer to xorg.conf(5) for general configuration
112:Xorg(1), xorg.conf(5), Xserver(1), X(7)

-.-

Additionally:

"read of a xf86... event" -> "read an xf86... event"

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095449

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 12:35:46 -07:00
Bjarni Ingi Gislason
49378eb510 exa.man: editorial changes for this man page
Wrong distance between sentences in the input file.

Separate the sentences and subordinate clauses; each begins on a new
line.  See man-pages(7) ("Conventions for source file layout") and
"info groff" ("Input Conventions").

Mark a final abbreviation point as such by suffixing it with "\&".

25:Disables acceleration of uploading pixmap data to the framebuffer. Default: No.

-.-.

Split a punctuation mark from a single argument for a two-font macro

40:.BR xorg.conf(5).

-.-.

Section headings (.SH and .SS) do not need quoting.

38:.SH "SEE ALSO"

-.-.

Output from "test-groff  -mandoc -t -K utf8 -rF0 -rHY=0 -rCHECKSTYLE=10 -ww -z ":

an.tmac:<stdin>:40: misuse, warning: .BR is for at least 2 arguments, got 1
	Use macro '.B' for one argument or split argument.

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095446

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 12:25:00 -07:00
Bjarni Ingi Gislason
359d12aa0b Xserver.man: some remarks and editorial changes for this man page
Output from "mandoc -T lint Xserver.1": (possibly shortened list)

mandoc: Xserver.1:117:4: WARNING: undefined escape, printing literally: \+
mandoc: Xserver.1:118:81: STYLE: input text line longer than 80 bytes: Allow connections fr...
mandoc: Xserver.1:122:84: STYLE: input text line longer than 80 bytes: Prohibit connections...

Add a comma (or \&) after "e.g." and "i.e.", or use English words
(man-pages(7)).

81:sets pointer acceleration (i.e. the ratio of how much is reported to how much
273:sets pointer acceleration threshold in pixels (i.e. after how many pixels
468:contain either an Internet hostname (e.g. expo.lcs.mit.edu)

Split lines longer than 80 characters into two or more lines.
Appropriate break points are the end of a sentence and a subordinate
clause; after punctuation marks.

Xserver.1: line 118 length 81
Allow connections from clients with an endianess different to that of the server.

Xserver.1: line 122 length 84
Prohibit connections from clients with an endianess different to that of the server.

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1072500

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 12:07:51 -07:00
Bjarni Ingi Gislason
056b447a33 Xserver.man: some editorial fixes for the manual
Wrong distance between sentences.

Separate the sentences and subordinate clauses; each begins on a new
line.  See man-pages(7) ("Conventions for source file layout") and
"info groff" ("Input Conventions").

Split lines longer than 100 characters into two or more lines.
Appropriate break points are the end of a sentence and a subordinate
clause; after punctuation marks.

"[" and "]", showing optional arguments to options, should be typeset in roman.

Output from "test-groff -b -mandoc -dAD=l -rF0 -rHY=0 -t -w w -z -rSTYLECHECK=3":
an.tmac:<stdin>:104: style: .BI expects at least 2 arguments, got 1
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an.tmac':524: macro 'B'
troff: backtrace: file '<stdin>':167
troff:<stdin>:167: warning: cannot select font 'F'

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041094

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 11:55:55 -07:00
Bjarni Ingi Gislason
f544e0df2c Xserver.man: Fix some textual and formatting issues
Protect . if not end of sentence

Protect an aphostrophe (', 0x27), if it can become a control character

Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of a name
for an option.

Adjust space between sentences or protect the indicator.

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869252

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 11:29:19 -07:00
Bjarni Ingi Gislason
d7b7789cac Xserver.man: some minor markup changes
Dash for a range is \(en

Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of a name
for an option.

Add extra word space

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726063

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 11:16:49 -07:00
Bjarni Ingi Gislason
c7b6424eed xorg.conf.5: Some formatting and word corrections in the manual
see man-pages(7) for a style manual.

Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919143

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 10:19:09 -07:00
Tanguy Ortolo
e4d2de8198 xorg.conf.man: Complete the xorg.conf.5 manpage with Option "Disable"
The xorg.conf.5 manpage mentions an "Enable" option to enable a monitor
regardless of whether or not it is connected, but gives no indication of how
to disable it. This patch corrects that by documenting the "Disable" option.

Orignally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755809

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 10:03:36 -07:00
Bjarni Ingi Gislason
1f8e32ea65 xorg.conf.man: unprotected period in ellipses
Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667983

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1875>
2025-03-29 09:51:17 -07:00
Peter Hutterer
4966fbb55a meson.build: print a summary of the DDX to build
Makes it easier to detect accidentally "oops, i'm not building Xwayland"

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1869>
2025-03-24 03:05:35 +00:00
Peter Hutterer
2bca68f41b dix: fix erroneous BUG_RETURN check
Check was inverted, we want to complain if evcount exceeds our target
array.

Fixes: 219c54b8a3 ("dix: fix DeviceStateNotify event calculation")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1868>
2025-03-21 11:42:41 +10:00
Alan Coopersmith
4b5d410591 dix-config.h: define HAVE_STRUCT_SOCKADDR_STORAGE for xtrans 1.6
xtrans 1.6 will use struct sockaddr_storage if HAVE_STRUCT_SOCKADDR_STORAGE
is defined, even if IPv6 is disabled, unlike previous versions which tied
it to the IPv6 #define.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1864>
2025-03-14 22:38:36 +00:00
Alan Coopersmith
b73cd6066a pkgconfig files: Add URL
https://github.com/pkgconf/pkgconf/blob/master/man/pc.5 says it's
a mandatory field in *.pc files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1863>
2025-03-09 07:32:28 +00:00
Peter Hutterer
797f63b8be Xi: disallow grabbing disabled devices
Grabbing a disabled (pointer) device will lead to a segfault later
in the myriad of places where we look at the device's spriteInfo - which
will be NULL.

As a workaround, disallow grabbing a disabled device by pretending it's
already grabbed. Since the point of a grab is to receive all events by
that device and disabled devices cannot send events, this should be Good
Enough.

Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1856>
2025-03-06 14:19:50 +01:00
Povilas Kanapickas
68054d0fe3 ci: Reuse xserver created by meson-dist job in driver build jobs
Currently each driver build job also builds the server. This is bad use
of resources because server build takes way more resources compared to a
driver build. Reusing already built xserver would resolve the issue.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1806>
2025-03-03 14:10:17 +00:00
Povilas Kanapickas
8e5a5cf2c1 ci: Add install prefix to the artifacts of meson-dist job
This will allow to reuse built xserver on subsequent driver build jobs

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1806>
2025-03-03 14:10:17 +00:00
Povilas Kanapickas
f7d2e810ba ci: Adjust prefix instead of setting DESTDIR for meson-dist job
This ensures that the pkg-config files installed to
xserver-tarball/install will have correct paths. This is needed so that
xf86-driver-build-test will be able to reuse this installation of
xserver. It will be passed to that job via artifacts (subsequent
commits)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1806>
2025-03-03 14:10:17 +00:00
Povilas Kanapickas
8d1fa6acde ci: Point to last commit of xf86-video-qxl instead of master branch
This ensures that the tests don't start failing silently after new
commits are added to the QXL driver.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1806>
2025-03-03 14:10:17 +00:00
Enrico Weigelt, metux IT consult
af86c5cbc2 Xnest: use authorative declarations from X11/XKBlib.h
Better use the headers from the library we're linking against,
instead of having our own private declarations.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1842>
2025-02-28 17:27:05 +00:00
Enrico Weigelt, metux IT consult
cab3856903 xfree86: os-support: fix FTBS when no recent enough libdrm found
On Linux, the only supported platform bus backend (*1) is via DRM/DRI.
Trying to build it w/o (recent enough) libdrm fails as it tries to
compile the drm-based implementation, w/o having drm.h available. (*2)

In order to fix this, we need to compile noop-implementation instead.

*1) platform specific code for detecting video devices
*2) https://gitlab.freedesktop.org/xorg/xserver/-/issues/1771

Issue: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1771
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1848>
2025-02-28 16:15:32 +00:00
Enrico Weigelt, metux IT consult
e2ac461629 xfree86: platform_noop: add missing functions
In order to be able to build on Linux w/ platform_noop
(when no recent enough libdrm found), a few more dummy functions
are needed here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1848>
2025-02-28 16:15:32 +00:00
Enrico Weigelt, metux IT consult
fe9c911e22 xfree86: xf86helper: fix NULL dereference
xf86MatchDevice() can segfault if screensecptr->device is NULL.

Issue: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1767
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1847>
2025-02-28 16:41:09 +01:00
Enrico Weigelt, metux IT consult
628e94b164 os: let vpnprintf() accept %X
Several pieces of the code, as well as drivers are using %X, which
we don't support, so leading to error messages like this:

[2025-02-27 14:28:44] BUG: 'if (f[f_idx])'
[2025-02-27 14:28:44] BUG: ../xserver/os/log.c:538 in vpnprintf()
[2025-02-27 14:28:44] Unsupported printf directive 'X'
[2025-02-27 14:28:44]
[2025-02-27 14:28:44] Backtrace:
[2025-02-27 14:28:44] unw_get_proc_name failed: no unwind info found [-10]
[2025-02-27 14:28:44] 0: /usr/lib/Xorg (?+0x0) [0x5f4d1261bc47]
[2025-02-27 14:28:44] 1: /usr/lib/Xorg (LogVHdrMessageVerb+0x10f) [0x5f4d1261ca3f]
[2025-02-27 14:28:44] 2: /usr/lib/Xorg (LogHdrMessageVerb+0x85) [0x5f4d1261cae5]
[2025-02-27 14:28:44] 3: /usr/lib/Xorg (xf86VDrvMsgVerb+0x54) [0x5f4d12636604]
[2025-02-27 14:28:44] 4: /usr/lib/Xorg (xf86DrvMsg+0x97) [0x5f4d126367d7]
[2025-02-27 14:28:44] 5: /usr/lib/Xorg (xf86PrintEDID+0x545) [0x5f4d12654315]
[2025-02-27 14:28:44] 6: /usr/lib/Xorg (xf86OutputSetEDID+0x1bd) [0x5f4d12657e0d]

In the longer run, we'll have to decide whether we actually want to
implement the upper-case directive or change all callers to lower-case.

But for now it's better to just accept %X and interpret it as lower-case,
in order to fix those error messages. Whether it's printed as upper or
lower case is more or less an aesthetic matter.

Reported-By: guido iodice <guido.iodice@gmail.com>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1846>
2025-02-28 12:51:44 +01:00
Enrico Weigelt, metux IT consult
53876f1ef1 randr: fix RRGetCrtcTransform reply length, part 2
Mixed up reply vs request. Obviously, the size substracted from reply
struct's one has to be the one of the generic reply, not generic requst :o

Background: the meaning of the length field isn't entirely intuitive.

a) the size is in 4-byte units, instead of bytes (therefore passing through
   bytes_to_int32() call)
b) it's not the total packet size, but only the *extra* payload size, ergo:
   how much is the packet longer than a xGenericReply = 8 units = 32 bytes.
   (min. packet size is 32 bytes -> length = 0)

In order to prevent those kind of coding errors ever happening again, it might
be a good idea putting that into a generic macro.

Fixes: c6f1b8a735
Fixes: 0ca5aaba50
Issue: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1797
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1845>
2025-02-27 12:18:20 +00:00
Enrico Weigelt, metux IT consult
fe156104cf Revert "mi: drop obsolete miInitOverlay()"
This reverts commit 12ab2e314b.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
41a75f01cc Revert "mi: drop obsolete miOverlayGetPrivateClips()"
This reverts commit 2c21824ee9.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
ab95b569e1 Revert "mi: drop obsolete miOverlayCollectUnderlayRegions()"
This reverts commit a860ce2c9f.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
4cdc184c13 Revert "mi: drop obsolete miOverlayComputeCompositeClip()"
This reverts commit bfb69b7316.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
9d88cc5f11 Revert "mi: drop obsolete miOverlayCopyUnderlay()"
This reverts commit be6985948d.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
d4f92a5688 Revert "mi: drop obsolete miOverlaySetRootClip()"
This reverts commit 00796cbf8c.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
0463d7aaaa Revert "mi: drop now obsolete mioverlay.c"
This reverts commit 65b738ed60.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
f1d87a38ae Revert "mi: drop now obsolete mioverlay.h"
This reverts commit 6825f89cd2.

Requested by Nvidia - their proprietary driver still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1843>
2025-02-27 11:53:54 +00:00
Enrico Weigelt, metux IT consult
0ca5aaba50 randr: fix RRGetCrtcTransform reply length
Reply length field missed to add the payload's size.

Fixes: c6f1b8a735
Issue: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1797
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1844>
2025-02-26 19:05:41 +01:00
Enrico Weigelt, metux IT consult
a0c1eeea98 xkb: simplify loops in XkbRF_Free()
Make the code a bit easier to read by simplifying the loops.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
abfbc76824 xkb: drop obsolete parameter from XkbRF_Free()
The freeRules parameter is always set to TRUE, meaning always free the
XkbRF_RulesRec struct. Therefore also no need to clear out fields that
aren't going to be reused again, ever.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
a88b17565b xkb: maprules: use static struct init instead of memset()
Allow the compiler to figure out the most efficient way to do the
struct initialization, and a little improvement on code readability.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
ffd7ca8af2 xkb: maprules: put some loop counters into local scope
Prevent from being accidentially removed and making the code a
little bit easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
60d37d0158 xkb: make XkbRF_Create() static inline
The function is nothing more than a calloc() call, so we can spare
an actual function call here by making it static inline.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
a82fa00835 xkb: unexport XkbRF_RuleRec struct
Not used outside xkb, so no need to keep it in public API header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
83c8a90a61 xkb: unexport XkbRF_GroupRec struct
Not used outside xkb, so no need to keep it in public API header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
043dc8041c xkb: unexport XkbRF_RulesRec struct
Not used by any drivers, so no need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
34372cb3da xkb: unexport XkbRF_Free()
Only used inside xkb/* - not used by any modules, so no need
to keep maintaining it in public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
89475cbed4 xkb: unexport XkbRF_Create()
Only used inside xkb/* - not used by any modules, so no need
to keep maintaining it in public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
c376cd2c3d xkb: unexport XkbRF_LoadRules()
Only used inside xkb/* - not used by any modules, so no need
to keep maintaining it in public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
d3b328ba4a xkb: unexport XkbRF_GetComponents()
Only used inside xkb/* - not used by any modules, so no need
to keep maintaining it in public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
b535fd7a4c xkb: move XkbRF_* defines into xkb/maprules.c
Only used there so no need to keep them in public API header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
1a9592ea4b xkb: move _XKB_RF_NAMES_PROP_ATOM define into xkbInit.c
It's only used there, nowhere else, so no need to keep it in
a public API header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
5030f23f94 xkb: drop unused XkbRF_Invalid define from xkbrules.h
Not used anywhere, so no need to keep it in public interface.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
975aed300e xkb: drop unused _XKB_RF_NAMES_PROP_MAXLEN define
Not used anywhere, so no need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
e38eeb4718 xkb: drop unused XkbRF_LoadRulesByName()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1840>
2025-02-26 13:43:52 +00:00
Enrico Weigelt, metux IT consult
00843efafb Xext: drop disable flag for GE extension
There's really no practical use for disabling GEEext, would just
cause the Xserver misbehaviour (eg. missing byte swapping)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1812>
2025-02-26 13:34:19 +00:00
Enrico Weigelt, metux IT consult
a7401945c4 dix: add prefix to grab state value defines
make it a bit easier to diffenciate from other symbols by
adding a prefix to their names.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1837>
2025-02-26 13:24:41 +00:00
Enrico Weigelt, metux IT consult
5f6cb45ac3 dix: unexport defines for device grab states
These aren't used anywhere in modules or outside DIX & XI, so
no need to keep them in public API any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1837>
2025-02-26 13:24:41 +00:00
Alan Coopersmith
42a1f25faf xkb: Add tbGetBufferString helper function
Handles common case of allocating & copying string to temporary buffer

(cherry picked from xorg/lib/libxkbfile@8a91517ca6ea77633476595b0eb5b213357c60e5)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1821>
2025-02-26 13:15:34 +00:00
Martin Burggraf
7a23010232 xkb: correcting mathematical nonsense in XkbGeomFPText
Fixes formatting of negative numbers, so they don't show minus sign
after the decimal point.

(cherry picked from xorg/lib/libxkbfile@d2ec504fec2550f4fd046e801b34317ef4a4bab9)

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1821>
2025-02-26 13:15:34 +00:00
Alan Coopersmith
60419d8e4a xkb: Convert more sprintf calls to snprintf in xkbtext.c
Based on xorg/lib/libxkbfile@390acfe5bb88cdab509b5eaae4041f265e969d2b

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1821>
2025-02-26 13:15:34 +00:00
José Expósito
6d33834186 xkb: Check that needed is > 0 in XkbResizeKeyActions
Passing a negative value in `needed` to the `XkbResizeKeyActions()`
function can create a `newActs` array of an unespected size.
Check the value and return if it is invalid.

This error has been found by a static analysis tool. This is the report:

    Error: OVERRUN (CWE-119):
    libX11-1.8.7/src/xkb/XKBMAlloc.c:811: cond_const:
      Checking "xkb->server->size_acts == 0" implies that
      "xkb->server->size_acts" is 0 on the true branch.
    libX11-1.8.7/src/xkb/XKBMAlloc.c:811: buffer_alloc:
      "calloc" allocates 8 bytes dictated by parameters
      "(size_t)((xkb->server->size_acts == 0) ? 1 : xkb->server->size_acts)"
      and "8UL".
    libX11-1.8.7/src/xkb/XKBMAlloc.c:811: var_assign:
      Assigning: "newActs" = "calloc((size_t)((xkb->server->size_acts == 0) ? 1 : xkb->server->size_acts), 8UL)".
    libX11-1.8.7/src/xkb/XKBMAlloc.c:815: assignment:
      Assigning: "nActs" = "1".
    libX11-1.8.7/src/xkb/XKBMAlloc.c:829: cond_at_least:
      Checking "nCopy > 0" implies that "nCopy" is at least 1 on the
      true branch.
    libX11-1.8.7/src/xkb/XKBMAlloc.c:830: overrun-buffer-arg:
      Overrunning buffer pointed to by "&newActs[nActs]" of 8 bytes by
      passing it to a function which accesses it at byte offset 15
      using argument "nCopy * 8UL" (which evaluates to 8).
    #  828|
    #  829|           if (nCopy > 0)
    #  830|->             memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i),
    #  831|                      nCopy * sizeof(XkbAction));
    #  832|           if (nCopy < nKeyActs)

(cherry picked from xorg/lib/libx11@af1312d2873d2ce49b18708a5029895aed477392)

Signed-off-by: José Expósito <jexposit@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1821>
2025-02-26 13:15:34 +00:00
Alan Coopersmith
09c6f09eb7 xkb: ensure XkbAllocNames sets num_rg to 0 on allocation failure
If there was a previous radio_groups array which we failed to realloc
and freed instead, clear the array size in the XkbNamesRec.

Taken from xorg/lib/libx11@258a8ced681dc1bc50396be7439fce23f9807e2a

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1821>
2025-02-26 13:15:34 +00:00
Michel Dänzer
f73f8ccb60 ci: Install XCB dependencies for meson tests
The lack of these prevented some of the tests from running in CI.
2025-02-26 09:57:07 +01:00
Peter Hutterer
68c17477d2 mi: guard miPointer functions against NULL dereferences
Already in place for some functions, let's add it to most others.
The only function missing is miPointerSetPosition() which needs to
return the ScreenPtr and that one is unclear if we don't have a screen -
returning NULL will crash the caller(s) so let's wait for something to
trigger this bug before we try to fix it wrongly.

Related to #1782

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1771>
2025-02-26 04:17:03 +00:00
Peter Hutterer
acbdd0ecdd mi: don't crash on miPointerGetPosition for disabled devices
If a device is disabled, its master device is forcibly reset to NULL but
unlike a floating device it doesn't have a sprite allocated. Calling
miPointerGetPosition for a disabled device thus crashes.

Avoid this by returning 0/0 for any device without a miPointer.
This is a quick fix only, a proper fix for this issue is rather more
involved.

Closes #1782

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1771>
2025-02-26 04:17:02 +00:00
Olivier Fourdan
05e54fefaf test: Fix xsync test
The xsync test is relying on the values being changed even in the case
of a BadMatch value.

Typically, it updates the delta but does not update the test type
comparison, so when passing a negative value, it generates a BadMatch.

That's actually not correct, and that will fail with the new fixes that
check the validity of the values prior to apply the changes.

Fix the test by updating the test type as needed.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1835>
2025-02-25 19:25:40 +01:00
Olivier Fourdan
c285798984 sync: Apply changes last in SyncChangeAlarmAttributes()
SyncChangeAlarmAttributes() would apply the various changes while
checking for errors.

If one of the changes triggers an error, the changes for the trigger,
counter or delta value would remain, possibly leading to inconsistent
changes.

Postpone the actual changes until we're sure nothing else can go wrong.

Related to CVE-2025-26601, ZDI-CAN-25870

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 16:11:58 +01:00
Olivier Fourdan
8cbc90c881 sync: Do not fail SyncAddTriggerToSyncObject()
We do not want to return a failure at the very last step in
SyncInitTrigger() after having all changes applied.

SyncAddTriggerToSyncObject() must not fail on memory allocation, if the
allocation of the SyncTriggerList fails, trigger a FatalError() instead.

Related to CVE-2025-26601, ZDI-CAN-25870

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
f52cea2f93 sync: Check values before applying changes
In SyncInitTrigger(), we would set the CheckTrigger function before
validating the counter value.

As a result, if the counter value overflowed, we would leave the
function SyncInitTrigger() with the CheckTrigger applied but without
updating the trigger object.

To avoid that issue, move the portion of code checking for the trigger
check value before updating the CheckTrigger function.

Related to CVE-2025-26601, ZDI-CAN-25870

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
16a1242d0f sync: Do not let sync objects uninitialized
When changing an alarm, the change mask values are evaluated one after
the other, changing the trigger values as requested and eventually,
SyncInitTrigger() is called.

SyncInitTrigger() will evaluate the XSyncCACounter first and may free
the existing sync object.

Other changes are then evaluated and may trigger an error and an early
return, not adding the new sync object.

This can be used to cause a use after free when the alarm eventually
triggers.

To avoid the issue, delete the existing sync object as late as possible
only once we are sure that no further error will cause an early exit.

CVE-2025-26601, ZDI-CAN-25870

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
6e0f332ba4 dix: Dequeue pending events on frozen device on removal
When a device is removed while still frozen, the events queued for that
device remain while the device itself is freed.

As a result, replaying the events will cause a use after free.

To avoid the issue, make sure to dequeue and free any pending events on
a frozen device when removed.

CVE-2025-26600, ZDI-CAN-25871

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
b07192a8be composite: initialize border clip even when pixmap alloc fails
If it fails to allocate the pixmap, the function compAllocPixmap() would
return early and leave the borderClip region uninitialized, which may
lead to the use of uninitialized value as reported by valgrind:

 Conditional jump or move depends on uninitialised value(s)
    at 0x4F9B33: compClipNotify (compwindow.c:317)
    by 0x484FC9: miComputeClips (mivaltree.c:476)
    by 0x48559A: miValidateTree (mivaltree.c:679)
    by 0x4F0685: MapWindow (window.c:2693)
    by 0x4A344A: ProcMapWindow (dispatch.c:922)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)
  Uninitialised value was created by a heap allocation
    at 0x4841866: malloc (vg_replace_malloc.c:446)
    by 0x4F47BC: compRedirectWindow (compalloc.c:171)
    by 0x4FA8AD: compCreateWindow (compwindow.c:592)
    by 0x4EBB89: CreateWindow (window.c:925)
    by 0x4A2E6E: ProcCreateWindow (dispatch.c:768)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)

 Conditional jump or move depends on uninitialised value(s)
    at 0x48EEDBC: pixman_region_translate (pixman-region.c:2233)
    by 0x4F9255: RegionTranslate (regionstr.h:312)
    by 0x4F9B7E: compClipNotify (compwindow.c:319)
    by 0x484FC9: miComputeClips (mivaltree.c:476)
    by 0x48559A: miValidateTree (mivaltree.c:679)
    by 0x4F0685: MapWindow (window.c:2693)
    by 0x4A344A: ProcMapWindow (dispatch.c:922)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)
  Uninitialised value was created by a heap allocation
    at 0x4841866: malloc (vg_replace_malloc.c:446)
    by 0x4F47BC: compRedirectWindow (compalloc.c:171)
    by 0x4FA8AD: compCreateWindow (compwindow.c:592)
    by 0x4EBB89: CreateWindow (window.c:925)
    by 0x4A2E6E: ProcCreateWindow (dispatch.c:768)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)

 Conditional jump or move depends on uninitialised value(s)
    at 0x48EEE33: UnknownInlinedFun (pixman-region.c:2241)
    by 0x48EEE33: pixman_region_translate (pixman-region.c:2225)
    by 0x4F9255: RegionTranslate (regionstr.h:312)
    by 0x4F9B7E: compClipNotify (compwindow.c:319)
    by 0x484FC9: miComputeClips (mivaltree.c:476)
    by 0x48559A: miValidateTree (mivaltree.c:679)
    by 0x4F0685: MapWindow (window.c:2693)
    by 0x4A344A: ProcMapWindow (dispatch.c:922)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)
  Uninitialised value was created by a heap allocation
    at 0x4841866: malloc (vg_replace_malloc.c:446)
    by 0x4F47BC: compRedirectWindow (compalloc.c:171)
    by 0x4FA8AD: compCreateWindow (compwindow.c:592)
    by 0x4EBB89: CreateWindow (window.c:925)
    by 0x4A2E6E: ProcCreateWindow (dispatch.c:768)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)

Fix compAllocPixmap() to initialize the border clip even if the creation
of the backing pixmap has failed, to avoid depending later on
uninitialized border clip values.

Related to CVE-2025-26599, ZDI-CAN-25851

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
c1ff84bef2 composite: Handle failure to redirect in compRedirectWindow()
The function compCheckRedirect() may fail if it cannot allocate the
backing pixmap.

In that case, compRedirectWindow() will return a BadAlloc error.

However that failure code path will shortcut the validation of the
window tree marked just before, which leaves the validate data partly
initialized.

That causes a use of uninitialized pointer later.

The fix is to not shortcut the call to compHandleMarkedWindows() even in
the case of compCheckRedirect() returning an error.

CVE-2025-26599, ZDI-CAN-25851

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
bba9df1a9d Xi: Fix barrier device search
The function GetBarrierDevice() would search for the pointer device
based on its device id and return the matching value, or supposedly NULL
if no match was found.

Unfortunately, as written, it would return the last element of the list
if no matching device id was found which can lead to out of bounds
memory access.

Fix the search function to return NULL if not matching device is found,
and adjust the callers to handle the case where the device cannot be
found.

CVE-2025-26598, ZDI-CAN-25740

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
0e4ed94952 xkb: Fix buffer overflow in XkbChangeTypesOfKey()
If XkbChangeTypesOfKey() is called with nGroups == 0, it will resize the
key syms to 0 but leave the key actions unchanged.

If later, the same function is called with a non-zero value for nGroups,
this will cause a buffer overflow because the key actions are of the wrong
size.

To avoid the issue, make sure to resize both the key syms and key actions
when nGroups is 0.

CVE-2025-26597, ZDI-CAN-25683

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
80d69f0142 xkb: Fix computation of XkbSizeKeySyms
The computation of the length in XkbSizeKeySyms() differs from what is
actually written in XkbWriteKeySyms(), leading to a heap overflow.

Fix the calculation in XkbSizeKeySyms() to match what kbWriteKeySyms()
does.

CVE-2025-26596, ZDI-CAN-25543

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
11fcda8753 xkb: Fix buffer overflow in XkbVModMaskText()
The code in XkbVModMaskText() allocates a fixed sized buffer on the
stack and copies the virtual mod name.

There's actually two issues in the code that can lead to a buffer
overflow.

First, the bound check mixes pointers and integers using misplaced
parenthesis, defeating the bound check.

But even though, if the check fails, the data is still copied, so the
stack overflow will occur regardless.

Change the logic to skip the copy entirely if the bound check fails.

CVE-2025-26595, ZDI-CAN-25545

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Peter Hutterer
b0a09ba602 dix: keep a ref to the rootCursor
CreateCursor returns a cursor with refcount 1 - that refcount is used by
the resource system, any caller needs to call RefCursor to get their own
reference. That happens correctly for normal cursors but for our
rootCursor we keep a variable to the cursor despite not having a ref for
ourselves.

Fix this by reffing/unreffing the rootCursor to ensure our pointer is
valid.

Related to CVE-2025-26594, ZDI-CAN-25544

Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Olivier Fourdan
01642f263f Cursor: Refuse to free the root cursor
If a cursor reference count drops to 0, the cursor is freed.

The root cursor however is referenced with a specific global variable,
and when the root cursor is freed, the global variable may still point
to freed memory.

Make sure to prevent the rootCursor from being explicitly freed by a
client.

CVE-2025-26594, ZDI-CAN-25544

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

v2: Explicitly forbid XFreeCursor() on the root cursor (Peter Hutterer
<peter.hutterer@who-t.net>)
v3: Return BadCursor instead of BadValue (Michel Dänzer
<michel@daenzer.net>)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1828>
2025-02-25 11:43:01 +01:00
Jan Engelhardt
530e80375e glamor: explicitly draw endpoints of line segments
The OpenGL 4.6 specification §14.5.1 "Basic Line Rasterization"
figure 14.2 says:

"""A diamond shaped region of height 1 is placed around each fragment
center; those regions that the line segment **exits** cause
rasterization to produce corresponding fragments."""

As the line does not necessarily exit the last diamond,
it is necessary to explicitly paint a pixel at line ends.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1434
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1755>
2025-02-24 20:39:12 +00:00
Enrico Weigelt, metux IT consult
6fad884ce7 randr: RRScreenInit(): drop unnecessary zero'ing
The whole struct is already allocated by calloc(), so no need to explicitly
zero-out individual fields.

Fixes: 479b2be4ba - Clear allocated RandR screen private structure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
73467faeb2 randr: ProcRRQueryOutputProperty(): use SwapShort()/SwapLong()
Simplify reply payload preparation and sendout by using SwapShort()
and SwapLong() instead of WriteToClientSwapped() and callbacks.

This also allows even further simplifications by using generic macros
for the request send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
e3001b71b3 randr: ProcRRListOutputProperties(): use SwapShort()/SwapLong()
Simplify reply payload preparation and sendout by using SwapShort()
and SwapLong() instead of WriteToClientSwapped() and callbacks.

This also allows even further simplifications by using generic macros
for the request send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
d9863f7cb0 randr: ProcRRGetCrtcGamma(): use SwapShort()/SwapLong()
Simplify reply payload preparation and sendout by using SwapShort()
and SwapLong() instead of WriteToClientSwapped() and callbacks.

This also allows even further simplifications by using generic macros
for the request send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
62b8497999 randr: ProcRRGetProviderProperty(): use SwapShort()/SwapLong()
Simplify reply payload preparation and sendout by using SwapShort()
and SwapLong() instead of WriteToClientSwapped() and callbacks.

This also allows even further simplifications by using generic macros
for the request send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
8789be52a4 randr: ProcRRGetOutputProperty(): use SwapShort()/SwapLong()
Simplify reply payload preparation and sendout by using SwapShort()
and SwapLong() instead of WriteToClientSwapped() and callbacks.

This also allows even further simplifications by using generic macros
for the request send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
53d43bd8dc randr: ProcRRGetOutputProperty(): rename reply struct to "rep"
Harmonize it with all the other reply struct fields, so we can later
use generic macros for final preparation and writeout.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
05188ccec1 randr: RRCreateProviderProperty(): use calloc()
We can rely on everything being cleared. And usually even faster, as the
compiler can emit optimized instructions for clearing a whole block at once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
3d3137513a randr: RROutputCreate(): use calloc()
We can rely on everything being cleared. And usually even faster, as the
compiler can emit optimized instructions for clearing a whole block at once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
1bc6ca30a9 randr: ProcRRGetMonitors(): collect reply payload in temporary buffer
Instead of arbitrary count of individual WriteToClient() calls on small
chunks, collect the whole payload in a buffer and write it out all at once.

This also makes possible to use generic macros for reply sending, as well
as further simplifications in the write-out path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
203f59c6d3 randr: ProcRRGetMonitors() use SwapLongs instead of callbacks
WriteSwappedDataToClient() calls a callback on each single field.
We can have it easier and more efficient by just using SwapLongs()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
c6f1b8a735 randr: ProcRRGetCrtcTransform(): split reply header and payload
Using struct initializer for the reply header and only allocating the
payload on heap. This allows using generic macros for reply preparation
and send-out later.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
90abc95c85 randr: ProcRRGetCrtcInfo(): use locally scoped variables
Improve readability by moving the variables into local scopes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
7eff742ef2 randr: use struct initializer for reply structs
Improve readability, move the declarations to where they're needed first
and get rid of extra individual assignments. In some cases this should also
allow the compiler to produce a bit more efficient code.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
6d2c42d0c8 randr: RRCrtcCreate(): drop unnecessary zero assigments
The struct is already zero'ed out by calloc(), so no need to additionally
clear individual fields.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
058815bed1 randr: use explicit case statement instead of SProcRandrVector table
No need to go indirectly through a vector table, since everything's fixed
anyways. It's not a pretty robust programming style: any changes need great
care, in order to not mix up things.

Replacing this by direct switch/case statement, which is using the defines
from the xrandr protocol headers. Also adding a little bit more protection
against subtle programming errors and reducing cognitive load (source size)
on understanding the code by using a tiny macro for deducing define name and
function name from the request's name.

This approach actually uncovered some subtle bug that had been waiting in
the dark for over 15 years.

As collateral benefit, getting a tiny bit better performance.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
42677ae1e3 randr: use explicit case statement instead of ProcRandrVector table
No need to go indirectly through a vector table, since everything's fixed
anyways. It's not a pretty robust programming style: any changes need great
care, in order to not mix up things.

Replacing this by direct switch/case statement, which is using the defines
from the xrandr protocol headers. Also adding a little bit more protection
against subtle programming errors and reducing cognitive load (source size)
on understanding the code by using a tiny macro for deducing define name and
function name from the request's name.

This approach actually uncovered some subtle bug that had been waiting in the
dark for over 15 years (see commit b87314c876)

As collateral benefit, getting a tiny bit better performance.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
ed17224403 randr: let SProc*'s call their Proc*'s directly
No need to go indirectly through an vector table. It's much clearer and
easier to understand when calling them directly. And a tiny bit performance
improvement as collateral benefit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
2025-02-24 20:30:26 +00:00
Enrico Weigelt, metux IT consult
1fc9a26afd drop not needed includes of geext.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1810>
2025-02-24 20:19:55 +00:00
Enrico Weigelt, metux IT consult
a955b83848 Xext: dpms: need to include geext.h
It's calling GERegisterExtension(), which is defined in geext.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1810>
2025-02-24 20:19:55 +00:00
Enrico Weigelt, metux IT consult
ce1f0c9375 present: need to include geext.h
It's calling GERegisterExtension(), which is defined in geext.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1810>
2025-02-24 20:19:55 +00:00
Enrico Weigelt, metux IT consult
80593ab279 misc.h: move out MAXEXTENSIONS to geext.c
The only user of it is geext.c, so no need to have that define
in a public include file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1810>
2025-02-24 20:19:55 +00:00
Enrico Weigelt, metux IT consult
3f469acb96 panoramix: don't install panoramiX.h and panoramiXsrv.h
Not used by any drivers/modules, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1815>
2025-02-24 20:06:30 +00:00
Enrico Weigelt, metux IT consult
86244ff36f dbe: fix byte swapping in SProcDbeSwapBuffers()
The loop forgot to move the SwapInfo pointer, so the same list entry
gets swapped over and over again, while the remaining ones get ignored.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1822>
2025-02-24 16:24:53 +01:00
Enrico Weigelt, metux IT consult
de0aed0543 misc.h: move out checked_int64_(add|subtract)
These inline functions are used only in exactly one place,
so no need to keep them in a public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1808>
2025-02-23 18:08:45 +00:00
Enrico Weigelt, metux IT consult
b664b44869 present: fix prototype for present_select_input()
Wants XID instead of CARD32 for 2nd parameter.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1809>
2025-02-23 18:01:02 +00:00
Enrico Weigelt, metux IT consult
90bc995016 Xext: geext: move geeint.h stuff into geext.c
Everything in here only used by geext.c, so no need to keep
a separate header file for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
658f1b34ee Xext: geext.h: fix missing include of Xfuncproto.h
Needed for _X_EXPORT.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
20d4c40df4 Xext: geext.h: don't include <dix-config.h>
Really no need to ever include it from here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
a7600ac884 Xext: geext: move struct _GEExtension into geext.c
Not used anywhere outside geext implementation itself,
so shouldn't be public at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
896937298b Xext: geext: unexport GEExtensions[]
This field isn't used by anybody outside, nor should it be accessed
directly. So better make it local.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
6fa340c578 Xext: geext: drop unused GEInitEvent()
This function isn't called by anybody, so no need to keep it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
480a7e4b11 Xext: geext: drop unused GEV() macro
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
ae7bbd36df Xext: geext: drop unused GEEXT() macro
Not used by anybody, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
b865f44f5e Xext: geext: drop unused GEEXTIDX() macro
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
1006a37f7d Xext: geext: drop unused GEMaskIsSet() macro
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
c1d49e19b9 Xext: geext: drop unused GECLIENT() macro
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
01ad88b8c8 Xext: geext: drop unused GEIsType() macro
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
bdb5d4867a Xext: geext: drop unused GEEventFill() macro
It's not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1811>
2025-02-23 17:53:25 +00:00
Enrico Weigelt, metux IT consult
1dc648b1b7 os: drop unused TimerCheck()
This isn't used anywhere, so can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1789>
2025-02-23 17:46:13 +00:00
Enrico Weigelt, metux IT consult
d973c43810 os: unexport SetCriticalOutputPending()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1814>
2025-02-23 17:39:18 +00:00
Enrico Weigelt, metux IT consult
573d70ae25 xwin: don't need NULL check before free()
free() is safe against NULL arguments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1818>
2025-02-23 17:32:49 +00:00
Enrico Weigelt, metux IT consult
eafec5836a glamor: don't need NULL check before free()
free() is safe against NULL arguments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1818>
2025-02-23 17:32:49 +00:00
Enrico Weigelt, metux IT consult
e4e3b69626 Xext: geext: fix regression in SProcGEQueryVersion()
Commit 36dd28129b had an ugly typo
(probably broke on rebase - shame on myself) causing SProcGEQueryVersion()
calling itself recursively. Obviously, ProcGEQueryVersion() needs
to be called instead.

Fixes: 36dd28129b
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1817>
2025-02-23 17:25:29 +00:00
Enrico Weigelt, metux IT consult
7ca8c1518c present: need to include <X11/Xfuncproto.h>
Some headers making use of X_EXPORT macro, so Xfuncproto.h should be
included explicitly, instead of silently relying any other include
already doing that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1813>
2025-02-23 17:18:46 +00:00
Enrico Weigelt, metux IT consult
b55d726a7b present: need to include dix-config.h
dix-config.h always needs to be included first, otherwise things
can get messed up in really obscure ways, eg. certain types silently
changing in size and causing mysterious crashes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1813>
2025-02-23 17:18:46 +00:00
Enrico Weigelt, metux IT consult
2e6f3a632b meson.build: enable VLA warning
variable length arrays can be dangerous, so better don't use
them at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1819>
2025-02-20 17:28:05 +01:00
Enrico Weigelt, metux IT consult
b4f0c1abd5 test: sync: don't use VLA
The array size is fixed anyways, so we can use a symbol instead
of variable.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1819>
2025-02-20 17:28:01 +01:00
Enrico Weigelt, metux IT consult
f894801fa2 xfree86: modesetting: don't use VLA
even through this specific case is correct and safe, it's safer to
remove all VLA usages and forbid them completely by compiler flag.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1819>
2025-02-20 17:26:49 +01:00
Doug Brown
a0834009cf dri2: Protect against dri2ClientPrivate assertion failures
If DRI2ScreenInit hasn't been called yet, DRI2Authenticate and
DRI2CreateDrawable2 cause the X server to crash. This has been observed
to happen on multiple modern Linux distros in various conditions,
including QEMU and VMware VMs. Make these functions more robust in order
to prevent the crash.

This patch was originally provided by Bernhard Übelacker and expanded
upon by Mark Wagner.

Signed-off-by: Doug Brown <doug@schmorgal.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1053
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1534
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1608>
2025-02-19 11:25:01 +00:00
Enrico Weigelt, metux IT consult
6c88eb0cc4 misc.h: unexport compare_version()
Not used by any external modules, so no need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1807>
2025-02-18 11:17:40 +00:00
Enrico Weigelt, metux IT consult
804b2c081b os: unexport CloseWellKnownConnections()
Not used by any modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
0d95b53a20 os: unexport ResetWellKnownSockets()
Not used by any modules (and not supposed to be), so should not
be exported at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
dd05532b38 os: unexport CreateWellKnownSockets()
Not used by any modules (and not supposed to be), so should not
be exported at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
59b39ee6ee os: unexport NotifyParentProcess()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
c9ee4245a2 os: unexport ResetOsBuffers()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
583dbe832d os: unexport FlushIfCriticalOutputPending()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
be16616715 os: unexport FlushAllOutput()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
c6b223459c os: unexport ResetCurrentRequest()
Not used by any external modules, so no need to keep it in public API.

Since it's used by DRI, still needs the _X_EXPORT flag, as long as DRI
is a dynamically loaded module.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:45 +00:00
Enrico Weigelt, metux IT consult
189a70dfb2 os: unexport InsertFakeRequest()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
ba665948f6 os: unexport WriteFdToClient()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
effe8d66bd os: unexport ReadRequestFromClient()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
9b0c3c62f2 os: unexport ListenOnOpenFD()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
d637e1d284 os: unexport AddClientOnOpenFD()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
a84ae08526 os: unexport ClientAuthorized()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
c6b8207342 os: unexport AuthorizationIDOfClient()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
1f27d3d653 os: unexport ClientIsLocal()
Not used by any modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1790>
2025-02-18 10:53:44 +00:00
Enrico Weigelt, metux IT consult
6ec89c91f3 ci: update freebsd builder image
FreeBSD upstream removed image for 14.0 image, so we need to update.
Also increasing image size, since the new images are too small.
(needs update of ci-templates)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1784>
2025-02-18 10:43:28 +01:00
Enrico Weigelt, metux IT consult
80f5d29c84 xfree86: doc: update docs on XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
e88762896e xfree86: inputtest: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
2a10eff6c5 xfree86: modsetting: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
c8ad9c6567 xfree86: exa: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
c862cf3c3a xfree86: fbdevhw: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
d87e93bf40 xfree86: xf86int10module: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
f54993a222 xfree86: xfbmodule: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
a2e20304e0 xfree86: vgaHWmodule: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
3066125bec xfree86: shmodule: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
f0590decb6 xfree86: sfbmodule: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
03becba76b xfree86: glxmodule: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
7dd8d0627c xfree86: fbmodule: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:30 +00:00
Enrico Weigelt, metux IT consult
c46e645bad glamor: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:29 +00:00
Enrico Weigelt, metux IT consult
1848027892 xfree86: xf86configure: use NULL instead of 0
Zero pointers should be initialized w/ NULL instead of raw 0.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:29 +00:00
Enrico Weigelt, metux IT consult
346d5f5c35 os: move BUG_*() macros to own private header
These macros aren't used by any external modules, so no need
to keep them public. Moving them into private header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1804>
2025-02-17 19:32:48 +00:00
Enrico Weigelt, metux IT consult
a6b2eb3780 misc.h: drop LengthRestB() macro
Only used at exactly one place, for trivial size computation, so not worth
having an extra macro in a public header for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1805>
2025-02-17 19:25:14 +00:00
Alan Coopersmith
9af363b046 ci: update XTS to a commit that doesn't require -fcommon workaround
xorg/test/xts!10 fixed XTS to build with recent gcc without adding -fcommon

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1786>
2025-02-17 19:16:04 +00:00
Enrico Weigelt, metux IT consult
f209ac2014 doc: drop removed PaintWindowBackground() and PaintWindowBorder()
These have been removed 1.5 decades ago.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1785>
2025-02-17 19:05:55 +00:00
Enrico Weigelt, metux IT consult
f4d878086e Xext: selinux: use static reply struct init on declaration
Make the code a bit easier to read by using initialization of the reply
structs, at the point of declaration. Most of them aren't written to later,
just passed into WriteReplyToClient(). Also dropping some useless zero
assignments (struct initializers automatically zero-out unmentioned fields).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1795>
2025-02-17 18:58:10 +00:00
Enrico Weigelt, metux IT consult
94d942267a dri: report failed memory allocation
ProcXF86DRIGetDrawableInfo() should report failed memory allocation instead
of pretending everything's okay.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1797>
2025-02-17 18:50:25 +00:00
Enrico Weigelt, metux IT consult
2539ddae50 modsetting: also add libglx to library symbol test
Increase test coverage a bit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1798>
2025-02-17 18:42:52 +00:00
Enrico Weigelt, metux IT consult
e10283d842 xfree86: os-support: unexport xf86scanpci()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1800>
2025-02-17 18:35:43 +00:00
Enrico Weigelt, metux IT consult
b3ec0bf58a dix: unexport MakePredeclaredAtoms()
Should never be called by modules/drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1802>
2025-02-17 18:13:33 +00:00
Enrico Weigelt, metux IT consult
9dc26f6743 os: no need to defined PATH_MAX
All our supported platforms define it, so no need to do
it on our own.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1803>
2025-02-17 16:55:13 +01:00
Enrico Weigelt, metux IT consult
6c24e53a89 os: drop upstart specific SIGSTOP signaling logic
Upstart is long dead, discontinued a decade ago, so there's no
need to keep around a special signaling logic just for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1791>
2025-02-14 14:25:28 +01:00
Enrico Weigelt, metux IT consult
6349773d5e mi: (re)export and document miPointerInitialize()
Xrdp project request exporting this function again, because (unlike the
usual xf86-video-* drivers) they need their own custom cursor handling:
RDP is designed to draw cursors on client side.

Also documenting what the function does.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1787>
2025-02-13 23:53:39 +00:00
Andy Myers
7933cc24d0 xvfb: Add multiple CRTC support
Multiple CRTCs can be added on a per-screen basis with the new -crtcs
option. Each CRTC has one associated output. Outputs beyond the first
are disabled by default and can be enabled by setting a mode. Outputs
can be disabled again by setting the associated CRTC's mode and output
to None.

Signed-off-by: Andy Myers <andy.myers@zetier.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1749>
2025-02-13 23:22:49 +00:00
Enrico Weigelt, metux IT consult
b61647f3a1 dix: add in-code docs for dixDestroyPixmap()
Give some more explaination for the dixDestroyPixmap() function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
ee798cf212 exa: simplify CreatePixmap()/DestroyPixmap() handlers error pathes
Instead of complex wrap/unwrap trickery in the error path, just
protect the DestroyPixmap() handlers from half-initialized state.

Prior to this change, we always had to make sure, the we're calling
the original (screen driver's) handler directly, instead of our own
(which calls the original one, too), so it doesn't do any damage.
This isn't necessary anymore, since it finds out on it own what to do.

This not just makes the code flow simpler and easier to understand, but
also clears the road for decoupling the extension specific pixmap destructor
logic from the ScreenRec proc vectors (*1).

*1) see: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1755
         https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
69837185c0 glx: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
0132baa422 xwayland: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
4d1953728e xfree86: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
c117925ace vfb: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
4378656cbb kdrive: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
0a54e24721 xnest: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
c8607ca66f render: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
d2a93d0346 randr: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
4628254698 mi: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
372a510ef0 miext: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
7a0f8301c5 glamor: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
08ec122fa7 fb: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
9ca03e6da0 exa: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
4694b8488e dri3: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
668d9fc40e dbe: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
eb5476381a composite: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
5b541780c1 dix: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
c0f3b5bcef Xext: shm: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
7ce19233bc Xext: saver: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult
984da40fbb doc: document that ScreenRec->DestroyPixmap() shouldn't be called directly
Direct calls to ScreenRec->DestroyPixmap() is fragile and blocks cleaning up
the wrapping jungle, so use the proper dix function instead.

While this function originally wasn't made for that purpose (and so we have an
useless parameter here, and the naming isn't entirely correct), it's the best
effort we have right now, without breaking existing API: it's already exported
since long time, so drivers can be easily converted and still work with both
new and older Xserver ABI versions.

Retrospectively, this already should have been done 20 years ago.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:26 +01:00
Enrico Weigelt, metux IT consult
2e0c19b6d9 dix: add getter for display name
Xrdp needs to know the current display name (for setting up it's
own server sockets accordingly). Instead of exporting an internal
field, adding a little getter for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1783>
2025-02-11 19:13:01 +01:00
Enrico Weigelt, metux IT consult
80a3df55ae xfree86: xf86Opt.h: fix missing include
<X11/Xdefs.h> is needed for `Bool` type.

Consumers shouldn't have to rely on Xdefs.h being accidentally included
by something else.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1782>
2025-02-11 14:52:15 +00:00
Enrico Weigelt, metux IT consult
5f1bdd0aa3 ci: add intel driver to build matrix
Add the intel driver to our CI, in order to prevent API breaks going
unnoticed again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1778>
2025-02-11 09:53:59 +01:00
Enrico Weigelt, metux IT consult
d4f60b5462 ci: workaround for building xf86-video-intel via autotools
This driver's meson build scripts are currently broken, but autotools
still works fine. So add a little workaround for forcing it to be built
via autotools, even if meson.build file is there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1778>
2025-02-11 09:53:59 +01:00
Enrico Weigelt, metux IT consult
9b3b938ede os: re-add System() function for backwards compat
This function had been unexported long ago, but the Intel driver
still needs it. Adding a tiny temporary compat wrapper, so Intel
team has time to keep up with us.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1778>
2025-02-11 09:53:59 +01:00
Enrico Weigelt, metux IT consult
5b6f2292a3 os: drop win32-only System() function
Not used anymore, so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1778>
2025-02-11 09:53:59 +01:00
Enrico Weigelt, metux IT consult
f837dee79d win32: use lib system() instead of our own function
mingw32 has system() function, so we don't need our own implementation
anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1778>
2025-02-11 09:53:59 +01:00
Enrico Weigelt, metux IT consult
6789b911c4 render: picturestr.h: re-add compat macros for intel driver
The ancient pict_f_vector and pixman_f_vector macros have been a fallout
from long ago transition to pixman and had been removed quite a while ago.

Unfortunately, Intel driver (which is not under our reign) hasn't been
kept up to date yet. So re-adding the compat macro, until Intel driver
team had a chance to keep up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1778>
2025-02-11 09:53:59 +01:00
Aki Sakurai
3562298068 xquartz: fix inverted tablet pen Y tilt on macOS
On macOS, the y tilt behavior is inverted; an increase in the tilt
value corresponds to tilting the device away from the user.

see https://chromium-review.googlesource.com/c/chromium/src/+/2348544
see 0f128fd7c5/src/plugins/platforms/cocoa/qnsview_tablet.mm (L63)

Fixes #792

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1779>
2025-02-10 22:02:16 +08:00
Aki Sakurai
da0de21b72 xquartz: fix compilation
Fixes #1788

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1777>
2025-02-10 19:37:18 +08:00
Spiky Caterpillar
2631cad85d No longer leak FDs on VT switch.
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/997>
2025-02-08 17:38:20 +02:00
Randy Palamar
5677de586f os/osinit: fix build when execinfo.h is missing
HAVE_BACKTRACE gets set on systems with libunwind however
execinfo.h may be missing (on *BSD or musl for example).
HAVE_EXECINFO_H has been defined by the build system for a long
time but previously not used.

Signed-off-by: Randy Palamar <randy@rnpnr.xyz>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1207>
2025-02-08 15:22:29 +00:00
Enrico Weigelt, metux IT consult
143a6a21e1 miext: rootless: fix unused variables
Compiling w/ -Werror (which our CI does) breaks compile due a buch of
unused variables.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1703>
2025-02-08 15:15:57 +00:00
Enrico Weigelt, metux IT consult
6ee163cb94 mi: miexpose: fix FTBS w/ rootless helper
FTBS when rootless subsys enabled:

> ../mi/miexpose.c: In function ‘miPaintWindow’:
> ../mi/miexpose.c:411:15: error: unused variable ‘orig_pWin’ [-Werror=unused-variable]
>   411 |     WindowPtr orig_pWin = pWin;
>       |               ^~~~~~~~~
> cc1: all warnings being treated as errors

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1703>
2025-02-08 15:15:57 +00:00
Enrico Weigelt, metux IT consult
bcbc7479f3 xfree86: common: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1681>
2025-02-07 22:40:06 +00:00
Enrico Weigelt, metux IT consult
5fd918421a xfree86: fbdevhw: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1681>
2025-02-07 22:40:06 +00:00
Enrico Weigelt, metux IT consult
4ba0cf1f55 xfree86: os-support: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1681>
2025-02-07 22:40:06 +00:00
Enrico Weigelt, metux IT consult
1f93ec5c33 xfree86: i2c: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1681>
2025-02-07 22:40:06 +00:00
Enrico Weigelt, metux IT consult
76874498be glx: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1681>
2025-02-07 22:40:06 +00:00
Enrico Weigelt, metux IT consult
6fc4f35f62 xfree86: use LogMessageVerb() instead of xf86MsgVerb()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1681>
2025-02-07 22:40:06 +00:00
Enrico Weigelt, metux IT consult
8e8bf63908 os: move AbortServer() to os/utils.c
This function doesn't much to do with logging, except for being
called once by FatalError(). It's better placed in utils.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1678>
2025-02-07 18:45:35 +01:00
Ivaylo Dimitrov
579eb31222 linux: Fix BUS_PLATFORM detection for non-PCI devices
Commit 74b7427c41 (linux: Make platform device probe less fragile)
effectively dropped busid detection for non-PCI devices, for example on
OMAP we have "ID_PATH=platform-omapdrm.0". For such devices busid will not
be set, making platform probes (and server mediated fd support) impossible.

Fix that by extending config_udev_odev_setup_attribs() logic to support
platform devices as well.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1761>
2025-02-07 15:10:17 +00:00
Doug Johnson
e0588d2110 os: backtrace: Fix -Wincompatible-pointer-types compiler error on 32-bit targets
```
../os/backtrace.c: In function ‘print_registers’:
../os/backtrace.c:94:52: error: passing argument 3 of ‘_ULarm_get_reg’ from incompatible pointer type [-Wincompatible-pointer-types]
   94 |         ret = unw_get_reg(&cursor, regs[i].regnum, &val);
      |                                                    ^~~~
      |                                                    |
      |                                                    uint64_t * {aka long long unsigned int *}
```
Switched to libunwind's un_word_t type and PRIxPTR fprintf fmt specification

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1763>
2025-02-07 16:58:02 +02:00
Enrico Weigelt, metux IT consult
4f2c6c98b7 xfree86: mark LoaderShouldIgnoreABI() and LoaderGetABIVersion() deprecated
These functions are only used by the proprietary NVidia drivers,
so keeping them only for backwards compat. Nobody else should ever
really need them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1773>
2025-02-07 14:46:21 +01:00
Enrico Weigelt, metux IT consult
13a16de310 Revert "xfree86: loader: drop unused LoaderShouldIgnoreABI()"
This reverts commit d8c47a3db6.

Proprietary NVidia driver needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1773>
2025-02-07 14:46:21 +01:00
Enrico Weigelt, metux IT consult
ea118d3897 Revert "xfree86: loader: drop unused LoaderGetABIVersion()"
This reverts commit f3887956ec.

Proprietary NVidia drivers still needs it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1773>
2025-02-07 14:46:21 +01:00
Enrico Weigelt, metux IT consult
e3cbde9914 include: unexport no*Extension flags
Most of these flags aren't used by any drivers, so no need to keep them
exported. Only three exceptions: composite, Panoramix/Xinerama and Xv.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1519>
2025-02-07 12:00:58 +01:00
Enrico Weigelt, metux IT consult
356e18dcc6 os: move out extension disable flags to corresponing extensions
The OS abstraction isn't really the right place for those flags,
they are're probably better off in their corresponding extensions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1519>
2025-02-07 12:00:53 +01:00
Enrico Weigelt, metux IT consult
8539f35818 Revert "xv: unexport XvScreenRec and XvScreenPtr"
This reverts commit 58a2fb8b6f.

Needed by xf86-video-intel driver. Didn't get noticed, because we don't
have this driver in our CI yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1772>
2025-02-07 10:08:41 +01:00
Enrico Weigelt, metux IT consult
37dd2897d4 Xext: saver: consolidate (non-)xinerama versions
We can make it a bit simpler by doing the request header
checking only once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1591>
2025-02-06 23:56:51 +00:00
Enrico Weigelt, metux IT consult
8236ef3b56 Xext: saver: use explicit switch/case for dispatching
It's more robust / easier understandable programming style to use explicit
switch statements, case'ing on the constants defined in the protocol header,
instead of implicitly via a some opaque call table. It's also done this
way in the other extensions, so making the code a bit more consistent.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1591>
2025-02-06 23:56:51 +00:00
Enrico Weigelt, metux IT consult
40469a9d51 Xext: saver: skip unneeded zero init and zero-swapping
When using struct initializers, all fields not set explicitly are zero.
Also no need to swap fields that are known to be zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1591>
2025-02-06 23:56:51 +00:00
Enrico Weigelt, metux IT consult
fdb8c8ea41 Xext: saver: fix missing swap in QueryVersion reply
The `majorVersion` and `minorVersion` fields are CARD16, thus need to be swapped.
OTOH, the lengths field is zero anyways, so no need to swap it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1591>
2025-02-06 23:56:51 +00:00
Enrico Weigelt, metux IT consult
1efb2151e3 xfree86: sdksyms.sh: add more headers
Add some headers that are still needed by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:34 +00:00
Enrico Weigelt, metux IT consult
cf03948572 xfree86: move private definitions out of dri.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:34 +00:00
Enrico Weigelt, metux IT consult
1d3c26446d xfree86: move private definitions out of dri2.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:34 +00:00
Enrico Weigelt, metux IT consult
00c2a8fb0a xfree86: ddc: move private definitions from xf86DDC.h to xf86DDC_priv.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:34 +00:00
Enrico Weigelt, metux IT consult
d4724009ce xfree86: parser: move private defs from xf86Parser.h to xf86Parser_priv.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:34 +00:00
Enrico Weigelt, metux IT consult
ac5e95be49 xfree86: modes: move private definitions out of from xf86RandR12.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:33 +00:00
Enrico Weigelt, metux IT consult
013eaacdd0 xfree86: common: move private defs out of xf86VGAarbiter.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:33 +00:00
Enrico Weigelt, metux IT consult
df33e1c51b xfree86: common: move private defs from xf86Xinput.h to xf86Xinput_priv.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:33 +00:00
Enrico Weigelt, metux IT consult
a0eea4e0ec xfree86: int10: move private defs out of xf86int10.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:33 +00:00
Enrico Weigelt, metux IT consult
50d1a98c6a xfree86: common: move private defs out of xf86sbusBus.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1290>
2025-02-06 23:51:33 +00:00
Enrico Weigelt, metux IT consult
f4eb217f11 os: log: replace VErrorF() by LogVMessageVerb()
Since LogVMessageVerb() is now signal safe, we can use this one instead.
Leaving VErrorF() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
9652bc73e2 xwin: drop duplicate OsVendorVErrorF()
It really doesn't seem to be necessary to protect a LogVMessageVerb()
call by extra mutex on windows only, while obviously not needed on
any other platform.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
da22bc9ae0 os: log: replace VErrorFSigSafe() by VErrorF()
Since VErrorF() is now signal safe, we can use this one instead.
Leaving VErrorFSigSafe() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
2d18c353b4 os: log: replace ErrorFSigSafe() by ErrorF()
Since ErrorF() is now signal safe, we can use this one instead.
Leaving ErrorFSigSafe() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
dd37cc4855 os: log: replace LogMessageVerbSigSafe() by LogMessageVerb()
Since LogMessageVerb() is now signal safe, we can use this one instead.
Leaving LogMessageVerbSigSafe() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
5962211612 os: log: make LogVMessageVerb() signal safe
We already have our own signal safe vnsprintf() implementation, which is used
for formatting log messages while being in a signal handler, there's no need
to have two separate implementations of all the logging functions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
71b8953597 os: log: consolidate log formatting functions
Simplify log formatting functions and remove redundancies, e.g.:

* common function for line termination
* copy prefix directly instead of *printf'ing it
* now just exactly one LogSWrite() call per message
  (good for other log targets like syslog)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:27 +00:00
Enrico Weigelt, metux IT consult
f5fe8a6379 os: log: drop unused variables
Drop some unneeded variabes, whose values can be computed at compile-time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1691>
2025-02-06 23:35:26 +00:00
Enrico Weigelt, metux IT consult
a33639f975 xvmc: move over protocol version defines into xvmc.c
These are exclusively used in one source file, so no need to keep them
in a global header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1693>
2025-02-06 23:29:10 +00:00
Enrico Weigelt, metux IT consult
171db3b01b meson: drop defining BIGREQS
This symbol isn't used for decades, so no need to define it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1700>
2025-02-06 23:22:31 +00:00
Enrico Weigelt, metux IT consult
4235d2375a xfree86: vgahw: drop obsolete vgaHWSaveScreenWeak()
No callers left, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:40 +00:00
Enrico Weigelt, metux IT consult
be9b89ef0f xfree86: vgahw: drop obsolete vgaHWDisable()
No callers left, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:40 +00:00
Enrico Weigelt, metux IT consult
bb0295b397 xfree86: vgahw: drop obsolete vgaHWSetRegCounts
No callers left, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:40 +00:00
Enrico Weigelt, metux IT consult
515d19806c xfree86: vgahw: make vgaHWSaveColormap() static
No external callers anymore, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:40 +00:00
Enrico Weigelt, metux IT consult
79522220a6 xfree86: vgahw: make vgaHWSaveMode() static
No external callers left, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:40 +00:00
Enrico Weigelt, metux IT consult
f004998b78 xfree86: vgaha: make vgaHWRestoreColormap() static
No external callers left, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:40 +00:00
Enrico Weigelt, metux IT consult
30380cb207 xfree86: vgahw: make vgaHWRestoreMode() static
No external callers anymore, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:39 +00:00
Enrico Weigelt, metux IT consult
cd2457412f xfree86: vgahw: drop obsolete vgaHWBlankScreenWeak()
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:39 +00:00
Enrico Weigelt, metux IT consult
a415e6ed37 xfree86: vgahw: drop obsolete vgaHWProtectWeak()
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1724>
2025-02-06 23:15:39 +00:00
Enrico Weigelt, metux IT consult
00f69564c5 xfree86: common: unexport UnloadModule() and UnloadSubModule()
Not used by any driver/module, so no need to keep it exported.
Also making them type-safe.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1722>
2025-02-06 23:09:02 +00:00
Enrico Weigelt, metux IT consult
b0452ecff4 xfree86: drop obsolete macro INITARGS
This macro isn't used anymore for 12 years now, see commit:

    5079db78ae

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1722>
2025-02-06 23:09:02 +00:00
Enrico Weigelt, metux IT consult
f3887956ec xfree86: loader: drop unused LoaderGetABIVersion()
This function isn't called anywhere, neither in xserver nor modules, thus no
need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1722>
2025-02-06 23:09:02 +00:00
Enrico Weigelt, metux IT consult
d8c47a3db6 xfree86: loader: drop unused LoaderShouldIgnoreABI()
This function isn't called anywhere, neither in xserver nor modules, thus no
need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1722>
2025-02-06 23:09:02 +00:00
Enrico Weigelt, metux IT consult
24d693c5ae dix: make dixDestroyPixmap() NULL-proof
Make dixDestroyPixmap() check for NULL pointer, so callers don't need to
do it anymore. Returning TRUE on NULL pointer - but most callers won't
even look at the retval anyways.

Together with subsequent commits, which will make use of that function,
instead of calling raw ScreenRec->DestroyPixmap vectors, this gives us some
more freedom for architectural changes, eg. get rid of the extremely
complicated and fragile wrapping chains.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1709>
2025-02-06 23:02:06 +00:00
Enrico Weigelt, metux IT consult
ef62929f58 treewide: NULL-protect ScreenRec->DestroyPixmap() calls
Right now, we're assuming that even when deep nesting involved, the proc
vector is always set to a valid function. One the one hand it requires
extra dummy procs in some cases, OTOH it's making upcoming refactoring
of the code flow unnecessarily complex.

The big plot (of subsequent commits) is splitting out the extension's
(and possibly subsystem's) special logic out of the wrapping chain and
let them be executed independently from the DDX/drivers - when applicable
even only when the pixmap is really destroyed (not just unref'ed).
(At some later point, it might even become be actually a valid situation
that DestroyPixmap vector really being NULL.)

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754
See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1755

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1709>
2025-02-06 23:02:06 +00:00
Enrico Weigelt, metux IT consult
af2d3e9487 xnest: drop obsolete mi.h include
Since moving to mi_priv.h, we don't need to include mi.h here.

Fixes: 94451181c2
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1725>
2025-02-06 22:53:43 +00:00
Enrico Weigelt, metux IT consult
f8fc46cbbf include: drop now empty xkbfile.h
This (public) file isn't used by anybody outside Xserver tree
and doesn't contain anything useful anymore, so lets drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1729>
2025-02-06 22:45:25 +00:00
Enrico Weigelt, metux IT consult
3f8a5475c9 xkb: unexport remaining internal declarations
These are only used inside xkb/*, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1729>
2025-02-06 22:45:25 +00:00
Enrico Weigelt, metux IT consult
660657a2c3 xkb: unexport functions from xkbout.c
These are only used inside xkb/*, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1729>
2025-02-06 22:45:25 +00:00
Enrico Weigelt, metux IT consult
5d98664ec1 xkb: unexport functions from xkbfmisc.c
These are only used inside xkb/*, so no need to keep them exported.

Also replacing some macros by inline functions in order to improve
type-safety and debugging, and adding documentation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1729>
2025-02-06 22:45:25 +00:00
Enrico Weigelt, metux IT consult
114c1c84b1 xkb: move XkbConvertGetByNameComponents and make it static
This function has only one caller in xkb.c, so no need to keep it exported,
can be moved over into xkb.c and made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1729>
2025-02-06 22:45:25 +00:00
Enrico Weigelt, metux IT consult
cd52a8f8a4 xfree86: common: dont install xf86MatchDrivers.h
xf86MatchDrivers.h doesn't export any symbols, thus doesn't need to
be installed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1738>
2025-02-07 00:39:00 +02:00
Enrico Weigelt, metux IT consult
0b123a0413 xfree86: unexport xf86PlatformMatchDriver()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1738>
2025-02-07 00:38:58 +02:00
Enrico Weigelt, metux IT consult
16ca87703c xfree86: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
190346663b Xi: drop now obsolete swap procs
Lots of SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
dc9a998b96 Xext: xv: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
753e6c44ba Xext: xtest: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
0c87f9b1da Xext: xcmisc: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
9a3daf908c Xext: vidmode: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
3bb15b3e04 Xext: sync: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
c8c42490b7 Xext: shm: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
a7bdfdb3b5 Xext: shape: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
07131dccc5 Xext: saver: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:52 +00:00
Enrico Weigelt, metux IT consult
515992b046 Xext: panoramiX: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
98dbd817f6 Xext: dpms: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
0da419246e randr: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
851ce5c6a8 dbe: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
4c3ff75772 dix: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Also dropping now obsolete SProcNoOperation().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
643f91266e xwin: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
4cb141307c xwayland: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
65224a2f9a xquartz: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
7e5c342be1 xfree86: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
4d053f22f3 Xi: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
54d4dd619c Xext: xv: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
69982abf7b Xext: xtest: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:51 +00:00
Enrico Weigelt, metux IT consult
8a5d2a1335 Xext: selinux: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
8b57516414 Xext: xres: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
776efd3cfc Xext: xf86bigfont: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
405a227c73 Xext: xcmisc: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
65cb5e5575 Xext: vidmode: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
bf6d132df6 Xext: sync: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
75544f1f58 Xext: shm: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
a105c1f7a9 Xext: shape: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
cd413baa4b Xext: security: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
b52f5f9693 Xext: saver: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
23a8d9be71 Xext: panoramiX: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
fb40f65ee0 Xext: dpms: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:50 +00:00
Enrico Weigelt, metux IT consult
4f56025812 Xext: bigreq: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
d9760ad127 dri3: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
7e2bbba067 damage: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
fea6b99519 randr: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
00ab4ff813 render: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
5bcbacce6c present: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
4454b71f4b pseudoramiX: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
b4df6f1fe3 record: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
9b88a64ba9 dbe: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
96344583e4 composite: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
eea9e4e84b xfixes: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:49 +00:00
Enrico Weigelt, metux IT consult
9af095e121 xkb: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
44c063d93d Xext: xtest: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
c3e1f6fccf Xext: vidmode: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
dab1299745 Xext: shape: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
67a3319d73 Xext: security: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
bacc4b1477 Xext: saver: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
ef396a28b7 xquartz: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
a623060185 xkb: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
4b2115a182 randr: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
fc9f8f8d3c Xi: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
2025-02-06 22:28:48 +00:00
Enrico Weigelt, metux IT consult
e1e8ab3ddf mi: miline.h: drop DEFAULTZEROLINEBIAS from public header
This define in only used locally, in exactly one source file,
thus no neeed to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1726>
2025-02-06 22:18:12 +00:00
Enrico Weigelt, metux IT consult
c06d9da5b6 mi: miline.h: unexport only locally used macros
These macros are only used in one source file, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1726>
2025-02-06 22:18:11 +00:00
Enrico Weigelt, metux IT consult
36dd28129b Xext: geext: simplify dispatcher
Most of the complexity here isn't needed at all. It can be really trivial,
since we just have one operation anyways.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1596>
2025-02-06 21:26:32 +00:00
Enrico Weigelt, metux IT consult
6df7ba38ae Xext: geext: drop unused variable extEntry
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1596>
2025-02-06 21:26:32 +00:00
Enrico Weigelt, metux IT consult
a57db845bb Xext: shape: clean up Xinerama dispatch
Simplify the dispatching by moving the branching between Xinerama
vs. single screen into the actual request handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1598>
2025-02-06 21:08:13 +00:00
Enrico Weigelt, metux IT consult
6825f89cd2 mi: drop now obsolete mioverlay.h
This used to be part of public API, but no (known) driver ever
using it, nor any exported functions left. The only internal consumer
(mioverlay.c) also gone now, so it's time to drop this file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
65b738ed60 mi: drop now obsolete mioverlay.c
Since it became practically empty, we can remove it now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
00796cbf8c mi: drop obsolete miOverlaySetRootClip()
Not used by any (known) drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
54704e4a50 mi: drop obsolete miOverlaySetTransFunction()
Not used by any (known) drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
be6985948d mi: drop obsolete miOverlayCopyUnderlay()
Not used by any (known) drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
bfb69b7316 mi: drop obsolete miOverlayComputeCompositeClip()
Not used by any (known) drivers anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
a860ce2c9f mi: drop obsolete miOverlayCollectUnderlayRegions()
Not used by any known drivers/modules.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
2c21824ee9 mi: drop obsolete miOverlayGetPrivateClips()
It's not used anymore, not even by any (known) drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
12ab2e314b mi: drop obsolete miInitOverlay()
It doesn't seem to be used anywhere for quite some time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1503>
2025-02-06 21:00:08 +00:00
Enrico Weigelt, metux IT consult
30fb73d9af Xnest: drop obsolete xnest-config.h
This file became pretty no-op, just including dix-config.h.
So we can remove it now and include dix-config.h directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1632>
2025-02-06 20:22:52 +00:00
Enrico Weigelt, metux IT consult
7130072dc5 Xnest: no need to include xkb-config.h
Xnest doesn't need anything from xkb-config.h, so no need to include it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1632>
2025-02-06 20:22:52 +00:00
Enrico Weigelt, metux IT consult
ec13a6a61f Xnest: simplify disabling unsupported extension
Instead of strange #undef hacks in various places, just go the straight
route and set the corresponding no*Extension flags on server startup.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1632>
2025-02-06 20:22:52 +00:00
Enrico Weigelt, metux IT consult
a647cc8a41 glx: DoQueryContext(): use core's swapping macros
No need to have duplicated byte swapping macros in GLX for things that
the core alreay provides. Using core's macros is actually even easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:23 +00:00
Enrico Weigelt, metux IT consult
56ca98aa47 glx: DoQueryContext(): drop duplicate write path
We now have two copies of the same write path in both swapped and
non-swapped branch. One is enough.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:23 +00:00
Enrico Weigelt, metux IT consult
ab4142bc75 glx: DoQueryContext(): determine reply length from buffer size
The reply length (in units as well as bytes) can safely be determined
at compile time, by using sizeof() operator. No need for unnecessarily
complicated shifting bits back and forth.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:23 +00:00
Enrico Weigelt, metux IT consult
ef77c486d5 glx: DoQueryContext(): explicitly use reply buf type defined by spec
The spec defines the reply as array of "CARD32", not "int". The latter
just accidentially has the same type (for now :o), but it's *semantically*
incorrect. Using CARD32 instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:23 +00:00
Enrico Weigelt, metux IT consult
0a7763bfce glx: DoQueryContext(): use fixed size array instead of variable length
Our array here really is fixed, but it's size is determined by a variable
(that's assigned a fix values), unncessarily making it a VLA (even making
it const doesn't change that), so giving false alarms when compiling w/
-Wvla or -Werror=vla.

Replacing the variable by #define trivially fixes this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:23 +00:00
Enrico Weigelt, metux IT consult
6bd673ab15 glx: use sizeof() for reply struct
The reply struct's size can safely be determined by the sizeof()
operator, so no need for using an extra define here. Making the code
easier to read and also open the door for future convenience macros
that might determine the buffer size on their own.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:23 +00:00
Enrico Weigelt, metux IT consult
558ded4dbf glx: assign at declaration
Assigning structs at declaration is quicker to read/understand. No need
to support ancient compilers that couldn't do that, anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
2025-02-06 20:04:22 +00:00
Enrico Weigelt, metux IT consult
161c3c8398 os: drop obsolete LogHdrMessage()
This function isn't used anywhere, so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1677>
2025-02-06 19:57:52 +00:00
Enrico Weigelt, metux IT consult
216fc6fe83 dix: drop remains of ancient code generator
This script used to generated xproto header as well as a piece of source
for initializing the builtin atoms in the Xserver (MakePredeclaredAtoms()).

At least with R6.6 baseline it didn't seem to be used anymore, and - at least
since the modularization - it's completely broken and useless.

Since we now have a new generator, running directly in the build process,
this ancient script can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1670>
2025-02-06 19:29:52 +00:00
Enrico Weigelt, metux IT consult
44e6558934 dix: generate MakePredeclaredAtoms() from BuiltInAtoms file
This function probably been (half?) auto generated somewhere back in the
dark ages (there're still remains of the former generator, which doesn't
work anymore, and hasn't been updated for ages). It's been added to SCM
with R6.6 baseline - and from that on manually maintained.

Adding a little generator to create source from "BuiltInAtoms" file,
directly in the build process.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1670>
2025-02-06 19:29:52 +00:00
Enrico Weigelt, metux IT consult
4775f547d8 netbsd: disable pccons support
On NetBSD, pccons is (almost) dead: only remaining port is arc,
but only on some specific kernel, which is unlikely to be used
for running X.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1588>
2025-02-06 19:03:25 +00:00
Enrico Weigelt, metux IT consult
3ed962b858 xfree86: os-support: bsd: consolidate duplicate defines
Consolidate defines duplicated across several sources into one header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1411>
2025-02-06 16:22:42 +00:00
Enrico Weigelt, metux IT consult
923da4d569 xfree86: os-support: unexport DEV_MEM defines
DEV_MEM define isn't used by any drivers, and BSD seems to be the only one
left using that define (Linux uses the symbol, but defines on its own)

Therefore, just define it where actually used and drop it from the global
xf86OSlib.h file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1411>
2025-02-06 16:22:42 +00:00
Enrico Weigelt, metux IT consult
d79432e0d4 Xnest: tidy up extension blacklisting in miinitext.c
The DDX'es sometimes need to disable certain extensions. Instead of complex
include cascades with ifdef'ed ddx-specific include from dix code, it's
more clean to add some clear and explicit knobs set by the DDX'es individual
meson.build.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1401>
2025-02-06 16:14:03 +00:00
Enrico Weigelt, metux IT consult
584bbe9988 xfree86: parser: rename IOBASE for fixing name conflict
Resolve conflicts with OS headers definining IOBASE by renaming the
IOBASE enum value to XF86_TOKEN_IOBASE.

This way, don't need the special #undef hack anymore.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1405>
2025-02-06 16:05:00 +00:00
Enrico Weigelt, metux IT consult
a1fa019012 xfree86: parser: drop obsolete token enum values
These have been forgotten on some major cleanup back almost two decades ago.
(Daniel dropped a lot of dead code, which already had been removed earlier
but merged back accidentially).

Didn't look further back on where exactly they had become obsolete - being
unused for decades should be enough justification for dropping.

Fixes: 81913a1291
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1405>
2025-02-06 16:05:00 +00:00
Enrico Weigelt, metux IT consult
fb696a7d7b rename old symbol PANORAMIX to XINERAMA
PANORAMIX was the original working title of the extension, before it became
official standard. Just nobody cared about fixing the symbols to the official
naming.

For backwards compatibility with drivers, the old PANORAMIX symbol will
still be set.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1258>
2025-02-06 15:51:27 +00:00
Enrico Weigelt, metux IT consult
a0326994cc 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@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
2025-02-06 16:24:01 +01:00
Enrico Weigelt, metux IT consult
e67f2a5eb5 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@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
2025-02-06 16:24:00 +01:00
Enrico Weigelt, metux IT consult
dda06aff96 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@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
2025-02-06 16:22:57 +01:00
Enrico Weigelt, metux IT consult
aae9bd3f62 mi: unexport SetInstalledmiColormap() macro
Not neeed by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
c3c538784a mi: unexport miExpandDirectColors()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
3cf2408232 mi: unexport miXYToWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
85be6c82b0 mi: unexport miSpriteTrace()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
6c3b432053 mi: unexport miMarkUnrealizedWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
b23ecec2f4 mi: unexport miChangeBorderWidth()
Not used by any driveres/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
597ba690d3 mi: unexport miSetShape()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
f11e203215 mi: unexport miGetLayerWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
14565a4561 mi: unexport miResizeWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
faad8ed1c6 mi: unexport miMoveWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
0624a8bad4 mi: unexport miHandleValidateExposures()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
ade6650a81 mi: unexport miMarkOverlappedWindows()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
bcbb6eec62 mi: unexport miMarkWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
3856b6cb5e mi: unexport miClearToBackground()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
7e21a514d7 mi: unexport miValidateTree()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
c2ee74c523 mi: unexport miShapedWindowIn()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
d14ae53e1f mi: unexport miCreateScreenResources()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
191cca0905 mi: unexport miSourceValidate()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
a54e8f5343 mi: unexport miPaintWindow()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
e424f49cdb mi: unexport miWindowExposures()
Not used by any modules/drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
8d07450904 mi: unexport miSendExposures()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
7748984e3a mi: unexport mieqSetHandler()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
964127ce10 mi: unexport mieqRemoveCallbackOnDrained()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
269d54c48f mi: unexport mieqAddCallbackOnDrained()
Not used by any modules/drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
9aa23b6abd mi: unexport mieqProcessInputEvents()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
0f7770bce3 mi: unexport mieqProcessDeviceEvent()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
413e6ed2c8 mi: unexport mieqSwitchScreen()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
9dd280607f mi: unexport mieqEnqueue()
Not used by any (known) drivers, so no need to keep it exported.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
4742790351 mi: unexport mieqFini()
Not used by any driver/module, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
5ac361cce9 mi: unexport mieqInit()
Not used by any drivers/modules so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
8a6bbc80f3 mi: unexport miStepDash()
Not used by any module/driver, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
aaaa0a35e5 mi: unexport miWideArc()
It's not used by any modules/drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
12c507cd1f mi: make CopyGetMasterEvent() static
It's not used outside mieq.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
6dbb957922 mi: make miRecolorCursor() static
It's only used inside mipointer.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult
471147d4b9 mi: unexport miPointerPrivKeyRec
Not used by any (known) driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
8ca88b8f75 mi: unexport miPointerUpdateSprite()
Not used by any (known) drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
4933780f28 mi: unexport miPointerInvalidateSprite()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
fdd509f345 mi: unexport miPointerUpdateSprite()
Not used by any (known) driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
64cd343569 mi: unexport miPointerSetScreen()
Not used by any (known) drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
6c04f94f3b mi: unexport miPointerWarpCursor()
Not used by any known drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
44c2e08877 mi: unexport miPointerInitialize()
It's not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1505>
2025-02-06 14:38:05 +00:00
Enrico Weigelt, metux IT consult
c8daf76c3e glx: drop obsolete warnings on files being generated
These files haven't been auto-generated, but instead manually changed for
at least over a decade now, so these warnings have become wrong.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1728>
2025-02-06 14:29:54 +00:00
Enrico Weigelt, metux IT consult
2d8af9cc5e glx: drop obsolete glxbyteorder.h
It's just a local header, doing nothing more than including misc.h,
so we can just include misc.h directly and drop glxbyteorder.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1728>
2025-02-06 14:29:54 +00:00
Olivier Fourdan
e8784b7d89 xwayland/glamor: Disable GLAMOR after GBM cleanup
The cleanup function for GBM is called on the various error paths.

Once xwl_glamor_gbm_cleanup() has been called, GBM support is no longer
usable (and the corresponding data structures are freed), so there is
no way we can keep using GLAMOR after that point.

Make sure to explicitly disable GLAMOR support in that case, so we do
not crash later on trying to use GBM.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1768>
2025-02-04 11:46:25 +01:00
Michel Dänzer
b27b5cd5f3 xwayland/glamor: Clean-up GBM's screen private on failure
If we bail out initializing GBM glamor backend, the screen private for
the GBM backend may remain, pointing at freed memory.

To avoid that issue, make sure to clear up the screen's private for the
GBM backend.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1785
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1768>
2025-02-04 11:45:56 +01:00
Julian Orth
45c1d22ff6 xwayland: Don't run key behaviors and actions
Consider the following keymap:

```xkb
xkb_keymap {
    xkb_keycodes {
        <compose> = 135;
    };
    xkb_symbols {
        key <compose> {
            [ SetGroup(group = +1) ]
        };
    };
};
```

When the user presses the compose key, the following happens:

1. The compositor forwards the key to Xwayland.
2. Xwayland executes the SetGroup action and sets the base_group to 1
   and the effective group to 1.
3. The compositor updates its own state and sends the effective group,
   1, to Xwayland.
4. Xwayland sets the locked group to 1 and the effective group to
   1 + 1 = 2.

This is wrong since pressing compose should set the effective group to 1
but to X applications the effective group appears to be 2.

This commit makes it so that Xwayland completely ignores the key
behaviors and actions of the keymap and only updates the modifier and
group components in response to the wayland modifiers events.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1758>
2025-02-03 05:37:48 +00:00
Julian Orth
8d9184db5f xwayland: copy repeat settings from the compositor map
Previously the repeat settings sent by the compositor were completely
ignored.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1759>
2025-01-28 15:32:20 +01:00
Alan Coopersmith
6cc358dfb4 os: if inet_ntop() is available, use it for IPv4 addresses as well
Support for using inet_ntop() was originally added to support IPv6,
and only used for IPv6 addresses in AuthAudit().  Two decades later,
support for inet_ntop() is ubiquitous and OS'es have marked inet_ntoa()
as deprecated, so use the modern interface for IPv4 as well now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1760>
2025-01-27 22:34:51 +00:00
Alan Coopersmith
2ffe0f8a35 os: if getaddrinfo() is available, use it, even if IPv6 support is disabled
Support for using getaddrinfo() was originally added to support IPv6,
and only used if IPv6 support was enabled.  Two decades later, support
for getaddrinfo() is ubiquitous and OS'es have marked gethostbyname()
as deprecated, so use the modern interface whenever we can now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1760>
2025-01-27 22:34:51 +00:00
Pierre-Eric Pelloux-Prayer
5397854877 glamor: reject configs using unsupported rgbBits size
The supported color depths is a hardcoded list for now, so we
need to honor the value exposed there otherwise we'll get
inconsistencies between what glXGetFBConfigs and XListDepths
report to applications.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
2025-01-21 09:16:52 +00:00
Pierre-Eric Pelloux-Prayer
83b13387ab glamor: use gbm_format_for_depth instead of open-coding it
This way glamor_back_pixmap_from_fd deals with the same depth
values as glamor_pixmap_from_fds.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
2025-01-21 09:16:52 +00:00
Pierre-Eric Pelloux-Prayer
87afcc7699 glamor: return the result of gbm_format_for_depth
This way the caller knows if the conversion failed.
While at it, check for width/height at the same time.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
2025-01-21 09:16:52 +00:00
Olivier Fourdan
080fb49eff os/connection: Make sure partial is initialized
Following the change in Xtrans 1.5 that allows for partial connections
to succeed, we need to make sure partial is properly initialized at
first, otherwise we rely on an uninitialized variable.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Twaik Yont <twaikyont@gmail.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1783
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1765>
2025-01-17 08:24:19 +00:00
Olivier Fourdan
92bcebfd7e xkb: Always use MAP_LENGTH keymap size
Generating the modifier modmap, the helper function generate_modkeymap()
would check the entire range up to the MAP_LENGTH.

However, the given keymap might have less keycodes than MAP_LENGTH, in
which case we would go beyond the size of the modmap, as reported by
ASAN:

==ERROR: AddressSanitizer: heap-buffer-overflow
READ of size 1 at 0x5110001c225b thread T0
    #0 0x5e7369393873 in generate_modkeymap ../dix/inpututils.c:309
    #1 0x5e736930dcce in ProcGetModifierMapping ../dix/devices.c:1794
    #2 0x5e7369336489 in Dispatch ../dix/dispatch.c:550
    #3 0x5e736934407d in dix_main ../dix/main.c:275
    #5 0x7e46d47b2ecb in __libc_start_main
    #6 0x5e73691be324 in _start (xserver/build/hw/xwayland/Xwayland)

Address is located 0 bytes after 219-byte region
allocated by thread T0 here:
    #0 0x7e46d4cfc542 in realloc
    #1 0x5e73695aa90e in _XkbCopyClientMap ../xkb/xkbUtils.c:1142
    #2 0x5e73695aa90e in XkbCopyKeymap ../xkb/xkbUtils.c:1966
    #3 0x5e73695b1b2f in XkbDeviceApplyKeymap ../xkb/xkbUtils.c:2023
    #4 0x5e73691c6c18 in keyboard_handle_keymap ../hw/xwayland/xwayland-input.c:1194

As MAP_LENGTH is used in various code paths where the max keycode might
not be easily available, best is to always use MAP_LENGTH to allocate the
keymaps so that the code never run past the buffer size.

If the max key code is smaller than the MAP_LENGTH limit, fill-in the gap
with zeros.

That also simplifies the code slightly as we do not constantly need to
reallocate the keymap to adjust to the max key code size.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1780
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1762>
2025-01-13 11:44:11 +01:00
Olivier Fourdan
8707d2835c xwayland: Do not keep the cursor's pixmap around
Currently, Xwayland creates a pixmap backed by shared memory buffer as
soon as an X11 cursor is realized, which is destroyed when the cursor is
eventually unrealized.

If an X11 client is leaking cursors, Xwayland will be creating new
pixmaps continuously, which will eventually cause an error once the
limit is reached, and get Xwayland killed.

However, we do not need the shared memory buffer to stay around, we
already have the buffer retention mechanism which will take care of
keeping the buffer around until the Wayland compositor is done with it,
so we could just create and destroy the pixmap as needed when setting
the cursor.

That would not fix the leak in the X11 application, yet that would
mitigate the risk of Xwayland being killed by reaching the shared memory
limits, until the client itself reaches the limit of X11 resources.

v2: Don't increase the pixmap refcnt to destroy it just after (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Michel Dänzer <michel@daenzer.net>
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1773
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1754>
2024-12-20 09:29:03 +01:00
Matt Turner
bdacb100bf hw/xfree86: Fix -Wincompatible-pointer-types sbus compile failure
```
../hw/xfree86/common/xf86sbusBus.c: In function ‘xf86SbusConfigureNewDev’:
../hw/xfree86/common/xf86sbusBus.c:751:21: error: passing argument 1 of ‘XNFasprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
  751 |         XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
      |                     ^~~~~~~~~~~~
      |                     |
      |                     const char **
```

Apply the same fix as in commit e1e01d2e3 ("xfree86/common: Warning
fixes. Mostly const string handling.")

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1751>
2024-12-16 22:41:47 -05:00
Matt Turner
00a96cd82a hw/xfree86: Fix -Wmissing-prototypes warnings
None of these functions are used elsewhere in the Xserver nor in any of
the xf86-video-sun* DDXs.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1751>
2024-12-16 22:41:04 -05:00
Peter Hutterer
298c5dcb02 Ignore the coding style change commit during git blame
git supports ignoring specific revs during git blame, configured via

  $ git config blame.ignoreRevsFile .git-blame-ignore-revs

Let's make this easier for developers to set up, starting with the
one massive coding style change commit.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1748>
2024-12-06 09:55:53 +10:00
Olivier Fourdan
e4804d11e8 xwayland: Add xdg-system-bell support
For the Wayland compositors who do not implement XkbBellNotifyMask but
support the Wayland protocol xdg-system-bell, use that to ring the
bell.

v2: Be more selective on the device, make sure it's a keyboard and it
    has core events.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1742>
2024-12-02 08:55:34 +00:00
Olivier Fourdan
1ccc19d1df build: Bump wayland-protocols requirement to 1.38
To get xdg-system-bell-v1 protocol.

This is just preparation work for the next commits.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1742>
2024-12-02 08:55:34 +00:00
Olivier Fourdan
a55ed3309b ci: Install wayland-protocols 1.38
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1742>
2024-12-02 08:55:34 +00:00
Olivier Fourdan
d98b36461a ci: Check for DDXen to be built
Add a script in CI to check for the mere presence of the expected DDXen
to be built.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1743>
2024-11-19 09:19:15 +01:00
Olivier Fourdan
fbedb9b12b ci: Force build of default DDXen in the default target
If any dependency that a DDX requires is missing, the build of the DDX
will be automatically disabled, and the CI check will succeed.

We want the build to fail if any of the expected DDX cannot be built in
the CI, so let's force-enable them at build time.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>

v2: Use a variable for the DDX build args (Peter Hutterer
    <peter.hutterer@who-t.net>)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1743>
2024-11-19 09:19:15 +01:00
Alan Coopersmith
cac0d08102 Revert "xfree86: os-support: move CONSOLE_X_BELL into bsd_bell.c"
This reverts commit 8958a99c02.
It broke the build of the xf86-input-keyboard driver, which relies
on CONSOLE_X_BELL in src/bsd_kbd.c.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1741>
2024-11-13 16:47:52 -08:00
Alan Coopersmith
5268fbd7cf xkbtext_priv.h: fix typo in header guard definition
Found by clang 13.0.1:

../xkb/xkbtext_priv.h:5:9: warning: '_XSERVER_XKB_XKBTEXT_PRIV_H' is used
 as a header guard here, followed by #define of a different macro
 [-Wheader-guard]
#ifndef _XSERVER_XKB_XKBTEXT_PRIV_H
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../xkb/xkbtext_priv.h:6:9: note: '_XSERVER_XKB_XKBTEXt_PRIV_H' is defined
 here; did you mean '_XSERVER_XKB_XKBTEXT_PRIV_H'?
#define _XSERVER_XKB_XKBTEXt_PRIV_H
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        _XSERVER_XKB_XKBTEXT_PRIV_H

Fixes: 434044cb0 ("xkb: unexport functions from xkbtext.c")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1740>
2024-11-10 12:51:10 -08:00
Sérgio Basto
4cd7e2e819 Revert "fb: Declare wfbFinishScreenInit, wfbScreenInit for !FB_ACCESS_WRAPPER"
This reverts commit 34a430a16e

Signed-off-by: Sérgio M. Basto <sergio@serjux.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1720>
2024-11-08 17:42:09 +00:00
Michel Dänzer
8c4b137237 xwayland: Always decrement expecting_event in xwl_output_create
If we bail without decrementing it, xwl_screen_init will keep waiting
indefinitely for an event which never arrives.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1739>
2024-11-05 09:28:46 +00:00
Michel Dänzer
375c35a5e4 xwayland/glamor: Drop expecting_event bailing from xwl_drm_handle_device
If we bail without decrementing xwl_screen->expecting_event,
xwl_screen_init will keep waiting indefinitely for an event which never
arrives.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1648
Fixes: 2f113d68f6 ("xwayland: Add glamor and DRI3 support")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1739>
2024-11-05 09:28:46 +00:00
Alan Coopersmith
a1b5aa5a7f dix-config.h: add HAVE_SOCKLEN_T definition
Needed to build with IPv6 disabled using gcc 14 on some platforms to avoid:

In file included from /usr/X11/include/X11/Xtrans/transport.c:67,
                 from xstrans.c:17:
/usr/X11/include/X11/Xtrans/Xtranssock.c: In function ‘_XSERVTransSocketOpen’:
/usr/X11/include/X11/Xtrans/Xtranssock.c:467:28: error: passing argument 5
 of ‘getsockopt’ from incompatible pointer type [-Wincompatible-pointer-types]
  467 |             (char *) &val, &len) == 0 && val < 64 * 1024)
      |                            ^~~~
      |                            |
      |                            size_t * {aka long unsigned int *}

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1736>
2024-10-30 12:26:58 -07:00
Michel Dänzer
56ba0b2a5f xwayland/present: Check allow_commits in xwl_present_flip
We're not supposed to call wl_surface_commit while
xwl_window->allow_commits is false. Bailing results in falling back to
a copy.

Noticed by inspection while looking into an issue which turned out to be
due to something else.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1764
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1732>
2024-10-30 10:56:31 +00:00
Matthieu Herrb
85b7765714 xkb: Fix buffer overflow in _XkbSetCompatMap()
The _XkbSetCompatMap() function attempts to resize the `sym_interpret`
buffer.

However, It didn't update its size properly. It updated `num_si` only,
without updating `size_si`.

This may lead to local privilege escalation if the server is run as root
or remote code execution (e.g. x11 over ssh).

CVE-2024-9632, ZDI-CAN-24756

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1733>
2024-10-29 14:41:59 +01:00
Alan Coopersmith
bf63d9b34e modesetting: avoid memory leak when ms_present_check_unflip() returns FALSE
Found by Oracle Parfait 13.3 static analyzer:
   Memory leak [memory-leak]:
      Memory leak of pointer event allocated with calloc(1, 16)
        at line 470 of hw/xfree86/drivers/modesetting/present.c in
	function 'ms_present_unflip'.
          event allocated at line 431 with calloc(1, 16)
          event leaks when ms_present_check_unflip(...) == 0 at line 438
              and i >= config->num_crtc at line 445

Fixes: 13c7d53df ("modesetting: Implement page flipping support for Present.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1730>
2024-10-28 05:38:25 +00:00
Alan Coopersmith
b65eea43dd dix: limit checks to MAX_VALUATORS when generating Xi events
Previously, it was looping through sizeof(ev->valuators.mask) * 8
valuators, where valuators.mask is defined as an array of
(MAX_VALUATORS + 7) / 8 entries.  Since MAX_VALUATORS is defined as 36,
this made it actually loop through 40 entries.  The last 4 bits in this
array should never be set, so we should never access memory outside the
bounds of the arrays defined to be exactly MAX_VALUATORS in length, but
we can make the static analyzer happier and not waste time checking bits
that should never be set.

Found by Oracle Parfait 13.3 static analyzer:

   Read outside array bounds [read-outside-array-bounds]:
      In array dereference of ev->valuators.data[i] with index i
      Array size is 36 elements (of 8 bytes each), index >= 0 and index <= 39
        at line 741 of dix/eventconvert.c in function 'eventToDeviceEvent'.

   Read outside array bounds [read-outside-array-bounds]:
      In array dereference of ev->valuators.data[i] with index i
      Array size is 36 elements (of 8 bytes each), index >= 0 and index <= 39
        at line 808 of dix/eventconvert.c in function 'eventToRawEvent'.

   Read outside array bounds [read-outside-array-bounds]:
      In array dereference of ev->valuators.data_raw[i] with index i
      Array size is 36 elements (of 8 bytes each), index >= 0 and index <= 39
        at line 809 of dix/eventconvert.c in function 'eventToRawEvent'.

Fixes: b2ba77bac ("dix: add EventToXI2 and GetXI2Type.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1730>
2024-10-28 05:38:25 +00:00
Alan Coopersmith
4b073d65bb dix: fix button offset when generating DeviceButtonStateNotify events
Found by Oracle Parfait 13.3 static analyzer:
   Buffer Overflow in STD C function [buffer-overflow-call-stdc]:
      Buffer overflow in call to memcpy. Buffer &bev->buttons[4] of
       size 24 is written at an offset of 28
      Array size is 28 bytes, index is 32
        at line 743 of dix/enterleave.c in function
	 'DeliverStateNotifyEvent'.

Fixes: a85f0d6b9 ("Xi: fix use of button->down - bitflags instead of int arrays.")
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1730>
2024-10-28 05:38:25 +00:00
Alan Coopersmith
7af077dd2f render: avoid NULL pointer dereference if PictureFindVisual returns NULL
Found by Oracle Parfait 13.3:
   Null pointer dereference [null-pointer-deref]:
      Read from null pointer pVisual
        at line 257 of dix/colormap.c in function 'CreateColormap'.
          Null pointer introduced at line 412 of render/picture.c in
	   function 'PictureFindVisual'.
          Constant 'NULL' passed into function CreateColormap, argument
	   pVisual, from call at line 431 in function
	   'PictureInitIndexedFormat'.
          Function PictureFindVisual may return constant 'NULL' at
	   line 412, called at line 429.

Fixes: d4a101d4e ("Integration of DAMAGE-XFIXES branch to trunk")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1730>
2024-10-28 05:38:25 +00:00
Alan Coopersmith
d10589cc09 Xi: avoid NULL pointer dereference if GetXTestDevice returns NULL
The comments in that function say "This only happens if master is a
slave device. don't do that" but static analysis doesn't respect that.

Found by Oracle Parfait 13.3:
   Null pointer dereference [null-pointer-deref]:
      Read from null pointer XTestptr
        at line 274 of Xi/xichangehierarchy.c in function 'remove_master'.
          Null pointer introduced at line 691 of Xext/xtest.c in function
	   'GetXTestDevice'.
          Function GetXTestDevice may return constant 'NULL' at line 691,
	   called at line 273 of Xi/xichangehierarchy.c in function
	   'remove_master'.
   Null pointer dereference [null-pointer-deref]:
      Read from null pointer XTestkeybd
        at line 279 of Xi/xichangehierarchy.c in function 'remove_master'.
          Null pointer introduced at line 691 of Xext/xtest.c in function
	   'GetXTestDevice'.
          Function GetXTestDevice may return constant 'NULL' at line 691,
	   called at line 278 of Xi/xichangehierarchy.c in function
	   'remove_master'.

Fixes: 0814f511d ("input: store the master device's ID in the devPrivate for XTest devices.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1730>
2024-10-28 05:38:25 +00:00
Alan Coopersmith
fa711c486a xfree86: avoid memory leak on realloc failure
Found by Oracle Parfait 13.3 static analyzer:
   Memory leak [memory-leak]:
      Memory leak of pointer optname allocated with asprintf(&optname,
      "\"%s\"", p->name)
        at line 326 of hw/xfree86/common/xf86Configure.c in function
	'configureDeviceSection'.
          optname allocated at line 309 with asprintf(&optname, "\"%s\"",
	  p->name)

Fixes: code inherited from XFree86
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1730>
2024-10-28 05:38:25 +00:00
Alan Coopersmith
45c485bfdf dix: Use __builtin_popcountl if available to replace Ones()
If the compiler knows of a better algorithm for counting the number of
bits set in a word for the target CPU, let it use that, instead of the
classic algorithm optimized for PDP-6.

Based on xorg/lib/libxext@490a25e6f8a4d2482af4364c700b68ad11a4d10b

v2: make old version static inline, stop exporting after !1695

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1674>
2024-10-26 10:04:13 -07:00
Enrico Weigelt, metux IT consult
1642adec3b dix: unexport Ones()
It's not used by any module/driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1695>
2024-10-26 16:35:57 +00:00
Michel Dänzer
91b5a003a5 xwayland/glamor/gbm: Don't close fence_fd after xwl_glamor_wait_fence
eglCreateSyncKHR takes ownership of the file descriptor. Noticed by
inspection.

While we're at it, move the fence_fd declaration to the scope where
it's used.

Last but not least, close the fd in xwl_glamor_wait_fence when bailing
before calling eglCreateSyncKHR, and document that it takes ownership.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1712>
2024-10-22 16:26:09 +00:00
Alan Coopersmith
b306df5a60 os: NextDPMSTimeout: mark intentional fallthroughs in switch
The comment at the top of the function tells humans the fallthroughs
are intentional, but gcc doesn't parse that.

Clears 3 -Wimplicit-fallthrough warnings from gcc 14.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1716>
2024-10-11 22:20:16 +00:00
YaoBing Xiao
e12d9863fd xwayland: prevent potential null pointer dereference
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1718>
2024-10-11 10:00:39 +08:00
Tj
728b54528d xfree86: fbdevhw: fix pci detection on recent Linux
Linux kernel v6.9 has changed the symlink to point to the parent device. This
breaks fbdev_open() detection logic. Change it to use the subsystem symlink
instead which will remain stable.

Kernel v6.8:

[    14.067] (II) fbdev_open() sysfs_path=/sys/class/graphics/fb0
[    14.067] (II) fbdev_open() buf=../../devices/platform/vesa-framebuffer.0/graphics/fb0

Kernel v6.9:

[    15.609] (II) fbdev_open() sysfs_path=/sys/class/graphics/fb0
[    15.609] (II) fbdev_open() buf=../../devices/pci0000:00/0000:00:01.0/vesa-framebuffer.0/graphics/fb0

Originally found in automated Debian ISO QA testing [0] and confirmed in Linux [1].

Tested on kernels v6.9.7 and v6.8.12

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075713
[1] https://lore.kernel.org/lkml/lLyvPFC_APGHNfyGNHRpQy5izBikkaTPOpHooZIT3fFAoJPquSI31ZMueA99XTdr8ysir3X7O7IMdc6za-0m79vr_claeparHhoRouVgHOI=@proton.me/

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1714
Signed-off-by: Tj <tj.iam.tj@proton.me>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1612>
2024-10-10 21:32:46 +00:00
Enrico Weigelt, metux IT consult
a136ce3d57 xfre86: drop xf86Msg() in favor of LogMessageVerb()
This function is doing the same like LogMessageVerb(), so no need to keep
around a duplicate implementation. Leaving it as a macro, until all callers,
also in drivers, have been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1679>
2024-10-10 21:16:26 +00:00
Enrico Weigelt, metux IT consult
14767eccc0 xfree86: drop xf86MsgVerb() in favor of LogMessageVerb()
This function is doing the same like LogMessageVerb(), so no need to keep
around a duplicate implementation. Leaving it as a macro, until all callers,
also in drivers, have been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1679>
2024-10-10 21:16:26 +00:00
Enrico Weigelt, metux IT consult
b87314c876 randr: fix wrong call to RRGetScreenResources() in swapped case
ProcRRGetScreenResources() vs. RRGetScreenResourcesCurrent() have different
semantics - this also must be followed in byte-swapped case.

Fixes: fc70839431 - Add server support for RRGetScreenResourcesCurrent
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1630>
2024-10-10 20:59:35 +00:00
Enrico Weigelt, metux IT consult
73cf8d3560 xfree86: dri: unexport DRIDestroyWindow() and make it static
This function is only called inside dri.c, not used by any drivers
(and wouldn't make sense to do so), so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1713>
2024-10-10 20:42:23 +00:00
Enrico Weigelt, metux IT consult
9323ba6fed xwin: fix memleak on freeing pixmaps
Xwin's DestroyPixmap proc just free()s the PixmapRec directly, w/o catering
for devPrivate's, so leaving a memleak. The correct DIX function for this
is FreePixmap().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1710>
2024-10-10 20:27:11 +00:00
Enrico Weigelt, metux IT consult
33a4250157 xvmc: unexport XvMCFindXvImage()
It's not needed by any driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1694>
2024-10-10 19:59:48 +00:00
Enrico Weigelt, metux IT consult
f65520c4a7 Xext: xvmc: drop unused XvMCScreenInitProc
This pointer field isn't used anywhere, neither in Xorg nor in drivers.
No need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1692>
2024-10-10 19:25:15 +00:00
Enrico Weigelt, metux IT consult
6625cc14df pseudoramix: replace PseudoramiXTrace & PseudoramiXDebug by LogMessageVerb
Since we're only going through macros (that are calling these), this extra
wrapper function isn't needed at all - using LogMessageVerb() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1689>
2024-10-10 18:59:40 +00:00
Enrico Weigelt, metux IT consult
e8c4857938 xfree86: unexport xf86SetVerbosity() and xf86SetLogVerbosity()
These aren't used by any modules/drivers, so no need to keep them exported.
Also drop the return value, which isn't used by any caller.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1687>
2024-10-10 18:25:54 +00:00
Enrico Weigelt, metux IT consult
27a5c59180 os: drop redefining getpid() on mingw32
mingw32 does does have getpid() function, so conditionally redefining
it to _getpid() isn't necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1686>
2024-10-10 17:55:56 +00:00
Enrico Weigelt, metux IT consult
e5b5b302d3 os: replace LogVWrite() by LogVMessageVerb()
It's just a wrapper around LogVMessageVerb() and no external module
using it, so can easily be optimized-away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1683>
2024-10-10 17:34:12 +00:00
Enrico Weigelt, metux IT consult
c26023a009 os: replace LogWrite() by LogMessageVerb()
It's nothing but a wrapper, doing the same as LogMessageVerb(X_NONE, ...),
and no external module / driver needs it, so can be easily optimized away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1683>
2024-10-10 17:34:12 +00:00
Enrico Weigelt, metux IT consult
37446b70de os.h: drop unnecessary guard on stdlib.h include
It's a standard C header, that's always present, so no extra guard needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1684>
2024-10-10 17:16:00 +00:00
Enrico Weigelt, metux IT consult
d43d346541 os: log: use localtime_r() on mingw builds
MingW also provides localtime_r(), but needs _POSIX_THREAD_SAFE_FUNCTIONS
symbol before including anything, in order for the prototype being defined.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1685>
2024-10-10 16:58:01 +00:00
Enrico Weigelt, metux IT consult
78d420870f xquartz: drop unused code
These code pieces have been commented out since their introduction back
almost two decades ago, so probably no need for them anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1603>
2024-10-10 16:42:38 +00:00
Enrico Weigelt, metux IT consult
886c282242 swapreq.h: drop SWAPREQ_PROC
This macro doesn't do anything more than just making the function declarations
a few bytes smaller, but this makes the code harder to read (eg. when just
grepping through the code base).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1609>
2024-10-10 16:10:32 +00:00
Enrico Weigelt, metux IT consult
e97adda52d xfree86: modesetting: merge FreeRec() into FreeScreen()
No need to have one function doing nothing more than calling another one
with the same prototype.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1611>
2024-10-10 15:47:51 +00:00
Enrico Weigelt, metux IT consult
bd40e9f836 xfree86: os-support: move including machine/sysarch.h out of public header
The only consumer seems to be one BSD specific file, the few drivers using
the *_iopl seem to include it on their own. Thus, no need to keep it in
public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult
4d677fab46 xfree86: os-support: move CONSOLE_X_TV_ON/OFF to i386_video.c
These are only used in i386_video.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult
758bee502d xfree86: os-support: move CONSOLE_X_MODE_ON/OFF to bsd_init.c
These are only used in bsd_init.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult
8958a99c02 xfree86: os-support: move CONSOLE_X_BELL into bsd_bell.c
This define is only used inside bsd_bell.c, so move it there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult
d7e0d174a5 xfree86: os-support: drop unused CONSOLE_GET_* defines
These don't seem to be used anywhere, so we can drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult
0560cb35ce xfree86. os-support: drop obsolete XMODE_* defines
These only had been used by xf86-video-chips, but meanwhile this
defines them on it's own, so we can drop them from here now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1420>
2024-10-10 15:12:22 +00:00
Enrico Weigelt, metux IT consult
91a67c7fcc mi: misprite.h: drop unnecessary extern on functions
By C standard, functions are always extern if not specified otherwise.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1501>
2024-10-10 14:44:52 +00:00
Enrico Weigelt, metux IT consult
9432106b30 xkb: drop unused variable extDevReason
fix warning on unused variable:

> ../xkb/xkb.c:3576:18: warning: variable 'extDevReason' set but not used [-Wunused-but-set-variable]
>     unsigned int extDevReason;
                 ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1426>
2024-10-10 14:25:41 +00:00
Enrico Weigelt, metux IT consult
e79dfb87e9 xkb: xkbInit: fix char signess mismatch
On NetBSD gives warning:

../xkb/xkbInit.c: In function ‘XkbProcessArguments’:
../xkb/xkbInit.c:778:57: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  778 |             if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                         ^
../xkb/xkbInit.c:782:61: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  782 |                 if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                             ^
../xkb/xkbInit.c:792:61: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  792 |                 if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                             ^
../xkb/xkbInit.c:799:61: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  799 |                 if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                             ^

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
02be87b880 xkb: xkbtext: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../xkb/xkbtext.c:32:
../xkb/xkbtext.c: In function ‘XkbAtomText’:
../xkb/xkbtext.c:94:44: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   94 |             if ((tmp == rtrn) && (!isalpha(*tmp)))
      |                                            ^
../xkb/xkbtext.c:96:31: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   96 |             else if (!isalnum(*tmp))
      |                               ^
../xkb/xkbtext.c: In function ‘XkbIMWhichStateMaskText’:
../xkb/xkbtext.c:470:43: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  470 |                 buf[len + 9] = toupper(buf[len + 9]);
      |                                           ^
../xkb/xkbtext.c: In function ‘XkbControlsMaskText’:
../xkb/xkbtext.c:532:43: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  532 |                 buf[len + 3] = toupper(buf[len + 3]);
      |                                           ^
../xkb/xkbtext.c: In function ‘XkbStringText’:
../xkb/xkbtext.c:563:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  563 |         if (!isprint(*in)) {
      |                      ^
../xkb/xkbtext.c:584:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  584 |         if (isprint(*in))
      |                     ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
bb9953db3f os: utils: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../include/misc.h:174,
                 from ../os/utils.c:75:
../os/utils.c: In function ‘VerifyDisplayName’:
../os/utils.c:624:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  624 |         if (!isdigit(d[i])) {
      |                       ^
../os/utils.c: In function ‘ProcessCommandLine’:
../os/utils.c:942:44: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  942 |             if ((i + 1 < argc) && (isdigit(*argv[i + 1])))
      |                                            ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
9446ae487c os: access: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../include/misc.h:174,
                 from ../os/access.c:96:
../os/access.c: In function ‘ResetHosts’:
../os/access.c:981:49: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  981 |                 lhostname[i] = tolower(ohostname[i]);
      |                                                 ^

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
3b99837b78 xfree86: parser: scan: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/parser/scan.c:58:
../hw/xfree86/parser/scan.c: In function ‘xf86getToken’:
../hw/xfree86/parser/scan.c:343:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  343 |         else if ((c == ',') && !isalpha(configBuf[configPos])) {
      |                                                  ^
../hw/xfree86/parser/scan.c:346:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  346 |         else if ((c == '-') && !isalpha(configBuf[configPos])) {
      |                                                  ^
../hw/xfree86/parser/scan.c: In function ‘xf86nameCompare’:
../hw/xfree86/parser/scan.c:1031:19: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1031 |     c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                   ^
../hw/xfree86/parser/scan.c:1031:34: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1031 |     c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                                  ^
../hw/xfree86/parser/scan.c:1032:19: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1032 |     c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                   ^
../hw/xfree86/parser/scan.c:1032:34: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1032 |     c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                                  ^
../hw/xfree86/parser/scan.c:1042:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1042 |         c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                       ^
../hw/xfree86/parser/scan.c:1042:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1042 |         c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                                      ^
../hw/xfree86/parser/scan.c:1043:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1043 |         c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                       ^
../hw/xfree86/parser/scan.c:1043:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1043 |         c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                                      ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
7830b007e4 xfree86: common: xf86Configure: fix char signess mismatch
On NetBSD gives warning:

../hw/xfree86/common/xf86Configure.c: In function ‘xf86AddBusDeviceToConfigure’:
../hw/xfree86/common/xf86Configure.c:125:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  125 |     for (j = 0; (lower_driver[j] = tolower(driver[j])); j++);
      |                                                  ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
43a57fc6e9 xfree86: common: xf86pciBus: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86pciBus.c:35:
../hw/xfree86/common/xf86pciBus.c: In function ‘xf86ParsePciBusString’:
../hw/xfree86/common/xf86pciBus.c:286:27: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  286 |             if (!isdigit(d[i])) {
      |                           ^
../hw/xfree86/common/xf86pciBus.c:293:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  293 |         if (!isdigit(p[i])) {
      |                       ^
../hw/xfree86/common/xf86pciBus.c:307:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  307 |         if (!isdigit(p[i])) {
      |                       ^
../hw/xfree86/common/xf86pciBus.c:320:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  320 |         if (!isdigit(p[i])) {
      |                       ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
1f861bbb9d xfree86: common: xf86Option: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Option.c:39:
../hw/xfree86/common/xf86Option.c: In function ‘xf86NormalizeName’:
../hw/xfree86/common/xf86Option.c:915:25: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  915 |             if (isupper(*p))
      |                         ^
../hw/xfree86/common/xf86Option.c:916:32: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  916 |                 *q++ = tolower(*p);
      |                                ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
99017bf948 xfree86: common: xf86Bus: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Bus.c:36:
../hw/xfree86/common/xf86Bus.c: In function ‘StringToBusType’:
../hw/xfree86/common/xf86Bus.c:270:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  270 |     if (isdigit(busID[0])) {
      |                      ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult
84be5b4e9c dix: unexport non-public functions from dixgrabs.h and document prototypes
* unexport functions from dixgrab.h, that aren't used by any driver/module.
* add paremeter names to prototypes
* add doxygen-style documentation for all the prototypes

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:50:57 +00:00
Enrico Weigelt, metux IT consult
e7c225aef6 dix: CreateGrab() rename "type" parameter to "eventType"
Make it clear what exactly this parameter is for.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:50:57 +00:00
Enrico Weigelt, metux IT consult
48cee2fd22 dix: make FreeGrab() NULL tolerant
Allow NULL parameters to be passed to FreeGrab(), so callers don't all
need to check on their own anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:50:57 +00:00
Enrico Weigelt, metux IT consult
93856053b7 dix: make CopyGrab() static
This function is only called once in the same source file, no external callers
at all. So, it doesn't need to be visible outside that file, and we can allow
the compiler to do whatever fancy optimizations it might wanna do.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:50:57 +00:00
Enrico Weigelt, metux IT consult
bd8d3455fb os: don't include client.h anymore
There's no need to include client.h anymore. But still leaving it, in case
some external consumer relying on it's presence.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:45:29 +00:00
Enrico Weigelt, metux IT consult
1891a8dc14 os: unexport client id retrieval functions
These aren't used by any (known) external modules, thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:45:29 +00:00
Enrico Weigelt, metux IT consult
ed3c2aeeb1 os: unexport DetermineClientPid() and DetermineClientCmd()
These aren't used by any drivers/modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:45:29 +00:00
Enrico Weigelt, metux IT consult
7ac7a2d6de os: split off internal definitions from client.h
The client.h file is part of the public module API, but it also contains
definitions that aren't useful for being used in modules. Splitting them
out into their own client_priv.h file, which isn't part of the API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:45:29 +00:00
Enrico Weigelt, metux IT consult
a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult
4cac1ee46d dix: drop unnecessary check on HAVE_DIX_CONFIG_H
The dix-config.h include file is always present, so no need for
an extra check and conditional include.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult
313334ec28 Xnest: drop obsolete ifdef HAVE_XNEST_CONFIG_H
These files are always compiled w/ HAVE_XNEST_CONFIG_H and always
need to include this file, so the ifdef can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult
79ad940021 os: log: drop unncessary HAVE_DIX_CONFIG
It's always defined and dix-config.h is always present, so need for the
extra check.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1680>
2024-10-09 00:01:18 +00:00
Enrico Weigelt, metux IT consult
2a959a27df os: log: drop unnecessary ifdef's
The #ifdef's for log prefix defines aren't needed, so drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1680>
2024-10-09 00:01:18 +00:00
Michel Dänzer
23dde0860c xwayland/present: Update surface window again if manual redirect fails
Even if the manual redirect didn't result in the surface window we
wanted, it might be different again without the redirect.

I don't know of any specific scenario hitting this though, it's more of
a theoretical safeguard.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1637>
2024-10-02 08:02:03 +00:00
Michel Dänzer
e6c649e6e6 xwayland/glamor: Try manual redirect only if parent window has depth 32
That's the case 8e8bc0a1ef ("xwayland: Try manual redirection for
surface window in glamor_check_flip") was intended for. If the parent
window doesn't have depth 32, the automatic redirection might have been
done by a client, in which case doing the manual redirection may run
into trouble.

Fixes: 8e8bc0a1ef ("xwayland: Try manual redirection for surface window in glamor_check_flip")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1724
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1637>
2024-10-02 08:02:03 +00:00
Mike Blumenkrantz
ff8ec59c97 xwayland: connect to the wl display before calling into EGL
using EGL (e.g., eglQueryString, epoxy_has_egl_extension)
before establishing this connection
enables the GBM/EGL implementation to potentially consume the
WAYLAND_SOCKET fd, which, if closed, will cause the compositor
to kill this xserver

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1646>
2024-09-24 08:07:39 +00:00
Olivier Fourdan
57a446c0f9 os: Fix NULL pointer dereference
RemoveHost() can be called from DisableLocalHost() with a NULL client,
but doesn't actually check whether the given client pointer is valid on
error and assigns the error value unconditionally, leading to a possible
NULL pointer dereference and a crash of the Xserver.

To avoid the issue, simply check whether the client pointer is not NULL
prior to assign the errorValue.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1752
See-also: https://bugzilla.redhat.com/2313799
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1701>
2024-09-23 09:36:52 +02:00
Enrico Weigelt, metux IT consult
cda799533f xfree86: os-support: bsd: fix missing include of xf86_OSproc.h
Missing include of xf86_OSproc.h leads to missing prototype warnings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1697>
2024-09-13 17:47:01 +02:00
Enrico Weigelt, metux IT consult
3cbc9eda07 ci: reduce nolibdecor build to xwayland only
libdecor is only relevant for Xwayland, so no need to build all the
other DDX'es for this build test. Remvoving some unncessary load from
CI machines by disabling all DDX'es but Xwayland here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1676>
2024-09-10 13:49:30 +02:00
Alan Coopersmith
4accb821f2 meson: list required version of xproto headers in xorg-server.pc
Many of the SDK headers use the _X_* helper macros from Xfuncproto.h,
so list a dependency on them so the right path & version are used when
building out-of-tree loadable modules such as drivers.

Raises required version of meson to 0.58.0 to support format strings.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1668>
2024-09-09 07:48:07 -07:00
Alan Coopersmith
3de2e27ccc CI: update meson from 0.56.2 (bullseye) to 1.0.0 (bullseye-backports)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1668>
2024-09-09 07:47:32 -07:00
Alan Coopersmith
32adf434b7 CI: update libdecor from 0.1.0 to 0.1.1
The install_demo meson_option was added in
libdecor/libdecor@7106f5e329
which is in the 0.1.1 tag, but not 0.1.0.

If we upgrade the version of meson used in the CI to 1.0.0, then it fails
to build libdecor 0.1.0 with: ERROR: Unknown options: "install_demo"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1668>
2024-09-09 07:44:44 -07:00
Alan Coopersmith
fc8ba24413 CI: clone libdecor from fd.o instead of gnome.org
https://gitlab.gnome.org/jadahl/libdecor is archived and the README
says to use  https://gitlab.freedesktop.org/libdecor/libdecor instead.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1668>
2024-09-09 07:44:44 -07:00
Alan Coopersmith
83f553b340 CI: Update xcb util libraries to versions with working submodule URLs
The tags previously listed used anongit.fd.o URLs for their submodules
which no longer work.  Update to tags using gitlab.fd.o URL's instead.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1672>
2024-09-09 00:08:52 +00:00
Alan Coopersmith
9c9e1afeb2 dix: FindBestPixel: fix implicit fallthrough warning
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 13:27:45 -07:00
Alan Coopersmith
e6fc0861d8 dix: GetPairedDevice: check if GetMaster returned NULL
Clears warning from gcc 14.1:

../dix/devices.c: In function ‘GetPairedDevice’:
../dix/devices.c:2734:15: warning: dereference of NULL ‘dev’
 [CWE-476] [-Wanalyzer-null-dereference]
 2734 |     return dev->spriteInfo? dev->spriteInfo->paired: NULL;
      |            ~~~^~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 13:21:14 -07:00
Alan Coopersmith
26a7ab09ea dix: HashResourceID: use unsigned integers for bit shifting
Clears warning from gcc 14.1:

../dix/resource.c: In function ‘HashResourceID’:
../dix/resource.c:691:44: warning: left shift of negative value
 [-Wshift-negative-value]
  691 |     return (id ^ (id >> numBits)) & ~((~0) << numBits);
      |                                            ^~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:59:07 -07:00
Alan Coopersmith
39f337fd49 dix: ProcListProperties: skip unneeded work if numProps is 0
No real harm, but clears warning from gcc 14.1:

../dix/property.c: In function ‘ProcListProperties’:
..//dix/property.c:605:27: warning: dereference of NULL ‘temppAtoms’
 [CWE-476] [-Wanalyzer-null-dereference]
  605 |             *temppAtoms++ = pProp->propertyName;
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:48:18 -07:00
Alan Coopersmith
10cafd0bbe dix: dixChangeWindowProperty: don't call memcpy if malloc failed
It shouldn't matter, since it would have a length of 0, but it
clears warnings from gcc 14.1:

../dix/property.c: In function ‘dixChangeWindowProperty’:
../dix/property.c:287:9: warning: use of possibly-NULL ‘data’ where
 non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
  287 |         memcpy(data, value, totalSize);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../dix/property.c:324:13: warning: use of possibly-NULL ‘data’ where
 non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
  324 |             memcpy(data, value, totalSize);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:48:18 -07:00
Alan Coopersmith
462d13c2f6 dix: InitPredictableAccelerationScheme: avoid memory leak on failure
Clears warning from gcc 14.1:

../dix/ptrveloc.c: In function ‘InitPredictableAccelerationScheme’:
../dix/ptrveloc.c:149:9: warning: leak of ‘<unknown>’
 [CWE-401] [-Wanalyzer-malloc-leak]
  149 |         free(vel);
      |         ^~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:48:18 -07:00
Alan Coopersmith
7ee3a52018 dix: CreateScratchGC: avoid dereference of pointer we just set to NULL
Clears warning from gcc 14.1:

../dix/gc.c: In function ‘CreateScratchGC’:
../dix/gc.c:818:28: warning: dereference of NULL ‘pGC’
 [CWE-476] [-Wanalyzer-null-dereference]
  818 |     pGC->graphicsExposures = FALSE;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:48:18 -07:00
Alan Coopersmith
0cb826e3d0 dix: enterleave.c: fix implicit fallthrough warnings
Clears 7 -Wimplicit-fallthrough warnings from gcc 14.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:48:06 -07:00
Alan Coopersmith
1a86fba0d9 dix: SetFontPath: don't set errorValue on Success
Clears warning from gcc 14.1:

../dix/dixfonts.c: In function ‘SetFontPath’:
../dix/dixfonts.c:1697:28: warning: use of uninitialized value ‘bad’
 [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
 1697 |         client->errorValue = bad;
      |         ~~~~~~~~~~~~~~~~~~~^~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:47:49 -07:00
Alan Coopersmith
d78836a3a6 dix: PolyText: fully initialize local_closure
Clears warning from gcc 14.1:

../dix/dixfonts.c:1352:15: warning: use of uninitialized value ‘*c.data’
 [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
 1352 |         free(c->data);
      |              ~^~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 11:47:37 -07:00
Alan Coopersmith
25762834c9 dix: check for calloc() failure in Xi event conversion routines
Clears up 12 -Wanalyzer-possible-null-dereference warnings from gcc 14.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
2024-09-08 09:19:40 -07:00
Enrico Weigelt, metux IT consult
94998e3a1d ci: add FreeBSD build
Build the Xserver in FreeBSD VM.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1425>
2024-09-06 09:56:29 +10:00
Enrico Weigelt, metux IT consult
c41bb2049e ci: use master branch of xf86-video-qxl driver
Need some fixes not in a tagged release yet.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1425>
2024-09-05 11:05:02 +02:00
Enrico Weigelt, metux IT consult
b5a3ac9527 Xext: xf86bigfont: split reply header and payload
Split reply header and payload buffers. Making it more coherent with all the
other request handlers, and allows a lot of further simplification by using
generic macros (coming in subsequent commits).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1600>
2024-09-02 18:28:23 +00:00
Enrico Weigelt, metux IT consult
866f3261c4 Xext: xf86bigfont: code styling cleanups
* tidy up the includes into logic order.
* beautify function prototype

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1600>
2024-09-02 18:28:23 +00:00
Enrico Weigelt, metux IT consult
7735c4462c Xext: xf86bigfont: drop some dead code
There's some piece ifdef'ed code that doesn't serve any practical purpose.
Instead add a little comment telling why that funny way of dispatching
(based on request size) is necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1600>
2024-09-02 18:28:23 +00:00
Enrico Weigelt, metux IT consult
b0272692a1 dix: unexport DeleteAllWindowProperties()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1340>
2024-09-02 17:50:47 +00:00
Enrico Weigelt, metux IT consult
fb697dd644 dix: unexport dixLookupProperty()
It's not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1340>
2024-09-02 17:50:47 +00:00
Enrico Weigelt, metux IT consult
955cc5417b include: split out non-exported stuff from property.h
Reduce cluttering public interface with non-exported stuff, moving those
things into a separate internal header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1340>
2024-09-02 17:50:47 +00:00
Enrico Weigelt, metux IT consult
6c7c4fdc7e dix: drop superfluous XineramaGetCursorScreen()
It's only used for record extension, no external callers, thus doesn't
need to be exported. Since it's just for retrieving one struct value,
it's not needed at all - we can do this directly (just like we do in
many other places)

Note: the check on noPanoramixExtensions is superfluous, since the only
call site already does it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
eb81769b58 dix: unexport GetSpritePosition()
This function isn't used in any external modules, thus no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
9673886fac dix: unexport PointerConfinedToScreen()
It's not used by external modules, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
bd3c252710 dix: unexport NewCurrentScreen()
It's not used by external modules/drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
24d1c08441 dix: unexport CheckCursorConfinement()
This function isn't used by any external module, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
0c354e9166 dix: unexport CursorMetricsFromGlyph()
This function isn't used by external modules, thus no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
974cd2b5f2 dix: unexport ServerBitsFromGlyph()
This function isn't used by external modules/drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
24f3c4a508 dix: unexport cursor allocation functions
These functions aren't used by external modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
4aadbeb8aa dix: unexport cursor refcounting functions
These aren't used externally (drivers/modules), thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
a2f72755a9 dix: unexport rootCursor
This field is only used by DIX and XI, thus no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1345>
2024-09-02 16:43:29 +00:00
Enrico Weigelt, metux IT consult
1d7cb4b2c3 os: unexport CloseDownConnection()
Not used by any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1582>
2024-09-02 16:02:39 +00:00
Olivier Fourdan
8fe15a60c5 build: Fix DRI3 on DragonFly and OpenBSD
Commit 96bdc156 added a check for <sys/eventfd.h> to enable DRI3.

DragonFly and OpenBSD however rely on epoll-shim for <sys/eventfd.h>,
so that must be added as a dependency for the <sys/eventfd.h> check.

Fixes: commit 96bdc156 - xwayland: Do not enable DRI3 without eventfd
Suggested-by: Jan Beich <jbeich@freebsd.org>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1642>
2024-09-02 11:52:26 +00:00
Olivier Fourdan
7bcf2bcafc build: Add epoll to Xwayland for DragonFly and OpenBSD
DragonFly and OpenBSD rely on epoll-shim for <sys/eventfd>, add a
optional dependency to build Xwayland.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1642>
2024-09-02 11:52:26 +00:00
Olivier Fourdan
673b56e61c build: Move epoll dependency check
DragonFly and OpenBSD rely on epoll-shim to provide eventfd.

Move the check for epoll dependency to the root meson.build script so
that we can use that for the <sys/evenfd.h> check as well.

This is preparation work for the following commits, no functional change
intended at this point.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1642>
2024-09-02 11:52:26 +00:00
Matthieu Herrb
fbc034e847 Fix a double-free on syntax error without a new line.
$ echo "#foo\nfoo" > custom_config $ X -config custom_config

will trigger the double free because the contents of xf86_lex_val.str
have been realloc()ed aready  when free is called in read.c:209.

This copies the lex token and adds all the necessary free() calls to
avoid leaking it

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1176>
2024-09-01 23:28:20 +00:00
Peter Hutterer
e7c876ab0b Xi: when removing a master search for a disabled paired device
If either the master pointer or keyboard was disabled, the respective
GetMaster() call returns NULL, causing a segfault later accessing the
deviceid.

Fix this by looking in the off_devices list for any master
device of the type we're looking for. Master devices lose the pairing
when disabled (on enabling a keyboard we simply pair with the first
available unpaired pointer).

And for readability, split the device we get from the protocol request
into a new "dev" variable instead of re-using ptr.

Fixes #1611

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1256>
2024-09-01 23:12:28 +00:00
Peter Hutterer
9b983fecf9 dix: don't push the XKB state to a non-existing master keyboard
If our master keyboard is disabled, GetMaster() returns NULL and
we segfault in XkbPushLockedStateToSlaves().

Fixes 45fb3a934d
Fixes #1611

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1256>
2024-09-01 23:12:28 +00:00
Matthieu Herrb
59f5445a7f Return NULL in *cmdname if the client argv or argv[0] is NULL
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/995>
2024-09-01 22:59:26 +00:00
Matthieu Herrb
a8512146ba Don't crash if the client argv or argv[0] is NULL.
Report from  bauerm at pestilenz dot org.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/995>
2024-09-01 22:59:26 +00:00
moozcheng
96079f8c68 dix: fix a misused const pointer in cursor.c
`const CursorPtr` actually means `struct _Cursor *const`, a constant pointer, which does not prevent you from accidentally modifying the value it points to, like the cursor refcnt.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1140>
2024-09-01 22:46:05 +00:00
Enrico Weigelt, metux IT consult
080fd7821b dix: fix duplicate typedef of CallbackListPtr
fix warning on duplicated typedef:

> In file included from ../dix/main.c:86:
> ../dix/callback_priv.h:10:31: warning: redefinition of typedef 'CallbackListPtr' is a C11 feature [-Wtypedef-redefinition]
> typedef struct _CallbackList *CallbackListPtr;
>                               ^
> ../include/callback.h:60:31: note: previous definition is here
> typedef struct _CallbackList *CallbackListPtr;  /* also in misc.h */
>                               ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1427>
2024-09-01 22:32:49 +00:00
Enrico Weigelt, metux IT consult
415df761d5 dix: fix duplicate typedef of MotionTracker and *MotionTrackerPtr
fix warning on duplicate typedef:

> In file included from ../hw/xfree86/common/xf86Xinput.c:59:
> ../dix/ptrveloc_priv.h:33:3: warning: redefinition of typedef 'MotionTracker' is a C11 feature [-Wtypedef-redefinition]
> } MotionTracker, *MotionTrackerPtr;
>   ^
> ../include/ptrveloc.h:54:31: note: previous definition is here
> typedef struct _MotionTracker MotionTracker, *MotionTrackerPtr;
>                               ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1427>
2024-09-01 22:32:49 +00:00
Enrico Weigelt, metux IT consult
df5047fa46 dix: fix duplicate typedef of PointerAccelerationProfileFunc
fix warning:

> ../dix/ptrveloc_priv.h:20:18: warning: redefinition of typedef 'PointerAccelerationProfileFunc' is a C11 feature [-Wtypedef-redefinition]
> typedef double (*PointerAccelerationProfileFunc)
>                  ^
> ../include/ptrveloc.h:50:18: note: previous definition is here
> typedef double (*PointerAccelerationProfileFunc)
>                  ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1427>
2024-09-01 22:32:49 +00:00
Enrico Weigelt, metux IT consult
8a3cce0101 dix: fix duplicate typedef of *ScreenPtr
fix warning:

> In file included from ../hw/xfree86/common/xf86Init.c:53:
> In file included from ../include/input.h:51:
> ../include/screenint.h:55:25: warning: redefinition of typedef 'ScreenPtr' is a C11 feature [-Wtypedef-redefinition]
> typedef struct _Screen *ScreenPtr;
>                         ^
> ../dix/screenint_priv.h:11:25: note: previous definition is here
> typedef struct _Screen *ScreenPtr;
>                         ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1427>
2024-09-01 22:32:49 +00:00
Enrico Weigelt, metux IT consult
03eb593460 include: unexport XIstubs.h
The functions declared here aren't used by any driver, so no need to keep
them in the public driver API. Since the whole file isn't included by anybody
outside the xserver tree itself, it doesn't need to be installed at all,
so making it internal and move it to Xi directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1325>
2024-09-01 22:21:12 +00:00
Enrico Weigelt, metux IT consult
1bfa4876f6 dix: move colormap flags into colormap_priv.h and rename them
These aren't used by any drivers/modules, so no need to keep them exported.
As already touching them, give them a proper name prefix for clarity.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
7ba3fc3a54 dix: move internal defines into colormap.c
These are really internal to colormap.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
cbf5d88352 include: colormap.h: drop unused defines
These aren't used anywhere, so we can drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
7c03549134 include: colormap.h: drop unused typedef colorResourcePtr
This typedef isn't used anywhere, so can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
a3ec1a829d dix: unexport IsMapInstalled()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
5eca51a5d2 dix: unexport StoreColors()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
6809621985 dix: unexport FreeColors()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
c2e49c82be dix: unexport AllocColorPlanes()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
b7e280e163 dix: unexport AllocColorCells()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
3964510fb8 dix: unexport FreeClientPixels()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
5dc5d2965b dix: unexport QueryColors()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult
968cb9c7fa dix: unexport FakeFreeColor()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
989c46fc9d dix: unexport FakeAllocColor()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
b48e4a9cb7 dix: unexport AllocColor()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
3874fced31 dix: unexport CopyColormapAndFree()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
de4db967e0 dix: unexport TellGainedMap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
ece72f50fe dix: unexport TellLostMap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
a1902f2029 dix: unexport FreeColormap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
7ce67a99bc dix: unexport CreateColormap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:49 +00:00
Enrico Weigelt, metux IT consult
a66f99515a Revert "dix: unexport AttachOutputGPU() and DetachOutputGPU()"
This reverts commit 1277bb7143.

Nvidia driver needs them for PRIME handling.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1371>
2024-09-01 20:38:01 +00:00
Enrico Weigelt, metux IT consult
811977228b os: unexport screen saver timer functions
These functions aren't supposed to be used by drivers, so move them
out of the public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1583>
2024-09-01 20:23:10 +00:00
Enrico Weigelt, metux IT consult
aef17edd92 os: utils: drop obsolete REMOVE_ENV_LD conditional
This always had been set since it's incarnation back two decades
ago, on XFree86 4.3.0.1. Probably no need to keep that around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult
4b94e4fa08 os: utils: drop unused USE_ISPRINT
This always had been disabled since it's incarnation XFree86 4.3.0.1,
back two decades ago, so there's likely no need for it.

Fixes: d568221710
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult
b5d897d126 os: utils: drop REMOVE_LONG_ENV conditional
This always had been enabled since it's incarnation back two decades ago,
so it doesn't seem to be necessary keeping that conditional any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult
6c6944be14 os: utils: drop unused VENDORSUPPORT
This doesn't seem to be used anymore for two decades now,
so there's probably no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult
69905a0a28 os: utils: drop unused NO_OUTPUT_PIPES
This hasn't been used/enabled for over 20 years, so there's probably
no reason for keeping it even longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult
6153b89d19 os: utils: minor code formatting cleanup
Just correcting some small indention issues, no actual change.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult
3d3d148039 os: unexport WaitForSomething()
Not used by any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1584>
2024-09-01 19:53:43 +00:00
Enrico Weigelt, metux IT consult
2cec3cfbf1 include: move private definitions out of input.h
It's not good having the public server api headers clobbered with private
definitions, so cleaning them up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1354>
2024-09-01 17:59:23 +00:00
Enrico Weigelt, metux IT consult
646831cda2 include: dixfontstr.h: drop silent dependency on libxfont2
This header includes libxfont2.h, but the dependency isn't stated anywhere,
causing some drivers to FTBS (when libxont2.h is in non-standard location).

Since this header doesn't seem to need including libxfont2.h at all, just
stop including it, instead of adding yet another dependency to server SDK.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1610>
2024-09-01 17:45:13 +00:00
Alan Coopersmith
62c9f52e41 Remove remnants of support for SVR4 systems other than Solaris & illumos
Most of the support for such OS'es was removed in 2010 for
xorg-server-1.10.0, but a few bits lingered on.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1667>
2024-09-01 02:14:10 +00:00
Alan Coopersmith
f35951d83e Remove remnants of support for SysV versions before SVR4
Most of the support for such OS'es was removed in 2010 for
xorg-server-1.10.0, but a few bits lingered on, and a few
comments were left out-of-date.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1667>
2024-09-01 02:14:10 +00:00
Enrico Weigelt, metux IT consult
12f71ede8a Xnest: use Xorg's TRUE/FALSE instead of Xlib's True/False
Use Xserver's defines instead of Xlib's ones. The values are the same.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1657>
2024-09-01 00:48:52 +00:00
Enrico Weigelt, metux IT consult
0d3ae98661 Xnest: split off event handler
Tidy it up a bit and split the actual request handler from the request
reading loop, making upcoming reworks easier to review (smaller diffs).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1661>
2024-09-01 00:38:30 +00:00
Enrico Weigelt, metux IT consult
3597323d48 Xnest: xnestCollectEvents(): scope local variables
Make the code easier to read/understand by scoping variables to where
exactly they're needed. Also a preparation for subsequent reworks
(keep the diff smaller and thus easier to review)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1661>
2024-09-01 00:38:30 +00:00
Enrico Weigelt, metux IT consult
e1c47ad123 Xnest: fix broken exposure events
Xnest fails to properly pass through expose events: the coordinates are
miscalculated in xnestCollectExposures(), before miSendExposures() is called.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1735
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1634>
2024-08-31 23:45:26 +00:00
Enrico Weigelt, metux IT consult
ea042cd6ef Xnest: Display.h: fix missing include of colormap.h
Needs some types (eg. Pixel) from colormap.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1660>
2024-08-31 23:32:54 +00:00
Enrico Weigelt, metux IT consult
4db1da86fc Xnest: XNGC.h: add missing includes
This header makes use of types and functions defined in gcstruct.h and
privates.h. It should include them, instead of demanding it's consumers
having done that before including this file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1659>
2024-08-31 23:21:21 +00:00
Enrico Weigelt, metux IT consult
eafd687c47 Xnest: add guards to Xnest.h
protect it from duplicate inclusion.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1658>
2024-08-31 23:09:30 +00:00
Enrico Weigelt, metux IT consult
1bea5ddfce test: dix_input_valuator_masks(): use fixed array instead of VLA
The array size is determined on compile time, so no need to use a vla
which always has the same size anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1663>
2024-08-31 22:42:36 +00:00
Enrico Weigelt, metux IT consult
3c1f34347d damage: fix missing removal of obsolete damageext.h
This file became obsolete with 33350ef8ff, but was forgotten to
be removed.

Fixes: 33350ef8ff
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1593>
2024-08-31 22:29:01 +00:00
Enrico Weigelt, metux IT consult
6531720c7c os: backtrace: use fixed size array instead of vla
The backtrace buffer size (BT_SIZE) is determined by compile time,
so we can change BT_SIZE into a #define to turn vla into fixed array.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1664>
2024-08-31 22:14:07 +00:00
Enrico Weigelt, metux IT consult
588b97b932 doc: drop removed functions from the Xserver spec
The recently dropped mi functions shouldn't be described as "provided by MI"
anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
2024-08-29 19:34:09 +02:00
Enrico Weigelt, metux IT consult
a716484926 mi: drop obsolete mibitblt.c
This file is practically empty now, so we can remove it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
2024-08-29 19:34:09 +02:00
Enrico Weigelt, metux IT consult
af2b29106d mi: drop unused miPutImage()
With removal of Xwin's NATIVEGDI (back a decade ago), the last caller is
gone, and it also doesn't seem to be called by any driver.

Fixes: 8465ee788f
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
2024-08-29 19:34:09 +02:00
Enrico Weigelt, metux IT consult
c0589e228c mi: drop unused miGetImage()
With removal of Xwin's NATIVEGDI (back a decade ago), the last caller is
gone, and it also doesn't seem to be called by any driver.

Fixes: 8465ee788f
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
2024-08-29 19:34:09 +02:00
Enrico Weigelt, metux IT consult
e89ed59c94 mi: drop unused miCopyArea()
With removal of Xwin's NATIVEGDI (back a decade ago), the last caller is
gone, and it also doesn't seem to be called by any driver.

Fixes: 8465ee788f
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
2024-08-29 19:34:09 +02:00
Enrico Weigelt, metux IT consult
c90543968b mi: drop unused miCopyPlane()
With removal of Xwin's NATIVEGDI (back a decade ago), the last caller is
gone, and it also doesn't seem to be called by any driver.

Fixes: 8465ee788f
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
2024-08-29 19:34:09 +02:00
Enrico Weigelt, metux IT consult
c4481fc20f treewide: fix indentions got broke by recent commit
Commit f26f17c66a broke some indentions,
fixing them now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1662>
2024-08-27 20:08:32 +02:00
Enrico Weigelt, metux IT consult
720651ebf3 Xnest: Keyboard: drop unnecessary include
<X11/extensions/XKBconfig.h> isn't needed, so drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1649>
2024-08-26 11:33:40 +02:00
Enrico Weigelt, metux IT consult
8d5584558f Xnest: cursor: fix potentially uninitialized memory
It's safer to zero-out the cursor-private memory on allocation,
instead of relying on being cleared initialized somewhere later.

Fixes: 3f3ff971ec - Replace X-allocation functions with their C89 counterparts
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1652>
2024-08-26 03:58:28 +00:00
Enrico Weigelt, metux IT consult
f26f17c66a treewide: mark pGC->ops->CopyArea() calls not using result as void
We alread have several of these calls, that aren't interested in result value,
explicitly casting to void. Fixing this up for the remaining ones.

This is helpful for the human reader as well as quality analysis tools.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1648>
2024-08-26 03:44:23 +00:00
Enrico Weigelt, metux IT consult
9929f64ec8 ci: fix w64 cross build pkg-config path
pkg-config path is wrong: it's using /usr/share/pkgconfig from the *host*
instead of sysroot, which is leading to wrong pathes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1655>
2024-08-23 15:42:21 +02:00
Olivier Fourdan
e2e5842444 xwayland: Report correct mode size when rootful
The vidmode extension emulation in Xwayland reports the modeline based
on the current mode.

To do so, it searches for the mode using `xwl_output_find_mode(-1, -1)`
which is supposed to return the current mode, whatever that mode is.

With XRandR emulation, in rootless mode, the default value is the mode
at index 0. That assumption, however is not true when running rootful.

That means that the vidmode extension will always return the highest
mode available, which is 5120x2880, with Xwayland running rootful:

  $ xwayland-run -geometry 1024x768 -- xvidtune -show
  "5120x2880"   1276.50   5120 5560 6128 7136   2880 2883 2888 2982 -hsync +vsync

Luckily, when Xwayland is running rootful, we have the current mode size
conveniently stored in dedicated fields of the xwayland output struct,
so we can use that to search for the right mode being used and report
that through the vidmode extension:

  $ xwayland-run -geometry 1024x768 -- xvidtune -show
  "1024x768"     63.50   1024 1064 1176 1328    768  771  775  798 -hsync +vsync

That fixes legacy games using the vidmode extension and rendering at the
wrong size when running within Xwayland rootful.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1641>
2024-08-13 10:08:19 +02:00
Ian Douglas Scott
386b54fbe9 xwayland: Release keys on keyboard enter event if leave wasn't received
The code here assumed a `leave` event always occurs between two `enter`
events. On Sway (and presumably other compositors) this happens even if
the client has destroyed the `wl_surface`, but the client gets a null
`surface` here. (Which presumably on on the wire is the id of the
destroyed surface.)

This seems like a bad thing to rely on, and is easy to avoid. But if
this is correct to assume, the Wayland protocol should be explicit about
this.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1527>
2024-08-05 09:10:51 +00:00
Olivier Fourdan
23c295ea8b xwayland: Do not include sys/eventfd.h without DRI3
Now that we won't enable DRI3 if <sys/eventfd.h> is not available, there
is not point in trying to include that header without DRI3.

That allows to build Xwayland with GLAMOR enabled (without DRI3) on
platforms which do not support eventfd.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
2024-08-05 10:24:58 +02:00
Olivier Fourdan
96bdc156a1 xwayland: Do not enable DRI3 without eventfd
DRI3 version 1.4 which supports explicit buffers synchronization relies
on the eventfd interface.

As result, building would fail with DRI3 enabled on platforms without
the eventfd interface.

Check for the availability of the sys/eventfd.h header and disable DRI3
support if missing.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
2024-08-05 10:24:58 +02:00
Olivier Fourdan
a58352b985 xwayland: Fix build without DRI3 enabled
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1668
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
2024-08-05 10:24:58 +02:00
Nicolas Dufresne
39c8a6f367 glamor: xv: Rewrite UYVY shader to match NV12/I420 CSC
This rewrites the shader so that we use the same (more flexible) CSC as
we have for I420 and NV12. This also fixes the reverse of odd/even which
caused chroma shift.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1633>
2024-08-01 10:51:20 +03:00
Konstantin
eb26f32368 glamor: xv: fix UYVY alignment
UYVY videos should be aligned by 2 to avoid breakups in the shader

Fixes: 832b392f7 - glamor: xv: enable UYVY acceleration
Suggested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1633>
2024-08-01 10:48:25 +03:00
Konstantin
75f56b7923 glamor: check BPP by render_format.
Check actual BPP by render_format in upload_boxes, not by drawable BPP.

It is required when we used different BPP formats for storing and
rendering (for example, in the case of UYVY).

The problem of UYVY size lies inside method of glamor downloading boxes.

When we set GLAMOR_CREATE_FORMAT_CBCR, it actually uses 16-bit GL and
Pixman formats, but before this change in glamor_download_boxes, that
function deduces GL and Pixman formats from BPP, which is wrong in this
case (will be deduced to 32).

When GL and Pixman format BPP is identical to drawable BPP, this change
does nothing, but when it is different - it will prioritize Pixman
format, not the format deduced from BPP.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1730
Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1633>
2024-08-01 10:48:11 +03:00
Olivier Fourdan
0525b9a5b9 xwayland/ei: Dequeue events when all caps are available
Currently, we would start dequeuing events as soon as a device is
resumed, regardless of its capabilities.

If the capabilities are not available, we would just fallback to the
regular XTEST code path and not use input emulation.

As a result, it is very likely that we shall lose the first events until
the compositor resumes first a device with the requested capabilities.

To avoid that issue, start emulating only once we have the requested
capabilities, if they match the seat capabilities.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1732
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1631>
2024-07-31 06:04:12 +00:00
Olivier Fourdan
68ec297ee9 xwayland/ei: Move code to helper function
This is a small code refactoring to help with clarity, simply move the
code from the switch case for device resume to a dedicated function.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1631>
2024-07-31 06:04:12 +00:00
Olivier Fourdan
34ea020344 glamor: Fix possible double-free
If glamor_link_glsl_prog() fails, we may jump to the failed code path
which frees the variable vs_prog_string and fs_prog_string.

But those variables were already freed just before, so in that case we
end up freeing the memory twice.

Simply move the free at the end of the success code path so we are sure
to free the values only once, either in the successful of failed code
paths.

Fixes: 2906ee5e4 - glamor: Fix leak in glamor_build_program()
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1629>
2024-07-29 13:49:27 +00:00
Alan Coopersmith
bbc758d47b compiler.h: drop translation of Sun compiler platform defines to gcc
Missed when the rest of Sun compiler support was removed by
commit 6dafe3dbe6.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1628>
2024-07-28 23:26:37 +00:00
Alan Coopersmith
f3b43adf3a meson: make AF_INET6 check work with stricter compiler flags
Previously it failed with:
_build/meson-private/tmpr7qpcbo1/testfile.c: In function 'main':
_build/meson-private/tmpr7qpcbo1/testfile.c:7:5:
 error: old-style function definition [-Werror=old-style-definition]
    7 | int main() { int foo = AF_INET6; }
      |     ^~~~
_build/meson-private/tmpr7qpcbo1/testfile.c:7:18:
 warning: unused variable 'foo' [-Wunused-variable]
    7 | int main() { int foo = AF_INET6; }
      |                  ^~~

Fixes: bc55a98d6 ("meson: explicitly check whether AF_INET6 is available")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1627>
2024-07-27 11:59:34 -07:00
Enrico Weigelt, metux IT consult
ed9c48a030 xv: unexport XvPortNotifyRec
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
58a2fb8b6f xv: unexport XvScreenRec and XvScreenPtr
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
a952b93d0d xv: unexport XvdiGrabPort() and XvdiUngrabPort()
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
27a2245da7 xv: unexport XvdiMatchPort()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
043a9c7b03 xv: unexport XvdiStopVideo()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
79189b9e11 xv: unexport XvdiSetPortAttribute() and XvdiGetPortAttribute()
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
bb287bb7c6 xv: unexport XvdiGet*()
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
6b884b89c5 xv: unexport XvdiPut*()
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
12ffbdccc2 xv: unexport notify control functions
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
00f00e5d42 xv: make XvdiSendPortNotify() static
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
68ea5f855c xv: unexport XvFillColorKey()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
01de53c815 xv: unexport XvFreeAdaptor()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
f3c3b78907 xv: unexport dispatch functions
These aren't supposed to be called by drivers, no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
d746a43a67 xv: unexport remaining public variables
These variabls aren't used by any driver, no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
d53b5550c1 xv: unexport VALIDATE_XV_PORT and _XvBadPort macros
These are only used inside xv extension code, so no need to keep
them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
9bb6d8b169 xv: unexport internal variables and make them static
These variables are only used by xvmain.c (no drivers using them),
so make them static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
354f42b25c xv: move XvVideoNotifyRec into xvmain.c
This struct is only used in xvmain.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
4d0b5833da xv: move SCREEN_(PROLOGUE|EPILOGUE) into xvmain.c
These macros are only used in xvmain.c, so no need to keep
them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
d7e481f200 xv: drop unused macro _XvBadEncoding
Couldn't find a trace where it actually had been used, so there doesn't
seem to be any reason while still keeping it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
6b445819dd xv: drop unused define GLOBAL
This symbol isn't used anywhere, for at least 20 years now,
so no need to define it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
8e32cec204 xv: move noXvExtension to xvmain.c
It's more appropriate having those kind of flags in the corresponding
extension.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult
dec57e5796 treewide: replace xnfstrdup() calls by XNFstrdup()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:34 +00:00
Enrico Weigelt, metux IT consult
f446235b71 treewide: replace xnfcalloc() calls by XNFcallocarray()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult
9ec31d1a88 treewide: replace strdup() calls to Xstrdup()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult
a1fd7e7ba5 treewide: replace xnfrealloc() calls to XNFrealloc()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult
61233adbca treewide: replace xnfreallocarray macro call by XNFreallocarray()
The xnfreallocarray was added along (and just as an alias to) XNFreallocarray
back a decade ago. It's just used in a few places and it's only saves us from
passing the first parameter (NULL), so the actual benefit isn't really huge.

No (known) driver is using it, so the macro can be dropped entirely.

Fixes: ae75d50395
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult
6b3c916030 treewide: replace xnfallocarray() calls by XNFreallocarray
The xnfallocarray was added along (and just as an alias to) XNFreallocarray
back a decade ago.

No (known) driver is using it, so the macro can be dropped entirely.

Fixes: ae75d50395
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult
c55ddd072b treewide: replace xnfalloc() calls to XNFalloc()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Fixes: ded6147bfb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult
96c99b8318 os: move -nolock help message printing to serverlock.h
Reduce #ifdef cluttering in os/utils.c a little bit my moving the (built-time-)
conditional printing of the help message into serverlock.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult
749046e5e9 os: move out LockServer logic from util.c to serverlock.c
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult
4773182c72 os: unexport LockServer() and UnlockServer() from public module API
These functions work on server process level, and shouldn't be touched
by drivers at all, thus shouldn't be exported to them.

(couldn't find any driver/module using these symbols)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult
69b57fd01f os: move defining LOCK_SERVER into meson
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult
ab701418b2 meson.build: disable udev on platforms not having it
Several more platforms lacking udev haven't been catched yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1577>
2024-07-25 23:59:37 +00:00
Olivier Fourdan
1a42fe40d0 xwayland/ei: Log the type name of unhandled events
Currently, we would log only the event type, use the libei API to also
log the name in plain text, so we can quickly identify the events we're
missing out.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1620>
2024-07-25 23:13:16 +00:00
Olivier Fourdan
bfabd3bdab xwayland/ei: Handle EI_EVENT_KEYBOARD_MODIFIERS
Although we do not do anything with that event, handle it so we don't
end up in the "Unhandled event" territory.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1722
Fixes: a133334270 - xwayland: Add XTEST support using EIS
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1620>
2024-07-25 23:13:16 +00:00
Enrico Weigelt, metux IT consult
b2198df55a xkb: ProcXkbGetGeometry(): fix memleak
If XkbComputeGetGeometryReplySize() returns an error, the XkbGeometryRec won't
be freed, since we're bailing out too early and not calling XkbSendGeometry().

Having XkbSendGeometry() responsible for freeing that struct is unnecessarily
complicated anyways, so move that to ProcXkbGetGeometry() and do it also when
XkbComputeGetGeometryReplySize() failed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1622>
2024-07-25 18:04:01 +02:00
Olivier Fourdan
66f5e7e96a xwayland: Make sure output is suitable for fullscreen
Since commit d370f1e58, Xwayland can optionally be started rootful and
fullscreen.

To do so, it will setup a viewport to scale the root window to match the
size of the output.

However, if the rootful Xwayland window receives an xdg-surface configure
event before the output definition is complete, as with e.g. the labwc
Wayland compositor, we might end up trying to setup a viewport with a
destination size of 0x0 which is a protocol violation, and that kills
Xwayland.

To avoid that issue, only setup the viewport if the output size is
meaningful.

Also, please note that once the output definition is complete, i.e. when
the "done" event is eventually received, we shall recompute the size for
fullscreen again, hence achieving the desired fullscreen state.

Fixes: d370f1e58 - xwayland: add fullscreen mode for rootful
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1717
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1621>
2024-07-24 15:42:19 +02:00
Enrico Weigelt, metux IT consult
aec722db36 ci: enable building security extension
Since we already had incident where a break in security extension went to
master unnoticed, it's better to enable it in CI build.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1617>
2024-07-23 09:17:36 +02:00
Enrico Weigelt, metux IT consult
37e65497e4 Xext: security: fix missing include of extinit_priv.h
Fix a warning on missing prototype due missing include of extinit_priv.h

Fixes: 33350ef8 - include: move private definitions out of extinit.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1617>
2024-07-23 09:17:33 +02:00
Enrico Weigelt, metux IT consult
f94e280896 Xext: fix missing include of <X11/Xmd.h>
Including <X11/extensions/securproto.h> depends on <X11/Xmd.h> has been
included before.

Bug: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1719
Fixes: b30edf32 - fix missing includes of <X11/Xfuncproto.h>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1617>
2024-07-23 08:55:38 +02:00
Enrico Weigelt, metux IT consult
b30edf326b fix missing includes of <X11/Xfuncproto.h>
Several places using _X_ATTRIBUTE_PRINTF macro from X11/Xfuncproto.h
but missing to include it, so it depends on other headers whether it's
included by mere accident, which quickly causes trouble if include order
changes. Cleaning that up by adding explicit include statements.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1580>
2024-07-20 17:18:38 +00:00
Alan Coopersmith
522f469fe9 Move sizeof to second argument in calloc calls
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as:

../dix/main.c:165:42: warning: ‘calloc’ sizes specified with ‘sizeof’ in the
 earlier argument and not in the later argument [-Wcalloc-transposed-args]
  165 |             serverClient = calloc(sizeof(ClientRec), 1);
      |                                          ^~~~~~~~~
../dix/main.c:165:42: note: earlier argument should specify number of
 elements, later size of each element

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1606>
2024-07-19 23:45:21 +00:00
Enrico Weigelt, metux IT consult
6a1d730006 dix: create empty selection objects as-needed in dixLookupSelection()
For now, new selection objects are only created in ProcSetSelectionOwner()
when dixLookupSelection() can't find the requested one (returns BadMatch).

When somebody's trying to listen on a not-yet existing selection, via
XFixesSelectSelectionInput() -- XFIXES:SelectSelectionInput message -- he's
also getting BadMatch. The spec isn't explicitly clear on the exact behaviour
in those specific situations: it doesn't tell anything about selection's
lifetimes (when are they actually *created* or *destroyed*), just about their
ownership.

But there are real-world clients not expecting an error here and crashing
with a BadMatch error.

Since the spec doesn't mandate any Selection lifetime, it's safe to assume,
they can be created as-needed (as other related code paths already do).
Doing so ensures such an error cannot happen anymore.

XACE consumers get properly notified by the new Selection object creation
(eg. SElinux is attaching it's private data to it). And all callers already
prepared to get a cleared Selection object, because that's always been a
perfectly normal situation - Selection objects never get removed again,
just cleared.

Fixes: 601fd0fd8 - xfixes/xace: fix pointer type mismatch on XFixesSelectSelectionInput()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1574>
2024-07-16 12:02:33 +00:00
Alan Coopersmith
552250901f CI: Checkout driver tag into the directory we build from
It was previously checking out the default branch into the $DRIVER
subdirectory, and the requested tag into the current subdirectory,
but then proceeding to build the $DRIVER subdirectory.

Fixes: 89b7f4501 ("CI: add a driver build stage to check for header breakage")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1607>
2024-07-14 12:20:07 -07:00
Olivier Fourdan
7203626173 xwayland: Check for pointer in xwl_seat_leave_ptr()
Since commit 792758fa ("xwayland: Update lost focus on deactivation"),
in rootful mode, if we receive an "activated" state from xdg-shell
indicating that the surface is no longer active, we shall end up calling
xwl_seat_leave_ptr().

But xwl_seat_leave_ptr() does not actually check whether the seat has
pointer capabilities, and if not, get_pointer_device() will return NULL.

As a result, we would crash using a NULL pointer in GetMaster(). This
typically can happen when using Xwayland rootful on headless compositors
such as "cage" which do not advertise any capabilities for the seat.

To avoid the issue, simply check whether get_pointer_device() returns a
valid non-null device and bail out early otherwise.

Fixes: 792758fa - xwayland: Update lost focus on deactivation
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1700
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1590>
2024-07-09 09:21:12 +00:00
Enrico Weigelt, metux IT consult
9f78d548e5 fix FTBS on NetBSD
../hw/xfree86/os-support/bsd/bsd_init.c: In function ‘xf86CloseConsole’:
../hw/xfree86/os-support/xf86_os_support.h:22:6: error: ‘dispatchException’ undeclared (first use in this function)
   22 |  if (dispatchException & DE_TERMINATE) { \
      |      ^~~~~~~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:634:13: note: in expansion of macro ‘xf86FatalError’
  634 |             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
      |             ^~~~~~~~~~~~~~
../hw/xfree86/os-support/xf86_os_support.h:22:6: note: each undeclared identifier is reported only once for each function it appears in
   22 |  if (dispatchException & DE_TERMINATE) { \
      |      ^~~~~~~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:634:13: note: in expansion of macro ‘xf86FatalError’
  634 |             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
      |             ^~~~~~~~~~~~~~
../hw/xfree86/os-support/xf86_os_support.h:22:26: error: ‘DE_TERMINATE’ undeclared (first use in this function); did you mean ‘ACTION_TERMINATE’?
   22 |  if (dispatchException & DE_TERMINATE) { \
      |                          ^~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:634:13: note: in expansion of macro ‘xf86FatalError’
  634 |             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
      |             ^~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1575>
2024-07-06 19:40:10 +00:00
Enrico Weigelt, metux IT consult
fba3eefcc9 Xext: saver: little bit formatting cleanup
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1586>
2024-07-06 17:29:11 +00:00
Enrico Weigelt, metux IT consult
df38987656 Xext: saver: drop New() macro
We can directly use calloc() as all other places do.

If we wanna have an convenient macro for struct allocation, that would be the
job of a separate patch queue and should be done consequently, treewide.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1586>
2024-07-06 17:29:10 +00:00
Olivier Fourdan
a5e863963e xwayland: Force disposal of windows buffers for root on destroy
With explicit buffer synchronization in use, the window buffers use a
file descriptor for event notification to keep the buffer alive for
synchronization purpose.

When running rootful, the root window (which is visible) is destroyed
directly from the resource manager on server reset, and the window
buffer's eventfd will trigger after the window is destroyed, leading to
a use after free and a crash of the xserver.

To avoid the issue, check whether the window being destroyed is the root
window in rootless mode, and make sure to force the disposal of the
window buffers in that case.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1699
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan
fa04e15afc xwayland/window-buffers: optionally force disposal
For cases (to come) where we would want to force the disposal of the
window buffers, add a parameter to force the disposal by calling
dispose() directly instead of maybe_dispose().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan
571cb13342 xwayland/window-buffers: Move buffer disposal to its own function
No functional change, this is just preparation work for the next commit.

v2: Reshuffle functions (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan
0e1a98f52f xwayland: Make sure we do not leak xwl_window on destroy
Right now, we would dispose the xwl_window and all the data associated
with it on unrealize.

But not all window destruction go through the unrealize code path, for
example when the root window (running rootful) is destroyed from the
resource manager on server reset, we do not get to the unrealize window
step, but straight to destroy window.

As a result, we are leaking the xwl_window and all the data associated
with it, for example:

| 65,536 bytes in 1 blocks are possibly lost in loss record 12,462 of 12,488
|    at 0x484A0FC: calloc (vg_replace_malloc.c:1675)
|    by 0x48B661C: UnknownInlinedFun (pixman-bits-image.c:1273)
|    by 0x48B661C: _pixman_bits_image_init (pixman-bits-image.c:1296)
|    by 0x48B6754: create_bits_image_internal (pixman-bits-image.c:1349)
|    by 0x64180DE: UnknownInlinedFun (cairo-image-surface.c:380)
|    by 0x64180DE: UnknownInlinedFun (cairo-image-surface.c:366)
|    by 0x64180DE: cairo_image_surface_create (cairo-image-surface.c:432)
|    by 0x6346B44: UnknownInlinedFun (libdecor-gtk.c:467)
|    by 0x6346B44: libdecor_plugin_gtk_frame_new (libdecor-gtk.c:546)
|    by 0x4B7F297: libdecor_decorate (libdecor.c:559)
|    by 0x42C6F3: xwl_create_root_surface (xwayland-window.c:1266)
|    by 0x42CD97: ensure_surface_for_window (xwayland-window.c:1466)
|    by 0x42D0D1: xwl_realize_window (xwayland-window.c:1560)
|    by 0x50858F: compRealizeWindow (compwindow.c:279)
|    by 0x4FF2A2: MapWindow (window.c:2706)
|    by 0x4F9E7F: InitRootWindow (window.c:697)

To avoid that issue, check whether there is still an xwl_window
associated with the X11 window on destroy, and if that's the case,
dispose the xwl_window.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan
74be7a7f36 xwayland: Move xwl_window disposal to its own function
No functional change intended, this is just preparation work for the
next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1589>
2024-07-04 08:26:23 +00:00
Olivier Fourdan
bc9bf56360 xwayland/window-buffers: Set syncpnts for all pixmaps
The wp_linux_drm_syncobj_v1 protocol states that :

| If at surface commit time there is a pending buffer attached but no
| pending release timeline point set, the no_release_point protocol
| error is raised.

So we need to set a release timeline point in any case from the swap
pixmap routine, even for the early out code paths.

Failing to do so may cause a Wayland protocol error that is fatal to the
Wayland client, in this case Xwayland:

| wp_linux_drm_syncobj_surface_v1: error 4: No Acquire point provided
| (EE) failed to dispatch Wayland events: Protocol error

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1688
Fixes: 87bf2cafcc - xwayland: add support for wp_linux_drm_syncobj_v1
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan
33330f0dc9 xwayland/window-buffers: Move code to submit pixmaps
Move the code which takes care of submitting pixmaps and the
synchronization points to its own function.

This will allow to reuse that code from different code path.

No functional change intended.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan
aab01c7391 xwayland/window-buffers: Do not always set syncpnts
The function xwl_window_swap_pixmap() can be called from two places,
either from xwl_window_attach_buffer() or from damage_report().

When called from xwl_window_attach_buffer(), the new buffer is attached
and the surface committed.

However, when called from damage_report(), a new buffer might not be
attached before the surface is committed.

That's fine with implicit synchronization, but if we use explicit
synchronization, committing a surface without a new buffer attached but
with a release timeline point set is a protocol error:

| If at surface commit time there is a pending release timeline point
| set but no pending buffer attached, a no_buffer error is raised.

To avoid such an issue, add a new parameter to xwl_window_swap_pixmap()
to hint whether it should set the synchronization points, and have the
synchronization points set only from xwl_window_attach_buffer().

v2: Rename param to handle_sync (Michel)

Suggested-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan
256cef8b20 xwayland/window-buffers: Use synchronization from GLAMOR/GBM
Now that we have the buffer synchronization implemented in the
GLAMOR/GBM code, switch to use that code.

At this point, there is still not functional change intended, this is
still preparation work for a fix that is still to come.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan
cc021aca99 xwayland/glamor/gbm: Copy explicit sync code to GLAMOR/GBM
Copy the code to deal with synchronization objects from the window
buffers to the GLAMOR/GBM code.

The idea is to deal with synchronizations for all pixmaps, even when
there is no window buffer involved.

This is still preparation work for the following commits, no functional
change intended at this point.

v2: Use a "xwl_window_buffer *" instead of a "void *data" (Michel)
v3: Bail early if there's no xwl_window_buffer (Michel)
v4: Rename xwl_window_submit_pixmap() to
    xwl_glamor_gbm_wait_release_fence() (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan
b5082073b0 xwayland/window-buffers: Add xwl_window_buffer_release()
We want to decorrelate the explicit buffer synchronization from the
window buffers, and move that to the GLAMOR/GBM code instead.

To do that, we need to be able to invoke the xwl_window_buffer's
release_callback() routine from outside the window buffer code.

For that purpose, introduce xwl_window_buffer_release() which calls
xwl_window_buffer_release_callback() for us.

This is preparation work for the following changes, no functional change
intended at this point.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
Olivier Fourdan
0e0472a005 xwayland/window-buffers: Promote xwl_window_buffer
Make the (opaque) definition of the xwl_window_buffer generally
available.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1571>
2024-07-04 08:13:36 +00:00
nerdopolis
05c63d2a02 modesetting: Fix hang when all probed cursor sizes fail to find a minimum one
This fixes a hang on simpledrm where min_cursor_height and min_cursor_width is
never established, and drmmode_load_cursor_argb_check would infinitely when
the minimum values where 0 or less.
2024-06-24 09:53:11 -04:00
Michel Dänzer
8e8bc0a1ef xwayland: Try manual redirection for surface window in glamor_check_flip
If the surface window already uses automatic redirection, we can upgrade
to manual redirection and save some blits with common use cases.

This fixes a minor performance regression from a65bb8480a ('Revert
"xwayland/glamor: Avoid implicit redirection with depth 32 parent
windows"') with mutter >= 44.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
2024-06-24 08:26:46 +00:00
Michel Dänzer
e1b8a12194 xwayland: Only ignore manual redirection by clients for surface window
If the manual redirection was done by xwl_present_maybe_redirect_window,
we are in control.

This allows xwl_present_maybe_redirect_window to work as intended again.
Previously, xwl_window_update_surface_window would ignore the window
redirected by xwl_present_maybe_redirect_window, which would result in
xwl_present_maybe_redirect_window undoing the redirection and bailing.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
2024-06-24 08:26:46 +00:00
Michel Dänzer
ed575eee81 xwayland: Drop pixmap parameter from xwl_present_maybe_redirect_window
Never used.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
2024-06-24 08:26:46 +00:00
Joaquim Monteiro
a6a993f950 os: Fix siHostnameAddrMatch in the case where h_addr isn't defined
When IPv6 support isn't enabled, and h_addr isn't defined,
there is no for loop, so the break statement is invalid.

Signed-off-by: Joaquim Monteiro <joaquim.monteiro@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1572>
2024-06-23 21:32:23 +00:00
Joaquim Monteiro
0ddcd87851 os: Fix assignment with incompatible pointer type
struct hostent->h_addr_list is of type char**, not const char**.
GCC considers this an error when in C99 mode or later.

Signed-off-by: Joaquim Monteiro <joaquim.monteiro@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1572>
2024-06-23 21:32:23 +00:00
Enrico Weigelt, metux IT consult
34662f15af os: unexport fields from opaque.h not used by modules / drivers
There're lots of field that aren't used by any modules or drivers,
thus no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult
06b599edb6 dix: unexport fields from opaque.h not used by modules/drivers
Lots of fields from opaque.h aren't used by any drivers/modules and thus
don't need to be exported at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult
53e8ba3aff dix: move party_like_its_1989 into dix_priv.h
Internal symbol, no need to have it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult
d8cbcfd601 dix: colormap: fix name clash with win32 api on UpdateColors
As soon as winapi headers are included, we're running into a name clash
on UpdateColors(), since winapi has a function by the same name.
Trivial fix simply renaming our own UpdateColors() function.

../dix/colormap.c:110:13: error: conflicting types for ‘UpdateColors’
  110 | static void UpdateColors(ColormapPtr    /*pmap */
      |             ^~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/windows.h:71,
                 from /usr/share/mingw-w64/include/winsock2.h:23,
                 from /usr/i686-w64-mingw32/include/X11/Xwinsock.h:57,
                 from ../os/osdep.h:138,
                 from ../dix/colormap.c:57:
/usr/share/mingw-w64/include/wingdi.h:3202:28: note: previous declaration of ‘UpdateColors’ was here
 3202 |   WINGDIAPI WINBOOL WINAPI UpdateColors(HDC hdc);
      |                            ^~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult
facdaae4e8 xace: typesafe hook function for XACE_KEY_AVAIL
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
591d95c79e xace: typesafe hook function for XACE_AUTH_AVAIL
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
305f2d59d8 xace: typesafe hook function for XACE_SCREENSAVER_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
51d8bcfc0d xace: typesafe hook function for XACE_SCREEN_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
47d6c3ad75 xace: typesafe hook function for XACE_SERVER_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
0f6bb23bc2 xace: typesafe hook function for XACE_EXT_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
922b7685dc xace: typesafe hook function for XACE_CLIENT_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
3dfe00d5e0 xace: typesafe hook function for XACE_RECEIVE_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
67e468c8bd xace: typesafe hook function for XACE_SEND_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
9524ffee89 xace: typesafe hook function for XACE_DEVICE_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
ae3c573337 xace: typesafe hook function for XACE_RESOURCE_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
632a48a057 Xace: clean up XaceHookDispatch() declaration
Overloading real function name with macro makes it unnecessarily
complicated. Just rename the real function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
3e0a4ab712 Xace: unexport Xace functions
These aren't used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
22a3014c50 Xace: dont install xace.h and xacestr.h anymore
These aren't used by any drivers, so no need to keep them installed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
601fd0fd84 xfixes/xace: fix pointer type mismatch on XFixesSelectSelectionInput()
This could potentially be security related or crash the server:

XFixesSelectSelectionInput() calls the XACE_SELECTION_ACCESS hook with
wrong parameter type: XID instead of pointer to Selection struct.
It seems that it hadn't been kept up in XACE changed to polyinstantiation.

When XACE is used (eg. Security or SELinux extension enabled), this can
easily lead to memory corruptions at attacker-controlled locations, since
the client-given XID is interpreted as the memory location of Selection
structure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult
9c95347244 Xext: drop _PANORAMIX_SERVER
This used to be for panoramiXproto.h, but it doesn't look at it anymore,
so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1551>
2024-06-23 19:31:46 +00:00
Enrico Weigelt, metux IT consult
c77bcb9f7f Xext: securitysrv.h: drop hacks for including secur.h
The secur.h doesn't need the symbols defined here (eg. Status or Display)
anymore, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1550>
2024-06-23 19:20:12 +00:00
Enrico Weigelt, metux IT consult
224fa46f26 include: dix.h: fix outdated comment
The comment about ClientPtr also being defined in misc.h is outdated
for about 20 years now: XFree86 4.3.0.1 dropped the redundant definition
over there.

It's still also in Xdefs.h, so the guard is still needed.

Fixes: d568221710
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1514>
2024-06-23 18:13:30 +00:00
Enrico Weigelt, metux IT consult
487eb46826 os: move xserver_poll.h into os/ directory
This header isn't public and holds defines for code in os/ directory,
so no need to keep it in the global header dir - it's probably better
off in os/ directory - just like we already have with many others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1389>
2024-06-21 00:53:39 +00:00
Enrico Weigelt, metux IT consult
245f77cfdb mi: drop unused miPolyFillRect()
With removal of Xwin's NATIVEGDI (back a decade ago), the last caller is
gone, and it also doesn't seem to be called by any driver.

Fixes: 8465ee788f
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1504>
2024-06-21 00:24:56 +00:00
Enrico Weigelt, metux IT consult
cdb4d5648a kbd: move _XkbWantsDetectableAutoRepeat() macro into dix/events.c
That's the only place where it is used, so no need to keep it
in a public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1462>
2024-06-18 02:10:04 +00:00
Enrico Weigelt, metux IT consult
f8057261fe os: drop extra ifdefs for AF_INET6
Since IPv6 is now only defined if IPv6 is really supported, we don't
need to ifdef on AF_INET6 anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1539>
2024-06-18 01:59:33 +00:00
Enrico Weigelt, metux IT consult
bc55a98d62 meson: explicitly check whether AF_INET6 is available
We're currently not checking whether IPv6 is available before build,
so it just gets silently disabled if AF_INET6 is missing - even
when user wants to enable it explicitly. Adding explicit check into
meson.build, so failing when ipv6 option enabled, but no IPv6 supported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1539>
2024-06-18 01:59:33 +00:00
Enrico Weigelt, metux IT consult
88b2257cc4 os: drop duplicate nested ifdef TCPCONN
This #ifdef is always true, since two lines above it's already
checked that TCPCONN is defined.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1539>
2024-06-18 01:59:33 +00:00
Enrico Weigelt, metux IT consult
9d6a1d1118 os: access.c: drop unnecessary ifdef
Conditional on ipv6 around including <arpa/inet.h> isn't necessary.
The only reason target not having it is win32, but it doesn't enable
SIOCGLIFCONF anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1539>
2024-06-18 01:59:33 +00:00
Enrico Weigelt, metux IT consult
842e866155 xnest: don't silently disable Xnest
The current implementation silently disables Xnest, even if requested
explcitly. That's a bit unstable behaviour - it's better to break the
build in those cases, just disable silently in auto mode.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1534>
2024-06-18 01:44:26 +00:00
Enrico Weigelt, metux IT consult
1ead670476 xnest: don't force it off on Windows
No reason to explicitly force it off on Windows - if dependencies are present,
we can build it. Even though it will be rarely needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1534>
2024-06-18 01:44:26 +00:00
Enrico Weigelt, metux IT consult
4a27ff7a1a dix: drop unused args from CreateRootCursor()
The args have become dummies almost two decades ago, so no need
to keep them any longer.

Fixes: 0afeb0241a
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1522>
2024-06-18 01:33:56 +00:00
Enrico Weigelt, metux IT consult
27babe0334 mi: move *_VISUALS defines into consumer source file
These are only needed inside one .c source, so no need to keep thm exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1498>
2024-06-18 01:22:52 +00:00
Enrico Weigelt, metux IT consult
98104c969d mi: drop unused SWAPPT() macro
Leftover of dropping mfb about 1.5 decades ago.

Fixes: f31bd087e8
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1499>
2024-06-18 01:12:42 +00:00
Enrico Weigelt, metux IT consult
62a0a58717 mi: drop unused XMAJOROCTANTS
It hasn't been used for really long time, the history even doesn't
tell whether it ever had been used.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1500>
2024-06-18 01:02:26 +00:00
Enrico Weigelt, metux IT consult
71b207a2eb os: drop SUN-DES-1 authentication
DES isn't considered secure anymore for long time now, more and more platforms
dropping DES from their RPC implementations, and even the one where it came
from (Solaris) disabled it for a decade now. We have much better alternatives
(eg. passing creds via Unix socket for local connections, ssh tunneling,
MIT-MAGIC-COOKIE-1, ...), so it's unlikely anybody still really relying on it.

Therefore, sweep it out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1453>
2024-06-18 00:52:11 +00:00
Enrico Weigelt, metux IT consult
229a6953ad xfree86: x86emu: rename segment register fields
Instead of keeping lots of special hacks for Solaris, just rename the
field of struct i386_segment_regs, so we don't need special care anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult
0a0731721f xfree86: common: include math.h unconditionally
The header exists on all supported platform, maybe some might still need
to define _XOPEN_SOURCE to get pow() defined.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult
fd6fe36622 xfree86: os-support: simplify pci init
All supported platforms, except Linux, have have to call xf86InitVidMem()
from xf86scanpci(), so we can make the code much simpler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult
1b49f6ddb8 kdrive: drop Solaris specific hack
Since kdrive is only working on Unix'es, we don't need to care whether
that file might not exist on Windows, neither any need for doing so
exlusively on Solaris.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Enrico Weigelt, metux IT consult
83c94b7345 record: clean up Sun/Solaris specific hack
Instead of selectively undefining individual symbols with platform
specific hacks, just rename the enum values.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1548>
2024-06-18 00:41:38 +00:00
Peter Hutterer
baef637747 CI: include ci-templates only once
No functional change here.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1568>
2024-06-18 00:30:58 +00:00
Olivier Fourdan
32e16082c5 xwayland: Stop on first unmapped child
If a child window of the same size is unmapped, we should stop walking
the tree looking for the surface window to use.

Whatever lies beneath is not visible anyway.

This also fixes an issue with the Damage list becoming corrupted when
destroying a window, because the first thing that DeleteWindow() does
is to unmap the window and crush the window tree underneath it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: 3a0fc268 - xwayland: Add xwl_window::surface_window
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1680
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1564>
2024-06-17 07:06:38 +00:00
Olivier Fourdan
0509b13fa2 xwayland: Do not use manual redirect windows as surface window
While walking the window tree looking for the surface window to use, we
should ignore windows using manual redirection.

If a client manually redirects a window, it has control over how the
contents of that window are presented. It's not safe to present them
directly to the Wayland compositor.

v2: break instead of continue, reword commit message (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: 3a0fc268 - xwayland: Add xwl_window::surface_window
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1677
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1679
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1564>
2024-06-17 07:06:38 +00:00
Chenx Dust
7605833315 xwayland: fix segment fault in xwl_glamor_gbm_init_main_dev
Function `xwl_glamor_gbm_init_main_dev` does not check whether
`xwl_screen->default_feedback.main_dev` a.k.a. `main_dev` is a
valid pointer. This result in some special situation where main
linux-dmabuf device is not accessible, such as KWin nested desktop,
raising segment fault.

This commit add a null pointer check to prevent crashing.

Signed-off-by: Chenx Dust <chenx_dust@outlook.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1683
Fixes: d7f1909e - xwayland/glamor/gbm: make wl_drm optional
See-also: https://bugzilla.redhat.com/2284141
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1565>
2024-06-14 09:53:12 +00:00
Fotios Valasiadis
af6180b2c9 os: Explicitly include X11/Xmd.h for CARD32 definition to fix building on i686
Noticed this after trying to update to xorg-server-xwayland-24.1.0 in void linux https://github.com/void-linux/void-packages/pull/50457

Signed-off-by: Fotios Valasiadis <fvalasiad@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1561>
2024-06-07 08:42:58 +00:00
Rouven Czerwinski
b9754729e1 xwayland: install pkgconfig to sharedir
Remove the previous change which ensured that the xwayland pkgconfig
file was installed into $libdir. This is a breaking change for build
systems searching for the xwayland pkg-config file. The sharedir
location fits xwayland better since the pkg-config file does not contain
linking information, it only contains the data on how to locate the
xwayland binary and which features are enabled.

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1543>
2024-05-31 11:55:12 +00:00
Rouven Czerwinski
9df084c8d1 xwayland: remove includedir from pkgconfig
Before this change, the xwayland pkgconfig file will always contain an
includedir directive, even though xwayland is not a linkable shared
library:

  prefix=/nix/store/3spcjqp5zcyg8arz6dnsj59fal5yk3jy-xwayland-23.2.6
  includedir=${prefix}/include

  exec_prefix=${prefix}
  xwayland=/nix/store/3spcjqp5zcyg8arz6dnsj59fal5yk3jy-xwayland-23.2.6/bin/Xwayland
  […]
  Cflags: -I${includedir}

According to a bug reporter this trips up cmake [1], which expects that
the include directory exists, which it does not since xwayland does not
install any header files.

Add the dataonly directive to pkgsconfig.generate() which will remove
the default "." subdir and ensures that includedir is not set inside the
pkgconfig file. Additionally enforce the install directory to
$libdir/pkgconfig, since it otherwise will be installed to
$datadir/pkgconfig, which precludes programs from finding the pkgconfig
because share/pkgconfig is usually not included in the search path.

The resulting pkgconfig does not contain an includedir:

  prefix=/nix/store/p7xhdzl65hfhzf36vxykzp2i9cyy7y6c-xwayland-23.2.6

  exec_prefix=${prefix}
  xwayland=/nix/store/p7xhdzl65hfhzf36vxykzp2i9cyy7y6c-xwayland-23.2.6/bin/Xwayland
  have_glamor=true
  have_eglstream=true
  have_initfd=true
  have_listenfd=true
  have_verbose=true
  have_terminate_delay=true
  have_no_touch_pointer_emulation=true
  have_force_xrandr_emulation=true
  have_geometry=true
  have_fullscreen=true
  have_host_grab=true
  have_decorate=false
  have_enable_ei_portal=true
  have_byteswappedclients=true

  Name: Xwayland
  Description: X Server for Wayland
  Version: 23.2.6

[1]: https://github.com/NixOS/nixpkgs/pull/309075#issuecomment-2108381428

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1543>
2024-05-31 11:55:12 +00:00
Matthieu Herrb
89c3f35d92 present: On *BSD, epoll-shim is needed to emulate eventfd()
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1559>
2024-05-22 09:00:11 +00:00
Yusuf Khan
c5d152c176 modesetting/dri2: Remove always true ifdef
GLAMOR_HAS_GBM is ifdefed through the whole file, so checking for it
again is redundant.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1554>
2024-05-22 05:34:30 +00:00
Dr. David Alan Gilbert
d94bff7880 xkb: deadcode cleanup
The last use of struct '_SrvXkmInfo' was removed in
commit fbd7768946 ("XKB: Ditch XkbFileInfo").
Remove it.

The define MAX_TOC hasn't been used in this file since sometime
in the mid 90's; it's unused in version '1997/05/20 11:42:06'
but in '1.8 94/05/16 10:49:53' it's used in the definition
of _SrvXkmInfo.
Remove it.

Build tested.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1558>
2024-05-19 16:15:43 +01:00
Michael Dluhosch
e61bd1e5fd xkb: Replaced hardcoded values with compile time options
The core keyboard before this change always used a layout of "us" even if you
configured the build with another default layout.

Signed-off-by: Michael Dluhosch <michael.dluhosch@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1549>
2024-05-15 19:37:19 +02:00
Alan Coopersmith
7e119c5114 solaris: convert APM interfaces to official SRN interfaces
The sun_apm.c support was written to a draft version of the interfaces that
were integrated under a different name (SRN - Suspend/Resume Notification)
in 2007 for OpenSolaris, and what eventually became Solaris 11.0. Adopt the
official names and use the system-provided header file for these now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1540>
2024-05-14 04:12:44 +00:00
Enrico Weigelt, metux IT consult
fec061fc21 xkb: unexport Xkb* defines used by xkbtext.c
These are only used inside xkb/*, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1475>
2024-05-14 03:57:45 +00:00
Enrico Weigelt, metux IT consult
434044cb08 xkb: unexport functions from xkbtext.c
These are only used inside xkb/*, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1475>
2024-05-14 03:57:45 +00:00
Alan Coopersmith
a4d298d855 xf86_OSlib.h: Don't need to include Solaris keyboard headers here
Left over from the builtin keyboard driver removed from the Xorg
server in 2006 (commit 3eeb62e8f5).

Requires xorg/driver/xf86-input-keyboard@40ef7d9e24987eb6708d822d0ea070
to build the current keyboard driver with this change.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1541>
2024-05-13 23:14:48 +00:00
Enrico Weigelt, metux IT consult
61d0c8e21c os: drop duplicate include of misc.h
Need to include it only once.

Fixes: be4c8444eb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1542>
2024-05-13 19:23:08 +00:00
Enrico Weigelt, metux IT consult
a4cb4bc4f8 os: drop remains of STREAMSCONN
STREAMSCONN has been removed about a decade ago, but some comments
have been forgotten to be cleaned.

Fixes: b3e9c534e2
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1538>
2024-05-13 18:20:55 +02:00
Olivier Fourdan
702a419c39 xwayland: Move XRandR emulation to the ResizeWindow hook
This restores the handling of the XRandR emulation for Xwayland rootless
where it was before commit fa7b1c20.

Some compositors may trigger a protocol error if the viewport source is
larger than the actual window size, having that handled in the window
resize hook makes sure we do not regress.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
2024-05-13 08:52:32 +00:00
Olivier Fourdan
31d6f9998d xwayland: Handle rootful resize in ResizeWindow
Commit fa7b1c20 ("xwayland: Use ConfigNotify screen hook instead of
ResizeWindow") replaced the WindowResize hook with ConfigNotify.

However, that's breaking rootful Xwayland with libdecor because the root
window size is already set so the libdecor size is not updated, and the
root size will be reverted back as soon as the focus changes.

Reinstate the rootful size change in ResizeWindow to avoid that issue.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1669
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1671
Fixes: fa7b1c20 - xwayland: Use ConfigNotify screen hook instead of ResizeWindow
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
2024-05-13 08:52:32 +00:00
Olivier Fourdan
539859bde0 xwayland: Restore the ResizeWindow handler
For now it just chains to ResizeWindow hook.

This is preparation work for the next commit, no functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1521>
2024-05-13 08:52:32 +00:00
Joshua Ashton
7745fde24e xwayland: Send ei_device_frame on device_scroll_discrete
This fixes the scroll action in Steam Input in SteamOS/Gamescope when using the new libeis backend.

Fixes: a133334270 ("xwayland: Add XTEST support using EIS")
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1531>
2024-05-11 07:25:48 +01:00
Enrico Weigelt, metux IT consult
1fce9f43ab dix: fix misspelled header guard
Fix FTBS on BSD:

In file included from ../dix/colormap.c:57:
../dix/colormap_priv.h:5:9: warning: '_XSERVER_DIX_COLORMAP_PRIV_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../dix/colormap_priv.h:6:9: note: '_XSERVER_DIX_COLORMAP_PRIv_H' is defined here; did you mean '_XSERVER_DIX_COLORMAP_PRIV_H'?
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _XSERVER_DIX_COLORMAP_PRIV_H
1 warning generated.
[7/531] Compiling C object dix/liblibxserver_dix.a.p/devices.c.o
In file included from ../dix/devices.c:62:
../dix/ptrveloc_priv.h:20:18: warning: redefinition of typedef 'PointerAccelerationProfileFunc' is a C11 feature [-Wtypedef-redefinition]
typedef double (*PointerAccelerationProfileFunc)
                 ^
../include/ptrveloc.h:50:18: note: previous definition is here
typedef double (*PointerAccelerationProfileFunc)
                 ^
In file included from ../dix/devices.c:62:
../dix/ptrveloc_priv.h:33:3: warning: redefinition of typedef 'MotionTracker' is a C11 feature [-Wtypedef-redefinition]
} MotionTracker, *MotionTrackerPtr;
  ^
../include/ptrveloc.h:54:31: note: previous definition is here
typedef struct _MotionTracker MotionTracker, *MotionTrackerPtr;
                              ^
In file included from ../dix/devices.c:62:
../dix/ptrveloc_priv.h:33:19: warning: redefinition of typedef 'MotionTrackerPtr' is a C11 feature [-Wtypedef-redefinition]
} MotionTracker, *MotionTrackerPtr;
                  ^
../include/ptrveloc.h:54:47: note: previous definition is here
typedef struct _MotionTracker MotionTracker, *MotionTrackerPtr;
                                              ^
3 warnings generated.
[8/531] Compiling C object dix/liblibxserver_dix.a.p/main.c.o
In file included from ../dix/main.c:86:
../dix/callback_priv.h:10:31: warning: redefinition of typedef 'CallbackListPtr' is a C11 feature [-Wtypedef-redefinition]
typedef struct _CallbackList *CallbackListPtr;
                              ^
../include/callback.h:60:31: note: previous definition is here
typedef struct _CallbackList *CallbackListPtr;  /* also in misc.h */
                              ^
1 warning generated.
[9/531] Compiling C object dix/liblibxserver_dix.a.p/dispatch.c.o
In file included from ../dix/dispatch.c:111:
../dix/screenint_priv.h:11:25: warning: redefinition of typedef 'ScreenPtr' is a C11 feature [-Wtypedef-redefinition]
typedef struct _Screen *ScreenPtr;
                        ^
../include/screenint.h:55:25: note: previous definition is here
typedef struct _Screen *ScreenPtr;
                        ^
1 warning generated.
[10/531] Compiling C object dix/liblibxserver_dix.a.p/dixutils.c.o
In file included from ../dix/dixutils.c:90:
../dix/callback_priv.h:10:31: warning: redefinition of typedef 'CallbackListPtr' is a C11 feature [-Wtypedef-redefinition]
typedef struct _CallbackList *CallbackListPtr;
                              ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1530>
2024-05-10 16:41:26 +02:00
Trevor Davenport
69beb65653 modesetting: Fix invalid identity CTM on 32-bit.
On 32-bit, the shifts used to initialized the identity CTM overflow and
result in zero instead of the intended 1.  This results in a broken
display (on at least i915) when using the modesetting xorg driver.

Fix the invalid CTM by using ULL suffix on the shifts.

Fixes:4e670f1281ad75c5673b6ac75645036d810da8d9

Signed-off-by: Trevor Davenport <trevor_davenport@selinc.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1526>
2024-05-09 11:59:55 -06:00
Enrico Weigelt, metux IT consult
e5c8b664d3 os: unexport ddx callbacks
The DDX callbacks (where core/DIX calls into DDX) aren't supposed to be
called by drivers directly, so unexport them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1332>
2024-05-08 09:37:35 +02:00
Enrico Weigelt, metux IT consult
1fdf97f28d include: xkbfile: clean up forgotten unused declarations
Back in 2008, when cleaning out unused/undefined stuff, some pieces have been
forgotten in commit fb22d4d928.
This was accidentially introduced by 68bd7ac193.

Fixes: fb22d4d928
Fixes: 68bd7ac193
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1473>
2024-05-07 22:43:14 +00:00
Olivier Fourdan
a7ba1e9fe4 xquartz: Remove invalid Unicode sequence
This is flagged by the automatic scanning tools.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1673
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1524>
2024-05-07 22:26:34 +00:00
Vlad Zahorodnii
8c2b9f4e71 xwayland: Use correct xwl_window lookup function in xwl_set_shape
In xwl_set_shape(), xwl_window_set_input_region() should be called only
when the input shape of the toplevel window changes.

However, given that xwl_window_from_window() is going to walk the
ancestor tree until it finds an xwl_window, that lookup function cannot
be used. Instead, xwl_window_get() should be used. It's going to return
a valid xwl_window object iff the specified window has one associated
with it.

Fixes: a4ed100c0 - xwayland: Set wl_surface input region
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1672
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1516>
2024-05-06 14:47:39 +00:00
Michel Dänzer
069ad69efe xwayland/present: Drop vblank->flip_ready assignment
Xwayland hasn't used the flip_ready field's value for anything since
e1f16fb1ac ("xwayland: don't scrap pending present requests").

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1511>
2024-05-02 08:17:35 +00:00
Michel Dänzer
0d9a54aa97 xwayland/present: Skip queued flip when a new one becomes ready
If multiple flips become ready for the same MSC, we would previously
execute them all sequentially, one per MSC for sync flips. This could
result in an unbounded flip queue and corresponding memory consumption.

With implicit sync, leave the mailbox handling to the compositor for
async flips though.

v2:
* Use present_vblank_rec::sync_flip.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1664
Fixes: e1f16fb1ac ("xwayland: don't scrap pending present requests")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1511>
2024-05-02 08:17:35 +00:00
Erik Kurzinger
80f74b0e44 present: signal explicit sync release point in present_vblank_scrap
If a present request using explicit sync is scrapped, instead of sending
a PresentIdleNotify event we should signal the release point.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1511>
2024-05-02 08:17:35 +00:00
Erik Kurzinger
d5192ba8eb xwayland: use write fence in xwl_glamor_dmabuf_import_sync_file
The functions xwl_glamor_dmabuf_import_sync_file and
xwl_glamor_dmabuf_export_sync_file are used to ensure proper
synchronization between clients using PresentPixmapSynced and
compositors that do not support the wp_linux_drm_syncobj_v1 protocol
when presenting by flipping. The acquire point's fence will be imported
as the DMA-BUF's implicit fence before handing it off to the compositor,
and then, after the DMA-BUF has been released, its new implicit fence
will be exported and become the release point's fence which the client
is expected to wait for before re-using the buffer.

Both functions currently set the flags arguments of their respective
ioctls to DMA_BUF_SYNC_READ. When importing a sync file, this means that
any subsequent implicitly synchronized reads from the buffer will not
wait for the fence, and when exporting a sync file it means that the
returned fence may be signaled before preceeding reads from the buffer
have completed.

While this is correct for xwl_glamor_dmabuf_export_sync_file since the
compositor will never write to the buffer, it is incorrect for
xwl_glamor_dmabuf_import_sync_file. To avoid corruption, we need any
reads from the buffer by the compositor to wait on the acquire point's
fence.

As a fix, instead of setting the DMA_BUF_SYNC_READ flag in
xwl_glamor_dmabuf_import_sync_file, we set the DMA_BUF_SYNC_WRITE flag.
This *does* provide the necessary guarantees.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1509>
2024-04-30 13:18:30 +00:00
Vlad Zahorodnii
a4ed100c0c xwayland: Set wl_surface input region
Some applications that use client side decorations usually set custom
input shape in order to prevent drop shadows stealing pointer events
from windows below. Currently, the only way to get it is to use some
XFixes APIs.

On the other hand, plenty of wayland compositors use solely the
wl_surface input region to decide what view can receive pointer input,
which results in some pointer input issues around client side drop
shadows because Xwayland doesn't set wl_surface.input_region.

See-also: https://bugs.kde.org/show_bug.cgi?id=448119
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1510>
2024-04-30 12:46:49 +00:00
Olivier Fourdan
4053782443 xwayland: Do not remove output on withdraw if leased
On DRM lease connector withdrawn event, Xwayland would free the
corresponding xwl_output offered for lease.

However, the pointer is still referenced from the rrLease->outputs[],
meaning that trying to clean up the RANDR DRM leases as done with commit
ef181265 (xwayland: Clean up drm lease when terminating) would cause a
use after free and random crashes.

To avoid that issue, on the connector withdraw event, set the connector
withdrawn flag but do not to remove (i.e. free) the xwayland output if
its is offered for lease.

Then, once the lease is terminated, check for the xwl_outputs with a
withdrawn connector and remove them (once we have no use for them
anymore.

Note that we cannot do that cleanup from xwl_randr_terminate_lease() as
removing the xwl_output will free the RRcrtc resources, which checks for
leases in XRANDR, and calls RRTerminateLease(), which chains back to
xwl_randr_terminate_lease().

v2: Use a "withdrawn_connector" flag to mark outputs to remove (Xaver)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
fixes: ef181265 - xwayland: Clean up drm lease when terminating

See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/946
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1130
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1482>
2024-04-30 09:13:34 +02:00
Olivier Fourdan
21916ae148 xwayland: Check for outputs before lease devices
In xwl_randr_request_lease(), the code checks first for leased device,
and then checks for existing output for lease.

The former assumes there are outputs for lease whereas the latter checks
for the output, connector and lease.

So if there is any existing rrLease->outputs[]->devPrivate unset, the
code would crash on a NULL pointer dereference on the first sanity check
before having a chance to reach the second check that would have caught
the problem.

Invert the sanity checks so that we would catch this first and return a
BadValue instead of possibly segfaulting.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1482>
2024-04-30 09:13:34 +02:00
Enrico Weigelt, metux IT consult
eff7ccc11c include: move private definitions out of exevents.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@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult
33350ef8ff include: move private definitions out of extinit.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to extinit_priv.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult
bae6cbc8ca include: move private defs to dixstruct_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dixstruct_priv.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult
f17bc7e24d include: split out non-exported prototypes to dix_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dix-intern.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult
8a2590e5d3 xkb: make XkbInternAtom() static
It's only used in the same .c file, so make it static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1506>
2024-04-28 23:21:52 +00:00
Michel Dänzer
08113b8923 xwayland/glamor: Handle depth 15 in gbm_format_for_depth
Prevents Xwayland with glamor from logging

 unexpected depth: 15

to stderr many times when running

 rendercheck -t blend -o clear

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1507>
2024-04-25 17:17:55 +02:00
Olivier Fourdan
49b8f131f7 xwayland: Use the connector name for XRANDR leases
Use the connector name as basis for the Xwayland output name in XRANDR,
similar to what we do for regular outputs, instead of the generic
"XWAYLAND<n>" name which changes every time the output is leased.

Prefix the actual name with "lease-" to distinguish from duplicate names
from the regular outputs.

v2: avoid duplicate names (Simon)
v3: Move the check for duplicates to xwl_output_set_name() (Simon)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Olivier Fourdan
d36f66f15d xwayland: Check for duplicate output names
Even though the name provided by either xdg-output or wl_output are
guaranteed to be unique, that might not be the case with output names
between different protocols, such as the one offered for DRM lease.

To avoid running into name conflicts, check that no other existing
output of the same name exists prior to changing the output name.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Olivier Fourdan
0cb4ec4dbd xwayland: Make xwl_output_set_name() public
No functional change, this is preparation work for the next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Olivier Fourdan
12265aaa1c xwayland: Define MAX_OUTPUT_NAME in the header
So that other parts of the Xwayland code can use it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1492>
2024-04-23 11:14:31 +02:00
Enrico Weigelt, metux IT consult
75cf29fe6c dbe: unexport dbestruct.h
This include isn't used by any (known) driver nor included by any other
public header, so no need to keep it in the public module API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1422>
2024-04-23 02:18:02 +00:00
Enrico Weigelt, metux IT consult
feb5c785fc xkb: move *_TIMER defines into xkbAccessX.c
These are only used in this file (and also not any external driver),
so no need to have them in a public header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1459>
2024-04-23 02:01:17 +00:00
Enrico Weigelt, metux IT consult
8982344e53 include: move dbus-core.h to config
This header is internal (not installed) and holds definitions for sources
in config/, thus it fells more clean moving it to config/, too.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1357>
2024-04-23 01:46:24 +00:00
Enrico Weigelt, metux IT consult
140b75298a include: colormap.h: move internal typedef to dix/colormap_priv.h
Moving the internal EntryType typedef from "colormap.h" into newly added
internal-only header "dix/colormap_priv.h"

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1283>
2024-04-23 01:05:06 +00:00
Enrico Weigelt, metux IT consult
94451181c2 xnest: fix segfault in miCreateScreenResources()
With aa3f5023e3, pScreen->devPrivate now is
initialized only once, which uncovered a silent bug in xnestOpenScreen:
It's NULL'ing the pScreen->devPrivate pointer which already had been
initialized by previous miScreenDevPrivateInit() call.

Fixes: aa3f5023e3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1495>
2024-04-23 00:52:52 +00:00
Enrico Weigelt, metux IT consult
86d0f6dafa include: drop obsolete check for typeof operator
It really seems that compilers on all our supported platforms
(including Solaris) supporting `typeof`, so we can always use it
and drop hacks with undefind behaviour entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1432>
2024-04-22 22:15:45 +00:00
Enrico Weigelt, metux IT consult
17db4ba3de xfree86: sdksyms: drop errornous check for mifillarc.h
This file had been dropped from public API a decade ago, but sdksyms.sh
yet had been forgotten to be fixed.

Fixes: 707965407a
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1497>
2024-04-22 20:43:38 +02:00
Enrico Weigelt, metux IT consult
43f47e8e65 xfree86: x86emu: fix warning on unneccessary abs()
fix warning:

> In file included from ../hw/xfree86/int10/x86emu.c:11:
> ../hw/xfree86/x86emu/prim_ops.c:2478:9: warning: taking the absolute value of unsigned type 'x86emuu32' (aka 'unsigned int') has no effect [-Wabsolute-value]
>     if (abs(div) > 0xff) {
>         ^
> ../hw/xfree86/x86emu/prim_ops.c:2478:9: note: remove the call to 'abs' since unsigned values cannot be negative
>     if (abs(div) > 0xff) {
>         ^~~
> ../hw/xfree86/x86emu/prim_ops.c:2502:9: warning: taking the absolute value of unsigned type 'x86emuu32' (aka 'unsigned int') has no effect [-Wabsolute-value]
>     if (abs(div) > 0xffff) {
>         ^
> ../hw/xfree86/x86emu/prim_ops.c:2502:9: note: remove the call to 'abs' since unsigned values cannot be negative
>     if (abs(div) > 0xffff) {
>         ^~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult
a0daa6f1fe xfree86: x86emu: drop unused stq_u()
fix warning on unused function:

> ../hw/xfree86/x86emu/sys.c:87:1: warning: unused function 'stq_u' [-Wunused-function]
> stq_u(u64 val, u64 * p)
> ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult
8081fe1206 xfree86: x86emu: drop unused ldq_u()
fix warning on unused function:

> ../hw/xfree86/x86emu/sys.c:69:1: warning: unused function 'ldq_u' [-Wunused-function]
> ldq_u(u64 * p)
> ^
> ../hw/xfree86/x86emu/sys.c:95:1: warning: unused function 'stq_u' [-Wunused-function]
> stq_u(u64 val, u64 * p)
> ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult
1e7085d143 xfree86: os-support: bsd: fix missing prototypes
Fix warnings on missing prototypes:

> ../hw/xfree86/os-support/bsd/bsd_VTsw.c:56:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86VTSwitchPending()
>                    ^
>                     void
> ../hw/xfree86/os-support/bsd/bsd_VTsw.c:67:17: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86VTSwitchAway()
>                 ^
>                  void
> ../hw/xfree86/os-support/bsd/bsd_VTsw.c:82:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86VTSwitchTo()
>               ^
>                void

> ../hw/xfree86/os-support/bsd/bsd_init.c:155:16: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenConsole()
>                ^
>                 void
> ../hw/xfree86/os-support/bsd/bsd_init.c:322:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenPccons()
>               ^
>                void
> ../hw/xfree86/os-support/bsd/bsd_init.c:347:16: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenSyscons()
>                ^
>                 void
> ../hw/xfree86/os-support/bsd/bsd_init.c:453:13: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86OpenPcvt()
>             ^
>              void
> ../hw/xfree86/os-support/bsd/bsd_init.c:596:17: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86CloseConsole()
>                 ^
>                  void
> ../hw/xfree86/os-support/bsd/bsd_init.c:673:11: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
> xf86UseMsg()
>           ^
>            void

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult
20d0545f0d xfree86: modes: drop unused xf86_driver_has_show_cursor()
Fix warning on unused function:

> ../hw/xfree86/modes/xf86Cursors.c:212:1: warning: unused function 'xf86_driver_has_show_cursor' [-Wunused-function]
> xf86_driver_has_show_cursor(xf86CrtcPtr crtc)
> ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1428>
2024-04-18 01:03:11 +00:00
Enrico Weigelt, metux IT consult
a532c93206 composite: fix duplicate typedef of ScreenPtr
fix warning on duplicate typedef:

> ../composite/compositeext_priv.h:11:25: warning: redefinition of typedef 'ScreenPtr' is a C11 feature [-Wtypedef-redefinition]
> typedef struct _Screen *ScreenPtr;
>                         ^
> ../include/screenint.h:55:25: note: previous definition is here
> typedef struct _Screen *ScreenPtr;
>                         ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1430>
2024-04-18 00:51:06 +00:00
Enrico Weigelt, metux IT consult
0f715b4ca4 xfree86: os-support: move hidden Solaris-specific symbols out of public header
These aren't exported at all, so no need to have it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
7429f8ee8f xfree86: os-support: move xf86FatalError macro out of public header
This macro is only used inside xfree86's os-support layer, not by any
(known) drivers. Thus no need to have it exported in the public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
16a3790d60 xfree86: os-support: move unexported stuff out of xf86_OSproc.h
It's cleaner to have public headers only holding public stuff and
xf86_os_support seems to be much more appropriate place for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
5b23578f93 xfree86: os-support: move VidMemInfo xf86_os_support.h
This type is only used inside the os-support layer of xfree86, so it fits
better into xf86_os_support.h, whose purpose is being the primary entry
point into os-support layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
533c45e595 xfree86: os-support: move xf86OSInitVidMem() to xf86_os_support.h
This function isn't exported at all, so it better fits into xf86_os_support.h,
whose purpose is being the primary entry point into os-support layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
a5cfe020f5 xfree86: os-support: unexport xf86RemoveSIGIOHandler
It's not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
3e4fc3e588 xfree86: os-support: unexport xf86DeallocateGARTMemory
It's not used in any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
38030fce53 xfree86: os-support: unexport xf86OSInputThreadInit()
This is just called by xfree86 core, not by any drivers, thus no need
to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
b9569f1eb3 xfree86: os-support: unexport xf86OSRingBell()
This function is only internal to xfree86 DDX, not used by any drivers,
thus no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
7aa3fa54d4 xfree86: unexport os-support functions
These aren't called by drivers/modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1456>
2024-04-18 00:40:39 +00:00
Enrico Weigelt, metux IT consult
e2fa0d2ae0 fix including <sys/mman.h>
Make sure everybody who needs stuff from <sys/mman.h> actually includes it,
and dropped the include from xf86_OSlib.h.

Check for all symbols defined by Open Group spec.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1412>
2024-04-18 00:12:02 +00:00
Enrico Weigelt, metux IT consult
8ce76acddf xfree86: os-support: bsd fix warning on unused label on NetBSD
The label is only used on FreeBSD, so compiling on NetBSD gives a
warning on unused label.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1447>
2024-04-18 00:01:27 +00:00
Enrico Weigelt, metux IT consult
6eea4f0b8c xfree86: os-support: bsd: fix warning on discarded const
Fix warnings:

../hw/xfree86/os-support/bsd/bsd_init.c
../hw/xfree86/os-support/bsd/bsd_init.c:91:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   91 |     "pccons (with X support)",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c:97:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   97 |     "pcvt",
      |     ^~~~~~
../hw/xfree86/os-support/bsd/bsd_init.c💯5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  100 |     "wscons",
      |     ^~~~~~~~

../hw/xfree86/os-support/bsd/bsd_init.c:462:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  462 |     vtprefix = "/dev/ttyv";
      |              ^
../hw/xfree86/os-support/bsd/bsd_init.c:471:18: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  471 |         vtprefix = "/dev/ttyE";
      |                  ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1446>
2024-04-17 23:50:09 +00:00
Enrico Weigelt, metux IT consult
620b678cfe os: secure-rpc: make build option tristate
Add support `auto` mode, which only enables secure-rpc when
dependencies are met.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1441>
2024-04-17 23:38:25 +00:00
Enrico Weigelt, metux IT consult
339717bac6 os: secure-rpc: check struct authdes_cred
Some platforms (eg. NetBSD) don't have DES support in rpc anymore, so we
should check, in order to prevent weird, hard to understand build breaks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1441>
2024-04-17 23:38:25 +00:00
Enrico Weigelt, metux IT consult
d2d3f4a700 os: define SECURE_RPC locally instead of global config header
Since this define is only used inside os subdir, move the definition there
and out of the global config header. This also makes some further steps,
e.g. checking whether it's supported, a litle bit easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1441>
2024-04-17 23:38:25 +00:00
Enrico Weigelt, metux IT consult
c17c527b9a os: unexport ForceClockId()
This function is only intended for DDX'es (currently just Xwayland) that
need to force using another clock. Really shouldn't be called by drivers
or extensions.

Fixes: a779fda224
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1333>
2024-04-17 16:20:54 -07:00
Olivier Fourdan
41c3155fdf xwayland: Use exec name instead of hardcoding '/Xwayland'
Use the target name instead of hardcoding the 'Xwayland' executable
name, along with the / operator.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1490>
2024-04-17 15:20:05 +00:00
Olivier Fourdan
8ff88ffec9 xwayland: Use the path to Xwayland as installed
Otherwise the executable cannot be found where specified.

v2: Use 'xwayland_path' (Simon)

Fixes: fbf5e26b5 - xwayland: Use full path for Xwayland exec
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1490>
2024-04-17 15:20:05 +00:00
Simon Ser
d1fe52933e xwayland: use array for protocol XML files
Saves us the repetition.

Signed-off-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1491>
2024-04-17 15:25:34 +02:00
Enrico Weigelt, metux IT consult
5057c716eb Fix missing include of sys/stat.h
Instead of relying on very indirect includes, it's more more clean when
everybody explicitly includes what he really needs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1417>
2024-04-17 10:55:10 +02:00
Enrico Weigelt, metux IT consult
97e26532d5 xfree86: os-support: drop ununsed POSIX_TTY
Found no evidence that this define is practically used anywhere, aymore.
Web research just showed up a single ancient .c file (looks like an
Wacom driver) from 1998. Xserver's git history doesn't tell when it
actually had been introduced.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1408>
2024-04-17 02:16:12 +00:00
Enrico Weigelt, metux IT consult
a1c1f8b9d8 xfree86: drop unused xf86EnableAGP()
This function doesn't seem to be used anymore, neither inside the xserver,
nor by any drivers - so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1404>
2024-04-17 02:05:36 +00:00
Enrico Weigelt, metux IT consult
ba870af892 xfree86: drop unused xf86SetReallySlowBcopy()
This had been introduced almost two decades ago, by Dave Airlie (*1) along
with some major IO speed improvement, just in case some driver still needed
the old behaviour - in that case it would call xf86SetReallySlowBcopy(),
so xf86SlowBcopy() would fall back to the old approach emitting an extra
outb() on debug port, in order to slow things down more.

Now aeons have passed and there doesn't seem to be any actual user for this,
so it's time to drop that ancient relic.

*1) commit e717eb82dc

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1402>
2024-04-17 01:54:28 +00:00
Enrico Weigelt, metux IT consult
e37bcac1dc xfree86: linux: int10: drop dead code
The code pieces inside `ifdef DoSubModule` aren't used anymore since very
long time. There's no evidence of this symbol ever been set in the whole
git history, so it must be an really ancient relic, that nobody used for
decades.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1400>
2024-04-17 01:43:30 +00:00
Enrico Weigelt, metux IT consult
a0b69624f7 os: unexport ListenToAllClients()
It's just called by DIX, not by any drivers/modules, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1387>
2024-04-16 18:23:27 -07:00
Enrico Weigelt, metux IT consult
d18ef33099 os: unexport OnlyListenToOneClient()
Not used by any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1385>
2024-04-16 18:13:11 -07:00
Enrico Weigelt, metux IT consult
4c1795701c os: unexport MakeClientGrabPervious() and MakeClientGrabImpervious()
Not used by any drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1384>
2024-04-16 17:52:14 -07:00
Enrico Weigelt, metux IT consult
be4c8444eb os: unexport Os*() functions
These aren't called (and suited for being called) by drivers,
thus drop them from the public module API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1381>
2024-04-16 14:20:30 +02:00
Enrico Weigelt, metux IT consult
3aa62ca6f0 os: fix missing include of misc.h in busfault.h
busfault.h is using FALSE, but didn't include misc.h, so it really
depends on include order whether it works.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1381>
2024-04-16 14:19:59 +02:00
Enrico Weigelt, metux IT consult
85d4bd0dba rename remaining RT_* defines to X11_RESTYPE_*
Since we already had to rename some of them, in order to fix name clashes
on win32, it's now time to rename all the remaining ones.

The old ones are still present as define's to the new ones, just for
backwards compatibility.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 19:00:47 -07:00
Enrico Weigelt, metux IT consult
1ca48d0a48 dix: workaround for win32 name clash on CreateWindow()
The problem is, ming32 headers unconditionally define CreateWindow() to
alias CreateWindowA() in winuser.h, which is included by windows.h, which
is included by *a lot* common headers. So it highly depends on the exact
include order, whether it works. (also weird things could happen, e.g.
the Xserver's CreateWindow() ending up renamed to CreateWindowA(), ...)

Until we've found a really clean solution to this problem (which might
involve fixing mingw32 first), just add a little workaround by undef'ing
CreateWindow symbol whereever necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 18:59:23 -07:00
Enrico Weigelt, metux IT consult
232cad9ec3 prevent name clash on Windows w/ RT_* defines
Windows' native headers using some our RT_* define's names for other things.
Since the naming isn't very nice anyways, introducing some new ones
(X11_RESTYPE_NONE, X11_RESTYPE_FONT, X11_RESTYPE_CURSOR) and define the old
ones as an alias to them, in case some out-of-tree code still uses them.

With thins change, we don't need to be so extremely careful about include
ordering and have explicit #undef's in order to prevent name clashes on
Win32 targets.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 18:59:23 -07:00
Enrico Weigelt, metux IT consult
f789dca4e9 dix: move closestr.h into dix directory
It's only used by dix internally (actually just dixfonts.c - since at
least 25 years now), thus no need to keep it in global include directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1388>
2024-04-16 01:42:39 +00:00
Enrico Weigelt, metux IT consult
d444cd4237 dix: unexport some lookup functions
These aren't used by any drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1380>
2024-04-15 18:11:57 -07:00
Enrico Weigelt, metux IT consult
dfdde27990 dix: unexport InitClient()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1379>
2024-04-16 00:53:28 +00:00
Enrico Weigelt, metux IT consult
b064b79132 dix: unexport DeleteWindowFromAnySaveSet()
Not used by any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1378>
2024-04-15 17:05:41 -07:00
Enrico Weigelt, metux IT consult
76d01e9bf6 os: unexport OsVendorVErrorFProc pointer
This pointer allows a DDX to install it's own error print handler. It's really
only intended for DDXes, thus no need to have it exported to modules.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1369>
2024-04-15 23:59:38 +00:00
Enrico Weigelt, metux IT consult
1205f5b6f9 dix: unexport GetCurrentClient()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1377>
2024-04-15 23:47:47 +00:00
Enrico Weigelt, metux IT consult
ad7e7d9259 dix: unexport CompareISOLatin1Lowered() and make it static
This function isn't used by any drivers, so no need to export it.

Also has just one consumer, so move it there and make it static.
(and also move ISOLatin1ToLower() along with it)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1374>
2024-04-15 23:34:58 +00:00
Enrico Weigelt, metux IT consult
1999785fa9 os: move over osLookupColor to dix
This function is only used by DIX and not os-specific at all.
So move it over to DIX and give it a more fitting name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>
2024-04-15 16:19:30 -07:00
Enrico Weigelt, metux IT consult
6cb599f59c os: unexport OsLookupColor()
It's an internal function, only used by DIX, not by drivers and shouldn't
have been exported in the first place.

Fixes: 49f77fff14
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>
2024-04-15 16:19:06 -07:00
Enrico Weigelt, metux IT consult
2b7a2f8ed2 dix: unexport SetClipRects()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
9a8e6c5bfd dix: unexport VerifyRectOrder
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
407fe60483 dix: unexport SetDashes
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
30670e72c7 dix: unexport FreeDefaultStipple()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
f6af379928 dix: unexport CreateDefaultStipple()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
bdf8ae3fc1 dix: unexport CreateGCperDepth()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
fc1a7363eb dix: unexport FreeGCperDepth()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
32512c579e dix: unexport FreeGC()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
7e30f2c8e1 dix: unexport CopyGC()
Not used by any driver, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
6896396456 dix: unexport CreateGC()
Not used by any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
46c0ac8c70 dix: unexport ChangeGCXIDs()
Move non-exported gc functions to private header
No need to clutter public headers with non-exported stuff.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult
3b7a63e6ae os: unexport xthread_sigmask
This function isn't used by drivers and there's currently no need to do so,
thus keep it out of the public module API.

Fixes: 30ac756798
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1368>
2024-04-15 22:49:02 +00:00
Enrico Weigelt, metux IT consult
62d3114ab9 include: gc.h: drop unused defines
These seem to be unused for *long* time - couldn't even trace it back in
git history. Also not used by any known driver. Time to get rid of them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1364>
2024-04-15 22:36:06 +00:00
Enrico Weigelt, metux IT consult
cf5fab0bbe os: unexport AccessUsingXdmcp()
This function is only used internally for xdmcp auth handling, not used
in modules/drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult
dd21a80219 os: unexport ChangeAccessControl()
this function isn't used by modules/drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult
3f00c1b6cf os: unexport host control functions
these aren't used by modules/drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult
5a9b885118 os: unexport authorization management functions
Those aren't used by modules, thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult
bed778ee60 os: unexport LocalAccessScopeUser()
this function is only used by wayland ddx, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult
e621081fa3 os: unexport EnableLocalUser() and DisableLocalUser()
these aren't used by module, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult
54441ff98a os: unexport EnableLocalAccess() and DisableLocalAccess()
these aren't used by modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:44:36 -07:00
Enrico Weigelt, metux IT consult
b00fdd482c os: unexport EnableLocalHost() and DisableLocalHost()
These aren't used by modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:44:36 -07:00
Enrico Weigelt, metux IT consult
5f19eab1ee os: unexport local client creds handling
these functions aren't used by modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:44:34 -07:00
Enrico Weigelt, metux IT consult
cbc9f557e5 os: unexport set_font_authorizations()
This function is only used by DIX, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:42:45 -07:00
Enrico Weigelt, metux IT consult
389b528203 os: unexport command line args handling functions
These functions shouldn't be called by drivers or extensions, thus
shouldn't be exported. Also moving it to separate header, so the
already huge ones aren't cluttered with even more things.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1334>
2024-04-15 21:21:40 +00:00
Enrico Weigelt, metux IT consult
dae76bbaaf include: move busfault.h out of public include dir
this header is isn't public, so it's more appropriate, where the actual
code is, which is the os/ directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1337>
2024-04-15 21:10:15 +00:00
Enrico Weigelt, metux IT consult
84407af615 xfree86: x86emu: fix missing Xfuncproto.h include in debug.h
The header uses macros from Xfuncproto.h - right now it just works by pure
accident since consumers of this header indirectly include Xfuncproto.h
by totally different roads. This is a fragile programming style that deserved
to be cleand up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1331>
2024-04-15 20:11:18 +00:00
Enrico Weigelt, metux IT consult
045c9185f8 xfree86: x86emu: drop unnecessary extern C from debug.h
Since we're not using C++ code, thus no trouble w/ name mangling, we don't
need explicit extern "C" { ... } sections in the code. (If we would, we
have to have it in many other places, too)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1331>
2024-04-15 20:11:18 +00:00
Enrico Weigelt, metux IT consult
3843a643e0 os: unexport audit functions
These aren't used by any drivers, so no need to keep them around in the
public driver API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1326>
2024-04-15 19:54:34 +00:00
Enrico Weigelt, metux IT consult
8516bbe422 Xnest: print event ID on warning about unhandled upstream event
When getting an unhandled event from upstream Xserver, a warning
is printed, but it doesn't tell which one yet. Just printing it's
ID should be good enough for now - it's already a good help
for debugging.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1398>
2024-04-15 19:33:57 +00:00
Enrico Weigelt, metux IT consult
2cc5c57238 Xnest: cleanup X.h includes
It's cleaner to include explicitly instead of relying on indirect includes,
thus adding a few more on X.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1394>
2024-04-15 19:20:39 +00:00
Enrico Weigelt, metux IT consult
737c316a99 Xnest: canonicalize includes: <X11/Xdefs.h>
For cleaner code, make sure every source needing something from Xdefs.h
does explicitly include it (not relying on indirect including)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1394>
2024-04-15 19:20:39 +00:00
Enrico Weigelt, metux IT consult
b15f0204b2 Xnest: ignore NoExpose event
Sometimes getting NoExpose event from upstream xserver, where
we've got nothing actually to do.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1399>
2024-04-15 19:06:59 +00:00
Enrico Weigelt, metux IT consult
57254ca23c xnest: Display: fix xallocarray() compiler warning
Compiler warning:

[7/29] Compiling C object hw/xnest/Xnest.p/Display.c.o
In file included from ../include/misc.h:119,
                 from ../include/screenint.h:50,
                 from ../hw/xnest/Display.c:24:
../hw/xnest/Display.c: In function ‘xnestOpenDisplay’:
../include/os.h:81:32: warning: argument 2 range [2147483648, 4294967295] exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]
   81 | #define xallocarray(num, size) reallocarray(NULL, (num), (size))
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xnest/Display.c:124:29: note: in expansion of macro ‘xallocarray’
  124 |     xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps,
      |                             ^~~~~~~~~~~
In file included from ../include/os.h:54:
/usr/include/stdlib.h:582:14: note: in a call to allocation function ‘reallocarray’ declared here
  582 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
      |              ^~~~~~~~~~~~

Since we really don't need more than 2^16 colormaps, using uint16_t here
to silence this warning.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1392>
2024-04-15 18:52:13 +00:00
Enrico Weigelt, metux IT consult
eac10cf1fa os: connection: drop obsolete define Pid_t
Clean up a yet some more stale leftovers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1260>
2024-04-15 18:02:11 +00:00
Enrico Weigelt, metux IT consult
887fc7121b m4: drop autoconf leftovers
these m4 macros had been used for autotools-based build system. But since this
had been replaced by meson, these files are obsolete now.

Fixes: c97397dc47
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1260>
2024-04-15 18:02:11 +00:00
Enrico Weigelt, metux IT consult
95706a5fec present: present_scmd: drop obsolete include of <time.h>
Not used anymore, was forgotten to be removed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1260>
2024-04-15 18:02:11 +00:00
Tom Yan
7c5b5642b2 mi: decouple miCreateScreenResources from pScreen->{width,height}
This allows pScreen->{width,height} to be changed to smaller values
after miScreenInit() is called but before pScreen is further set up
/ used by dix, so that the screen size can be fit to the mode of
choice even when it does not have the maximum width and/or height
among its peers.

XGetImage() for one will fail once the screen is change back to a
bigger size with xrandr, which prevents e.g. x11vnc to work on the
server.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/854>
2024-04-14 17:20:09 +00:00
Tom Yan
aa3f5023e3 xnest/mi: remove redundant call of miScreenDevPrivateInit()
miScreenDevPrivateInit() is also made static in this commit.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/854>
2024-04-14 17:20:09 +00:00
Enrico Weigelt, metux IT consult
786f7ceb61 xfree86: vgahw: drop obsolete _NEED_SYSI86
This doesn't seem to be needed anymore, probably a left over from migration
to libpciaccess. So it can be removed now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1415>
2024-04-13 19:43:59 +00:00
Enrico Weigelt, metux IT consult
dee16edd2e xfree86: os-support: move _NEED_SYSI86 guarded block to sun_vid.c
The sun_vid.c driver seems to be the only actual consumer left, so it
can be dropped from public headers and moved to sun_vid.c instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1414>
2024-04-13 12:13:50 -07:00
Enrico Weigelt, metux IT consult
1073ca2b8a xfree86: os-support: drop Solaris pre-7 remains
Since meson transition, we can't build on Solaris older than v7
(which came out 1998), so no need for extra quirks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1414>
2024-04-13 12:13:42 -07:00
Enrico Weigelt, metux IT consult
bfcc7726a8 xfree86: os-support: clean out remains of SVR3/sysv support
SVR3/sysv support had been removed 13 years ago, but there still was
some fallout left. The symbol HAS_SVR3_MMAPDRV never had been set by
autoconf, let alone meson, so this piece of code is really dead.

Fixes: 6ce1908ba4
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1414>
2024-04-13 12:13:42 -07:00
849 changed files with 9636 additions and 11724 deletions

24
.git-blame-ignore-revs Normal file
View file

@ -0,0 +1,24 @@
# This file contains revisions to be ignored by git blame.
# These revisions are expected to be formatting-only changes.
#
# Calling `git blame --ignore-revs-file .git-blame-ignore-revs` will
# tell git blame to ignore changes made by these revisions when assigning
# assigning blame, as if the change never happened.
#
# You can enable this as a default for your local repository by running
# `git config blame.ignoreRevsFile .git-blame-ignore-revs`
# Important: if you do this, then switch to a branch without this file,
# `git blame` will fail with an error.
#
# Introduce a consistent coding style
9838b7032ea9792bec21af424c53c07078636d21
# Drop trailing whitespaces
732fd7e571b81d63aa44d6e4cf55883479e88f2f
# glamor: Apply x-indent.sh.
d84d71029ae9e462559d64eff7259e2cc7732fac
# indent fixes (OMG SO UGLY), and nuke old RCS keywords.
6d7083bd69724586338d79784655328f1fcd2ae5

View file

@ -4,7 +4,7 @@
# Please see the ci-templates documentation for details:
# https://freedesktop.pages.freedesktop.org/ci-templates/
.templates_sha: &template_sha c5626190ec14b475271288dda7a7dae8dbe0cd76 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
.templates_sha: &template_sha ef5e4669b7500834a17ffe9277e15fbb6d977fff # see https://docs.gitlab.com/ee/ci/yaml/#includefile
# FDO_DISTRIBUTION_TAG is the tag of the docker image used for the build jobs.
# If the image doesn't exist yet, the docker-image stage generates it.
@ -16,19 +16,23 @@
# gcc/clang or other packages, which might break the build with older commits
# using the same tag.
variables:
FDO_UPSTREAM_REPO: xorg/xserver
FDO_DISTRIBUTION_VERSION: bullseye-slim
FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
FDO_DISTRIBUTION_TAG: "2024-03-26-explicit-sync-2"
MESON_BUILDDIR: "build"
FDO_UPSTREAM_REPO: 'xorg/xserver'
MESON_BUILDDIR: 'build'
REPO_URL_XORGPROTO: 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git'
XORG_DEBIAN_VERSION: 'bullseye-slim'
XORG_DEBIAN_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
XORG_DEBIAN_TAG: '2025-02-26-xcb-deps'
XORG_FREEBSD_VERSION: '14.2'
XORG_FREEBSD_EXEC: ''
XORG_FREEBSD_TAG: '2025-02-18-vm-image'
include:
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/debian.yml'
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/ci-fairy.yml'
file:
- '/templates/debian.yml'
- '/templates/freebsd.yml'
- '/templates/ci-fairy.yml'
- template: Security/SAST.gitlab-ci.yml
stages:
@ -94,17 +98,55 @@ stages:
.all_ddx_paths:
- hw/**/*
.debian:
variables:
FDO_DISTRIBUTION_VERSION: '$XORG_DEBIAN_VERSION'
FDO_DISTRIBUTION_EXEC: '$XORG_DEBIAN_EXEC'
FDO_DISTRIBUTION_TAG: '$XORG_DEBIAN_TAG'
.freebsd:
tags:
- kvm
variables:
FDO_DISTRIBUTION_TAG: '$XORG_FREEBSD_TAG'
FDO_DISTRIBUTION_VERSION: '$XORG_FREEBSD_VERSION'
FDO_DISTRIBUTION_EXEC: ''
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool xorg-macros xorgproto bash meson ninja pixman xtrans libXau libXdmcp libXfont2 libxkbfile libxcvt libpciaccess font-util libepoll-shim'
FDO_IMAGE_SIZE: '30G'
debian-bullseye:
extends:
- .fdo.container-build@debian
- .ci-run-policy
- .debian
stage: docker-image
variables:
GIT_STRATEGY: none
.common-build-and-test:
freebsd-image:
extends:
- .fdo.qemu-build@freebsd@x86_64
- .freebsd
stage: docker-image
variables:
GIT_STRATEGY: none
.xorg-image@debian:
extends:
- .fdo.distribution-image@debian
- .debian
.xorg-image@freebsd:
extends:
- .fdo.distribution-image@freebsd
- .freebsd
variables:
GIT_DEPTH: 1
PKG_CONFIG_PATH: /usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/pkg/share/pkgconfig:/usr/pkg/lib/pkgconfig:/usr/local/libdata/pkgconfig
.common-build-and-test:
extends:
- .xorg-image@debian
- .ci-run-policy
stage: build-and-test
artifacts:
@ -113,7 +155,7 @@ debian-bullseye:
- $MESON_BUILDDIR/meson-logs/
- $MESON_BUILDDIR/test/piglit-results/
variables:
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true -Dxcsecurity=true
CCACHE_COMPILERCHECK: content
CCACHE_DIR: /cache/xserver/cache
LC_ALL: C.UTF-8
@ -130,29 +172,73 @@ meson:
- .gitlab-ci/meson-build.sh --run-test
- .gitlab-ci/check-piglit-results.sh
- .gitlab-ci/manpages-check
- .gitlab-ci/check-ddx-build.sh
variables:
XTEST_DIR: /root/xts
PIGLIT_DIR: /root/piglit
LP_NUM_THREADS: 0
MESON_DDX_BUILD_ARGS: >
-Dxwayland=${BUILD_XWAYLAND} -Dxorg=${BUILD_XORG} -Dxephyr=${BUILD_XEPHYR} -Dxvfb=${BUILD_XVFB} -Dxnest=${BUILD_XNEST}
BUILD_XEPHYR: true
BUILD_XNEST: true
BUILD_XORG: true
BUILD_XVFB: true
BUILD_XWAYLAND: true
MESON_EXTRA_ARGS: ${MESON_DDX_BUILD_ARGS}
meson-enable-options:
extends: meson
variables:
MESON_EXTRA_ARGS: --auto-features=enabled -Dlisten_tcp=true -Dsuid_wrapper=true -Dxf86bigfont=true -Dxcsecurity=true -Dxpbproxy=true -Ddri1=true -Ddri2=true -Ddri3=true -Dlibunwind=true ${MESON_DDX_BUILD_ARGS}
meson-disable-options:
extends: meson
variables:
MESON_EXTRA_ARGS: --auto-features=disabled -Dglamor=false -Dglx=false -Dxdmcp=false -Dxdm-auth-1=false -Dint10=false -Dpciaccess=false -Dudev=false -Dudev_kms=false -Dvgahw=false -Dxace=false -Dxcsecurity=false -Dxinerama=false -Dxv=false -Dxvmc=false -Ddrm=false -Ddri1=false -Ddri2=false -Ddri3=false ${MESON_DDX_BUILD_ARGS}
meson-noglamor:
extends: meson
variables:
MESON_EXTRA_ARGS: >
-Dglamor=false
MESON_EXTRA_ARGS: -Dglamor=false ${MESON_DDX_BUILD_ARGS}
meson-nolibdecor:
xwayland-nolibdecor:
extends: meson
variables:
MESON_EXTRA_ARGS: >
-Dlibdecor=false
BUILD_XEPHYR: false
BUILD_XNEST: false
BUILD_XORG: false
BUILD_XVFB: false
MESON_EXTRA_ARGS: -Dlibdecor=false ${MESON_DDX_BUILD_ARGS}
mingw-cross-build:
extends: .common-build-and-test
script:
- .gitlab-ci/meson-build.sh --run-install
variables:
MESON_ARGS: --cross-file=.gitlab-ci/cross-i686-w64-mingw32.txt -Dglx=false -Dsecure-rpc=false -Dlisten_tcp=true
MESON_ARGS: --cross-file=.gitlab-ci/cross-i686-w64-mingw32.txt -Dglx=false -Dlisten_tcp=true
freebsd:
stage: build-and-test
extends:
- .xorg-image@freebsd
variables:
MESON_ARGS: -Dglx=false -Dglamor=false -Dudev=false -Dudev_kms=false
script:
# running of of disk space without this
# needed until https://gitlab.freedesktop.org/freedesktop/ci-templates/-/issues/67 is fixed
- git gc
- git clone --depth=1 $REPO_URL_XORGPROTO dep.xorgproto
- /app/vmctl start
- set +e
- scp -r $PWD "vm:"
# need to install newer xorgproto
- /app/vmctl exec "cd $CI_PROJECT_NAME/dep.xorgproto && ./autogen.sh --prefix=/usr && make && make install"
- /app/vmctl exec "cd $CI_PROJECT_NAME && PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\" MESON_ARGS=\"$MESON_ARGS\" MESON_BUILDDIR=\"$MESON_BUILDDIR\" .gitlab-ci/meson-build.sh --skip-test" && touch .success
# test not working yet, so skipped
# - scp -r vm:$CI_PROJECT_NAME/test-results.xml .
- /app/vmctl stop
- set -e
- test -e .success || exit 1
meson-dist:
extends: .common-build-and-test
@ -161,6 +247,7 @@ meson-dist:
paths:
- $MESON_BUILDDIR/meson-logs/
- $MESON_BUILDDIR/xserver-*/$MESON_BUILDDIR/meson-logs/
- xserver-tarball/install/
script:
- .gitlab-ci/meson-build.sh --run-dist
- mkdir xserver-tarball
@ -168,11 +255,11 @@ meson-dist:
- .gitlab-ci/meson-build.sh -C xserver-tarball --skip-test --skip-dist --run-install
variables:
MESON_DIST_ARGS: --no-tests
DESTDIR: xserver-tarball/install/
MESON_EXTRA_ARGS: -Dprefix=$CI_PROJECT_DIR/xserver-tarball/install/
xf86-driver-build-test:
extends:
- .fdo.distribution-image@debian
- .xorg-image@debian
- .ci-run-policy
stage: drivers
parallel:
@ -189,28 +276,33 @@ xf86-driver-build-test:
SHA: xf86-video-amdgpu-23.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati
SHA: xf86-video-ati-22.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel
SHA: e6a4c4740c15ace9dd79dc7c18955f2eb413a6a5 # no release yet
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-qxl
SHA: xf86-video-qxl-0.1.6
SHA: 989ff620220e8d0555cec38c1508b57dfbcfb0c6 # no release yet
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vesa
SHA: xf86-video-vesa-2.6.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vmware
SHA: xf86-video-vmware-13.4.0
script:
# Install the server first
- .gitlab-ci/meson-build.sh --skip-test --run-install
# built xserver is taken from meson-dist job
- export PKG_CONFIG_PATH=$(pwd)/xserver-tarball/install/lib/x86_64-linux-gnu/pkgconfig
- export ACLOCAL_PATH=$(pwd)/xserver-tarball/install/share/aclocal/
- unset MESON_EXTRA_ARGS
- DRIVER=$(basename $REPO)
- git clone "$REPO" "$DRIVER"
- GIT_DIR="$DRIVER/.git" git checkout -f "$SHA"
- git -C "$DRIVER" checkout "$SHA"
- |
if [[ -e "$DRIVER/meson.build" ]]; then
if [[ -e "$DRIVER/meson.build" ]] && [[ "$DRIVER" != "xf86-video-intel" ]]; then
.gitlab-ci/meson-build.sh -C "$DRIVER" --skip-test
else
pushd "$DRIVER" || exit 1
./autogen.sh && make
fi
needs:
- "meson"
- meson-dist
dependencies:
- meson-dist
variables:
GIT_DEPTH: 1
MESON_ARGS: -Dprefix=/usr/

25
.gitlab-ci/check-ddx-build.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
set -e
set -o xtrace
check_executable () {
if [[ ! -x $MESON_BUILDDIR/$1 ]]; then
echo "$1 not found after build"
exit 1
fi
return 0
}
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR not set"
exit 1
fi
[[ "$BUILD_XEPHYR" == true ]] && check_executable "hw/kdrive/ephyr/Xephyr"
[[ "$BUILD_XNEST" == true ]] && check_executable "hw/xnest/Xnest"
[[ "$BUILD_XORG" == true ]] && check_executable "hw/xfree86/Xorg"
[[ "$BUILD_XVFB" == true ]] && check_executable "hw/vfb/Xvfb"
[[ "$BUILD_XWAYLAND" == true ]] && check_executable "hw/xwayland/Xwayland"
exit 0

View file

@ -11,7 +11,7 @@ HOST=$1
cat >/usr/local/bin/${HOST}-pkg-config <<EOF
#!/bin/sh
PKG_CONFIG_SYSROOT_DIR=/usr/${HOST} PKG_CONFIG_LIBDIR=/usr/${HOST}/lib/pkgconfig:/usr/share/pkgconfig pkg-config \$@
PKG_CONFIG_SYSROOT_DIR=/usr/${HOST} PKG_CONFIG_LIBDIR=/usr/${HOST}/lib/pkgconfig:/usr/${HOST}/share/pkgconfig pkg-config \$@
EOF
chmod +x /usr/local/bin/${HOST}-pkg-config
@ -68,9 +68,9 @@ build 'https://gitlab.freedesktop.org/xorg/lib/libfontenc.git' 'libfontenc-1.1.4
build 'https://gitlab.freedesktop.org/xorg/lib/libXfont.git' 'libXfont2-2.0.3'
build 'https://gitlab.freedesktop.org/xorg/lib/libXdmcp.git' 'libXdmcp-1.1.3'
build 'https://gitlab.freedesktop.org/xorg/lib/libXfixes.git' 'libXfixes-5.0.3'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git' '0.4.0'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git' '0.4.0'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git' '0.4.1'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git' 'xcb-util-0.4.1-gitlab'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git' 'xcb-util-image-0.4.1-gitlab'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git' 'xcb-util-wm-0.4.2'
# workaround xcb_windefs.h leaking all Windows API types into X server build
# (some of which clash which types defined by Xmd.h) XXX: This is a bit of a

View file

@ -15,7 +15,7 @@ EPHEMERAL="
xvfb
"
# Add bullseye-backports for the newer linux-libc-dev package
# Add bullseye-backports for the newer linux-libc-dev & meson packages
echo 'deb http://deb.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list
apt update
@ -65,6 +65,9 @@ apt-get install -y \
libx11-xcb-dev \
libxau-dev \
libxaw7-dev \
libxcb-damage0-dev \
libxcb-dri2-0-dev \
libxcb-dri3-dev \
libxcb-glx0-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
@ -74,11 +77,15 @@ apt-get install -y \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-shm0-dev \
libxcb-sync-dev \
libxcb-util0-dev \
libxcb-xf86dri0-dev \
libxcb-xinput-dev \
libxcb-xkb-dev \
libxcb-xv0-dev \
libxcb1-dev \
libxcursor-dev \
libxdamage-dev \
libxdmcp-dev \
libxext-dev \
libxfixes-dev \
@ -90,16 +97,20 @@ apt-get install -y \
libxmu-dev \
libxmuu-dev \
libxpm-dev \
libxrandr-dev \
libxrender-dev \
libxres-dev \
libxshmfence-dev \
libxss-dev \
libxt-dev \
libxtst-dev \
libxv-dev \
libxvmc-dev \
libxxf86vm-dev \
libz-mingw-w64-dev \
linux-libc-dev/bullseye-backports \
mesa-common-dev \
meson \
meson/bullseye-backports \
mingw-w64-tools \
nettle-dev \
pkg-config \
@ -108,6 +119,7 @@ apt-get install -y \
python3-mako \
python3-numpy \
python3-six \
valgrind \
weston \
x11-xkb-utils \
xfonts-utils \
@ -151,8 +163,8 @@ ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf wayland
# Xwayland requires wayland-protocols >= 1.34, but Debian bullseye has 1.20 only
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.34
# Xwayland requires wayland-protocols >= 1.38, but Debian bullseye has 1.20 only
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.38
cd wayland-protocols
meson _build
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
@ -160,7 +172,7 @@ cd ..
rm -rf wayland-protocols
# Install libdecor for Xwayland
git clone https://gitlab.gnome.org/jadahl/libdecor.git --depth 1 --branch=0.1.0
git clone https://gitlab.freedesktop.org/libdecor/libdecor.git --depth 1 --branch=0.1.1
cd libdecor
meson _build -D{demo,install_demo}=false
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
@ -182,10 +194,8 @@ cd ..
git clone https://gitlab.freedesktop.org/xorg/test/xts
cd xts
git checkout dbbfa96c036e596346147081cbceda136e7c86c1
# Using -fcommon until we get a proper fix into xtst.
# See discussion at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/913
CFLAGS=-fcommon ./autogen.sh
git checkout 12a887c2c72c4258962b56ced7b0aec782f1ffed
./autogen.sh
xvfb-run make -j${FDO_CI_CONCURRENT:-4}
cd ..

View file

@ -277,7 +277,8 @@ Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <pzanoni@mandriva.c
Pekka Paalanen <pekka.paalanen@collabora.co.uk> <pekka.paalanen@collabora.com>
Peter Harris <pharris@opentext.com> <peter.harris@hummingbird.com>
Peter Harris <pharris2@rocketsoftware.com> <peter.harris@hummingbird.com>
Peter Harris <pharris2@rocketsoftware.com> <pharris@opentext.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter.hutterer@redhat.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter@cs.unisa.edu.au>

View file

@ -16,7 +16,7 @@ Copyright © 2006 Nokia Corporation
Copyright © 2006-2008 Peter Hutterer
Copyright © 2006 Adam Jackson
Copyright © 2009-2010 NVIDIA Corporation
Copyright © 1987, 2003-2006, 2008-2010 Oracle and/or its affiliates.
Copyright © 1987, 2003-2006, 2008-2010, 2025 Oracle and/or its affiliates.
Copyright © 1999 Keith Packard
Copyright © 2007-2009 Red Hat, Inc.
Copyright © 2005-2008 Daniel Stone

50
SECURITY.md Normal file
View file

@ -0,0 +1,50 @@
# Reporting Security Issues
Please notify us of any security issues by sending mail to
<xorg-security@lists.x.org>.
See https://www.x.org/wiki/Development/Security/Organization/
for more information about the X.Org security team.
# Learning about Security Fixes
X.Org announces security bugs and bug fix releases on the xorg-announce
mailing list. See the archives at https://lists.x.org/archives/xorg-announce/
and see https://lists.x.org/mailman/listinfo/xorg-announce to subscribe.
Security advisories are also listed on our wiki at
https://www.x.org/wiki/Development/Security/ and mailed to the
https://oss-security.openwall.org/wiki/mailing-lists/oss-security mailing list.
# Security model and trust boundaries
Only the Xorg server is expected to run with elevated privileges.
(Some distros may run Xorg with a wrapper to only grant these privileges when
necessary.) The Xorg server usually requires root access to hardware devices
and I/O registers when using a UMS (Userspace Mode Setting) driver, and not
when using a KMS (Kernel Mode Setting) driver, or drivers which do not require
actual hardware access (such as xf86-video-dummy).
All other X servers (Xephyr, Xnest, Xvfb, etc.) are expected to run with only
the privileges of the user who started the server. They should not require
direct access to any devices.
The Xorg server uses configuration files to control various aspects of its
operation (see the xorg.conf(5) man page), including specifying loadable
object modules to run code from with the full privileges of the X server.
There is no attempt to sandbox these modules - they are considered to be fully
trusted, and thus anyone who can edit a config file is considered to be fully
trusted - a module being able to control or crash the X server is not considered
a security vulnerability (though a crash would be a non-security bug in the
module). The configuration file loading mechanism takes steps to verify that
config files are owned by trusted users before reading them, and failure to do
so would be considered a security vulnerability.
Access control for which clients can connect to the X server is provided by
a number of mechanisms, see the Xsecurity(7) man page for details. Once a
client is authenticated via those mechanisms and has an active connection,
we do not consider it a security vulnerability for them to be able to take
any actions described in the X11 protocol or extension specifications, such
as changing monitor configurations or killing other clients, though we will
accept non-security bug reports for clients doing so in a manner or via
requests not documented in the protocol specs as doing those operations.

View file

@ -26,9 +26,7 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
@ -41,7 +39,7 @@ from The Open Group.
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#include "extinit.h"
#include "extinit_priv.h"
static int
ProcBigReqDispatch(ClientPtr client)
@ -49,9 +47,6 @@ ProcBigReqDispatch(ClientPtr client)
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
if (client->swapped) {
swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);

View file

@ -26,12 +26,14 @@ Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os/screensaver.h"
#include "Xext/geext.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@ -39,7 +41,7 @@ Equipment Corporation.
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "protocol-versions.h"
@ -163,7 +165,7 @@ ProcDPMSSelectInput(register ClientPtr client)
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, RT_NONE);
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;
@ -492,42 +494,16 @@ static int _X_COLD
SProcDPMSGetVersion(ClientPtr client)
{
REQUEST(xDPMSGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcDPMSGetVersion(client);
}
static int _X_COLD
SProcDPMSCapable(ClientPtr client)
{
REQUEST(xDPMSCapableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
}
static int _X_COLD
SProcDPMSGetTimeouts(ClientPtr client)
{
REQUEST(xDPMSGetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
}
static int _X_COLD
SProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
@ -536,34 +512,10 @@ SProcDPMSSetTimeouts(ClientPtr client)
return ProcDPMSSetTimeouts(client);
}
static int _X_COLD
SProcDPMSEnable(ClientPtr client)
{
REQUEST(xDPMSEnableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
}
static int _X_COLD
SProcDPMSDisable(ClientPtr client)
{
REQUEST(xDPMSDisableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
}
static int _X_COLD
SProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
@ -571,22 +523,10 @@ SProcDPMSForceLevel(ClientPtr client)
return ProcDPMSForceLevel(client);
}
static int _X_COLD
SProcDPMSInfo(ClientPtr client)
{
REQUEST(xDPMSInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int _X_COLD
SProcDPMSSelectInput(ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
swapl(&stuff->eventMask);
return ProcDPMSSelectInput(client);
@ -602,19 +542,19 @@ SProcDPMSDispatch(ClientPtr client)
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return SProcDPMSCapable(client);
return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return SProcDPMSGetTimeouts(client);
return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return SProcDPMSEnable(client);
return ProcDPMSEnable(client);
case X_DPMSDisable:
return SProcDPMSDisable(client);
return ProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return SProcDPMSInfo(client);
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return SProcDPMSSelectInput(client);
default:

View file

@ -23,26 +23,32 @@
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h"
#include <X11/extensions/ge.h>
#include "geint.h"
#include "geext.h"
#include "protocol-versions.h"
#include "extinit.h"
#include "extinit_priv.h"
DevPrivateKeyRec GEClientPrivateKeyRec;
GEExtension GEExtensions[MAXEXTENSIONS];
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
/* Major available requests */
static const int version_requests[] = {
X_GEQueryVersion, /* before client sends QueryVersion */
X_GEQueryVersion, /* must be set to last request in version 1 */
};
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
static GEExtension GEExtensions[MAXEXTENSIONS];
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
@ -89,11 +95,6 @@ ProcGEQueryVersion(ClientPtr client)
return Success;
}
static int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
ProcGEQueryVersion,
};
/************************************************************/
/* swapped request handlers */
/************************************************************/
@ -101,19 +102,12 @@ static int _X_COLD
SProcGEQueryVersion(ClientPtr client)
{
REQUEST(xGEQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return (*ProcGEVector[stuff->ReqType]) (client);
return ProcGEQueryVersion(client);
}
static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
SProcGEQueryVersion
};
/************************************************************/
/* callbacks */
/************************************************************/
@ -122,32 +116,29 @@ static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
static int
ProcGEDispatch(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
REQUEST(xReq);
REQUEST(xGEReq);
if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
switch (stuff->data) {
case X_GEQueryVersion:
return ProcGEQueryVersion(client);
default:
return BadRequest;
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
return (ProcGEVector[stuff->ReqType]) (client);
}
}
/* dispatch swapped requests */
static int _X_COLD
SProcGEDispatch(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
REQUEST(xReq);
swaps(&stuff->length);
REQUEST(xGEReq);
if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
switch (stuff->data) {
case X_GEQueryVersion:
return SProcGEQueryVersion(client);
default:
return BadRequest;
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
return (*SProcGEVector[stuff->ReqType]) (client);
}
}
/* Reset extension. Called on server shutdown. */
@ -186,24 +177,16 @@ SGEGenericEvent(xEvent *from, xEvent *to)
void
GEExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!dixRegisterPrivateKey
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
if ((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0) {
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
else {
if (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode))
FatalError("GEInit: AddExtensions failed.\n");
}
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
/************************************************************/

View file

@ -25,50 +25,12 @@ other dealings in this Software without prior written authorization
from the author.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _GEEXT_H_
#define _GEEXT_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/geproto.h>
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
/* All registered extensions and their handling functions. */
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
/* Typecast to generic event */
#define GEV(ev) ((xGenericEvent*)(ev))
/* Returns the extension offset from the event */
#define GEEXT(ev) (GEV(ev)->extension)
/* Return zero-based extension offset (offset - 128). Only for use in arrays */
#define GEEXTIDX(ev) (GEEXT(ev) & 0x7F)
/* True if mask is set for extension on window */
#define GEMaskIsSet(pWin, extension, mask) \
((pWin)->optional && \
(pWin)->optional->geMasks && \
((pWin)->optional->geMasks->eventMasks[(extension) & 0x7F] & (mask)))
/* Returns first client */
#define GECLIENT(pWin) \
(((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL)
/* Returns the event_fill for the given event */
#define GEEventFill(ev) \
GEExtensions[GEEXTIDX(ev)].evfill
#define GEIsType(ev, ext, ev_type) \
((GEV(ev)->type == GenericEvent) && \
GEEXT(ev) == (ext) && \
GEV(ev)->evtype == (ev_type))
/* Interface for other extensions */
extern _X_EXPORT void GERegisterExtension(int extension,
void (*ev_dispatch) (xGenericEvent

View file

@ -1,51 +0,0 @@
/*
* Copyright 2007-2008 Peter Hutterer
*
* 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: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _GEINT_H_
#define _GEINT_H_
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include <X11/extensions/geproto.h>
extern DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
#endif /* _GEINT_H_ */

View file

@ -1,6 +1,4 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "misc.h"

View file

@ -10,7 +10,6 @@ srcs_xext = [
hdrs_xext = [
'geext.h',
'geint.h',
'syncsdk.h',
]
@ -37,7 +36,6 @@ endif
if build_xace
srcs_xext += 'xace.c'
hdrs_xext += ['xace.h', 'xacestr.h']
endif
if build_xf86bigfont

View file

@ -23,14 +23,16 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xarch.h>
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@ -43,7 +45,6 @@ Equipment Corporation.
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
#include <X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "servermd.h"
@ -54,7 +55,7 @@ Equipment Corporation.
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "extinit.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -743,7 +744,7 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
j = PanoramiXNumDepths;
PanoramiXNumDepths++;
PanoramiXDepths = reallocarray(PanoramiXDepths,
PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
PanoramiXNumDepths, sizeof(DepthRec));
PanoramiXDepths[j].depth = pDepth->depth;
PanoramiXDepths[j].numVids = 0;
@ -816,11 +817,11 @@ PanoramiXConsolidate(void)
for (i = 0; i < pScreen->numVisuals; i++)
PanoramiXMaybeAddVisual(pVisual++);
root = malloc(sizeof(PanoramiXRes));
root = XNFcallocarray(1, sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
defmap = malloc(sizeof(PanoramiXRes));
defmap = XNFcallocarray(1, sizeof(PanoramiXRes));
defmap->type = XRT_COLORMAP;
saver = malloc(sizeof(PanoramiXRes));
saver = XNFcallocarray(1, sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
FOR_NSCREENS(i) {

View file

@ -39,9 +39,8 @@ Equipment Corporation.
#ifndef _PANORAMIX_H_
#define _PANORAMIX_H_
#define _PANORAMIX_SERVER
#include <X11/extensions/panoramiXproto.h>
#undef _PANORAMIX_SERVER
#include "gcstruct.h"
#include "dixstruct.h"

View file

@ -23,9 +23,7 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
@ -47,22 +45,10 @@ Equipment Corporation.
#include "globals.h"
#include "panoramiXh.h"
static int _X_COLD
SProcPanoramiXQueryVersion(ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int _X_COLD
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
@ -72,8 +58,6 @@ static int _X_COLD
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl(&stuff->window);
return ProcPanoramiXGetScreenCount(client);
@ -83,41 +67,19 @@ static int _X_COLD
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl(&stuff->window);
swapl(&stuff->screen);
return ProcPanoramiXGetScreenSize(client);
}
static int _X_COLD
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
static int _X_COLD
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
int _X_COLD
SProcPanoramiXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_PanoramiXQueryVersion:
return SProcPanoramiXQueryVersion(client);
return ProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
@ -125,9 +87,9 @@ SProcPanoramiXDispatch(ClientPtr client)
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return SProcXineramaIsActive(client);
return ProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return SProcXineramaQueryScreens(client);
return ProcXineramaQueryScreens(client);
}
return BadRequest;
}

View file

@ -25,13 +25,15 @@ Equipment Corporation.
/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "windowstr.h"
#include "dixfontstr.h"
#include "gcstruct.h"
@ -475,7 +477,7 @@ PanoramiXConfigureWindow(ClientPtr client)
/* because we need the parent */
result = dixLookupResourceByType((void **) &pWin, stuff->window,
RT_WINDOW, client, DixWriteAccess);
X11_RESTYPE_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;

View file

@ -26,12 +26,18 @@ in this Software without prior written authorization from the X Consortium.
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/saverproto.h>
#include "dix/colormap_priv.h"
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "os/screensaver.h"
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@ -40,53 +46,35 @@ in this Software without prior written authorization from the X Consortium.
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/saverproto.h>
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
#include "inputstr.h"
#ifdef PANORAMIX
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#endif /* XINERAMA */
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "protocol-versions.h"
#include "extinit_priv.h"
#include <stdio.h>
#include "extinit.h"
// temporary workaround for win32/mingw32 name clash
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
#undef CreateWindow
static int ScreenSaverEventBase = 0;
static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
int /* xstate */ ,
Bool /* force */
);
static Bool
CreateSaverWindow(ScreenPtr /* pScreen */
);
static Bool
DestroySaverWindow(ScreenPtr /* pScreen */
);
static void
UninstallSaverColormap(ScreenPtr /* pScreen */
);
static void
CheckScreenPrivate(ScreenPtr /* pScreen */
);
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
xScreenSaverNotifyEvent * /* to */
);
static Bool ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force);
static Bool CreateSaverWindow(ScreenPtr pScreen);
static Bool DestroySaverWindow(ScreenPtr pScreen);
static void UninstallSaverColormap(ScreenPtr pScreen);
static void CheckScreenPrivate(ScreenPtr pScreen);
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent *from,
xScreenSaverNotifyEvent *to);
static RESTYPE SuspendType; /* resource type for suspension records */
@ -193,8 +181,6 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) (malloc(sizeof (t)))
static void
CheckScreenPrivate(ScreenPtr pScreen)
{
@ -217,7 +203,7 @@ MakeScreenPrivate(ScreenPtr pScreen)
if (pPriv)
return pPriv;
pPriv = New(ScreenSaverScreenPrivateRec);
pPriv = calloc(1, sizeof(ScreenSaverScreenPrivateRec));
if (!pPriv)
return 0;
pPriv->events = 0;
@ -267,7 +253,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
}
else {
if (!pEv) {
pEv = New(ScreenSaverEventRec);
pEv = calloc(1, sizeof(ScreenSaverEventRec));
if (!pEv) {
CheckScreenPrivate(pScreen);
return FALSE;
@ -450,7 +436,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
if (pPriv && pPriv->installedMap != None) {
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
RT_COLORMAP, serverClient,
X11_RESTYPE_COLORMAP, serverClient,
DixUninstallAccess);
if (rc == Success)
(*pCmap->pScreen->UninstallColormap) (pCmap);
@ -474,7 +460,7 @@ CreateSaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, RT_NONE);
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
if (pPriv) {
UninstallSaverColormap(pScreen);
pPriv->hasWindow = FALSE;
@ -498,7 +484,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (!pWin)
return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, pWin))
return FALSE;
mask = 0;
@ -518,7 +504,7 @@ CreateSaverWindow(ScreenPtr pScreen)
CursorPtr cursor;
if (!pWin->optional)
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, RT_NONE);
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
return FALSE;
}
cursor = RefCursor(pAttr->pCursor);
@ -546,7 +532,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (wantMap == None || IsMapInstalled(wantMap, pWin))
return TRUE;
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
serverClient, DixInstallAccess);
if (result != Success)
return TRUE;
@ -570,7 +556,7 @@ DestroySaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, RT_NONE);
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
}
pPriv->hasWindow = FALSE;
CheckScreenPrivate(pScreen);
@ -601,9 +587,9 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
ret = TRUE;
}
#ifdef PANORAMIX
#ifdef XINERAMA
if (noPanoramiXExtension || !pScreen->myNum)
#endif
#endif /* XINERAMA */
SendScreenSaverNotify(pScreen, state, force);
return ret;
}
@ -624,6 +610,8 @@ ProcScreenSaverQueryVersion(ClientPtr client)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
return Success;
@ -645,8 +633,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
DixGetAttrAccess);
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -715,8 +702,7 @@ ProcScreenSaverSelectInput(ClientPtr client)
if (rc != Success)
return rc;
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
DixSetAttrAccess);
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixSetAttrAccess);
if (rc != Success)
return rc;
@ -726,9 +712,8 @@ ProcScreenSaverSelectInput(ClientPtr client)
}
static int
ScreenSaverSetAttributes(ClientPtr client)
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
WindowPtr pParent;
ScreenPtr pScreen;
@ -751,7 +736,6 @@ ScreenSaverSetAttributes(ClientPtr client)
Colormap cmap;
ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (ret != Success)
@ -759,11 +743,11 @@ ScreenSaverSetAttributes(ClientPtr client)
pScreen = pDraw->pScreen;
pParent = pScreen->root;
ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
ret = XaceHookScreensaverAccess(client, pScreen, DixSetAttrAccess);
if (ret != Success)
return ret;
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
len = client->req_len - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
if (!stuff->width || !stuff->height) {
@ -848,7 +832,7 @@ ScreenSaverSetAttributes(ClientPtr client)
if (!pPriv)
return FALSE;
}
pAttr = New(ScreenSaverAttrRec);
pAttr = calloc(1, sizeof(ScreenSaverAttrRec));
if (!pAttr) {
ret = BadAlloc;
goto bail;
@ -899,7 +883,7 @@ ScreenSaverSetAttributes(ClientPtr client)
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess);
X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -931,7 +915,7 @@ ScreenSaverSetAttributes(ClientPtr client)
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess);
X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -1014,7 +998,7 @@ ScreenSaverSetAttributes(ClientPtr client)
break;
case CWColormap:
cmap = (Colormap) * pVlist;
ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
client, DixUseAccess);
if (ret != Success) {
client->errorValue = cmap;
@ -1034,7 +1018,7 @@ ScreenSaverSetAttributes(ClientPtr client)
}
else {
ret = dixLookupResourceByType((void **) &pCursor, cursorID,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (ret != Success) {
client->errorValue = cursorID;
goto PatchUp;
@ -1068,16 +1052,13 @@ ScreenSaverSetAttributes(ClientPtr client)
}
static int
ScreenSaverUnsetAttributes(ClientPtr client)
ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv;
int rc;
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate(pDraw->pScreen);
@ -1093,9 +1074,11 @@ ScreenSaverUnsetAttributes(ClientPtr client)
static int
ProcScreenSaverSetAttributes(ClientPtr client)
{
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
REQUEST(xScreenSaverSetAttributesReq);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
#ifdef XINERAMA
if (!noPanoramiXExtension) {
PanoramiXRes *draw;
PanoramiXRes *backPix = NULL;
PanoramiXRes *bordPix = NULL;
@ -1104,15 +1087,13 @@ ProcScreenSaverSetAttributes(ClientPtr client)
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
XID orig_visual, tmp;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
status = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (status != Success)
return (status == BadValue) ? BadDrawable : status;
len =
stuff->length -
client->req_len -
bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
@ -1167,26 +1148,27 @@ ProcScreenSaverSetAttributes(ClientPtr client)
if (orig_visual != CopyFromParent)
stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
status = ScreenSaverSetAttributes(client);
status = ScreenSaverSetAttributes(client, stuff);
}
return status;
}
#endif
#endif /* XINERAMA */
return ScreenSaverSetAttributes(client);
return ScreenSaverSetAttributes(client, stuff);
}
static int
ProcScreenSaverUnsetAttributes(ClientPtr client)
{
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
REQUEST(xScreenSaverUnsetAttributesReq);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
#ifdef XINERAMA
if (!noPanoramiXExtension) {
PanoramiXRes *draw;
int rc, i;
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
@ -1194,15 +1176,14 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
return (rc == BadValue) ? BadDrawable : rc;
for (i = PanoramiXNumScreens - 1; i > 0; i--) {
stuff->drawable = draw->info[i].id;
ScreenSaverUnsetAttributes(client);
ScreenSaverUnsetAttributes(client, draw->info[i].id);
}
stuff->drawable = draw->info[0].id;
}
#endif
#endif /* XINERAMA */
return ScreenSaverUnsetAttributes(client);
return ScreenSaverUnsetAttributes(client, stuff->drawable);
}
static int
@ -1231,7 +1212,7 @@ ProcScreenSaverSuspend(ClientPtr client)
if (suspend == TRUE)
this->count++;
else if (--this->count == 0)
FreeResource(this->clientResource, RT_NONE);
FreeResource(this->clientResource, X11_RESTYPE_NONE);
return Success;
}
@ -1271,11 +1252,13 @@ ProcScreenSaverSuspend(ClientPtr client)
}
static int (*NormalVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,
ProcScreenSaverSelectInput,
ProcScreenSaverSetAttributes,
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
ProcScreenSaverUnsetAttributes,
ProcScreenSaverSuspend,
};
static int
ProcScreenSaverDispatch(ClientPtr client)
@ -1287,20 +1270,10 @@ ProcScreenSaverDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
SProcScreenSaverQueryVersion(ClientPtr client)
{
REQUEST(xScreenSaverQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
return ProcScreenSaverQueryVersion(client);
}
static int _X_COLD
SProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
swapl(&stuff->drawable);
return ProcScreenSaverQueryInfo(client);
@ -1310,7 +1283,6 @@ static int _X_COLD
SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
@ -1321,7 +1293,6 @@ static int _X_COLD
SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1339,7 +1310,6 @@ static int _X_COLD
SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
return ProcScreenSaverUnsetAttributes(client);
@ -1349,19 +1319,19 @@ static int _X_COLD
SProcScreenSaverSuspend(ClientPtr client)
{
REQUEST(xScreenSaverSuspendReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
swapl(&stuff->suspend);
return ProcScreenSaverSuspend(client);
}
static int (*SwappedVector[]) (ClientPtr /* client */ ) = {
SProcScreenSaverQueryVersion,
ProcScreenSaverQueryVersion,
SProcScreenSaverQueryInfo,
SProcScreenSaverSelectInput,
SProcScreenSaverSetAttributes,
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
SProcScreenSaverUnsetAttributes,
SProcScreenSaverSuspend,
};
static int _X_COLD
SProcScreenSaverDispatch(ClientPtr client)

View file

@ -24,12 +24,19 @@ in this Software without prior written authorization from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/Xmd.h>
#include <X11/extensions/securproto.h>
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "include/extinit_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "scrnintstr.h"
#include "inputstr.h"
@ -39,7 +46,6 @@ in this Software without prior written authorization from The Open Group.
#include "privates.h"
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
#include "extinit.h"
#include "protocol-versions.h"
@ -200,7 +206,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.authId = pAuth->id
};
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, RT_NONE);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
}
/* kill all clients using this auth */
@ -306,7 +312,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
pAuth->secondsRemaining);
}
else {
FreeResource(pAuth->id, RT_NONE);
FreeResource(pAuth->id, X11_RESTYPE_NONE);
return 0;
}
} /* SecurityAuthorizationExpired */
@ -370,7 +376,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
pEventClient; pEventClient = pEventClient->next) {
if (SameClient(pEventClient, client)) {
if (mask == 0)
FreeResource(pEventClient->resource, RT_NONE);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
else
pEventClient->mask = mask;
return Success;
@ -582,7 +588,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->authId, RT_NONE);
FreeResource(stuff->authId, X11_RESTYPE_NONE);
return Success;
} /* ProcSecurityRevokeAuthorization */
@ -607,8 +613,6 @@ static int _X_COLD
SProcSecurityQueryVersion(ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
@ -622,8 +626,6 @@ SProcSecurityGenerateAuthorization(ClientPtr client)
CARD32 *values;
unsigned long nvalues;
int values_offset;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
swaps(&stuff->nbytesAuthProto);
swaps(&stuff->nbytesAuthData);
@ -631,10 +633,10 @@ SProcSecurityGenerateAuthorization(ClientPtr client)
values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
bytes_to_int32(stuff->nbytesAuthData);
if (values_offset >
stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
client->req_len - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
return BadLength;
values = (CARD32 *) (&stuff[1]) + values_offset;
nvalues = (((CARD32 *) stuff) + stuff->length) - values;
nvalues = (((CARD32 *) stuff) + client->req_len) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);
} /* SProcSecurityGenerateAuthorization */
@ -643,8 +645,6 @@ static int _X_COLD
SProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
@ -749,12 +749,12 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
/* disable background None for untrusted windows */
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
if ((requested & DixCreateAccess) && (rec->rtype == X11_RESTYPE_WINDOW))
if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
((WindowPtr) rec->res)->forcedBG = TRUE;
/* additional permissions for specific resource types */
if (rec->rtype == RT_WINDOW)
if (rec->rtype == X11_RESTYPE_WINDOW)
allowed |= SecurityWindowExtraMask;
/* special checks for server-owned resources */
@ -763,7 +763,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
/* additional operations allowed on root windows */
allowed |= SecurityRootWindowExtraMask;
else if (rec->rtype == RT_COLORMAP)
else if (rec->rtype == X11_RESTYPE_COLORMAP)
/* allow access to default colormaps */
allowed = requested;

View file

@ -30,27 +30,8 @@ from The Open Group.
#ifndef _SECURITY_SRV_H
#define _SECURITY_SRV_H
/* Allow client side portions of <X11/extensions/security.h> to compile */
#ifndef Status
#define Status int
#define NEED_UNDEF_Status
#endif
#ifndef Display
#define Display void
#define NEED_UNDEF_Display
#endif
#include <X11/extensions/secur.h>
#ifdef NEED_UNDEF_Status
#undef Status
#undef NEED_UNDEF_Status
#endif
#ifdef NEED_UNDEF_Display
#undef Display
#undef NEED_UNDEF_Display
#endif
#include "input.h" /* for DeviceIntPtr */
#include "property.h" /* for PropertyPtr */
#include "pixmap.h" /* for DrawablePtr */

View file

@ -24,14 +24,16 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/shapeproto.h>
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@ -41,10 +43,9 @@ in this Software without prior written authorization from The Open Group.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/shapeproto.h>
#include "regionstr.h"
#include "gcstruct.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
@ -64,10 +65,10 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
* externally by the Xfixes extension and are now defined in window.h
*/
#ifdef PANORAMIX
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#endif /* XINERAMA */
static int ShapeEventBase = 0;
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
@ -265,7 +266,7 @@ ProcShapeRectangles(ClientPtr client)
client->errorValue = stuff->ordering;
return BadValue;
}
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
nrects = ((client->req_len << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
return BadLength;
nrects >>= 3;
@ -296,7 +297,7 @@ ProcShapeRectangles(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
#ifdef XINERAMA
static int
ProcPanoramiXShapeRectangles(ClientPtr client)
{
@ -319,7 +320,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
}
return result;
}
#endif
#endif /* XINERAMA */
/**************
* ProcShapeMask
@ -362,7 +363,7 @@ ProcShapeMask(ClientPtr client)
srcRgn = 0;
else {
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
RT_PIXMAP, client, DixReadAccess);
X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (rc != Success)
return rc;
if (pPixmap->drawable.pScreen != pScreen ||
@ -394,7 +395,7 @@ ProcShapeMask(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
#ifdef XINERAMA
static int
ProcPanoramiXShapeMask(ClientPtr client)
{
@ -428,7 +429,7 @@ ProcPanoramiXShapeMask(ClientPtr client)
}
return result;
}
#endif
#endif /* XINERAMA */
/************
* ProcShapeCombine
@ -522,7 +523,7 @@ ProcShapeCombine(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
#ifdef XINERAMA
static int
ProcPanoramiXShapeCombine(ClientPtr client)
{
@ -551,7 +552,7 @@ ProcPanoramiXShapeCombine(ClientPtr client)
}
return result;
}
#endif
#endif /* XINERAMA */
/*************
* ProcShapeOffset
@ -593,7 +594,7 @@ ProcShapeOffset(ClientPtr client)
return Success;
}
#ifdef PANORAMIX
#ifdef XINERAMA
static int
ProcPanoramiXShapeOffset(ClientPtr client)
{
@ -616,7 +617,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
}
return result;
}
#endif
#endif /* XINERAMA */
static int
ProcShapeQueryExtents(ClientPtr client)
@ -783,7 +784,7 @@ ProcShapeSelectInput(ClientPtr client)
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
FreeResource(clientResource, RT_NONE);
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;
@ -1034,32 +1035,32 @@ ProcShapeDispatch(ClientPtr client)
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeRectangles(client);
else
#endif
#endif /* XINERAMA */
return ProcShapeRectangles(client);
case X_ShapeMask:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeMask(client);
else
#endif
#endif /* XINERAMA */
return ProcShapeMask(client);
case X_ShapeCombine:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeCombine(client);
else
#endif
#endif /* XINERAMA */
return ProcShapeCombine(client);
case X_ShapeOffset:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeOffset(client);
else
#endif
#endif /* XINERAMA */
return ProcShapeOffset(client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents(client);
@ -1089,21 +1090,10 @@ SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
to->shaped = from->shaped;
}
static int _X_COLD
SProcShapeQueryVersion(ClientPtr client)
{
REQUEST(xShapeQueryVersionReq);
swaps(&stuff->length);
return ProcShapeQueryVersion(client);
}
static int _X_COLD
SProcShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1116,8 +1106,6 @@ static int _X_COLD
SProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1130,8 +1118,6 @@ static int _X_COLD
SProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1144,8 +1130,6 @@ static int _X_COLD
SProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1157,8 +1141,6 @@ static int _X_COLD
SProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
return ProcShapeQueryExtents(client);
@ -1168,8 +1150,6 @@ static int _X_COLD
SProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
return ProcShapeSelectInput(client);
@ -1179,8 +1159,6 @@ static int _X_COLD
SProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
return ProcShapeInputSelected(client);
@ -1190,7 +1168,6 @@ static int _X_COLD
SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
return ProcShapeGetRectangles(client);
@ -1202,7 +1179,7 @@ SProcShapeDispatch(ClientPtr client)
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
return SProcShapeQueryVersion(client);
return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
return SProcShapeRectangles(client);
case X_ShapeMask:

View file

@ -28,24 +28,29 @@ in this Software without prior written authorization from The Open Group.
#define SHM
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#ifdef HAVE_MEMFD_CREATE
#include <sys/mman.h>
#endif
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "dixstruct_priv.h"
#include "resource.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -55,11 +60,8 @@ in this Software without prior written authorization from The Open Group.
#include "servermd.h"
#include "shmint.h"
#include "xace.h"
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include <sys/mman.h>
#include "extinit_priv.h"
#include "protocol-versions.h"
#include "busfault.h"
/* Needed for Solaris cross-zone shared memory extension */
#ifdef HAVE_SHMCTL64
@ -88,12 +90,10 @@ in this Software without prior written authorization from The Open Group.
#define SHMPERM_MODE(p) p->mode
#endif
#ifdef PANORAMIX
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#include "extinit.h"
#endif /* XINERAMA */
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
@ -210,7 +210,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv = XNFcallocarray(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
@ -251,13 +251,14 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret;
Bool ret = TRUE;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
ret = (*pScreen->DestroyPixmap) (pPixmap);
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
@ -459,7 +460,7 @@ ProcShmDetach(ClientPtr client)
REQUEST_SIZE_MATCH(xShmDetachReq);
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
FreeResource(stuff->shmseg, RT_NONE);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
return Success;
}
@ -481,8 +482,8 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
PixmapBytePad(w, depth), data);
if (!pPixmap)
return;
pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
dy);
(void) pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC,
sx, sy, sw, sh, dx, dy);
FreeScratchPixmapHeader(pPixmap);
}
else {
@ -731,7 +732,7 @@ ProcShmGetImage(ClientPtr client)
return Success;
}
#ifdef PANORAMIX
#ifdef XINERAMA
static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
@ -996,8 +997,8 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
stuff->offset);
if (pMap) {
result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
result = XaceHookResourceAccess(client, stuff->pid,
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
break;
@ -1006,7 +1007,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *) pMap)) {
if (!AddResource(newPix->info[j].id, X11_RESTYPE_PIXMAP, (void *) pMap)) {
result = BadAlloc;
break;
}
@ -1019,7 +1020,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (result != Success) {
while (j--)
FreeResource(newPix->info[j].id, RT_NONE);
FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
free(newPix);
}
else
@ -1027,7 +1028,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
return result;
}
#endif
#endif /* XINERAMA */
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1111,8 +1112,8 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->addr +
stuff->offset);
if (pMap) {
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
@ -1121,7 +1122,7 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) {
if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) {
return Success;
}
}
@ -1139,7 +1140,7 @@ ShmBusfaultNotify(void *context)
(unsigned int) shmdesc->resource);
busfault_unregister(shmdesc->busfault);
shmdesc->busfault = NULL;
FreeResource (shmdesc->resource, RT_NONE);
FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
}
static int
@ -1321,7 +1322,7 @@ ProcShmCreateSegment(ClientPtr client)
}
if (WriteFdToClient(client, fd, TRUE) < 0) {
FreeResource(stuff->shmseg, RT_NONE);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
close(fd);
return BadAlloc;
}
@ -1347,22 +1348,22 @@ ProcShmDispatch(ClientPtr client)
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShmPutImage(client);
#endif
#endif /* XINERAMA */
return ProcShmPutImage(client);
case X_ShmGetImage:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShmGetImage(client);
#endif
#endif /* XINERAMA */
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
#ifdef PANORAMIX
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShmCreatePixmap(client);
#endif
#endif /* XINERAMA */
return ProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
@ -1387,20 +1388,10 @@ SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
cpswapl(from->offset, to->offset);
}
static int _X_COLD
SProcShmQueryVersion(ClientPtr client)
{
REQUEST(xShmQueryVersionReq);
swaps(&stuff->length);
return ProcShmQueryVersion(client);
}
static int _X_COLD
SProcShmAttach(ClientPtr client)
{
REQUEST(xShmAttachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachReq);
swapl(&stuff->shmseg);
swapl(&stuff->shmid);
@ -1411,7 +1402,6 @@ static int _X_COLD
SProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmDetachReq);
swapl(&stuff->shmseg);
return ProcShmDetach(client);
@ -1421,7 +1411,6 @@ static int _X_COLD
SProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmPutImageReq);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1442,7 +1431,6 @@ static int _X_COLD
SProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmGetImageReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1459,7 +1447,6 @@ static int _X_COLD
SProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
swapl(&stuff->pid);
swapl(&stuff->drawable);
@ -1476,7 +1463,6 @@ SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
@ -1486,7 +1472,6 @@ static int _X_COLD
SProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
swapl(&stuff->shmseg);
swapl(&stuff->size);
@ -1500,7 +1485,7 @@ SProcShmDispatch(ClientPtr client)
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return SProcShmQueryVersion(client);
return ProcShmQueryVersion(client);
if (!client->local)
return BadRequest;

View file

@ -27,9 +27,7 @@ in this Software without prior written authorization from The Open Group.
/* dixsleep.c - implement millisecond timeouts for X clients */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "sleepuntil.h"
#include <X11/X.h>
@ -166,7 +164,7 @@ SertafiedBlockHandler(void *data, void *wt)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
FreeResource(pReq->id, X11_RESTYPE_NONE);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
@ -195,7 +193,7 @@ SertafiedWakeupHandler(void *data, int i)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
FreeResource(pReq->id, X11_RESTYPE_NONE);
}
if (!pPending) {
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,

View file

@ -49,35 +49,35 @@ PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xmd.h>
#include <X11/extensions/syncproto.h>
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "scrnintstr.h"
#include "os.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "pixmapstr.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/syncproto.h>
#include "syncsrv.h"
#include "syncsdk.h"
#include "protocol-versions.h"
#include "inputstr.h"
#include "misync_priv.h"
#include <stdio.h>
#if !defined(WIN32)
#include <sys/time.h>
#endif
#include "extinit.h"
#include "extinit_priv.h"
/*
* Local Global Variables
@ -200,8 +200,8 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
return Success;
}
if (!(pCur = malloc(sizeof(SyncTriggerList))))
return BadAlloc;
/* Failure is not an option, it's succeed or burst! */
pCur = XNFalloc(sizeof(SyncTriggerList));
pCur->pTrigger = pTrigger;
pCur->next = pTrigger->pSync->pTriglist;
@ -330,11 +330,6 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
client->errorValue = syncObject;
return rc;
}
if (pSync != pTrigger->pSync) { /* new counter for trigger */
SyncDeleteTriggerFromSyncObject(pTrigger);
pTrigger->pSync = pSync;
newSyncObject = TRUE;
}
}
/* if system counter, ask it what the current value is */
@ -356,6 +351,24 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
}
}
if (changes & (XSyncCAValueType | XSyncCAValue)) {
if (pTrigger->value_type == XSyncAbsolute)
pTrigger->test_value = pTrigger->wait_value;
else { /* relative */
Bool overflow;
if (pCounter == NULL)
return BadMatch;
overflow = checked_int64_add(&pTrigger->test_value,
pCounter->value, pTrigger->wait_value);
if (overflow) {
client->errorValue = pTrigger->wait_value >> 32;
return BadValue;
}
}
}
if (changes & XSyncCATestType) {
if (pSync && SYNC_FENCE == pSync->type) {
@ -384,21 +397,11 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
}
}
if (changes & (XSyncCAValueType | XSyncCAValue)) {
if (pTrigger->value_type == XSyncAbsolute)
pTrigger->test_value = pTrigger->wait_value;
else { /* relative */
Bool overflow;
if (pCounter == NULL)
return BadMatch;
overflow = checked_int64_add(&pTrigger->test_value,
pCounter->value, pTrigger->wait_value);
if (overflow) {
client->errorValue = pTrigger->wait_value >> 32;
return BadValue;
}
if (changes & XSyncCACounter) {
if (pSync != pTrigger->pSync) { /* new counter for trigger */
SyncDeleteTriggerFromSyncObject(pTrigger);
pTrigger->pSync = pSync;
newSyncObject = TRUE;
}
}
@ -406,8 +409,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
* a new counter on a trigger
*/
if (newSyncObject) {
if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success)
return rc;
SyncAddTriggerToSyncObject(pTrigger);
}
else if (pCounter && IsSystemCounter(pCounter)) {
SyncComputeBracketValues(pCounter);
@ -694,7 +696,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
/* unblock the client */
AttendClient(pAwaitUnion->header.client);
/* delete the await */
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
}
static int64_t
@ -749,7 +751,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
* nothing, since it's already got them.
*/
if (!wantevents) {
FreeResource(pClients->delete_id, RT_NONE);
FreeResource(pClients->delete_id, X11_RESTYPE_NONE);
}
return Success;
}
@ -798,8 +800,14 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
int status;
XSyncCounter counter;
Mask origmask = mask;
SyncTrigger trigger;
Bool select_events_changed = FALSE;
Bool select_events_value = FALSE;
int64_t delta;
counter = pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None;
trigger = pAlarm->trigger;
delta = pAlarm->delta;
counter = trigger.pSync ? trigger.pSync->id : None;
while (mask) {
int index2 = lowbit(mask);
@ -815,24 +823,24 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
case XSyncCAValueType:
mask &= ~XSyncCAValueType;
/* sanity check in SyncInitTrigger */
pAlarm->trigger.value_type = *values++;
trigger.value_type = *values++;
break;
case XSyncCAValue:
mask &= ~XSyncCAValue;
pAlarm->trigger.wait_value = ((int64_t)values[0] << 32) | values[1];
trigger.wait_value = ((int64_t)values[0] << 32) | values[1];
values += 2;
break;
case XSyncCATestType:
mask &= ~XSyncCATestType;
/* sanity check in SyncInitTrigger */
pAlarm->trigger.test_type = *values++;
trigger.test_type = *values++;
break;
case XSyncCADelta:
mask &= ~XSyncCADelta;
pAlarm->delta = ((int64_t)values[0] << 32) | values[1];
delta = ((int64_t)values[0] << 32) | values[1];
values += 2;
break;
@ -842,10 +850,8 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
client->errorValue = *values;
return BadValue;
}
status = SyncEventSelectForAlarm(pAlarm, client,
(Bool) (*values++));
if (status != Success)
return status;
select_events_value = (Bool) (*values++);
select_events_changed = TRUE;
break;
default:
@ -854,25 +860,33 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
}
}
if (select_events_changed) {
status = SyncEventSelectForAlarm(pAlarm, client, select_events_value);
if (status != Success)
return status;
}
/* "If the test-type is PositiveComparison or PositiveTransition
* and delta is less than zero, or if the test-type is
* NegativeComparison or NegativeTransition and delta is
* greater than zero, a Match error is generated."
*/
if (origmask & (XSyncCADelta | XSyncCATestType)) {
if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) ||
(pAlarm->trigger.test_type == XSyncPositiveTransition))
&& pAlarm->delta < 0)
if ((((trigger.test_type == XSyncPositiveComparison) ||
(trigger.test_type == XSyncPositiveTransition))
&& delta < 0)
||
(((pAlarm->trigger.test_type == XSyncNegativeComparison) ||
(pAlarm->trigger.test_type == XSyncNegativeTransition))
&& pAlarm->delta > 0)
(((trigger.test_type == XSyncNegativeComparison) ||
(trigger.test_type == XSyncNegativeTransition))
&& delta > 0)
) {
return BadMatch;
}
}
/* postpone this until now, when we're sure nothing else can go wrong */
pAlarm->delta = delta;
pAlarm->trigger = trigger;
if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, RTCounter,
origmask & XSyncCAAllTrigger)) != Success)
return status;
@ -932,7 +946,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
if (status != Success) {
FreeResource(pFence->sync.id, RT_NONE);
FreeResource(pFence->sync.id, X11_RESTYPE_NONE);
return status;
}
@ -990,8 +1004,8 @@ SyncCreateSystemCounter(const char *name,
psci = malloc(sizeof(SysCounterInfo));
if (!psci) {
FreeResource(pCounter->sync.id, RT_NONE);
return pCounter;
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return NULL;
}
pCounter->pSysCounterInfo = psci;
psci->pCounter = pCounter;
@ -1013,7 +1027,7 @@ SyncDestroySystemCounter(void *pSysCounter)
{
SyncCounter *pCounter = (SyncCounter *) pSysCounter;
FreeResource(pCounter->sync.id, RT_NONE);
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
}
static void
@ -1126,7 +1140,7 @@ FreeAlarm(void *addr, XID id)
/* delete event selections */
while (pAlarm->pEventClients)
FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
FreeResource(pAlarm->pEventClients->delete_id, X11_RESTYPE_NONE);
SyncDeleteTriggerFromSyncObject(&pAlarm->trigger);
@ -1491,7 +1505,7 @@ ProcSyncDestroyCounter(ClientPtr client)
client->errorValue = stuff->counter;
return BadAccess;
}
FreeResource(pCounter->sync.id, RT_NONE);
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return Success;
}
@ -1592,7 +1606,7 @@ ProcSyncAwait(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
client->errorValue = pProtocolWaitConds->counter;
return SyncErrorBase + XSyncBadCounter;
}
@ -1612,7 +1626,7 @@ ProcSyncAwait(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -1743,7 +1757,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (!SyncCheckWarnIsCounter(pTrigger->pSync,
WARN_INVALID_COUNTER_ALARM)) {
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return BadAlloc;
}
@ -1874,7 +1888,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->alarm, RT_NONE);
FreeResource(stuff->alarm, X11_RESTYPE_NONE);
return Success;
}
@ -1979,7 +1993,7 @@ ProcSyncDestroyFence(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->fid, RT_NONE);
FreeResource(stuff->fid, X11_RESTYPE_NONE);
return Success;
}
@ -2057,7 +2071,7 @@ ProcSyncAwaitFence(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
client->errorValue = *pProtocolFences;
return SyncErrorBase + XSyncBadFence;
}
@ -2076,7 +2090,7 @@ ProcSyncAwaitFence(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -2151,31 +2165,10 @@ ProcSyncDispatch(ClientPtr client)
* Boring Swapping stuff ...
*/
static int _X_COLD
SProcSyncInitialize(ClientPtr client)
{
REQUEST(xSyncInitializeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncInitializeReq);
return ProcSyncInitialize(client);
}
static int _X_COLD
SProcSyncListSystemCounters(ClientPtr client)
{
REQUEST(xSyncListSystemCountersReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
return ProcSyncListSystemCounters(client);
}
static int _X_COLD
SProcSyncCreateCounter(ClientPtr client)
{
REQUEST(xSyncCreateCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
swapl(&stuff->cid);
swapl(&stuff->initial_value_lo);
@ -2188,7 +2181,6 @@ static int _X_COLD
SProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
@ -2201,7 +2193,6 @@ static int _X_COLD
SProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
@ -2214,7 +2205,6 @@ static int _X_COLD
SProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
swapl(&stuff->counter);
@ -2225,7 +2215,6 @@ static int _X_COLD
SProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
swapl(&stuff->counter);
@ -2236,7 +2225,6 @@ static int _X_COLD
SProcSyncAwait(ClientPtr client)
{
REQUEST(xSyncAwaitReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
SwapRestL(stuff);
@ -2247,7 +2235,6 @@ static int _X_COLD
SProcSyncCreateAlarm(ClientPtr client)
{
REQUEST(xSyncCreateAlarmReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
swapl(&stuff->id);
swapl(&stuff->valueMask);
@ -2260,7 +2247,6 @@ static int _X_COLD
SProcSyncChangeAlarm(ClientPtr client)
{
REQUEST(xSyncChangeAlarmReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
swapl(&stuff->alarm);
swapl(&stuff->valueMask);
@ -2272,7 +2258,6 @@ static int _X_COLD
SProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
swapl(&stuff->alarm);
@ -2283,7 +2268,6 @@ static int _X_COLD
SProcSyncDestroyAlarm(ClientPtr client)
{
REQUEST(xSyncDestroyAlarmReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
swapl(&stuff->alarm);
@ -2294,7 +2278,6 @@ static int _X_COLD
SProcSyncSetPriority(ClientPtr client)
{
REQUEST(xSyncSetPriorityReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
swapl(&stuff->id);
swapl(&stuff->priority);
@ -2306,7 +2289,6 @@ static int _X_COLD
SProcSyncGetPriority(ClientPtr client)
{
REQUEST(xSyncGetPriorityReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
swapl(&stuff->id);
@ -2317,7 +2299,6 @@ static int _X_COLD
SProcSyncCreateFence(ClientPtr client)
{
REQUEST(xSyncCreateFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
swapl(&stuff->d);
swapl(&stuff->fid);
@ -2329,7 +2310,6 @@ static int _X_COLD
SProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
swapl(&stuff->fid);
@ -2340,7 +2320,6 @@ static int _X_COLD
SProcSyncResetFence(ClientPtr client)
{
REQUEST(xSyncResetFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
swapl(&stuff->fid);
@ -2351,7 +2330,6 @@ static int _X_COLD
SProcSyncDestroyFence(ClientPtr client)
{
REQUEST(xSyncDestroyFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
swapl(&stuff->fid);
@ -2362,7 +2340,6 @@ static int _X_COLD
SProcSyncQueryFence(ClientPtr client)
{
REQUEST(xSyncQueryFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
swapl(&stuff->fid);
@ -2373,7 +2350,6 @@ static int _X_COLD
SProcSyncAwaitFence(ClientPtr client)
{
REQUEST(xSyncAwaitFenceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
SwapRestL(stuff);
@ -2387,9 +2363,9 @@ SProcSyncDispatch(ClientPtr client)
switch (stuff->data) {
case X_SyncInitialize:
return SProcSyncInitialize(client);
return ProcSyncInitialize(client);
case X_SyncListSystemCounters:
return SProcSyncListSystemCounters(client);
return ProcSyncListSystemCounters(client);
case X_SyncCreateCounter:
return SProcSyncCreateCounter(client);
case X_SyncSetCounter:
@ -2644,9 +2620,11 @@ IdleTimeQueryValue(void *pCounter, int64_t *pValue_return)
int deviceid;
CARD32 idle;
*pValue_return = 0;
if (pCounter) {
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
deviceid = priv->deviceid;
}
else
@ -2660,6 +2638,7 @@ IdleTimeBlockHandler(void *pCounter, void *wt)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle, old_idle;
@ -2750,6 +2729,7 @@ IdleTimeWakeupHandler(void *pCounter, int rc)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle;
@ -2783,6 +2763,7 @@ IdleTimeBracketValues(void *pCounter, int64_t *pbracket_less,
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
Bool registered = (less || greater);
@ -2820,8 +2801,10 @@ init_system_idle_counter(const char *name, int deviceid)
if (idle_time_counter != NULL) {
IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
if (priv) {
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
}
idle_time_counter->pSysCounterInfo->private = priv;
}

View file

@ -29,9 +29,7 @@ from Kaleb S. KEITHLEY
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef XF86VIDMODE
@ -471,7 +469,7 @@ ProcVidModeAddModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->length = client->req_len;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -641,7 +639,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->length = client->req_len;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -670,7 +668,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
"len = %d, length = %d\n",
(unsigned long) client->req_len,
(int) sizeof(xXF86VidModeDeleteModeLineReq) >> 2,
(unsigned long) stuff->privsize, len, stuff->length);
(unsigned long) stuff->privsize, len, client->req_len);
return BadLength;
}
@ -765,7 +763,7 @@ ProcVidModeModModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->length = client->req_len;
stuff->screen = oldstuff->screen;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
@ -808,6 +806,8 @@ ProcVidModeModModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -899,7 +899,7 @@ ProcVidModeValidateModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->length = client->req_len;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -951,6 +951,8 @@ ProcVidModeValidateModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -1052,7 +1054,7 @@ ProcVidModeSwitchToMode(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->length = client->req_len;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -1703,19 +1705,10 @@ ProcVidModeDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcVidModeQueryVersion(ClientPtr client)
{
REQUEST(xXF86VidModeQueryVersionReq);
swaps(&stuff->length);
return ProcVidModeQueryVersion(client);
}
static int _X_COLD
SProcVidModeGetModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeGetModeLineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
swaps(&stuff->screen);
return ProcVidModeGetModeLine(client);
@ -1725,7 +1718,6 @@ static int _X_COLD
SProcVidModeGetAllModeLines(ClientPtr client)
{
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen);
return ProcVidModeGetAllModeLines(client);
@ -1741,7 +1733,6 @@ SProcVidModeAddModeLine(ClientPtr client)
REQUEST(xXF86VidModeAddModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1757,7 +1748,6 @@ SProcVidModeAddModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1786,7 +1776,6 @@ SProcVidModeDeleteModeLine(ClientPtr client)
REQUEST(xXF86VidModeDeleteModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1802,7 +1791,6 @@ SProcVidModeDeleteModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1831,7 +1819,6 @@ SProcVidModeModModeLine(ClientPtr client)
REQUEST(xXF86VidModeModModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1847,7 +1834,6 @@ SProcVidModeModModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1876,7 +1862,6 @@ SProcVidModeValidateModeLine(ClientPtr client)
REQUEST(xXF86VidModeValidateModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1892,7 +1877,6 @@ SProcVidModeValidateModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1915,7 +1899,6 @@ static int _X_COLD
SProcVidModeSwitchMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen);
swaps(&stuff->zoom);
@ -1926,7 +1909,6 @@ static int _X_COLD
SProcVidModeSwitchToMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swapl(&stuff->screen);
return ProcVidModeSwitchToMode(client);
@ -1936,7 +1918,6 @@ static int _X_COLD
SProcVidModeLockModeSwitch(ClientPtr client)
{
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen);
swaps(&stuff->lock);
@ -1947,7 +1928,6 @@ static int _X_COLD
SProcVidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen);
return ProcVidModeGetMonitor(client);
@ -1957,7 +1937,6 @@ static int _X_COLD
SProcVidModeGetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen);
return ProcVidModeGetViewPort(client);
@ -1967,7 +1946,6 @@ static int _X_COLD
SProcVidModeSetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
swaps(&stuff->screen);
swapl(&stuff->x);
@ -1979,7 +1957,6 @@ static int _X_COLD
SProcVidModeGetDotClocks(ClientPtr client)
{
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen);
return ProcVidModeGetDotClocks(client);
@ -1989,7 +1966,6 @@ static int _X_COLD
SProcVidModeSetClientVersion(ClientPtr client)
{
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major);
swaps(&stuff->minor);
@ -2000,7 +1976,6 @@ static int _X_COLD
SProcVidModeSetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
swaps(&stuff->screen);
swapl(&stuff->red);
@ -2013,7 +1988,6 @@ static int _X_COLD
SProcVidModeGetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen);
return ProcVidModeGetGamma(client);
@ -2025,7 +1999,6 @@ SProcVidModeSetGammaRamp(ClientPtr client)
int length;
REQUEST(xXF86VidModeSetGammaRampReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2039,7 +2012,6 @@ static int _X_COLD
SProcVidModeGetGammaRamp(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2050,7 +2022,6 @@ static int _X_COLD
SProcVidModeGetGammaRampSize(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen);
return ProcVidModeGetGammaRampSize(client);
@ -2060,7 +2031,6 @@ static int _X_COLD
SProcVidModeGetPermissions(ClientPtr client)
{
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen);
return ProcVidModeGetPermissions(client);
@ -2072,7 +2042,7 @@ SProcVidModeDispatch(ClientPtr client)
REQUEST(xReq);
switch (stuff->data) {
case X_XF86VidModeQueryVersion:
return SProcVidModeQueryVersion(client);
return ProcVidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return SProcVidModeGetModeLine(client);
case X_XF86VidModeGetMonitor:

View file

@ -17,11 +17,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdarg.h>
#include "os/client_priv.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "pixmapstr.h"
@ -33,9 +34,8 @@ CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
/* Special-cased hook functions. Called by Xserver.
*/
#undef XaceHookDispatch
int
XaceHookDispatch(ClientPtr client, int major)
XaceHookDispatch0(ClientPtr client, int major)
{
/* Call the extension dispatch hook */
ExtensionEntry *ext = GetExtensionEntry(major);
@ -63,130 +63,85 @@ XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
return rec.status;
}
/* Entry point for hook functions. Called by Xserver.
*/
int
XaceHook(int hook, ...)
int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode)
{
union {
XaceResourceAccessRec res;
XaceDeviceAccessRec dev;
XaceSendAccessRec send;
XaceReceiveAccessRec recv;
XaceClientAccessRec client;
XaceExtAccessRec ext;
XaceServerAccessRec server;
XaceScreenAccessRec screen;
XaceAuthAvailRec auth;
XaceKeyAvailRec key;
} u;
int *prv = NULL; /* points to return value from callback */
va_list ap; /* argument list */
XaceResourceAccessRec rec = { client, id, rtype, res, ptype, parent,
access_mode, Success };
CallCallbacks(&XaceHooks[XACE_RESOURCE_ACCESS], &rec);
return rec.status;
}
if (!XaceHooks[hook])
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode)
{
XaceDeviceAccessRec rec = { client, dev, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_DEVICE_ACCESS], &rec);
return rec.status;
}
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
xEventPtr ev, int count)
{
XaceSendAccessRec rec = { client, dev, win, ev, count, Success };
CallCallbacks(&XaceHooks[XACE_SEND_ACCESS], &rec);
return rec.status;
}
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win,
xEventPtr ev, int count)
{
XaceReceiveAccessRec rec = { client, win, ev, count, Success };
CallCallbacks(&XaceHooks[XACE_RECEIVE_ACCESS], &rec);
return rec.status;
}
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode)
{
XaceClientAccessRec rec = { client, target, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_CLIENT_ACCESS], &rec);
return rec.status;
}
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext)
{
XaceExtAccessRec rec = { client, ext, DixGetAttrAccess, Success };
CallCallbacks(&XaceHooks[XACE_EXT_ACCESS], &rec);
return rec.status;
}
int XaceHookServerAccess(ClientPtr client, Mask access_mode)
{
XaceServerAccessRec rec = { client, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SERVER_ACCESS], &rec);
return rec.status;
}
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
{
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SCREEN_ACCESS], &rec);
return rec.status;
}
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
{
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SCREENSAVER_ACCESS], &rec);
return rec.status;
}
int XaceHookAuthAvail(ClientPtr client, XID authId)
{
XaceAuthAvailRec rec = { client, authId };
CallCallbacks(&XaceHooks[XACE_AUTH_AVAIL], &rec);
return Success;
}
va_start(ap, hook);
/* Marshal arguments for passing to callback.
* Each callback has its own case, which sets up a structure to hold
* the arguments and integer return parameter, or in some cases just
* sets calldata directly to a single argument (with no return result)
*/
switch (hook) {
case XACE_RESOURCE_ACCESS:
u.res.client = va_arg(ap, ClientPtr);
u.res.id = va_arg(ap, XID);
u.res.rtype = va_arg(ap, RESTYPE);
u.res.res = va_arg(ap, void *);
u.res.ptype = va_arg(ap, RESTYPE);
u.res.parent = va_arg(ap, void *);
u.res.access_mode = va_arg(ap, Mask);
u.res.status = Success; /* default allow */
prv = &u.res.status;
break;
case XACE_DEVICE_ACCESS:
u.dev.client = va_arg(ap, ClientPtr);
u.dev.dev = va_arg(ap, DeviceIntPtr);
u.dev.access_mode = va_arg(ap, Mask);
u.dev.status = Success; /* default allow */
prv = &u.dev.status;
break;
case XACE_SEND_ACCESS:
u.send.client = va_arg(ap, ClientPtr);
u.send.dev = va_arg(ap, DeviceIntPtr);
u.send.pWin = va_arg(ap, WindowPtr);
u.send.events = va_arg(ap, xEventPtr);
u.send.count = va_arg(ap, int);
u.send.status = Success; /* default allow */
prv = &u.send.status;
break;
case XACE_RECEIVE_ACCESS:
u.recv.client = va_arg(ap, ClientPtr);
u.recv.pWin = va_arg(ap, WindowPtr);
u.recv.events = va_arg(ap, xEventPtr);
u.recv.count = va_arg(ap, int);
u.recv.status = Success; /* default allow */
prv = &u.recv.status;
break;
case XACE_CLIENT_ACCESS:
u.client.client = va_arg(ap, ClientPtr);
u.client.target = va_arg(ap, ClientPtr);
u.client.access_mode = va_arg(ap, Mask);
u.client.status = Success; /* default allow */
prv = &u.client.status;
break;
case XACE_EXT_ACCESS:
u.ext.client = va_arg(ap, ClientPtr);
u.ext.ext = va_arg(ap, ExtensionEntry *);
u.ext.access_mode = DixGetAttrAccess;
u.ext.status = Success; /* default allow */
prv = &u.ext.status;
break;
case XACE_SERVER_ACCESS:
u.server.client = va_arg(ap, ClientPtr);
u.server.access_mode = va_arg(ap, Mask);
u.server.status = Success; /* default allow */
prv = &u.server.status;
break;
case XACE_SCREEN_ACCESS:
case XACE_SCREENSAVER_ACCESS:
u.screen.client = va_arg(ap, ClientPtr);
u.screen.screen = va_arg(ap, ScreenPtr);
u.screen.access_mode = va_arg(ap, Mask);
u.screen.status = Success; /* default allow */
prv = &u.screen.status;
break;
case XACE_AUTH_AVAIL:
u.auth.client = va_arg(ap, ClientPtr);
u.auth.authId = va_arg(ap, XID);
break;
case XACE_KEY_AVAIL:
u.key.event = va_arg(ap, xEventPtr);
u.key.keybd = va_arg(ap, DeviceIntPtr);
u.key.count = va_arg(ap, int);
break;
default:
va_end(ap);
return 0; /* unimplemented hook number */
}
va_end(ap);
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[hook], &u);
return prv ? *prv : Success;
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count)
{
XaceKeyAvailRec rec = { ev, dev, count };
CallCallbacks(&XaceHooks[XACE_KEY_AVAIL], &rec);
return Success;
}
/* XaceHookIsSet

View file

@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_MAJOR_VERSION 2
#define XACE_MINOR_VERSION 0
#include "extnsionst.h"
#include "pixmap.h"
#include "region.h"
#include "window.h"
@ -54,31 +55,47 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_KEY_AVAIL 14
#define XACE_NUM_HOOKS 15
extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
* Required by libdbe and libextmod
*/
extern _X_EXPORT int XaceHook(int /*hook */ ,
... /*appropriate args for hook */
);
/* needs to be exported for in-tree modsetting driver, but not part
of public API for external modules */
_X_EXPORT int XaceHook(int hook, ... /* appropriate args for hook */);
/* determine whether any callbacks are present for the XACE hook */
extern _X_EXPORT int XaceHookIsSet(int hook);
int XaceHookIsSet(int hook);
/* Special-cased hook functions
*/
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
int XaceHookDispatch0(ClientPtr ptr, int major);
#define XaceHookDispatch(c, m) \
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
XaceHookDispatch((c), (m)) : \
XaceHookDispatch0((c), (m)) : \
Success)
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
PropertyPtr *ppProp,
Mask access_mode);
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin, PropertyPtr *ppProp,
Mask access_mode);
int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel, Mask access_mode);
/* needs to be exported for in-tree modsetting, but not part of public API */
_X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode);
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode);
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
xEventPtr ev, int count);
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win, xEventPtr ev, int count);
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
int XaceHookAuthAvail(ClientPtr client, XID authId);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
/* Register a callback for a given hook.
*/
@ -92,13 +109,13 @@ extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
/* XTrans wrappers for use by security modules
*/
extern _X_EXPORT int XaceGetConnectionNumber(ClientPtr ptr);
extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
int XaceGetConnectionNumber(ClientPtr ptr);
int XaceIsLocal(ClientPtr ptr);
/* From the original Security extension...
*/
extern _X_EXPORT void XaceCensorImage(ClientPtr client,
void XaceCensorImage(ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
@ -113,18 +130,38 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
/* Define calls away when XACE is not being built. */
#ifdef __GNUC__
#define XaceHook(args...) Success
#define XaceHookIsSet(args...) 0
#define XaceHookDispatch(args...) Success
#define XaceHookPropertyAccess(args...) Success
#define XaceHookSelectionAccess(args...) Success
#define XaceHookResourceAccess(args...) Success
#define XaceHookDeviceAccess(args...) Success
#define XaceHookSendAccess(args...) Success
#define XaceHookReceiveAccess(args...) Success
#define XaceHookClientAccess(args...) Success
#define XaceHookExtAccess(args...) Success
#define XaceHookServerAccess(args...) Success
#define XaceHookScreenAccess(args...) Success
#define XaceHookScreensaverAccess(args...) Success
#define XaceHookAuthAvail(args...) Success
#define XaceHookKeyAvail(args...) Success
#define XaceCensorImage(args...) { ; }
#else
#define XaceHook(...) Success
#define XaceHookIsSet(...) 0
#define XaceHookDispatch(...) Success
#define XaceHookPropertyAccess(...) Success
#define XaceHookSelectionAccess(...) Success
#define XaceHookResourceAccess(...) Success
#define XaceHookDeviceAccess(...) Success
#define XaceHookSendAccess(...) Success
#define XaceHookReceiveAccess(...) Success
#define XaceHookClientAccess(...) Success
#define XaceHookExtAccess(...) Success
#define XaceHookServerAccess(...) Success
#define XaceHookScreenAccess(...) Success
#define XaceHookScreensaverAccess(...) Success
#define XaceHookAuthAvail(...) Success
#define XaceHookKeyAvail(...) Success
#define XaceCensorImage(...) { ; }
#endif

View file

@ -26,9 +26,7 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
@ -38,7 +36,7 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit.h"
#include "extinit_priv.h"
#include <stdint.h>
@ -146,30 +144,18 @@ static int _X_COLD
SProcXCMiscGetVersion(ClientPtr client)
{
REQUEST(xXCMiscGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcXCMiscGetVersion(client);
}
static int _X_COLD
SProcXCMiscGetXIDRange(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
return ProcXCMiscGetXIDRange(client);
}
static int _X_COLD
SProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
swaps(&stuff->length);
swapl(&stuff->count);
return ProcXCMiscGetXIDList(client);
}
@ -182,7 +168,7 @@ SProcXCMiscDispatch(ClientPtr client)
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return SProcXCMiscGetXIDRange(client);
return ProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
default:

View file

@ -34,9 +34,7 @@
* XLoadQueryFont).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#ifdef MITSHM
@ -58,20 +56,22 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/xf86bigfproto.h>
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
#include <X11/extensions/xf86bigfproto.h>
#include "xf86bigfontsrv.h"
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
);
static void XF86BigfontResetProc(ExtensionEntry *extEntry );
#ifdef MITSHM
@ -339,9 +339,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
CARD16 *pUniqIndex2Index;
CARD32 nUniqCharInfos;
#if 0
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
#else
/* protocol version is decided based on request packet size */
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
stuff_flags = (client->local &&
@ -353,7 +351,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
default:
return BadLength;
}
#endif
if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) !=
Success)
return BadFont; /* procotol spec says only error is BadFont */
@ -653,9 +651,7 @@ ProcXF86BigfontDispatch(ClientPtr client)
static int _X_COLD
SProcXF86BigfontQueryVersion(ClientPtr client)
{
REQUEST(xXF86BigfontQueryVersionReq);
swaps(&stuff->length);
/* REQUEST(xXF86BigfontQueryVersionReq); */
return ProcXF86BigfontQueryVersion(client);
}
@ -663,8 +659,6 @@ static int _X_COLD
SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);

View file

@ -2,30 +2,28 @@
Copyright (c) 2002 XFree86 Inc
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <assert.h>
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/XResproto.h>
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
#include "client.h"
#include "list.h"
#include "misc.h"
#include <string.h>
@ -226,6 +224,8 @@ ProcXResQueryClients(ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = xallocarray(currentMaxClients, sizeof(int));
if (current_clients == NULL)
return BadAlloc;
num_clients = 0;
for (i = 0; i < currentMaxClients; i++) {
@ -1080,7 +1080,6 @@ static int _X_COLD
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:

View file

@ -17,16 +17,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dix/dix_priv.h"
#include "selection.h"
#include "inputstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "extnsionst.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "xselinuxint.h"
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
@ -69,7 +69,6 @@ ProcSELinuxQueryVersion(ClientPtr client)
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
@ -86,7 +85,6 @@ ProcSELinuxQueryVersion(ClientPtr client)
static int
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
{
SELinuxGetContextReply rep;
char *ctx = NULL;
int len = 0;
@ -96,7 +94,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
rep = (SELinuxGetContextReply) {
SELinuxGetContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
@ -343,13 +341,9 @@ static int
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
int size, int count)
{
int rc, k, pos = 0;
SELinuxListItemsReply rep;
CARD32 *buf;
buf = calloc(size, sizeof(CARD32));
int rc = BadAlloc, k, pos = 0;
CARD32 *buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
rc = BadAlloc;
goto out;
}
@ -377,7 +371,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
rep = (SELinuxListItemsReply) {
SELinuxListItemsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
@ -455,8 +449,10 @@ ProcSELinuxListSelections(ClientPtr client)
count = 0;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
count++;
if (count == 0)
return SELinuxSendItemsToClient(client, NULL, 0, 0);
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
if (!items)
return BadAlloc;
/* Fill in the items and calculate size */
@ -624,8 +620,6 @@ SProcSELinuxDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return SProcSELinuxQueryVersion(client);

View file

@ -22,9 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* All rights reserved.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <errno.h>
#include <sys/socket.h>
@ -32,8 +30,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdarg.h>
#include <libaudit.h>
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include "selection.h"
#include "inputstr.h"
@ -42,7 +42,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "propertyst.h"
#include "extnsionst.h"
#include "xacestr.h"
#include "client.h"
#define _XSELINUX_NEED_FLASK_MAP
#include "xselinuxint.h"
@ -201,7 +200,7 @@ SELinuxLabelInitial(void)
/* Do the default colormap */
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
RT_COLORMAP, serverClient, DixCreateAccess);
X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
}
}
@ -664,7 +663,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
rec->status = rc;
/* Perform the background none check on windows */
if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
if (access_mode & DixCreateAccess && rec->rtype == X11_RESTYPE_WINDOW) {
rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
if (rc != Success)
((WindowPtr) rec->res)->forcedBG = TRUE;
@ -766,7 +765,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxObjectRec *obj;
WindowPtr pWin;
if (rec->type != RT_WINDOW)
if (rec->type != X11_RESTYPE_WINDOW)
return;
if (rec->state != ResourceStateAdding)
return;

View file

@ -17,9 +17,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <selinux/label.h>
@ -139,8 +137,12 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
rec = SELinuxArrayGet(&arr_atoms, atom);
if (!rec) {
rec = calloc(1, sizeof(SELinuxAtomRec));
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
if (!rec)
return BadAlloc;
if (!SELinuxArraySet(&arr_atoms, atom, rec)) {
free(rec);
return BadAlloc;
}
}
if (prop) {
@ -323,13 +325,13 @@ SELinuxTypeToClass(RESTYPE type)
if (type & RC_DRAWABLE)
class = SECCLASS_X_DRAWABLE;
else if (type == RT_GC)
else if (type == X11_RESTYPE_GC)
class = SECCLASS_X_GC;
else if (type == RT_FONT)
else if (type == X11_RESTYPE_FONT)
class = SECCLASS_X_FONT;
else if (type == RT_CURSOR)
else if (type == X11_RESTYPE_CURSOR)
class = SECCLASS_X_CURSOR;
else if (type == RT_COLORMAP)
else if (type == X11_RESTYPE_COLORMAP)
class = SECCLASS_X_COLORMAP;
else {
/* Need to do a string lookup */

View file

@ -26,13 +26,23 @@
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <X11/extensions/xtestproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "mi/mi_priv.h"
#include "mi/mipointer_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@ -42,20 +52,14 @@
#include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#include "mi.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include <X11/extensions/xtestproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "mipointer.h"
#include "xserver-properties.h"
#include "exevents.h"
#include "eventstr.h"
#include "inpututils.h"
#include "extinit.h"
#include "extinit_priv.h"
/* XTest events are sent during request processing and may be interrupted by
* a SIGIO. We need a separate event list to avoid events overwriting each
@ -75,10 +79,10 @@ static InternalEvent *xtest_evlist;
*/
DeviceIntPtr xtestpointer, xtestkeyboard;
#ifdef PANORAMIX
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#endif /* XINERAMA */
static int XTestSwapFakeInput(ClientPtr /* client */ ,
xReq * /* req */
@ -129,7 +133,7 @@ ProcXTestCompareCursor(ClientPtr client)
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
RT_CURSOR, client, DixReadAccess);
X11_RESTYPE_CURSOR, client, DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;
@ -194,7 +198,7 @@ ProcXTestFakeInput(ClientPtr client)
int flags = 0;
int need_ptr_update = 1;
nev = (stuff->length << 2) - sizeof(xReq);
nev = (client->req_len << 2) - sizeof(xReq);
if ((nev % sizeof(xEvent)) || !nev)
return BadLength;
nev /= sizeof(xEvent);
@ -346,6 +350,10 @@ ProcXTestFakeInput(ClientPtr client)
return BadAccess;
dev = GetXTestDevice(dev);
/* This can only happen if we passed a slave to GetXTestDevice() */
if (!dev)
return BadAccess;
}
@ -370,7 +378,6 @@ ProcXTestFakeInput(ClientPtr client)
/* swap the request back so we can simply re-execute it */
if (client->swapped) {
(void) XTestSwapFakeInput(client, (xReq *) stuff);
swaps(&stuff->length);
}
ResetCurrentRequest(client);
client->sequence--;
@ -484,8 +491,6 @@ static int _X_COLD
SProcXTestGetVersion(ClientPtr client)
{
REQUEST(xXTestGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
@ -495,8 +500,6 @@ static int _X_COLD
SProcXTestCompareCursor(ClientPtr client)
{
REQUEST(xXTestCompareCursorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
@ -511,7 +514,7 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
xEvent sev;
EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
nev = ((client->req_len << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
int evtype = ev->u.u.type & 0177;
/* Swap event */
@ -534,23 +537,12 @@ SProcXTestFakeInput(ClientPtr client)
REQUEST(xReq);
swaps(&stuff->length);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
return ProcXTestFakeInput(client);
}
static int _X_COLD
SProcXTestGrabControl(ClientPtr client)
{
REQUEST(xXTestGrabControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
return ProcXTestGrabControl(client);
}
static int _X_COLD
SProcXTestDispatch(ClientPtr client)
{
@ -563,7 +555,7 @@ SProcXTestDispatch(ClientPtr client)
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return SProcXTestGrabControl(client);
return ProcXTestGrabControl(client);
default:
return BadRequest;
}

View file

@ -21,14 +21,18 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/dix_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -37,10 +41,6 @@ SOFTWARE.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef MITSHM
#include <X11/extensions/shmproto.h>
#include "shmint.h"
@ -48,12 +48,12 @@ SOFTWARE.
#include "xvdisp.h"
#ifdef PANORAMIX
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
unsigned long XvXRTPort;
#endif
#endif /* XINERAMA */
static int
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
@ -1115,21 +1115,11 @@ ProcXvDispatch(ClientPtr client)
/* Swapped Procs */
static int _X_COLD
SProcXvQueryExtension(ClientPtr client)
{
REQUEST(xvQueryExtensionReq);
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
swaps(&stuff->length);
return XvProcVector[xv_QueryExtension] (client);
}
static int _X_COLD
SProcXvQueryAdaptors(ClientPtr client)
{
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
swaps(&stuff->length);
swapl(&stuff->window);
return XvProcVector[xv_QueryAdaptors] (client);
}
@ -1139,7 +1129,6 @@ SProcXvQueryEncodings(ClientPtr client)
{
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryEncodings] (client);
}
@ -1149,7 +1138,6 @@ SProcXvGrabPort(ClientPtr client)
{
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_GrabPort] (client);
@ -1160,7 +1148,6 @@ SProcXvUngrabPort(ClientPtr client)
{
REQUEST(xvUngrabPortReq);
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_UngrabPort] (client);
@ -1171,7 +1158,6 @@ SProcXvPutVideo(ClientPtr client)
{
REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1191,7 +1177,6 @@ SProcXvPutStill(ClientPtr client)
{
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1211,7 +1196,6 @@ SProcXvGetVideo(ClientPtr client)
{
REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1231,7 +1215,6 @@ SProcXvGetStill(ClientPtr client)
{
REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1251,7 +1234,6 @@ SProcXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1275,7 +1257,6 @@ SProcXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1303,7 +1284,6 @@ SProcXvSelectVideoNotify(ClientPtr client)
{
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return XvProcVector[xv_SelectVideoNotify] (client);
}
@ -1313,7 +1293,6 @@ SProcXvSelectPortNotify(ClientPtr client)
{
REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_SelectPortNotify] (client);
}
@ -1323,7 +1302,6 @@ SProcXvStopVideo(ClientPtr client)
{
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
return XvProcVector[xv_StopVideo] (client);
@ -1334,7 +1312,6 @@ SProcXvSetPortAttribute(ClientPtr client)
{
REQUEST(xvSetPortAttributeReq);
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
swapl(&stuff->value);
@ -1346,7 +1323,6 @@ SProcXvGetPortAttribute(ClientPtr client)
{
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
return XvProcVector[xv_GetPortAttribute] (client);
@ -1357,7 +1333,6 @@ SProcXvQueryBestSize(ClientPtr client)
{
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swaps(&stuff->vid_w);
swaps(&stuff->vid_h);
@ -1371,7 +1346,6 @@ SProcXvQueryPortAttributes(ClientPtr client)
{
REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryPortAttributes] (client);
}
@ -1381,7 +1355,6 @@ SProcXvQueryImageAttributes(ClientPtr client)
{
REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->id);
swaps(&stuff->width);
@ -1394,13 +1367,12 @@ SProcXvListImageFormats(ClientPtr client)
{
REQUEST(xvListImageFormatsReq);
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_ListImageFormats] (client);
}
static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
SProcXvQueryExtension,
ProcXvQueryExtension,
SProcXvQueryAdaptors,
SProcXvQueryEncodings,
SProcXvGrabPort,
@ -1433,7 +1405,7 @@ SProcXvDispatch(ClientPtr client)
return SXvProcVector[stuff->data] (client);
}
#ifdef PANORAMIX
#ifdef XINERAMA
static int
XineramaXvStopVideo(ClientPtr client)
{
@ -1541,7 +1513,7 @@ XineramaXvShmPutImage(ClientPtr client)
}
#else
#define XineramaXvShmPutImage ProcXvShmPutImage
#endif
#endif /* MITSHM */
static int
XineramaXvPutImage(ClientPtr client)
@ -1796,17 +1768,17 @@ XineramifyXv(void)
XvProcVector[xv_PutImage] = XineramaXvPutImage;
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
}
#endif /* PANORAMIX */
#endif /* XINERAMA */
void
XvResetProcVector(void)
{
#ifdef PANORAMIX
#ifdef XINERAMA
XvProcVector[xv_PutVideo] = ProcXvPutVideo;
XvProcVector[xv_PutStill] = ProcXvPutStill;
XvProcVector[xv_StopVideo] = ProcXvStopVideo;
XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
XvProcVector[xv_PutImage] = ProcXvPutImage;
XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
#endif
#endif /* XINERAMA */
}

View file

@ -55,21 +55,6 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
extern _X_EXPORT unsigned long XvExtensionGeneration;
extern _X_EXPORT unsigned long XvScreenGeneration;
extern _X_EXPORT unsigned long XvResourceGeneration;
extern _X_EXPORT int XvReqCode;
extern _X_EXPORT int XvEventBase;
extern _X_EXPORT int XvErrorBase;
extern _X_EXPORT RESTYPE XvRTPort;
extern _X_EXPORT RESTYPE XvRTEncoding;
extern _X_EXPORT RESTYPE XvRTGrab;
extern _X_EXPORT RESTYPE XvRTVideoNotify;
extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
extern _X_EXPORT RESTYPE XvRTPortNotify;
typedef struct {
int numerator;
int denominator;
@ -85,18 +70,7 @@ typedef struct {
ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
typedef struct _XvPortNotifyRec *XvPortNotifyPtr;
typedef struct {
int id;
@ -195,14 +169,6 @@ typedef struct _XvPortRec {
DevUnion devPriv;
} XvPortRec, *XvPortPtr;
#define VALIDATE_XV_PORT(portID, pPort, mode)\
{\
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
XvRTPort, client, mode);\
if (rc != Success)\
return rc;\
}
typedef struct {
int version, revision;
int nAdaptors;
@ -212,51 +178,8 @@ typedef struct {
CloseScreenProcPtr CloseScreen;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
extern void _X_EXPORT XvFillColorKey(DrawablePtr pDraw, CARD32 key,
RegionPtr region);
extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char *, Bool,
CARD16, CARD16);
extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
#endif /* XVDIX_H */

84
Xext/xvdix_priv.h Normal file
View file

@ -0,0 +1,84 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XORG_XVDIX_PRIV_H
#include <X11/Xdefs.h>
#include "include/pixmap.h"
#include "include/regionstr.h"
#include "Xext/xvdix.h"
#define VALIDATE_XV_PORT(portID, pPort, mode)\
{\
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
XvRTPort, client, mode);\
if (rc != Success)\
return rc;\
}
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
extern int XvReqCode;
extern int XvErrorBase;
extern RESTYPE XvRTPort;
/* dispatch functions */
int ProcXvDispatch(ClientPtr);
int SProcXvDispatch(ClientPtr);
void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
void XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region);
int XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff);
int XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff);
int XvdiPutVideo(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 wid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiPutStill(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiPutImage(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w,
CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h, XvImagePtr image, unsigned char *data,
Bool sync, CARD16 width, CARD16 height);
int XvdiGetVideo(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiGetStill(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiSetPortAttribute(ClientPtr client, XvPortPtr pPort, Atom attribute,
INT32 value);
int XvdiGetPortAttribute(ClientPtr client, XvPortPtr pPort, Atom attribute,
INT32 *p_value);
int XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw);
int XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw);
int XvdiGrabPort(ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result);
int XvdiUngrabPort(ClientPtr client, XvPortPtr pPort, Time ctime);
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
#endif /* _XORG_XVDIX_PRIV_H */

View file

@ -73,14 +73,16 @@ SOFTWARE.
**
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "os.h"
#include "scrnintstr.h"
@ -88,41 +90,50 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "input.h"
#define GLOBAL
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef PANORAMIX
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#endif /* XINERAMA */
#include "xvdisp.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
static DevPrivateKeyRec XvScreenKeyRec;
Bool noXvExtension = FALSE;
#define XvScreenKey (&XvScreenKeyRec)
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
unsigned long XvResourceGeneration = 0;
static unsigned long XvExtensionGeneration = 0;
static unsigned long XvScreenGeneration = 0;
static unsigned long XvResourceGeneration = 0;
int XvReqCode;
int XvEventBase;
static int XvEventBase;
int XvErrorBase;
RESTYPE XvRTPort;
RESTYPE XvRTEncoding;
RESTYPE XvRTGrab;
RESTYPE XvRTVideoNotify;
RESTYPE XvRTVideoNotifyList;
RESTYPE XvRTPortNotify;
static RESTYPE XvRTEncoding;
static RESTYPE XvRTGrab;
static RESTYPE XvRTVideoNotify;
static RESTYPE XvRTVideoNotifyList;
static RESTYPE XvRTPortNotify;
/* EXTERNAL */
@ -163,9 +174,9 @@ XvExtensionInit(void)
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
return;
}
#ifdef PANORAMIX
#ifdef XINERAMA
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif
#endif /* XINERAMA */
XvScreenGeneration = serverGeneration;
}
@ -256,9 +267,9 @@ XvScreenInit(ScreenPtr pScreen)
ErrorF("XvScreenInit: Unable to allocate resource types\n");
return BadAlloc;
}
#ifdef PANORAMIX
#ifdef XINERAMA
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif
#endif /* XINERAMA */
XvScreenGeneration = serverGeneration;
}
@ -360,13 +371,14 @@ static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status;
Bool status = TRUE;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
status = (*pScreen->DestroyPixmap) (pPix);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
@ -469,7 +481,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
}
int
static int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
XvPortNotifyPtr pn;

View file

@ -1,22 +1,21 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "servermd.h"
#include <X11/Xfuncproto.h>
#include "xvdix.h"
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
@ -44,8 +43,6 @@ static RESTYPE XvMCRTContext;
static RESTYPE XvMCRTSurface;
static RESTYPE XvMCRTSubpicture;
int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
@ -290,7 +287,7 @@ ProcXvMCDestroyContext(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->context_id, RT_NONE);
FreeResource(stuff->context_id, X11_RESTYPE_NONE);
return Success;
}
@ -368,7 +365,7 @@ ProcXvMCDestroySurface(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->surface_id, RT_NONE);
FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
return Success;
}
@ -496,7 +493,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->subpicture_id, RT_NONE);
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
return Success;
}

View file

@ -84,13 +84,9 @@ typedef struct {
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
int num, XvMCAdaptorPtr adapt);
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
const char *busID, int major, int minor,
int patchLevel);

View file

@ -26,21 +26,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef XI_STUBS_H
#define XI_STUBS_H 1
extern _X_EXPORT int
SetDeviceMode(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
int /* mode */ );
int SetDeviceMode(ClientPtr client,
DeviceIntPtr dev,
int mode);
extern _X_EXPORT int
SetDeviceValuators(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
int * /* valuators */ ,
int /* first_valuator */ ,
int /* num_valuators */ );
int SetDeviceValuators(ClientPtr client,
DeviceIntPtr dev,
int *valuators,
int first_valuator,
int num_valuators);
extern _X_EXPORT int
ChangeDeviceControl(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
xDeviceCtl * /* control */ );
int ChangeDeviceControl(ClientPtr client,
DeviceIntPtr dev,
xDeviceCtl *control);
#endif /* XI_STUBS_H */

View file

@ -50,16 +50,16 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "exglobals.h"
#include "allowev.h"
#include "dixevents.h"
@ -73,7 +73,6 @@ int _X_COLD
SProcXAllowDeviceEvents(ClientPtr client)
{
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));
@ -102,22 +101,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
switch (stuff->mode) {
case ReplayThisDevice:
AllowSome(client, time, thisdev, NOT_GRABBED);
AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, THAWED);
AllowSome(client, time, thisdev, GRAB_STATE_THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, THAW_OTHERS);
AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, THAWED_BOTH);
AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;

View file

@ -50,18 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "exglobals.h"
#include "exevents.h"
#include "chgdctl.h"
/***********************************************************************
@ -77,7 +76,6 @@ SProcXChangeDeviceControl(ClientPtr client)
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control);
ctl = (xDeviceCtl *) &stuff[1];
@ -117,7 +115,7 @@ ProcXChangeDeviceControl(ClientPtr client)
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceControlReq));
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceControlReq));
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
goto out;

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -75,7 +73,6 @@ int _X_COLD
SProcXChangeFeedbackControl(ClientPtr client)
{
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));
@ -438,7 +435,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
len = client->req_len - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
return rc;

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -71,23 +69,6 @@ SOFTWARE.
* This procedure changes the keyboard device.
*
*/
int _X_COLD
SProcXChangeKeyboardDevice(ClientPtr client)
{
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return (ProcXChangeKeyboardDevice(client));
}
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int
ProcXChangeKeyboardDevice(ClientPtr client)
{

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGKBD_H
#define CHGKBD_H 1
int SProcXChangeKeyboardDevice(ClientPtr /* client */
);
int ProcXChangeKeyboardDevice(ClientPtr /* client */
);

View file

@ -50,14 +50,14 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "chgkmap.h"
@ -75,7 +75,6 @@ SProcXChangeDeviceKeyMapping(ClientPtr client)
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
@ -106,7 +105,7 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
return ret;
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceKeyMappingReq));
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceKeyMappingReq));
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes,

View file

@ -50,18 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include "exevents.h"
#include "exglobals.h"
#include "chgprop.h"
#include "grabdev.h"
@ -75,7 +75,6 @@ int _X_COLD
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -102,7 +101,7 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
stuff->count)
return BadLength;

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -67,22 +65,6 @@ SOFTWARE.
#include "chgptr.h"
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int _X_COLD
SProcXChangePointerDevice(ClientPtr client)
{
REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return (ProcXChangePointerDevice(client));
}
/***********************************************************************
*
* This procedure changes the device used as the X pointer.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPTR_H
#define CHGPTR_H 1
int SProcXChangePointerDevice(ClientPtr /* client */
);
int ProcXChangePointerDevice(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -64,21 +62,6 @@ SOFTWARE.
#include "closedev.h"
/***********************************************************************
*
* This procedure closes an input device.
*
*/
int _X_COLD
SProcXCloseDevice(ClientPtr client)
{
REQUEST(xCloseDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
return (ProcXCloseDevice(client));
}
/***********************************************************************
*
* Clear out event selections and passive grabs from a window for the
@ -102,7 +85,7 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource(grab->resource, RT_NONE);
FreeResource(grab->resource, X11_RESTYPE_NONE);
}
}

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CLOSEDEV_H
#define CLOSEDEV_H 1
int SProcXCloseDevice(ClientPtr /* client */
);
int ProcXCloseDevice(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -61,21 +59,6 @@ SOFTWARE.
#include "devbell.h"
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int _X_COLD
SProcXDeviceBell(ClientPtr client)
{
REQUEST(xDeviceBellReq);
swaps(&stuff->length);
return (ProcXDeviceBell(client));
}
/***********************************************************************
*
* This procedure rings a bell on an extension device.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef DEVBELL_H
#define DEVBELL_H 1
int SProcXDeviceBell(ClientPtr /* client */
);
int ProcXDeviceBell(ClientPtr /* client */
);

View file

@ -78,38 +78,37 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h"
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/geproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include <X11/extensions/XKBproto.h>
#include "dix/dix_priv.h"
#include "dix/dixgrabs_priv.h"
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "mi/mi_priv.h"
#include "inputstr.h"
#include "windowstr.h"
#include "miscstruct.h"
#include "region.h"
#include "exevents.h"
#include "extnsionst.h"
#include "exglobals.h"
#include "eventstr.h"
#include "dixevents.h" /* DeliverFocusedEvent */
#include "dixgrabs.h" /* CreateGrab() */
#include "scrnintstr.h"
#include "listdev.h" /* for CopySwapXXXClass */
#include "xace.h"
#include "xiquerydevice.h" /* For List*Info */
#include "eventstr.h"
#include "inpututils.h"
#include "mi.h"
#include <X11/extensions/XKBproto.h>
#include "xkbsrv.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
@ -615,7 +614,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
if (from->button->xkb_acts) {
size_t maxbuttons = max(to->button->numButtons, from->button->numButtons);
to->button->xkb_acts = xnfreallocarray(to->button->xkb_acts,
to->button->xkb_acts = XNFreallocarray(to->button->xkb_acts,
maxbuttons,
sizeof(XkbAction));
memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction));
@ -1094,7 +1093,7 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
FixUpEventFromWindow(&ti->sprite, xi2, win, child, FALSE);
filter = GetEventFilter(dev, xi2);
if (XaceHook(XACE_RECEIVE_ACCESS, client, win, xi2, 1) != Success)
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
@ -1387,6 +1386,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
else
evtype = GetXI2Type(ev->any.type);
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
@ -1401,6 +1401,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
int xi_type = GetXIType(TouchGetPointerEventType(ev));
Mask xi_filter = event_get_filter_from_type(dev, xi_type);
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
@ -1538,7 +1539,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
l = &ti->listeners[ti->num_listeners - 1];
l->listener = g->resource;
l->grab = g;
//l->resource_type = RT_NONE;
//l->resource_type = X11_RESTYPE_NONE;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
l->type = TOUCH_LISTENER_POINTER_GRAB;
@ -1880,7 +1881,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
int count;
if (EventToCore(ev, &core, &count) == Success && count > 0) {
XaceHook(XACE_KEY_AVAIL, core, device, 0);
XaceHookKeyAvail(core, device, 0);
free(core);
}
}
@ -2240,7 +2241,7 @@ DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
FixUpEventFromWindow(&gi->sprite, xi2, win, child, FALSE);
filter = GetEventFilter(dev, xi2);
if (XaceHook(XACE_RECEIVE_ACCESS, client, win, xi2, 1) != Success)
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
@ -2290,6 +2291,7 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
listener->type == GESTURE_LISTENER_REGULAR */
evtype = GetXI2Type(ev->any.type);
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
@ -2504,7 +2506,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2514,7 +2516,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
rc = XaceHookDeviceAccess(client, dev, access_mode);
if (rc != Success)
return rc;
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
@ -2570,7 +2572,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
rc = XaceHookDeviceAccess(client, dev, access_mode);
if (rc != Success)
return rc;
@ -2603,7 +2605,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2613,7 +2615,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
rc = XaceHookDeviceAccess(client, dev, access_mode);
if (rc != Success)
return rc;
@ -2644,7 +2646,7 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGrabAccess);
rc = XaceHookDeviceAccess(client, dev, DixGrabAccess);
if (rc != Success)
return rc;
@ -2691,7 +2693,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
if (i == EMASKSIZE) {
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(others->resource, RT_NONE);
FreeResource(others->resource, X11_RESTYPE_NONE);
return Success;
}
}
@ -2957,7 +2959,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
break;
}
}
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count))
else if (!XaceHookSendAccess(client, NULL, pWin, ev, count))
DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab);
return Success;
}
@ -3118,7 +3120,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
ic = inputMasks->inputClients;
for (i = 0; i < EMASKSIZE; i++)
inputMasks->dontPropagateMask[i] = 0;
FreeResource(ic->resource, RT_NONE);
FreeResource(ic->resource, X11_RESTYPE_NONE);
}
}
@ -3234,14 +3236,19 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
inputMasks->dontPropagateMask[maskndx] = mask;
}
else {
if (!inputMasks)
AddExtensionClient(pWin, client, 0, 0);
if (!inputMasks) {
int ret = AddExtensionClient(pWin, client, 0, 0);
if (ret != Success)
return ret;
inputMasks = wOtherInputMasks(pWin);
BUG_RETURN_VAL(!inputMasks, BadAlloc);
}
inputMasks->dontPropagateMask[maskndx] = mask;
}
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, RT_NONE);
if (inputMasks && ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
return Success;
}
@ -3335,6 +3342,7 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
if (len && !others) {
if (AddExtensionClient(win, client, 0, 0) != Success)
return BadAlloc;
BUG_RETURN_VAL(!wOtherInputMasks(win), BadAlloc);
others = wOtherInputMasks(win)->inputClients;
}

View file

@ -51,22 +51,22 @@ SOFTWARE.
*/
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include "geext.h" /* extension interfaces for ge */
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include "geext.h" /* extension interfaces for ge */
#include "dixevents.h"
#include "exevents.h"
#include "extinit.h"
#include "extinit_priv.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -254,17 +254,17 @@ static int (*ProcIVector[]) (ClientPtr) = {
static int (*SProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
SProcXGetExtensionVersion, /* 1 */
SProcXListInputDevices, /* 2 */
SProcXOpenDevice, /* 3 */
SProcXCloseDevice, /* 4 */
SProcXSetDeviceMode, /* 5 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
SProcXSelectExtensionEvent, /* 6 */
SProcXGetSelectedExtensionEvents, /* 7 */
SProcXChangeDeviceDontPropagateList, /* 8 */
SProcXGetDeviceDontPropagateList, /* 9 */
SProcXGetDeviceMotionEvents, /* 10 */
SProcXChangeKeyboardDevice, /* 11 */
SProcXChangePointerDevice, /* 12 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
SProcXGrabDevice, /* 13 */
SProcXUngrabDevice, /* 14 */
SProcXGrabDeviceKey, /* 15 */
@ -272,30 +272,30 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXGrabDeviceButton, /* 17 */
SProcXUngrabDeviceButton, /* 18 */
SProcXAllowDeviceEvents, /* 19 */
SProcXGetDeviceFocus, /* 20 */
ProcXGetDeviceFocus, /* 20 */
SProcXSetDeviceFocus, /* 21 */
SProcXGetFeedbackControl, /* 22 */
ProcXGetFeedbackControl, /* 22 */
SProcXChangeFeedbackControl, /* 23 */
SProcXGetDeviceKeyMapping, /* 24 */
ProcXGetDeviceKeyMapping, /* 24 */
SProcXChangeDeviceKeyMapping, /* 25 */
SProcXGetDeviceModifierMapping, /* 26 */
SProcXSetDeviceModifierMapping, /* 27 */
SProcXGetDeviceButtonMapping, /* 28 */
SProcXSetDeviceButtonMapping, /* 29 */
SProcXQueryDeviceState, /* 30 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
SProcXSendExtensionEvent, /* 31 */
SProcXDeviceBell, /* 32 */
SProcXSetDeviceValuators, /* 33 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
SProcXGetDeviceControl, /* 34 */
SProcXChangeDeviceControl, /* 35 */
SProcXListDeviceProperties, /* 36 */
ProcXListDeviceProperties, /* 36 */
SProcXChangeDeviceProperty, /* 37 */
SProcXDeleteDeviceProperty, /* 38 */
SProcXGetDeviceProperty, /* 39 */
SProcXIQueryPointer, /* 40 */
SProcXIWarpPointer, /* 41 */
SProcXIChangeCursor, /* 42 */
SProcXIChangeHierarchy, /* 43 */
ProcXIChangeHierarchy, /* 43 */
SProcXISetClientPointer, /* 44 */
SProcXIGetClientPointer, /* 45 */
SProcXISelectEvents, /* 46 */

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -61,20 +59,6 @@ SOFTWARE.
#include "getbmap.h"
/***********************************************************************
*
* This procedure gets the button mapping for the specified device.
*
*/
int _X_COLD
SProcXGetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceButtonMapping(client));
}
/***********************************************************************
*
* This procedure gets the button mapping for the specified device.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETBMAP_H
#define GETBMAP_H 1
int SProcXGetDeviceButtonMapping(ClientPtr /* client */
);
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -72,7 +70,6 @@ int _X_COLD
SProcXGetDeviceControl(ClientPtr client)
{
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return (ProcXGetDeviceControl(client));

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -61,21 +59,6 @@ SOFTWARE.
#include "getfctl.h"
/***********************************************************************
*
* This procedure gets the control attributes for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXGetFeedbackControl(ClientPtr client)
{
REQUEST(xGetFeedbackControlReq);
swaps(&stuff->length);
return (ProcXGetFeedbackControl(client));
}
/***********************************************************************
*
* This procedure copies KbdFeedbackClass data, swapping if necessary.
@ -97,6 +80,7 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
k2->pitch = k->ctrl.bell_pitch;
k2->duration = k->ctrl.bell_duration;
k2->led_mask = k->ctrl.leds;
k2->led_values = k->ctrl.leds;
k2->global_auto_repeat = k->ctrl.autoRepeat;
for (i = 0; i < 32; i++)
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFCTL_H
#define GETFCTL_H 1
int SProcXGetFeedbackControl(ClientPtr /* client */
);
int ProcXGetFeedbackControl(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
@ -62,20 +60,6 @@ SOFTWARE.
#include "getfocus.h"
/***********************************************************************
*
* This procedure gets the focus for a device.
*
*/
int _X_COLD
SProcXGetDeviceFocus(ClientPtr client)
{
REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length);
return (ProcXGetDeviceFocus(client));
}
/***********************************************************************
*
* This procedure gets the focus for a device.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFOCUS_H
#define GETFOCUS_H 1
int SProcXGetDeviceFocus(ClientPtr /* client */
);
int ProcXGetDeviceFocus(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -64,21 +62,6 @@ SOFTWARE.
#include "getkmap.h"
/***********************************************************************
*
* This procedure gets the key mapping for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXGetDeviceKeyMapping(ClientPtr client)
{
REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceKeyMapping(client));
}
/***********************************************************************
*
* Get the device key mapping.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETKMAP_H
#define GETKMAP_H 1
int SProcXGetDeviceKeyMapping(ClientPtr /* client */
);
int ProcXGetDeviceKeyMapping(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -61,21 +59,6 @@ SOFTWARE.
#include "getmmap.h"
/***********************************************************************
*
* This procedure gets the modifier mapping for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXGetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceModifierMapping(client));
}
/***********************************************************************
*
* Get the device Modifier mapping.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETMMAP_H
#define GETMMAP_H 1
int SProcXGetDeviceModifierMapping(ClientPtr /* client */
);
int ProcXGetDeviceModifierMapping(ClientPtr /* client */
);

View file

@ -50,17 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "swaprep.h"
#include "getprop.h"
extern XExtEventInfo EventInfo[];
@ -76,7 +76,6 @@ int _X_COLD
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
return (ProcXGetDeviceDontPropagateList(client));
@ -119,6 +118,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
if (count) {
rep.count = count;
buf = xallocarray(rep.count, sizeof(XEventClass));
if (buf == NULL)
return BadAlloc;
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
tbuf = buf;

View file

@ -50,17 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
#include "exglobals.h"
#include "swaprep.h"
#include "getprop.h"
#include "getselev.h"
@ -74,7 +74,6 @@ int _X_COLD
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(client));

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -74,7 +72,6 @@ int _X_COLD
SProcXGetExtensionVersion(ClientPtr client)
{
REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes);
return (ProcXGetExtensionVersion(client));
@ -94,7 +91,7 @@ ProcXGetExtensionVersion(ClientPtr client)
REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (stuff->length != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
if (client->req_len != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
stuff->nbytes))
return BadLength;

View file

@ -50,17 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
#include "grabdev.h"
extern XExtEventInfo EventInfo[];
@ -76,13 +76,13 @@ int _X_COLD
SProcXGrabDevice(ClientPtr client)
{
REQUEST(xGrabDeviceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
swapl(&stuff->grabWindow);
swapl(&stuff->time);
swaps(&stuff->event_count);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
@ -109,7 +109,7 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;

View file

@ -50,18 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "xace.h"
#include "grabdev.h"
#include "grabdevb.h"
@ -75,7 +74,6 @@ int _X_COLD
SProcXGrabDeviceButton(ClientPtr client)
{
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
@ -107,7 +105,7 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST(xGrabDeviceButtonReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
return BadLength;
@ -125,7 +123,7 @@ ProcXGrabDeviceButton(ClientPtr client)
}
else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}

View file

@ -50,18 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "xace.h"
#include "grabdev.h"
#include "grabdevk.h"
@ -75,7 +74,6 @@ int _X_COLD
SProcXGrabDeviceKey(ClientPtr client)
{
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
@ -105,7 +103,7 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
return BadLength;
@ -123,7 +121,7 @@ ProcXGrabDeviceKey(ClientPtr client)
}
else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}

View file

@ -50,16 +50,15 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "gtmotion.h"
/***********************************************************************
@ -72,7 +71,6 @@ int _X_COLD
SProcXGetDeviceMotionEvents(ClientPtr client)
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);

View file

@ -50,38 +50,24 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "extnsionst.h"
#include "exevents.h"
#include "xace.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "listdev.h"
/***********************************************************************
*
* This procedure lists the input devices available to the server.
*
*/
int _X_COLD
SProcXListInputDevices(ClientPtr client)
{
REQUEST(xListInputDevicesReq);
swaps(&stuff->length);
return (ProcXListInputDevices(client));
}
/***********************************************************************
*
* This procedure calculates the size of the information to be returned
@ -309,7 +295,7 @@ ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
{
/* don't send master devices other than VCP/VCK */
if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
int rc = XaceHookDeviceAccess(client, d, DixGetAttrAccess);
if (rc == Success)
return FALSE;
@ -350,7 +336,7 @@ ProcXListInputDevices(ClientPtr client)
};
/* allocate space for saving skip value */
skip = calloc(sizeof(Bool), inputInfo.numDevices);
skip = calloc(inputInfo.numDevices, sizeof(Bool));
if (!skip)
return BadAlloc;
@ -377,6 +363,10 @@ ProcXListInputDevices(ClientPtr client)
/* allocate space for reply */
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *) calloc(1, total_length);
if (!devbuf) {
free(skip);
return BadAlloc;
}
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;

View file

@ -32,9 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define VPC 20 /* Max # valuators per chunk */
int SProcXListInputDevices(ClientPtr /* client */
);
int ProcXListInputDevices(ClientPtr /* client */
);

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -66,21 +64,6 @@ SOFTWARE.
extern CARD8 event_base[];
/***********************************************************************
*
* This procedure swaps the request if the server and client have different
* byte orderings.
*
*/
int _X_COLD
SProcXOpenDevice(ClientPtr client)
{
REQUEST(xOpenDeviceReq);
swaps(&stuff->length);
return (ProcXOpenDevice(client));
}
/***********************************************************************
*
* This procedure causes the server to open an input device.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef OPENDEV_H
#define OPENDEV_H 1
int SProcXOpenDevice(ClientPtr /* client */
);
int ProcXOpenDevice(ClientPtr /* client */
);

View file

@ -32,35 +32,21 @@ from The Open Group.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "queryst.h"
/***********************************************************************
*
* This procedure allows a client to query the state of a device.
*
*/
int _X_COLD
SProcXQueryDeviceState(ClientPtr client)
{
REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length);
return (ProcXQueryDeviceState(client));
}
/***********************************************************************
*
* This procedure allows frozen events to be routed.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef QUERYST_H
#define QUERYST_H 1
int SProcXQueryDeviceState(ClientPtr /* client */
);
int ProcXQueryDeviceState(ClientPtr /* client */
);

View file

@ -50,18 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "exglobals.h"
#include "grabdev.h"
#include "selectev.h"
@ -121,7 +121,6 @@ int _X_COLD
SProcXSelectExtensionEvent(ClientPtr client)
{
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -148,7 +147,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
return BadLength;

View file

@ -50,18 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* Window */
#include "extnsionst.h" /* EventSwapPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "grabdev.h"
#include "sendexev.h"
@ -83,12 +82,11 @@ SProcXSendExtensionEvent(ClientPtr client)
EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
swapl(&stuff->destination);
swaps(&stuff->count);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
return BadLength;
@ -134,7 +132,7 @@ ProcXSendExtensionEvent(ClientPtr client)
REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
return BadLength;

View file

@ -50,32 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exevents.h"
#include "exglobals.h"
#include "setbmap.h"
/***********************************************************************
*
* This procedure changes the button mapping.
*
*/
int _X_COLD
SProcXSetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xSetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXSetDeviceButtonMapping(client));
}
/***********************************************************************
*
* This procedure lists the input devices available to the server.
@ -92,7 +78,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
REQUEST(xSetDeviceButtonMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (stuff->length !=
if (client->req_len !=
bytes_to_int32(sizeof(xSetDeviceButtonMappingReq) + stuff->map_length))
return BadLength;

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETBMAP_H
#define SETBMAP_H 1
int SProcXSetDeviceButtonMapping(ClientPtr /* client */
);
int ProcXSetDeviceButtonMapping(ClientPtr /* client */
);

View file

@ -50,32 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "exglobals.h"
#include "setdval.h"
/***********************************************************************
*
* Handle a request from a client with a different byte order.
*
*/
int _X_COLD
SProcXSetDeviceValuators(ClientPtr client)
{
REQUEST(xSetDeviceValuatorsReq);
swaps(&stuff->length);
return (ProcXSetDeviceValuators(client));
}
/***********************************************************************
*
* This procedure sets the value of valuators on an extension input device.
@ -100,7 +86,7 @@ ProcXSetDeviceValuators(ClientPtr client)
.status = Success
};
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
stuff->num_valuators)
return BadLength;

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETDVAL_H
#define SETDVAL_H 1
int SProcXSetDeviceValuators(ClientPtr /* client */
);
int ProcXSetDeviceValuators(ClientPtr /* client */
);

View file

@ -50,19 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include "dix/dix_priv.h"
#include "dixevents.h"
#include "exglobals.h"
#include "setfocus.h"
/***********************************************************************
@ -75,7 +74,6 @@ int _X_COLD
SProcXSetDeviceFocus(ClientPtr client)
{
REQUEST(xSetDeviceFocusReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
swapl(&stuff->focus);
swapl(&stuff->time);

View file

@ -50,34 +50,19 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exevents.h"
#include "exglobals.h"
#include "setmmap.h"
/***********************************************************************
*
* This procedure sets the modifier mapping for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXSetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xSetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXSetDeviceModifierMapping(client));
}
/***********************************************************************
*
* Set the device Modifier mapping.
@ -94,7 +79,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
REQUEST(xSetDeviceModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
(stuff->numKeyPerModifier << 1))
return BadLength;

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETMMAP_H
#define SETMMAP_H 1
int SProcXSetDeviceModifierMapping(ClientPtr /* client */
);
int ProcXSetDeviceModifierMapping(ClientPtr /* client */
);

View file

@ -50,32 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "exglobals.h"
#include "setmode.h"
/***********************************************************************
*
* Handle a request from a client with a different byte order.
*
*/
int _X_COLD
SProcXSetDeviceMode(ClientPtr client)
{
REQUEST(xSetDeviceModeReq);
swaps(&stuff->length);
return (ProcXSetDeviceMode(client));
}
/***********************************************************************
*
* This procedure sets the mode of a device.

View file

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETMODE_H
#define SETMODE_H 1
int SProcXSetDeviceMode(ClientPtr /* client */
);
int ProcXSetDeviceMode(ClientPtr /* client */
);

View file

@ -54,9 +54,7 @@ SOFTWARE.
* Xnest could do the same thing.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>

View file

@ -50,9 +50,7 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -71,7 +69,6 @@ int _X_COLD
SProcXUngrabDevice(ClientPtr client)
{
REQUEST(xUngrabDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
swapl(&stuff->time);
return (ProcXUngrabDevice(client));

View file

@ -50,17 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/dixgrabs_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixgrabs.h"
#include "ungrdevb.h"
#define AllModifiersMask ( \
@ -77,7 +77,6 @@ int _X_COLD
SProcXUngrabDeviceButton(ClientPtr client)
{
REQUEST(xUngrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View file

@ -50,19 +50,19 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/dixgrabs_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixgrabs.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "ungrdevk.h"
#define AllModifiersMask ( \
@ -79,7 +79,6 @@ int _X_COLD
SProcXUngrabDeviceKey(ClientPtr client)
{
REQUEST(xUngrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View file

@ -29,19 +29,21 @@
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "os/fmt.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "mi.h"
#include "eventstr.h"
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
#include "exglobals.h" /* BadDevice */
#include "exevents.h"
#include "xiallowev.h"
int _X_COLD
@ -50,10 +52,9 @@ SProcXIAllowEvents(ClientPtr client)
REQUEST(xXIAllowEventsReq);
REQUEST_AT_LEAST_SIZE(xXIAllowEventsReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);
if (stuff->length > 3) {
if (client->req_len > 3) {
xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff;
REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
@ -94,25 +95,25 @@ ProcXIAllowEvents(ClientPtr client)
switch (stuff->mode) {
case XIReplayDevice:
AllowSome(client, time, dev, NOT_GRABBED);
AllowSome(client, time, dev, GRAB_STATE_NOT_GRABBED);
break;
case XISyncDevice:
AllowSome(client, time, dev, FREEZE_NEXT_EVENT);
AllowSome(client, time, dev, GRAB_STATE_FREEZE_NEXT_EVENT);
break;
case XIAsyncDevice:
AllowSome(client, time, dev, THAWED);
AllowSome(client, time, dev, GRAB_STATE_THAWED);
break;
case XIAsyncPairedDevice:
if (IsMaster(dev))
AllowSome(client, time, dev, THAW_OTHERS);
AllowSome(client, time, dev, GRAB_STATE_THAW_OTHERS);
break;
case XISyncPair:
if (IsMaster(dev))
AllowSome(client, time, dev, FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, dev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
break;
case XIAsyncPair:
if (IsMaster(dev))
AllowSome(client, time, dev, THAWED_BOTH);
AllowSome(client, time, dev, GRAB_STATE_THAWED_BOTH);
break;
case XIRejectTouch:
case XIAcceptTouch:

View file

@ -41,9 +41,11 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "mi/mi_priv.h"
#include "xibarriers.h"
#include "scrnintstr.h"
@ -57,7 +59,6 @@
#include "list.h"
#include "exglobals.h"
#include "eventstr.h"
#include "mi.h"
RESTYPE PointerBarrierType;
@ -129,14 +130,15 @@ static void FreePointerBarrierClient(struct PointerBarrierClient *c)
static struct PointerBarrierDevice *GetBarrierDevice(struct PointerBarrierClient *c, int deviceid)
{
struct PointerBarrierDevice *pbd = NULL;
struct PointerBarrierDevice *p, *pbd = NULL;
xorg_list_for_each_entry(pbd, &c->per_device, entry) {
if (pbd->deviceid == deviceid)
xorg_list_for_each_entry(p, &c->per_device, entry) {
if (p->deviceid == deviceid) {
pbd = p;
break;
}
}
BUG_WARN(!pbd);
return pbd;
}
@ -337,6 +339,9 @@ barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev,
double distance;
pbd = GetBarrierDevice(c, dev->id);
if (!pbd)
continue;
if (pbd->seen)
continue;
@ -445,6 +450,9 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
nearest = &c->barrier;
pbd = GetBarrierDevice(c, master->id);
if (!pbd)
continue;
new_sequence = !pbd->hit;
pbd->seen = TRUE;
@ -485,6 +493,9 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
int flags = 0;
pbd = GetBarrierDevice(c, master->id);
if (!pbd)
continue;
pbd->seen = FALSE;
if (!pbd->hit)
continue;
@ -679,6 +690,9 @@ BarrierFreeBarrier(void *data, XID id)
continue;
pbd = GetBarrierDevice(c, dev->id);
if (!pbd)
continue;
if (!pbd->hit)
continue;
@ -713,6 +727,8 @@ static void add_master_func(void *res, XID id, void *devid)
pbd = AllocBarrierDevice();
if (!pbd)
return;
pbd->deviceid = *deviceid;
input_lock();
@ -738,6 +754,8 @@ static void remove_master_func(void *res, XID id, void *devid)
barrier = container_of(b, struct PointerBarrierClient, barrier);
pbd = GetBarrierDevice(barrier, *deviceid);
if (!pbd)
return;
if (pbd->hit) {
BarrierEvent ev = {
@ -829,7 +847,7 @@ XIDestroyPointerBarrier(ClientPtr client,
if (CLIENT_ID(stuff->barrier) != client->index)
return BadAccess;
FreeResource(stuff->barrier, RT_NONE);
FreeResource(stuff->barrier, X11_RESTYPE_NONE);
return Success;
}
@ -840,7 +858,6 @@ SProcXIBarrierReleasePointer(ClientPtr client)
REQUEST(xXIBarrierReleasePointerReq);
int i;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
swapl(&stuff->num_barriers);
@ -903,6 +920,10 @@ ProcXIBarrierReleasePointer(ClientPtr client)
barrier = container_of(b, struct PointerBarrierClient, barrier);
pbd = GetBarrierDevice(barrier, dev->id);
if (!pbd) {
client->errorValue = dev->id;
return BadDevice;
}
if (pbd->barrier_event_id == event_id)
pbd->release_event_id = event_id;

View file

@ -29,22 +29,22 @@
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "dix/dix_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2proto.h>
#include "extnsionst.h"
#include "exevents.h"
#include "exglobals.h"
#include "input.h"
#include "xichangecursor.h"
/***********************************************************************
@ -58,7 +58,6 @@ SProcXIChangeCursor(ClientPtr client)
{
REQUEST(xXIChangeCursorReq);
REQUEST_SIZE_MATCH(xXIChangeCursorReq);
swaps(&stuff->length);
swapl(&stuff->win);
swapl(&stuff->cursor);
swaps(&stuff->deviceid);
@ -97,7 +96,7 @@ ProcXIChangeCursor(ClientPtr client)
}
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success)
return rc;
}

Some files were not shown because too many files have changed in this diff Show more