Compare commits

..

137 commits

Author SHA1 Message Date
Adam Jackson
94f036d412 xserver 1.20.4
Signed-off-by: Adam Jackson <ajax@redhat.com>
2019-02-25 13:31:13 -05:00
Michel Dänzer
9850d20c2a gitlab-ci: Run make distcheck in autotools build & test job
We don't set the PIGLIT_DIR and XTS_DIR environment variables for make
distcheck for now, otherwise it complains about files left behind by
piglit.

(cherry picked from commit 432fad04e7)
2019-02-25 13:07:16 -05:00
Michel Dänzer
fcac9b10c9 glx,xquartz: Fix make distcheck
Guard BUILT_SOURCES and CLEANFILES by XWIN_GLX_WINDOWS/XQUARTZ.

(cherry picked from commit f9bbc9d5ea)
2019-02-25 13:06:58 -05:00
Michel Dänzer
01a03a476a present/wnmd: Allow flipping if the window pixmap matches the toplevel's
Instead of testing window->redirectDraw.

With Xwayland, the toplevel window is always redirected, so this would
unnecessarily preclude flipping there in some cases, e.g. with wlroots
based Wayland compositors or with fullscreen X11 windows in weston.

Fixes issue #631.
(Cherry picked from commit a093a88531)
2019-02-22 11:56:44 +01:00
Michel Dänzer
e5984241ab gitlab-ci: Add autotools build & test job
(Cherry picked from commit 2f12c80175)
2019-02-22 11:56:23 +01:00
Michel Dänzer
de6d87b619 gitlab-ci: Use ccache
Meson picks it up automatically.

Based on:

* https://gitlab.freedesktop.org/mesa/mesa/merge_requests/240
* https://gould.cx/ted/blog/2017/06/10/ccache-for-Gitlab-CI/
* https://stackoverflow.com/questions/53659419/ccache-no-hits-in-gitlab-ci

v2 based on the corresponding Mesa change:
* Quote CCACHE_(BASE)DIR environment variables.
* Clear ccache stats in before_script.
* Move cache stanza to the build-and-test job, the cache isn't used in
  the docker-image job.

Reviewed-by: Adam Jackson <ajax@redhat.com> # v1
(Cherry picked from commit b577df7745)
2019-02-22 11:56:01 +01:00
Michel Dänzer
37ad8dd978 gitlab-ci: Add ccache to docker image, and leave in autotools
We're going to make use of these in build & test jobs.
(Cherry picked from commit 537f06e21e)
2019-02-22 11:55:31 +01:00
Michel Dänzer
61eccbcec9 gitlab-ci: Don't rely on $CI_PROJECT_NAME
The name of a forked repository can be changed later, in which case this
would fail to refer to the main repository.

Pointed out by Eric Engestrom in
https://gitlab.freedesktop.org/mesa/mesa/merge_requests/224 .
(Cherry picked from commit fede384962)
2019-02-22 11:54:57 +01:00
Michel Dänzer
e10cfd8fcc gitlab-ci: Only run docker-image stage if relevant source files change
Otherwise there's normally no need to run it. It will also run when a
new branch is created, which ensures that the docker image always exists
(e.g. in a newly forked repository).

Inspired by https://gitlab.freedesktop.org/mesa/mesa/merge_requests/143
(Cherry picked from commit 8694395fcf)
2019-02-22 11:54:41 +01:00
Michel Dänzer
7246730edf gitlab-ci: Set LC_ALL=C.UTF-8
Although piglit could now handle non-ASCII characters in the
environment, meson was still failing without this (even though it's
using Python 3).

Reviewed-by: Eric Anholt <eric@anholt.net>
(Cherry picked from commit bc6998b728)
2019-02-22 11:53:55 +01:00
Michel Dänzer
8db5a711da test: Use .../piglit instead of .../piglit-*.py
The latter use Python 2 and break with any non-ASCII characters in the
environment, the former uses Python 3 and works fine in that case.

Reviewed-by: Eric Anholt <eric@anholt.net>
(Cherry picked from commit 4aaaf69229)
2019-02-22 11:53:37 +01:00
Michel Dänzer
3314af2d15 gitlab-ci: Docker image can be generated as part of pipeline
This removes the dependency on an externally generated docker image, and
should make it easier to update the docker image or make other changes
related to it.

This is based on Debian testing, because I'm most familiar with Debian.
But it should be easy to base it on another distro.

v2:
* Use kaniko instead of docker-in-docker for image generation, so it can
  also work in unprivileged runners.
* Drop piglit.conf & tetexec.cfg overrides, just make sure the files in
  the image work.
(Cherry picked from commit f56d8e2282)
2019-02-22 11:53:12 +01:00
Michel Dänzer
e8b4e94d51 Drop Travis Linux build in favour of GitLab CI
Fold build-travis-deps.sh into .gitlab-ci.yml.

Preparation for the next change, which would break the Travis Linux
build.

Reviewed-by: Eric Anholt <eric@anholt.net>
(Cherry picked from commit ed44f9cd6a)
2019-02-22 11:52:42 +01:00
Michel Daenzer
4925f38dc0 Make artifacts of piglit results if job fails
Can be useful for figuring out what caused the failure.
(Cherry picked from commit a7472da941)
2019-02-22 11:51:57 +01:00
Michel Daenzer
b6ef90d83b travis: Use a single meson invocation
The prefix setting didn't take for some reason.
(Cherry picked from commit c1bb392b1d)
2019-02-22 11:51:35 +01:00
Adam Jackson
7753fd9989 gitlab: Skip the docker-in-docker step
No idea which cult's cargo I was looking at there. Cuts about a minute
off the build time.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(Cherry picked from commit a41ccaa085)
2019-02-22 11:50:05 +01:00
Peter Hutterer
524104e15c Xi: lock the input thread for any pointer barrier list manipulation
The input thread checks the barriers for pointer positioning, swapping the
list out from underneath is considered impolite.

Reported-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 678d64aa2e)
2019-02-20 14:27:16 -05:00
Peter Harris
ae9dda1e26 os: Fix GetTimeInMicros resolution
GetTimeInMillis is called first, which sets clockid to
CLOCK_MONOTONIC_COARSE, which is typically much lower resolution than
the callers of GetTimeInMicros want.

Prior to a779fda224, GetTimeInMillis and
GetTimeInMicros did not share a clockid.

Restore the clockid split to fix the granularity of GetTimeInMicros.

Signed-off-by: Peter Harris <pharris@opentext.com>
(cherry picked from commit 937a5b78a2)
2019-02-20 14:26:51 -05:00
A. Wilcox
013c28a122 DRI2: Add another Coffeelake PCI ID
A user of Adélie Linux reported that modesetting wasn't working properly on
their Intel i7-9700K-integrated UHD 630 GPU.  Xorg.0.log showed:

[   131.902] (EE) modeset(0): [DRI2] No driver mapping found for PCI device 0x8086 / 0x3e98
[   131.902] (EE) modeset(0): Failed to initialize the DRI2 extension.

Indeed, that PCI ID is missing from i965_pci_ids.  Adding it fixed the issue
and allowed the system to work with i965_dri under modesetting.

(cherry picked from commit d3a26bbf61)
2019-02-20 14:26:12 -05:00
Adam Jackson
a51d7a730c vnd: Fix a silly memory leak
'disp' was already allocated by LookupVendorPrivDispatch above,
clobbering it will do no good.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 709c656297)
2019-02-20 14:26:07 -05:00
Adam Jackson
544d0e961c mi: When {en,dis}abling extensions, match names case-insensitively
Both because extension names are inconsistently capitalized on the wire,
and because the table we're walking spells it COMPOSITE not Composite.
The latter is certainly also a bug, but there's no reason for us to be
that strict.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit bf991a5f98)
2019-02-20 14:26:02 -05:00
Adam Jackson
2215e8c7cf dri3: Fix XACE access mode for open and get_supported_modifiers
Neither opening a screen nor querying its modifiers confers the right to
attach the buffer for any particular pixmap. GetAttr seems more correct.

Fixes: xorg/xserver#550
(cherry picked from commit 086c2e3de5)
2019-02-20 14:25:58 -05:00
Michel Dänzer
59e0b5f041 xfree86/modes: Don't clobber gamma LUT of compatibility output's CRTC
If the driver calls xf86HandleColormaps, CMapChangeGamma updates the HW
gamma LUT of all CRTCs via xf86RandR12LoadPalette. However,
xf86RandR12ChangeGamma was then clobbering the gamma LUT of the RandR
1.2 compatibility output's CRTC with the gamma curves computed from the
screen's global gamma values.

Fix this by bailing if xf86RandR12LoadPalette is installed.

Fixes: 02ff0a5d7e "xf86RandR12: Fix XF86VidModeSetGamma triggering a
                     BadImplementation error"
(cherry picked from commit 30044b2253)
2019-02-20 14:25:49 -05:00
Maya Rashish
712d0e86aa xfree86: Try nouveau on NetBSD as well.
(cherry picked from commit e3fb178617)
2019-02-20 14:25:31 -05:00
Maya Rashish
ff1d1692e7 Fix typo in error message
(cherry picked from commit bf2a7bb4ff)
2019-02-20 14:25:28 -05:00
Alan Coopersmith
c091ea5e38 os: Report errors opening authorization file (#469)
Fixes: xorg/xserver#469

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7fb6338c68)
2019-02-20 14:24:42 -05:00
Michel Dänzer
7b0f6102df glamor: Check that storage format is compatible with RENDER format
Fixes x2r10g10b10 related rendercheck failures.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 7e6faa5b3c)
2019-02-20 14:24:28 -05:00
Peter Hutterer
356cf07b8a test: fix failing tests
Broken since 69d8ea4a49 because our fake screen
didn't have a root window and writing the XKB rules prop would happily
segfault. Fix this by setting up the required bits.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Michel Dänzer michel.daenzer@amd.com
(cherry picked from commit fde27b9b48)
2019-02-20 14:23:50 -05:00
Ilia Mirkin
c44eee243e modesetting: fix conn_id termination and potential overrun by 1 byte
Noticed when porting this logic to xf86-video-nouveau, and valgrind
complained about conditional jump based on uninitialized data.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
(cherry picked from commit 48b1af2718)
2019-02-20 14:23:33 -05:00
Adam Jackson
10609630e7 automake: Distribute meson's configure header templates
Fixes: xorg/xserver#17
(cherry picked from commit 82ed89c0f8)
2019-02-20 14:23:19 -05:00
Lionel Landwerlin
f5a77233b9 present: fix compile warning with debug traces
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit a425eee6dc)
2019-02-20 14:23:13 -05:00
Lyude Paul
4e12cba656 modesetting: Actually disable CRTCs in legacy mode
Believe it or not, somehow we've never done this in legacy mode! We
currently simply change the DPMS property on the CRTC's output's
respective DRM connector, but this means that we're just setting the
CRTC as inactive-not disabled. From the perspective of the kernel, this
means that any shared resources used by the CRTC are still in use.

This can cause problems for drivers that are not yet fully atomic,
despite using the atomic helpers internally. For instance: if CRTC-1 and
CRTC-2 are still enabled and use shared resources within the kernel (an
MST topology, for example), and then userspace tries to go enable CRTC-3
on the same topology this might suddenly fail if CRTC-3 needs the shared
resources CRTC-1 and CRTC-2 are using. While I don't know of any
situations in the mainline kernel that actually trigger this, future
plans for reworking the atomic check of MST drivers are absolutely
going to make this into a real issue (they already are in my WIP
branches for the kernel).

So: actually do the right thing here and disable CRTCs when they're not
going to be used anymore, even in legacy mode.

Signed-off-by: Lyude Paul <lyude@redhat.com>
(cherry picked from commit 7a44e8d400)
2019-02-20 14:23:03 -05:00
Alan Coopersmith
652918e736 Update configure.ac bug URL for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 17a22ad948)
2019-02-20 14:22:43 -05:00
Alan Coopersmith
40b22a0571 Update README for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 5d097c2a20)
2019-02-20 14:22:02 -05:00
Olivier Fourdan
a352f97954 xwayland: handle case without any crtc
Xwayland creates and destroys the CRTC along with the Wayland outputs,
so there is possibly a case where the number of CRTC drops to 0.

However, `xwl_present_get_crtc()` always return `crtcs[0]` which is
invalid when `numCrtcs` is 0.

That leads to crash if a client queries the Present capabilities when
there is no CRTC, the backtrace looks like:

  #0  raise() from libc.so
  #1  abort() from libc.so
  #2  OsAbort() at utils.c:1350
  #3  AbortServer() at log.c:879
  #4  FatalError() at log.c:1017
  #5  OsSigHandler() at osinit.c:156
  #6  OsSigHandler() at osinit.c:110
  #7  <signal handler called>
  #8  main_arena() from libc.so
  #9  proc_present_query_capabilities() at present_request.c:236
  #10 Dispatch() at dispatch.c:478
  #11 dix_main() at main.c:276

To avoid returning an invalid pointer (`crtcs[0]`) in that case, simply
check for `numCrtcs` being 0 and return `NULL` in that case.

Thanks to Michel Dänzer <michel.daenzer@amd.com> for pointing this as a
possible cause of the crash.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Bugzilla: https://bugzilla.redhat.com/1609181
(cherry picked from commit e8295c5020)
2019-01-09 15:26:33 +01:00
Michel Dänzer
210cd52906 xwayland: Don't take buffer release queue into account for frame timer
The buffer release queue has two kinds of entries:

* Pending async flips.
* Completed flips waiting for their buffer to be released by the Wayland
  compositor.

xwl_present_timer_callback neither completes async flips nor releases
buffers, so the timer isn't needed for the buffer release queue.

(cherry picked from commit e6cd1c9bde)
2019-01-09 15:26:33 +01:00
Michel Dänzer
7c28b0e34e xwayland: Don't need xwl_window anymore in xwl_present_queue_vblank
Fixes issue #12. Presumably the problem was that Present operations on
unmapped windows were executed immediately instead of only when reaching
the target MSC.

(cherry picked from commit f541615342)
2019-01-09 15:26:33 +01:00
Michel Dänzer
4613595709 xwayland: Add xwl_present_unrealize_window
When a window is unrealized, a pending frame callback may never be
called, which could result in repeatedly freezing until the frame timer
fires after a second.

Fixes these symptoms when switching from fullscreen to windowed mode in
sauerbraten.

(cherry picked from commit 8c9538573c)
2019-01-09 15:26:33 +01:00
Michel Dänzer
98f41563e6 xwayland: Replace xwl_window::present_window with ::present_flipped
There's no need to keep track of the window which last performed a
Present flip. This fixes crashes due to the assertion in
xwl_present_flips_stop failing. Fixes issue #10.

The damage generated by a flip only needs to be ignored once, then
xwl_window::present_flipped can be cleared. This may fix freezing in
the (hypothetical) scenario where Present flips are performed on a
window, followed by other drawing requests using the window as the
destination, but nothing triggering xwl_present_flips_stop. The damage
from the latter drawing requests would continue being ignored.

(cherry picked from commit 6b016d58d2)
2019-01-09 15:26:33 +01:00
Michel Dänzer
f393801dbb xwayland: Complete "synchronous" Present flips from xwl_present_msc_bump
Completing them from xwl_present_sync_callback had at least two issues:

* It was before the MSC was incremented in xwl_present_frame_callback,
  so the MSC value in the completion event could be lower than the
  target specified by the client. This could cause hangs with the Mesa
  Vulkan drivers.
* It allowed clients to run at a frame-rate higher than the Wayland
  compositor's frame-rate, wasting energy on generating frames which
  were never displayed. This isn't expected to happen unless the client
  specified PresentOptionAsync (in which case flips are still completed
  from xwl_present_sync_callback, allowing higher frame-rates).

v2:
* Make xwl_present_has_events return true when there's a pending
  "synchronous" flip, so those complete after at most ~1 second even if
  the Wayland server doesn't send a frame event.

Bugzilla: https://bugs.freedesktop.org/106713
(cherry picked from commit ace551d8a2)
2019-01-09 15:26:33 +01:00
Michel Dänzer
e646e3054a xwayland: Rename xwl_present_events_notify to xwl_present_msc_bump
And consolidate more code from xwl_present_timer_callback and
xwl_present_frame_callback in it.

(cherry picked from commit 2bfc46d414)
2019-01-09 15:26:33 +01:00
Michel Dänzer
47aed554b7 xwayland: Use xwl_present_reset_timer in xwl_present_timer_callback
Apart from simplifying the code, this should also prevent a condition
(which might only be possible with the following fix) reported in
https://gitlab.freedesktop.org/wayland/weston/issues/115#note_52467:

1. xwl_present_timer_callback indirectly calls xwl_present_reset_timer
   -> xwl_present_free_timer
2. xwl_present_timer_callback then returns a non-0 value, so DoTimer
   calls TimerSet with the old xwl_present_window->frame_timer pointer
   which was freed in step 1 => use after free

Calling xwl_present_reset_timer explicitly passes NULL to TimerSet if
step 1 freed xwl_present_window->frame_timer, and it will allocate a new
one.

(cherry picked from commit 5e8b9a3a56)
2019-01-09 15:26:33 +01:00
Olivier Fourdan
cf8e064ec0 xwayland: do not crash if gbm_bo_create() fails
The function `xwl_glamor_gbm_create_pixmap()` first creates a buffer
objects and then creates the xwl_pixmap from it.

However, `xwl_glamor_gbm_create_pixmap_for_bo()` is not called if the
buffer object creation fails, and `xwl_glamor_gbm_create_pixmap()`
simply returns `glamor_create_pixmap()`.

The problem with this is that if `xwl_glamor_gbm_create_pixmap_for_bo()`
is not called then neither is `xwl_pixmap_set_private()` and further
calls to `xwl_pixmap_get()` will return NULL and cause a NULL pointer
dereference if the return value is not checked:

  #0  xwl_glamor_gbm_get_wl_buffer_for_pixmap ()
      at hw/xwayland/xwayland-glamor-gbm.c:248
  #1  xwl_window_post_damage () at hw/xwayland/xwayland.c:697
  #2  xwl_display_post_damage () at hw/xwayland/xwayland.c:759
  #3  block_handler () at hw/xwayland/xwayland.c:890
  #4  BlockHandler () at dix/dixutils.c:388
  #5  WaitForSomething () at os/WaitFor.c:201
  #6  Dispatch () at dix/dispatch.c:421
  #7  dix_main () at dix/main.c:276
  #8  __libc_start_main () at ../csu/libc-start.c:308
  #9  _start ()

  (gdb) print xwl_pixmap
  $1 = (struct xwl_pixmap *) 0x0

Make sure we check for `xwl_pixmap_get()` returned value where relevant
and fail gracefully if this is the case.

See also: https://gitlab.gnome.org/GNOME/mutter/issues/340

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Marco Trevisan <mail@3v1n0.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 036794bebc)
2019-01-09 15:26:33 +01:00
Olivier Fourdan
f89518e17f present/wnmd: Fix use after free on CRTC removal
Xwayland will add and remove CRTCs as Wayland outputs are added or
removed.

If there is a pending flip when this occurs, the
`xwl_present_sync_callback()` will be triggered after the Xwayland
output's RRCtrcPtr has been destroyed, hence causing a crash in Xwayland
while trying to use freed memory:

  #1  abort ()
  #2  OsAbort () at utils.c:1350
  #3  AbortServer () at log.c:877
  #4  FatalError () at log.c:1015
  #5  OsSigHandler () at osinit.c:156
  #6  <signal handler called>
  #7  dixGetPrivate () at ../include/privates.h:122
  #8  dixLookupPrivate () at ../include/privates.h:166
  #9  present_screen_priv () at present_priv.h:198
  #10 present_wnmd_flip () at present_wnmd.c:358
  #11 present_wnmd_execute () at present_wnmd.c:466
  #12 present_wnmd_re_execute () at present_wnmd.c:80
  #13 xwl_present_sync_callback () at xwayland-present.c:287
  #14 ffi_call_unix64 () from /lib64/libffi.so.6
  #15 ffi_call () from /lib64/libffi.so.6
  #16 wl_closure_invoke () at src/connection.c:1006
  #17 dispatch_event () at src/wayland-client.c:1427
  #18 dispatch_queue () at src/wayland-client.c:1573
  #19 wl_display_dispatch_queue_pending () at src/wayland-client.c:1815
  #20 wl_display_dispatch_pending () at src/wayland-client.c:1878
  #21 xwl_read_events () at xwayland.c:814
  #22 ospoll_wait () at ospoll.c:651
  #23 WaitForSomething () at WaitFor.c:208
  #24 Dispatch () at ../include/list.h:220
  #25 dix_main () at main.c:276

To avoid the issue, get the `ScreenPtr` from the window instead of the
CRTC that might have been just freed, `xwl_present_flip()` has no use
for the CRTC anyway.

Bugzilla: https://bugs.freedesktop.org/108249
Suggested-by: Michel Daenzer <michel.daenzer@amd.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Daenzer <michel.daenzer@amd.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b768b7d6ce)
2019-01-09 15:26:33 +01:00
Michel Dänzer
64f5e6ec2d xwayland: Plug leaks in xwl_present_sync_callback
xwl_present_window->sync_callback was leaked.

The event memory was leaked if the corresponding buffer had already been
released.

(cherry picked from commit cb0de153bf)
2019-01-09 15:26:33 +01:00
Adam Jackson
971d418113 xserver 1.20.3
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-25 09:18:06 -04:00
Matthieu Herrb
da15c74139 LogFilePrep: add a comment to the unsafe format string.
CVE-2018-14665 also made it possible to exploit this to access
memory. With -logfile forbidden when running with elevated privileges
this is no longer an issue.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 248d164eae)
2018-10-25 09:18:06 -04:00
Matthieu Herrb
8a59e3b7db Disable -logfile and -modulepath when running with elevated privileges
Could cause privilege elevation and/or arbitrary files overwrite, when
the X server is running with elevated privileges (ie when Xorg is
installed with the setuid bit set and started by a non-root user).

CVE-2018-14665

Issue reported by Narendra Shinde and Red Hat.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 50c0cf885a)
2018-10-25 09:18:06 -04:00
Peter Hutterer
cfc3dec09e xfree86: fix readlink call
Misplaced parenthesis caused us to compare the sizeof, not the readlink return
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit bd5fe7593f)
2018-10-16 10:22:05 -04:00
Adam Jackson
2a0c6c15c3 xserver 1.20.2
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-15 11:17:35 -04:00
Adam Jackson
f5dc787fc9 fbdevhw: Refuse to touch PCI devices on the fallback probe path
Fixes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/issues/9
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit fc78bcca21)
2018-10-12 11:35:42 -04:00
Adam Jackson
4795c069a5 glamor/egl: Avoid crashing on broken configurations
0a9415cf apparently can tickle bugs in the GL stack where glGetString
returns NULL, presumably because the eglMakeCurrent() didn't manage to
actually install a dispatch table and you're hitting a stub function.
That's clearly not our bug, but if it happens we should at least not
crash. Notice this case and fail gently.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit af151895f3)
2018-10-12 11:35:07 -04:00
Adam Jackson
1e3c5d614e glamor_egl: Don't initialize on llvmpipe
Mesa started supporting GL_OES_EGL_image on llvmpipe in 17.3, after this
commit:

    commit bbdeddd5fd0b797e1e281f058338b3da4d98029d
    Author: Gurchetan Singh <gurchetansingh@chromium.org>
    Date:   Tue Aug 1 14:49:33 2017 -0700

        st/dri: add drisw image extension

That's pretty cool, but it means glamor now thinks it can initialize on
llvmpipe. This is almost certainly not what anyone wants, as glamor on
llvmpipe is pretty much uniformly slower than fb.

This fixes both Xorg and Xwayland to refuse glamor in such a setup.
Xephyr is left alone, both because glamor is not the default there and
because Xephyr+glamor+llvmpipe is one of the easier ways to get xts to
exercise glamor.

The (very small) downside of this change is that you lose DRI3 support.
This wouldn't have helped you very much (since an lp glamor blit is
slower than a pixman blit), but it would eliminate the PutImage overhead
for llvmpipe's glXSwapBuffers. A future change should add DRI3 support
for the fb-only case.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 0a9415cf79)
2018-10-12 11:35:00 -04:00
Alexander Volkov
b58aa8ed9b os/xdmcp: Don't create a new socket in XdmcpReset()
xdmcpSocket survives during the reset, there is no
need to create a new one.

This commit restores logic that was broken by
49c0f2413d in Xorg 1.19.

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
(cherry picked from commit 32677ce03d)
2018-10-05 09:14:18 +02:00
Pierre Ossman
b1215fb075 Switch automatic composite update to WorkQueue
It is currently (ab)using the screen BlockHandler callback to do
this. But this can cause problems with other extension as their
block handlers might have executed before Composite's. And the
operations Composite does might result in them wanting to change
timeouts.

Practically this caused problems for TigerVNC's VNC extension which
failed to send out updates for Composite's screen updates.

(cherry picked from commit 1bd5d0a53c)
2018-10-05 09:14:18 +02:00
Adam Jackson
a41b6ef224 modesetting: Don't free(dst) in drmmode_prop_info_copy
The destination is always either on the stack or in the middle of some
struct.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 43a0f9a5db)
2018-10-05 09:14:18 +02:00
Cedric Roux
9403335910 miext/damage: take care of the coordinate mode in damagePolyPoint
The mode (CoordModeOrigin or CoordModePrevious) was not taken into
account when computing the box. The result was a bad drawing of
points in some situations (on my hardware/software configuration,
calling XDrawString followed by XDrawPoints in the mode
CoordModePrevious).

Signed-off-by: Cedric Roux <sed@free.fr>
Signed-off-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit bc36594e0e)
2018-10-04 17:27:15 +02:00
Olivier Fourdan
c26a47b4f2 xwayland: Use double for xwl_tablet_tool
So we do not lose subpixel precision in Xwayland.

Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/libinput/libinput/issues/138
(cherry picked from commit 734b2d6907)
2018-10-04 17:27:08 +02:00
Adam Jackson
fb01b238c6 xfree86: Fix Option "MaxClients" validation
The old code would not in fact validate the option value, though it
might complain about it in the log. It also didn't let you set some
legal values that the -maxclients command line option would.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 7d689f049c)
2018-10-04 17:27:03 +02:00
Dave Airlie
cc4051ad6a devices: break after finding and removing device from lists
Coverity complains about a use after free in here after the
freeing, I can't follow the linked list so well, but whot
says the device can only be on one list once, so break should
fix it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit ba0f5d854f)
2018-10-04 17:26:57 +02:00
Dave Airlie
64a7aac257 mibltblt: free prgnSrcClip on error path.
Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit c4591ea171)
2018-10-04 17:26:51 +02:00
Dave Airlie
fcbdb7c8b0 xkb: fix what looks to be a copy-paste error with first vs firstMM
Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 7583939512)
2018-10-04 17:26:44 +02:00
Dave Airlie
83ef02839c posix_tty: free leak of xf86SetStrOption return value.
Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit cad3a1a82d)
2018-10-04 17:26:26 +02:00
Dave Airlie
66d36010a3 modesetting: get pEnt after error checks
This saves us having to make sure we clean it up.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit b6c29a881e)
2018-10-04 17:26:20 +02:00
Dave Airlie
795c58a1fe glamor: fix leak of fs_getcolor_source.
This is created using XNFstrdup, so it needs to be freed.

Pointed out by coverity.
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit f0a5c0d1fd)
2018-10-04 17:26:15 +02:00
Dave Airlie
bb384d0b11 fboverlay: move bpp checks above malloc
Avoids having to free the malloced object.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit c7fa6a0a0d)
2018-10-04 17:26:09 +02:00
Dave Airlie
26a83f9833 xi: free modifiers_failed on error path. (v2)
Pointed out by coverity.

v2: set modifies_failed to NULL at start (whot)

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 51ae6126dc)
2018-10-04 17:26:04 +02:00
Dave Airlie
bdeab7863e shm: move shmsize verify before allocating the drawable.
Otherwise if the VERIFY_SHMSIZE macro fails we leak the drawables
we allocated earlier.

Noticed by coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 3439929c51)
2018-10-04 17:25:59 +02:00
Adam Jackson
8e646ca985 modesetting: Document Option "DoubleShadow" in the man page
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit c4f3e42fe3)
2018-10-04 17:25:52 +02:00
Adam Jackson
fdb80a327c modesetting: Lie less in the man page
We don't support 8bpp, and we do have acceleration.

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 0dc2c419e1)
2018-10-04 17:25:30 +02:00
Olivier Fourdan
cffac815b9 xwayland: Remove xwl_present_window from privates on cleanup
Xwayland's `xwl_destroy_window()` invokes `xwl_present_cleanup()`
before the common `DestroyWindow()`.

But then `DestroyWindow()` calls `present_destroy_window()` which will
possibly end up in `xwl_present_abort_vblank()` which will try to access
data that was previously freed by `xwl_present_cleanup()`:

  Invalid read of size 8
     at 0x434184: xwl_present_abort_vblank (xwayland-present.c:378)
     by 0x53785B: present_wnmd_abort_vblank (present_wnmd.c:651)
     by 0x53695A: present_free_window_vblank (present_screen.c:87)
     by 0x53695A: present_destroy_window (present_screen.c:152)
     by 0x42A90D: xwl_destroy_window (xwayland.c:653)
     by 0x584298: compDestroyWindow (compwindow.c:613)
     by 0x53CEE3: damageDestroyWindow (damage.c:1570)
     by 0x4F1BB8: DbeDestroyWindow (dbe.c:1326)
     by 0x46F7F6: FreeWindowResources (window.c:1031)
     by 0x472847: DeleteWindow (window.c:1099)
     by 0x46B54C: doFreeResource (resource.c:880)
     by 0x46C706: FreeClientResources (resource.c:1146)
     by 0x446ADE: CloseDownClient (dispatch.c:3473)
   Address 0x182abde0 is 80 bytes inside a block of size 112 free'd
     at 0x4C2FDAC: free (vg_replace_malloc.c:530)
     by 0x42A937: xwl_destroy_window (xwayland.c:647)
     by 0x584298: compDestroyWindow (compwindow.c:613)
     by 0x53CEE3: damageDestroyWindow (damage.c:1570)
     by 0x4F1BB8: DbeDestroyWindow (dbe.c:1326)
     by 0x46F7F6: FreeWindowResources (window.c:1031)
     by 0x472847: DeleteWindow (window.c:1099)
     by 0x46B54C: doFreeResource (resource.c:880)
     by 0x46C706: FreeClientResources (resource.c:1146)
     by 0x446ADE: CloseDownClient (dispatch.c:3473)
     by 0x446DA5: ProcKillClient (dispatch.c:3279)
     by 0x4476AF: Dispatch (dispatch.c:479)
   Block was alloc'd at
     at 0x4C30B06: calloc (vg_replace_malloc.c:711)
     by 0x433F46: xwl_present_window_get_priv (xwayland-present.c:54)
     by 0x434228: xwl_present_get_crtc (xwayland-present.c:302)
     by 0x539728: proc_present_query_capabilities (present_request.c:227)
     by 0x4476AF: Dispatch (dispatch.c:479)
     by 0x44B5B5: dix_main (main.c:276)
     by 0x75F611A: (below main) (libc-start.c:308)

This is because `xwl_present_cleanup()` frees the memory but does not
remove it from the window's privates, and `xwl_present_abort_vblank()`
will still find it and hence try to access that freed memory...

Remove `xwl_present_window` from window's privates on cleanup so that no
other function can find and reuse that data once it's freed.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1616269
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 3f31f56929)
2018-10-04 17:25:24 +02:00
Lionel Landwerlin
8dd7173eeb xwayland: fix access to invalid pointer
xwl_output->randr_crtc is used in the update_screen_size() function :

==5331== Invalid read of size 4
==5331==    at 0x15263D: update_screen_size (xwayland-output.c:190)
==5331==    by 0x152C48: xwl_output_remove (xwayland-output.c:413)
==5331==    by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x14BCCA: xwl_read_events (xwayland.c:814)
==5331==    by 0x2AC0D0: ospoll_wait (ospoll.c:651)
==5331==    by 0x2A5322: WaitForSomething (WaitFor.c:208)
==5331==    by 0x27574B: Dispatch (dispatch.c:421)
==5331==    by 0x279945: dix_main (main.c:276)
==5331==  Address 0x1aacb5f4 is 36 bytes inside a block of size 154 free'd
==5331==    at 0x48369EB: free (vg_replace_malloc.c:530)
==5331==    by 0x1F8AE8: RROutputDestroyResource (rroutput.c:421)
==5331==    by 0x29A2AC: doFreeResource (resource.c:880)
==5331==    by 0x29AE5B: FreeResource (resource.c:910)
==5331==    by 0x152BE0: xwl_output_remove (xwayland-output.c:408)
==5331==    by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x14BCCA: xwl_read_events (xwayland.c:814)
==5331==    by 0x2AC0D0: ospoll_wait (ospoll.c:651)
==5331==  Block was alloc'd at
==5331==    at 0x48357BF: malloc (vg_replace_malloc.c:299)
==5331==    by 0x1F93E0: RROutputCreate (rroutput.c:83)
==5331==    by 0x152A75: xwl_output_create (xwayland-output.c:361)
==5331==    by 0x14BE59: registry_global (xwayland.c:764)
==5331==    by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x14BCCA: xwl_read_events (xwayland.c:814)
==5331==    by 0x2AC0D0: ospoll_wait (ospoll.c:651)
==5331==    by 0x2A5322: WaitForSomething (WaitFor.c:208)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit 53ce2ba0a1)
2018-10-04 17:25:19 +02:00
Olivier Fourdan
1191b23f94 glx: check for indirect context in CreateContextAttribsARB()
Commit 99f0365b "Add a command line argument for disabling indirect GLX"
added a test to check if indirect context are enabled in
`DoCreateContext()` but `__glXDisp_CreateContextAttribsARB()` doesn't
use `DoCreateContext()` and doesn't check if indirect context is
enabled.

As a result, clients can still manage to create indirect contexts using
`glXCreateContextAttribsARB()` even if indirect contexts are disabled,
which can possibly crash Xservers such as Xwayland or Xephyr when the
context is destroyed.

To avoid the issue, check for `enableIndirectGLX` in
`__glXDisp_CreateContextAttribsARB()` as well.

Fixes: 99f0365b "Add a command line argument for disabling indirect GLX"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107508
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 75448671ab)
2018-10-04 17:25:13 +02:00
Lionel Landwerlin
1b0db2c742 present: fix freed pointer access
When a vblank has been marked as aborted, it's going to be free in the
flip_notify function when stopped. We can't notify it after it's
stopped because the pointer is invalid.

Valgrind backtrace:

==5331== Invalid read of size 8
==5331==    at 0x212B4D: present_vblank_notify (present_vblank.c:34)
==5331==    by 0x21439B: present_wnmd_flip_notify (present_wnmd.c:194)
==5331==    by 0x21439B: present_wnmd_event_notify (present_wnmd.c:228)
==5331==    by 0x156216: xwl_present_sync_callback (xwayland-present.c:282)
==5331==    by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x14BCCA: xwl_read_events (xwayland.c:814)
==5331==    by 0x2AC0D0: ospoll_wait (ospoll.c:651)
==5331==    by 0x2A5322: WaitForSomething (WaitFor.c:208)
==5331==    by 0x27574B: Dispatch (dispatch.c:421)
==5331==  Address 0x1b44dc98 is 40 bytes inside a block of size 184 free'd
==5331==    at 0x48369EB: free (vg_replace_malloc.c:530)
==5331==    by 0x213B0A: present_wnmd_free_idle_vblanks (present_wnmd.c:118)
==5331==    by 0x213B0A: present_wnmd_flips_stop (present_wnmd.c:161)
==5331==    by 0x2143EF: present_wnmd_flip_notify (present_wnmd.c:192)
==5331==    by 0x2143EF: present_wnmd_event_notify (present_wnmd.c:228)
==5331==    by 0x156216: xwl_present_sync_callback (xwayland-present.c:282)
==5331==    by 0x6570FCD: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x657093E: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==5331==    by 0x4DDB183: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD79D8: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x4DD8EA3: wl_display_dispatch_queue_pending (in /usr/lib/x86_64-linux-gnu/libwayland-client.so.0.3.0)
==5331==    by 0x14BCCA: xwl_read_events (xwayland.c:814)
==5331==    by 0x2AC0D0: ospoll_wait (ospoll.c:651)
==5331==    by 0x2A5322: WaitForSomething (WaitFor.c:208)
==5331==  Block was alloc'd at
==5331==    at 0x48377D5: calloc (vg_replace_malloc.c:711)
==5331==    by 0x212D9F: present_vblank_create (present_vblank.c:69)
==5331==    by 0x214014: present_wnmd_pixmap (present_wnmd.c:610)
==5331==    by 0x21576C: proc_present_pixmap (present_request.c:150)
==5331==    by 0x27599D: Dispatch (dispatch.c:479)
==5331==    by 0x279945: dix_main (main.c:276)
==5331==    by 0x633AB16: (below main) (libc-start.c:310)

v2: Still notify aborted flips (Roman)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107314
Reviewed-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit ce271535ad)
2018-10-04 17:25:02 +02:00
Scott Anderson
48300a7775 xwayland: use wayland axis_discrete event
This prevents multiple scroll events happening for wayland compositors
which send axis values other than 10. For example, libinput will
typically return 15 for each scroll wheel step, and if a wayland
compositor sends those to xwayland without normalising them, 2 scroll
wheel steps will end up as 3 xorg scroll events. By listening for the
discrete_axis event, this will now correctly send only 2 xorg scroll
events.

The wayland protocol gurantees that there will always be an axis event
following an axis_discrete event. However, it does not gurantee that
other events (including other axis_discrete+axis pairs) will not happen
in between them. So we must keep a list of outstanding axis_discrete
events.

Signed-off-by: Scott Anderson <scott@anderso.nz>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit cd285922cd)
2018-10-04 17:24:50 +02:00
Jim Qu
cd19a752f8 modesetting: code refactor for PRIME sync
The X will be crashed on the system with other DDX driver,
such as amdgpu.

show the log like:

randr: falling back to unsynchronized pixmap sharing
(EE)
(EE) Backtrace:
(EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x4e)
(EE) 1: /usr/lib/xorg/Xorg (0x55cb0151a000+0x1b5ce9)
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1587a1d000+0x11390)
(EE)
(EE) Segmentation fault at address 0x0
(EE)

The issue is that modesetting as the master, and amdgpu as the slave.
Thus, when the master attempts to access pSlavePixPriv in ms_dirty_update(),
problems result due to the fact that it's accessing AMD's 'ppriv' using the
modesetting structure definition.

Apart from fixing crash issue, the patch fix other issue in master interface
in which driver should refer to master pixmap.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>
Reviewed-by: Alex Goins <agoins@nvidia.com>
(cherry picked from commit f79e536851)
2018-10-04 17:24:42 +02:00
Alex Goins
5396a4aa08 randr: rrCheckPixmapBounding should only increase screen size
The purpose of rrCheckPixmapBounding() is to make sure that the fb is large
enough to accommodate the region scanned out by a GPU screen. Currently, however,
it will actually shrink the fb if it's larger than it needs to be.

This is a problem when combining PRIME output slaving with arbitrary transforms
with xrandr.

Although arbitrary transforms are not supposed to constrain the size of the fb
(https://lists.freedesktop.org/archives/xorg-devel/2018-January/055563.html),
xrandr will use RRSetScreenSize to resize the desktop to accommodate scaling
transforms, e.g. scaling a 1920x1080 display to 3840x2160 will result in a
desktop size of 3840x2160.

In the case of PRIME, rrCheckPixmapBounding() will be called after
RRSetScreenSize() and it will resize the fb back down to what it would be
without the scaling transform, e.g. 1920x1080. This represents divergence in
behavior between PRIME and non-PRIME outputs.

I had originally made rrCheckPixmapBounding() account for arbitrary transforms,
but realized that the fb being large enough to accommodate arbitrary transforms
is not a hard requirement enforced in the server. Instead, this change simply
makes it so that rrCheckPixmapBounding() will only resize the fb to be larger
than it already is, preventing it from stepping on prior requests to increase
the size of the fb.

Signed-off-by: Alex Goins <agoins@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit a90f33721e)
2018-10-04 17:23:57 +02:00
Peter Hutterer
051a0efc5c dix: check_modmap_change() returns Success, not true
Not sure what if anything calls XSetDeviceModifierMapping() but this would've
failed all the time. check_modmap_change() returns Success but we were
treating it like a boolean. Fix this.

Reported-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 4fe02b8da3)
2018-10-04 17:23:48 +02:00
Adam Jackson
1508ea6806 xserver 1.20.1
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-08-07 12:26:05 -04:00
Keith Packard
101d15c763 During reset/shutdown, clean up leases in DIX instead of each driver
Instead of having every video driver loop over any pending leases to
free them during CloseScreen, do this up in the DIX layer by
terminating leases when a leased CRTC or Output is destroyed and
(just to make sure), also terminating leases in RRCloseScreen. The
latter should "never" get invoked as any lease should be associated
with a resource which was destroyed.

This is required as by the time the driver's CloseScreen function is
invoked, we've already freed all of the DIX randr structures and no
longer have any way to reference the leases

Signed-off-by: Keith Packard <keithp@keithp.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106960
Cc: Thomas Hellstrom <thellstrom@vmware.com>
(cherry picked from commit 1ef7aed3e2)
2018-08-07 12:08:01 -04:00
Peter Hutterer
9347326d28 Xext: dynamically allocate the PanoramiXDepths[j].vids array
Control flow is:
   PanoramiXMaybeAddDepth() allocates an array size 240 (pDepth->numVisuals)
   PanoramiXMaybeAddVisual() finds up to 270 matches (pScreen->numVisuals)
   and writes those into the previously allocated array.

This caused invalid reads/writes followed by eventually a double-free abort.

Reproduced with xorg-integration-tests server test
XineramaTest.ScreenCrossing/* (and a bunch of others).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 93cafb0828)
2018-08-02 10:04:10 -04:00
emersion
cbf1ca2dba xwayland: rotate logical size for RRMode
The logical size is the size of the output in the global compositor
space. The mode width/height should be scaled as in the logical
size, but shouldn't be transformed. Thus we need to rotate back
the logical size to be able to use it as the mode width/height.

This fixes issues with pointer input on transformed outputs.

Signed-Off-By: Simon Ser <contact@emersion.fr>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit ce2dde9ed0)
2018-08-02 10:04:10 -04:00
Olivier Fourdan
18a52a8e16 xwayland: Enable DRI3 for glamor
glamor_fds_from_pixmap() will bail out early if DRI3 is not enabled,
unfortunately Xwayland's glamor code would not set it as enabled which
would lead to blank pixmaps when using texture from pixmap.

Make sure to mark DRI3 as enabled from glamor_egl_screen_init() in
Xwayland.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107287
Fixes: c8c276c956 ("glamor: Implement PixmapFromBuffers and BuffersFromPixmap")
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit cdec2b3c19)
2018-08-02 10:04:10 -04:00
Takashi Iwai
c256e31a9e modesetting: Fix cirrus 24bpp breakage
The recent rewrite of modesetting driver broke the 24bpp support.
As typically found on cirrus KMS, it leads to a blank screen, spewing
the error like:
  failed to add fb -22
  (EE) modeset(0): failed to set mode: Invalid argument

The culript is that the wrong bpp value of the front buffer is passed
to drmModeAddFB().  Fix it by replacing with the back buffer bpp,
drmmode->kbpp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Dirsch <sndirsch@suse.de>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit d625e16918)
2018-08-02 10:04:10 -04:00
Matt Turner
2da0bde449 xfree86: Inline xf86{Read,Write}Mmio{8,16,32} on alpha
In commit 9db2af6f75 (xfree86: Remove xf86{Map,Unmap}VidMem) we
somehow stopped exporting xf86{Read,Write}Mmio{8,16,32}. Since the
function pointer indirection was intended to support dense vs sparse and
sparse support is now gone, we can just make the functions static inline
in compiler.h and avoid all of this.

Bugzilla: https://bugs.gentoo.org/548906
Tested-by: Christopher May-Townsend <chris@maytownsend.co.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 166ac294ae)
2018-08-01 15:27:21 -04:00
Stefan Agner
b9e9eda08b modesetting: Fix 16 bit depth/bpp mode
When setting DefaultDepth to 16 in the Screen section, the current
code requests a 32 bpp framebuffer, however the X-Server seems to
assumes 16 bpp.

Fixes commit 21217d0216 ("modesetting: Implement 32->24 bpp
conversion in shadow update")

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
(cherry picked from commit 1c7f34e99f)
2018-08-01 11:01:37 -04:00
Lyude Paul
5c0662d448 meson: ensure the libc has RPC functions when secure-rpc is enabled
Currently our meson.build just makes the assumption that the libc is
going to provide RPC functions. This doesn't actually seem to be the
case on Fedora, which causes compilation to fail unexpectedly:

../../Projects/xserver/os/rpcauth.c:47:10: fatal error: rpc/rpc.h: No such file or directory
 #include <rpc/rpc.h>
          ^~~~~~~~~~~
compilation terminated.

So, in the event that we can't use libtirpc ensure that we actually
check whether or not the libc provides rpc/rpc.h. If it doesn't, raise
an error.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
(cherry picked from commit d95a1310ef)
2018-08-01 11:01:37 -04:00
Keith Packard
10285bc36b xf86-video-modesetting: Lease planes as well if using atomic
If we're using atomic modesetting, then we're also using universal
planes, and so the lease we create needs to include the plane.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit d83efc47b7)
2018-08-01 11:01:37 -04:00
Keith Packard
a530198ac0 xf86-video-modesetting: Don't enable UNIVERSAL_PLANES separately
We don't want universal_planes unless we're using atomic APIs for
modesetting, and the kernel already enables universal_planes
automatically when atomic is enabled.

If we enable universal_planes when we're not using atomic, then we
won't have selected a plane for each crtc, and this will break lease
creation which requires planes for each output when universal_planes
is enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit 4a11f66e46)
2018-08-01 11:01:37 -04:00
Keith Packard
cd7680adcc xfree86: Wrap RRCrtcIsLeased and RROutputIsLeased to check for DIX structures
Before DIX structures are allocated for crtcs and outputs, we don't
want to call DIX randr code with NULL pointers. This can happen if the
driver sets video modes early in server initialization, which Nouveau
does in zaphod mode.

Cc: thellstrom@vmware.com
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106772
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106960
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 2faf4cef8b)
2018-08-01 11:01:37 -04:00
Keith Packard
ebd4cd71f4 xfree86: Reset randr_crtc and randr_output early in xf86CrtcCloseScreen
The DIX crtc and output structures are freed when their resources are
destroyed, which happens before CloseScreen is called. As a result, we
know these pointers are invalid and referencing them during any of the
remaining CloseScreen sequence will be bad.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Cc: thellstrom@vmware.com
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106960
(cherry picked from commit c55a44a9a8)
2018-08-01 11:01:37 -04:00
Jon Turney
1f169d5b38 meson: use absolute paths in manpage substitutions
paths returned by get_option('foodir') are potentially relative to prefix

Noticed when comparing manpages generated by a meson build with those
generated by an autotools build

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 49283e238a)
2018-08-01 11:01:37 -04:00
Keith Packard
bc1882aa23 modesetting: Allow a DRM fd to be passed on command line with -masterfd [v2]
This lets an application open a suitable DRM device and pass the file
descriptor to the mode setting driver through an X server command line
option, '-masterfd'.

There's a companion application, xlease, which creates a DRM master by
leasing an output from another X server. That is available at

	git clone git://people.freedesktop.org/~keithp/xlease

v2:
	Always print usage, but note that it can't be used if
	setuid/gid

	Suggested-by: Lyude Paul <lyude@redhat.com>

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
(cherry picked from commit 38ff29ec8e)
2018-08-01 11:01:37 -04:00
Laurent Carlier
d60ce5b01f meson: Add configuration of listening on tcp, unix and local
bugzilla: https://bugs.kde.org/show_bug.cgi?id=395419
bugzilla: https://bugs.archlinux.org/task/59025

Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2f39b2a078)
2018-08-01 11:01:37 -04:00
Lyude Paul
79795bf9df modesetting: Fix uninitialized memory usage in drmmode_crtc_get_fb_id()
This really sucked to find out :(

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
(cherry picked from commit c41d4ff48f)
2018-08-01 11:01:37 -04:00
Thomas Hellstrom
820ce7cb8b glamor: Work around GEM usage v2
KMS drivers are not required to support GEM. In particular, vmwgfx
doesn't support flink and handles and names are identical.
Getting a bo name should really be part of a lower level API, if needed,
but in the mean time work around this by setting the name identical to
the handle if GEM isn't supported.

This fixes modesetting driver dri2 on vmwgfx.

Reviewed-by: Deepak Rawat <drawat@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
(cherry picked from commit 9f02855e7a)
2018-08-01 11:01:37 -04:00
Lyude Paul
ba6a928381 randr: Scream when creating a shared pixmap fails
This seems like a problem worth screaming about.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit dc90b1c3c3)
2018-08-01 11:01:37 -04:00
Lyude Paul
91ec6245d6 glamor: Unbreak glamor_fd_from_pixmap()
When support for allocating GBM BOs with modifiers was added,
glamor_fd_from_pixmap() was changed so that it would return an error if
it got a bo with modifiers set from glamor_fds_from_pixmap(). The
problem is that on systems that support BOs with modifiers,
glamor_fds_from_pixmap() will always return BOs with modifiers.

This means that glamor_fd_from_pixmap() was broken entirely, which broke
a number of other things including glamor_shareable_fd_from_pixmap(),
which meant that modesetting using multiple GPUs with the modesetting
DDX was also broken. Easy reproducer:

- Find a laptop with DRI prime that has outputs connected to the
  dedicated GPU and integrated GPU
- Try to enable one display on each using the modesetting DDX
- Fail

Since there isn't a way to ask for no modifiers from
glamor_fds_from_pixmap, we create a shared _glamor_fds_from_pixmap()
function used by both glamor_fds_from_pixmap() and
glamor_fd_from_pixmap() that calls down to the appropriate
glamor_egl_fd*_from_pixmap() function.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Fixes: c8c276c956 ("glamor: Implement PixmapFromBuffers and BuffersFromPixmap")
(cherry picked from commit 186a21c4ba)
2018-08-01 11:01:37 -04:00
Lyude Paul
821f38fa56 modesetting: Also disable CRTC in drmmode_output_disable()
So, this did actually work on older kernels at one point in time,
however it seems that this working was a result of some of the Linux
kernel's atomic modesetting helpers not preserving the CRTC's enabled
state in the right spots. This was fixed in:

846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2")

As a result, atomic commits which simply disassociate a DRM connector
with it's CRTC while leaving the CRTC in an enabled state aren't enough
to disable the CRTC, and result in the atomic commit failing. This
currently can cause issues with MST hotplugging where X will end up
failing to disable the MST outputs after they've left the system. A
simple reproducer:

- Start up Xorg
- Connect an MST hub with displays connected to it
- Remove the hub
- Now there should be CRTCs stuck on the orphaned MST connectors, and X
  won't be able to reclaim them.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit c12f1bd4b7)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
2f4d0d8426 modesetting: use drmmode_bo_import() for rotate_fb
drmmode_shadow_allocate() still uses drmModeAddFB() which may fail if
the format is not as expected, preventing from using a rotated output.

Change it to use the new function drmmode_bo_import() which takes care
of calling the drmModeAddFB2() API.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106715
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Tomas Pelka <tpelka@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
(cherry picked from commit a85e94a50c)
2018-08-01 11:01:37 -04:00
John Lumby
394ed02f87 Change the DPMS initialization to be conditional on not set from config
Any DPMS timeout values set in ServerFlags section of the xorg.conf
are being overwritten by DPMS extension initialization.  Therefore
change the DPMS initialization of timeout values to be conditional on
not set from config.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106963
Signed-off-by: John Lumby <johnlumby@hotmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit f5aace7a27)
2018-08-01 11:01:37 -04:00
Damien Leone
8c2f0f8cbd os: Recompute whether any clients are ready after check_timers()
If a driver calls AttendClient() from within a timer callback we
need to re-compute the local 'are_ready' to prevent the attended
client from waiting until WaitForSomething() times out.

This is a fix similar to commit 9ed5b263.

Signed-off-by: Damien Leone <dleone@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit f33cb42643)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
180ab06d45 xwayland: mandatory EGL backend API
The API init_wl_registry() and has_wl_interfaces() are marked as being
optional, but both GBM And EGLStream backends implement them so there is
point in keeping those optional.

Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 92daeb31fa)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
c641d10ef0 xwayland: simplify xwl_glamor_pixmap_get_wl_buffer()
When retrieving the Wayland buffer from a pixmap, if the buffer already
exists, the GBM backend will return that existing buffer.

However, as seen with the Present issues, if the call had previously
passed a wrong size, that buffer will remain at the wrong size for as
long as the buffer exists, which is error prone.

Considering that the width/height passed to get_wl_buffer() is always the
actual pixmap  drawable size, and considering that the EGLStream backend
makes no use of the size either, there is really no point in passing the
width/height around.

Simplify the xwl_glamor_pixmap_get_wl_buffer() and EGL backends API by
removing the pixmap size, and use the drawable size instead.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 792359057b)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
79ebd7f689 xwayland: EGL_IMG_context_priority required by EGLStream
xwl_glamor_eglstream_init_egl() uses "EGL_IMG_context_priority"
extension, make sure it's actually available before using it.

Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit bdadaa25f5)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
81969ab773 xwayland: check for EGLStream backend explicitly
Now that we have separate backends for EGLStream and GBM, we can
explicitly check for the EGLStream backend to disable present support
in that case.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 5d843f6947)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
60020989b9 xwayland: refactor EGL backends for wayland registry
To be able to check for availability of the Wayland interfaces required
to run a given EGL backend (either GBM or EGLStream for now), we need
to have each backend structures and vfuncs in place before we enter the
Wayland registry dance.

That basically means that we should init all backends at first, connect
to the Wayland compositor and query the available interfaces and then
decide which backend is available and should be used (or none if either
the Wayland interfaces or the EGL extensions are not available).

For this purpose, hold an egl_backend struct for each backend we are to
consider prior to connect to the Wayland display so that, when we get to
query the Wayland interfaces, everything is in place for each backend to
handle the various Wayland interfaces.

Eventually, when we need to chose which EGL backend to use for glamor,
the available Wayland interfaces and EGL extensions available are all
known to Xwayland.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit d7185a84b6)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
cb698ec2ba xwayland: move EGL backend init to glamor
Move EGL backends initialization to its own function in
xwayland-glamor.c

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 48f037a27c)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
8ffee3a6bd xwayland: Add Wayland interfaces check
Introduces a new egl_backend function to let the EGL backend check for
the presence of the required Wayland interfaces.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit f2fcb4877e)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
aad1525180 xwayland: move egl_backend to its own struct
EGL backend availability requires both EGL extensions and Wayland
interfaces to be present, so we will need to consider multiple backends
during initialization.

As a preliminary work, move the egl_backend to its own struct so that we
can have more than one backend at any given time.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit b74b0f18b8)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
831f7194b7 xwayland: skip drm authentication with render node
If using a render node, we can skip DRM authentication.

Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit de004eefc6)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
60eda2af0a xwayland: GBM should fail w/out "GL_OES_EGL_image"
Surely, we should fail to init GBM backend if "GL_OES_EGL_image" is
missing.

This seems to have been lost with commit 1545e2dba ("xwayland: Decouple
GBM from glamor").

Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit b823b43dca)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
f8e96b22bf xwayland: swap "name" and "id" in init_wl_registry()
Both xwl_glamor_init_wl_registry() and the Wayland global registry
handler use the interface id/name in that order, using name/id in the
egl_backend vfunc makes things confusing and error prone.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 78ce4aa979)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
443e3348bb xwayland: move glamor specific routines
Functions such as:

  xwl_glamor_egl_supports_device_probing()
  xwl_glamor_egl_get_devices()
  xwl_glamor_egl_device_has_egl_extensions()

Are of no use outside of EGLStream support, move them to the relevant
source file.

Similarly, the other glamor functions such as:

  xwl_glamor_init()
  xwl_screen_set_drm_interface()
  xwl_screen_set_dmabuf_interface()
  xwl_glamor_pixmap_get_wl_buffer()
  xwl_glamor_init_wl_registry()
  xwl_glamor_post_damage()
  xwl_glamor_allow_commits()
  xwl_glamor_egl_make_current()

Are useless without glamor support enabled, move those within a
a "#ifdef XWL_HAS_GLAMOR" in xwayland.h

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit f6b2109c1b)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
dea40be935 xwayland: make xwl_output_get_xdg_output() static
Make xwl_output_get_xdg_output() private, it doesn't need to be
available elsewhere.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit d31a7be15e)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
04a19291c9 xwayland: do not disable glamor if EGLStream failed
EGLStream requires glamor, but the opposite is not true. So if someone
passes "-eglstream" with a GPU which does not support EGLStream, we
could maybe still try GBM and be lucky.

That allows Wayland compositors to pass "-eglstream" regardless of the
actual hardware, if they want to enable EGLStream on GPU which support
it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit e16a6da79d)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
de40a55235 xwayland: process Wayland events after adding screen
When we're done adding a new screen, we need to process any pending
Wayland events again.

Hence we don't end up processing xdg_output events unexpectedly when
glamor is disabled. Be that because "-shm" was passed or "-eglstream"
has failed.

Failing to do that could lead to a crash at startup:

    Xwayland: dixGetPrivateAddr: Assertion `key->initialized' failed.
    (EE)
    (EE) Backtrace:
    (EE) 0: Xwayland (OsSigHandler)
    (EE) 1: libpthread.so.0 (funlockfile)
    (EE) 2: libc.so.6 (gsignal)
    (EE) 3: libc.so.6 (abort)
    (EE) 4: libc.so.6 (?+0x0)
    (EE) 5: libc.so.6 (__assert_fail)
    (EE) 6: Xwayland (dixGetPrivateAddr)
    (EE) 7: Xwayland (_fbGetWindowPixmap)
    (EE) 8: Xwayland (getDrawableDamageRef)
    (EE) 9: Xwayland (damageRegionProcessPending)
    (EE) 10: Xwayland (damagePolyFillRect)
    (EE) 11: Xwayland (miPaintWindow)
    (EE) 12: Xwayland (miWindowExposures)
    (EE) 13: Xwayland (miHandleValidateExposures)
    (EE) 14: Xwayland (SetRootClip)
    (EE) 15: Xwayland (update_screen_size)
    (EE) 16: Xwayland (apply_output_change)
    (EE) 17: libffi.so.6 (ffi_call_unix64)
    (EE) 18: libffi.so.6 (ffi_call)
    (EE) 19: libwayland-client.so.0 (wl_log_set_handler_client)
    (EE) 20: libwayland-client.so.0 (_init)
    (EE) 21: libwayland-client.so.0 (wl_display_dispatch_queue_pending)
    (EE) 22: libwayland-client.so.0 (wl_display_roundtrip_queue)
    (EE) 23: Xwayland (InitInput)
    (EE) 24: Xwayland (dix_main)
    (EE) 25: libc.so.6 (__libc_start_main)
    (EE) 26: Xwayland (_start)
    (EE)
    (EE)
    Fatal server error:
    (EE) Caught signal 6 (Aborted). Server aborting
    (EE)
    Aborted (core dumped)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 44560af028)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
2d31a40db5 xwayland: "EGL_EXT_device_base" required for EGLStream
eglQueryDevicesEXT() would abort if the required extensions are not
available, meaning that enabling “-eglstream” on a non-EGLStream
capable hardware would lead to an abort().

Check that "EGL_EXT_device_base" extension is available and bail out
early if not, so we don't abort() later in eglQueryDevicesEXT().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit dbde3fec32)
2018-08-01 11:01:37 -04:00
Olivier Fourdan
65d46b2dfd xwayland: allow "-eglstream" option
The command line option "-eglstream" used to enable EGLStream support
for NVidia GPU was made available only when Xwayland was built with
EGLStream support enabled.

Wayland compositors who spawn Xwayland have no easy way to tell whether
or not Xwayland was built with EGLStream support enabled, and adding
"-eglstream" command line option to Xwayland when it wasn't built with
EGLStream support would prevent Xwayland from starting (“Unrecognized
option” error).

Make sure we support the command line option "-eglstream" regardless of
EGLStream support in Xwayland. Obviously, if Xwayland was built without
EGLStream support, this has no effect.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 06c31e782e)
2018-08-01 11:01:37 -04:00
Vladimir Panteleev
38835d1d8f glx/vndcmds: Fix vendor hash table key size
The keySize parameter of the hashing/comparison functions was
incorrectly specified to be sizeof(void*), even though the keys of
this hashtable are CARD32.

Fixes address sanitizer failure on 64-bit builds.

Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 707d0f912b)
2018-08-01 11:01:37 -04:00
Alexander Volkov
d7220428da Xext/shm: Refuse to work for remote clients
Avoid access to System V shared memory segment on the X server side
for clients forwarded via SSH. Also prevent them from hanging while
waiting for the reply from the ShmCreateSegment request.

v2: Allow ShmQueryVersion request even for remote clients

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=11080
Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit ec7e2b54c5)
2018-06-19 09:52:53 -04:00
Michał Górny
9e417072bc xfree86: Makefile shouldn't rely on superuser being named 'root'
Change the 'chown' statement in Makefile.am to use the numeric UID
of superuser instead of relying on the name 'root'.

Bugzilla: https://bugs.freedesktop.org/27726
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michał Górny <gentoo@mgorny.alt.pl>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 5c95be38e5)
2018-06-19 09:52:45 -04:00
Olivier Fourdan
2e66ed066e xwayland: use pixmap size on present flip
If the pixmap size does not match the present box size, flickering
occurs.

This can happen when the client changes its size (e.g. switching to
fullscreen), and since the buffer is kept as long as the pixmap is
valid, once the buffer is created, it remains at the wrong (old) size
and causes continuous flickering.

Use the actual pixmap's drawable size instead of the present box to
create the buffer so that it's sized appropriately.

Bugzilla: https://bugs.freedesktop.org/106841
Fixes: 0fb2cca193 "xwayland: Preliminary support for Present's new
                     window flip mode"
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit 1993f147d0)
2018-06-19 09:52:40 -04:00
Michel Dänzer
883d4d00b4 present/wnmd: Preserve window pixmap's screen_x/y on flip
The incorrect values could result in the new pixmap's contents
getting corrupted down the line.

v2:
* Guard screen_x/y lines by #ifdef COMPOSITE

Bugzilla: https://bugs.freedesktop.org/106841
Fixes: 029608dd80 "present: Add window flip mode"
Reviewed-by: Adam Jackson <ajax@redhat.com> # v1
Reviewed-by: Keith Packard <keithp@keithp.com> # v1
Reviewed-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com> # v1
(cherry picked from commit 10eec2ccb1)
2018-06-19 09:52:35 -04:00
Dave Airlie
55171d738a xwayland: fix typo in non-modifier fallback path
Pointed out on irc by q66.
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

(cherry picked from commit 6300049a9a)
2018-06-19 09:52:30 -04:00
Roman Kapl
64bf285729 Xi: add forgotten byte-swaps for Valuator fields
This has caused nonsensical values in xinput output.

Signed-off-by: Roman Kapl <code@rkapl.cz>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 40586cc4f8)
2018-06-19 09:52:17 -04:00
Roman Kapl
273115a012 Xi: fix byte-swapping of button labels
The byte-swapping code forgot that the xXIButtonInfo is followed by a
button mask, not directly by the button labels. This resulted in client
crashes in cross-endian setups, for example in `xinput list --long`,
since the client got an invalid atom.

A new function was introduced to get the right positions for the label
and mask data.

Signed-off-by: Roman Kapl <code@rkapl.cz>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit cefbc6a935)
2018-06-19 09:52:17 -04:00
Michel Dänzer
69980e4e5a exa: Use PictureMatchFormat for source-only picture format description
Their pFormat member is NULL, which resulted in a crash in
miRenderColorToPixel.

Fixes: 8171d4c2d6 "render: Store and use all 16bpc of precision for
                     solid pixels (v2.1)"
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 3ebef6ab85)
2018-06-19 09:52:17 -04:00
Michel Dänzer
33f20c38fc glamor: Propagate glamor_fds_from_pixmap error in glamor_fd_from_pixmap
glamor_fds_from_pixmap returns 0 on error, but we were treating that as
success, continuing with uninitialized stride and fd values.

Also bail if the offset isn't 0, same as in dri3_fd_from_pixmap.

v2:
* Reduce to a simple one-liner fix (Emil Velikov)

Fixes: c8c276c956 "glamor: Implement PixmapFromBuffers and
                     BuffersFromPixmap"
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 4d5950ce14)
2018-06-19 09:52:17 -04:00
Michel Dänzer
544caffae1 glamor: Always return 0 from glamor_fds_from_pixmap on error
This matches what glamor_egl_fds_from_pixmap and dri3_fds_from_pixmap do
and what proc_dri3_buffers_from_pixmap expects.

Fixes: c8c276c956 "glamor: Implement PixmapFromBuffers and
                     BuffersFromPixmap"
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 3da999a039)
2018-06-19 09:52:17 -04:00
Michel Dänzer
a9a17581ce modesetting: Pass O_CLOEXEC when opening a DRM device
We don't want DRM file descriptors to leak to child processes.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 315c63c41d)
2018-06-19 09:52:17 -04:00
Michel Dänzer
c3a06e330b xfree86: Fix O_CLOEXEC usage in lnx_platform
It was passing O_CLOEXEC as permission bits instead of as a flag.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit ab53e2859f)
2018-06-19 09:52:17 -04:00
Lukas F. Hartmann
662273397c glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays
Hi,

I upgraded Xwayland and the assorted libraries from git masters today,
and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
error was:

No provider of glVertexAttribDivisor found.  Requires one of:
    Desktop OpenGL 3.3
    OpenGL ES 3.0
    GL extension "GL_ANGLE_instanced_arrays"
    GL extension "GL_ARB_instanced_arrays"
    GL extension "GL_EXT_instanced_arrays"
    GL extension "GL_NV_instanced_arrays"

The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
rendering assumes that glVertexAttribDivisor() is always available on
GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
work fine again on this platform. After chatting with ajax in
#xorg-devel, the following solution was proposed.

This is my first time of submitting a patch, so please excuse me and
advise if I'm doing it wrong ;)

Cheers
Lukas (mntmn)
Reviewed-by: Eric Anholt <eric@anholt.net>

(cherry picked from commit 7437b6dbde)
2018-06-19 09:52:17 -04:00
Bas Nieuwenhuizen
590374bd92 DRI2: Sync radeonsi_pci_ids.h from Mesa
Fixes DRI2 client driver name mapping for newer AMD GPUs with the
modesetting driver, allowing the DRI2 extension to initialize.

Fixes using GL with the modesetting driver for me.

Seems we were way behind on this one, time to look into something
more scalable?

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 3ab32a5378)
2018-06-19 09:52:17 -04:00
Jon Turney
5407be2c51 meson: don't put literal 'PACKAGE_STRING' and 'XORG_MAN_PAGE' in man pages
Instead, substitute the same values as autotools does

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
(cherry picked from commit 27eff10bfa)
2018-06-19 09:52:17 -04:00
Jon Turney
acd881e271 meson: don't install xorg wrapper manpages if suid-wrapper isn't being used
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
(cherry picked from commit 47321bb455)
2018-06-19 09:52:17 -04:00
Jon Turney
c09c78298c meson: install xwinclip and Xwinrc man pages
Omitted from a1e8dc05

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
(cherry picked from commit 08a3583b5b)
2018-06-19 09:52:17 -04:00
1530 changed files with 208387 additions and 67695 deletions

View file

@ -5,80 +5,29 @@ version: '{build}'
skip_tags: true
clone_depth: 8
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
CYGWIN_MIRROR: http://cygwin.mirror.constant.com
CACHE: C:\cache
matrix:
- BUILD: i686-pc-cygwin
CYGWIN_ROOT: C:\cygwin
SETUP: setup-x86.exe
- BUILD: x86_64-pc-cygwin
CYGWIN_ROOT: C:\cygwin64
SETUP: setup-x86_64.exe
install:
- if "%BUILD%"=="x86_64-pc-cygwin" set SETUP=setup-x86_64.exe && set CYGWIN_ROOT=C:\cygwin64
- if "%BUILD%"=="i686-pc-cygwin" set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin
- curl -fsSL https://gist.githubusercontent.com/jon-turney/0338af595313f598bfab15a0ac0df847/raw/bd0eeca6be899e7846aa988fbcf15e4e12f5f842/zp_libtool_cleanlafiles.sh -o %CYGWIN_ROOT%\etc\postinstall\zp_libtool_cleanlafiles.sh
- echo Updating Cygwin and installing build prerequisites
- "%CYGWIN_ROOT%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g -P \
binutils,\
bison,\
ccache,\
flex,\
gcc-core,\
meson,\
ninja,\
pkg-config,\
python38,\
windowsdriproto,\
xorgproto,\
libepoxy-devel,\
libfontenc-devel,\
libfreetype-devel,\
libGL-devel,\
libnettle-devel,\
libpixman1-devel,\
libtirpc-devel,\
libXRes-devel,\
libXaw-devel,\
libXdmcp-devel,\
libXext-devel,\
libXfont2-devel,\
libXi-devel,\
libXinerama-devel,\
libXmu-devel,\
libXpm-devel,\
libXrender-devel,\
libXtst-devel,\
libxcb-composite-devel,\
libxcb-ewmh-devel,\
libxcb-icccm-devel,\
libxcb-image-devel,\
libxcb-keysyms-devel,\
libxcb-randr-devel,\
libxcb-render-devel,\
libxcb-render-util-devel,\
libxcb-shape-devel,\
libxcb-util-devel,\
libxcb-xkb-devel,\
libxcvt-devel,\
libxkbfile-devel,\
font-util,\
khronos-opengl-registry,\
python38-lxml,\
xkbcomp-devel,\
xkeyboard-config,\
xtrans"
- '%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -l "%CACHE%" -g -P "meson,binutils,bison,bzip2,diffutils,fileutils,findutils,flex,gawk,gcc-core,make,patch,pkg-config,python3,sed,tar,xorgproto,windowsdriproto,libdmx-devel,libfontenc-devel,libfreetype-devel,libGL-devel,libpixman1-devel,libX11-devel,libXRes-devel,libXau-devel,libXaw-devel,libXdmcp-devel,libXext-devel,libXfont2-devel,libXi-devel,libXinerama-devel,libXmu-devel,libXpm-devel,libXrender-devel,libXtst-devel,libxcb-ewmh-devel,libxcb-icccm-devel,libxcb-image-devel,libxcb-keysyms-devel,libxcb-randr-devel,libxcb-render-devel,libxcb-render-util-devel,libxcb-shape-devel,libxcb-util-devel,libxcb-xkb-devel,libxkbfile-devel,zlib,font-util,khronos-opengl-registry,python3-lxml,xorg-util-macros,xtrans,xkbcomp,xkeyboard-config,libnettle-devel,libepoxy-devel,libtirpc-devel"'
- echo Install done
- "%CYGWIN_ROOT%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g"
cache:
- C:\cache
- '%CYGWIN_ROOT%\home\%USERNAME%\.ccache'
build_script:
- SET PATH=%CYGWIN_ROOT%/bin
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dpciaccess=false -Dint10=false -Dglamor=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Ddmx=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dhal=false -Dudev=false -Dpciaccess=false -Dint10=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"'
test_script:
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build test"'
after_test:
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build install"'
artifacts:
- path: staging
deploy: off

View file

@ -1 +1 @@
((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))
((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))

View file

@ -1,24 +0,0 @@
# 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

82
.gitignore vendored
View file

@ -1,4 +1,82 @@
#
# X.Org module default exclusion patterns
# The next section if for module specific patterns
#
# Do not edit the following section
# GNU Build System (Autotools)
aclocal.m4
autom4te.cache/
autoscan.log
ChangeLog
compile
config.guess
config.h
config.h.in
config.log
config-ml.in
config.py
config.status
config.status.lineno
config.sub
configure
configure.scan
depcomp
.deps/
INSTALL
install-sh
.libs/
libtool
libtool.m4
ltmain.sh
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
Makefile
Makefile.in
mdate-sh
missing
mkinstalldirs
*.pc
py-compile
stamp-h?
symlink-tree
test-driver
texinfo.tex
ylwrap
# Do not edit the following section
# Edit Compile Debug Document Distribute
*~
*.swp
*.[0-9]
*.[0-9]x
*.bak
*.bin
core
*.dll
*.exe
*-ISO*.bdf
*-JIS*.bdf
*-KOI8*.bdf
*.kld
*.ko
*.ko.cmd
*.lai
*.l[oa]
*.[oa]
*.obj
*.patch
tags
*.so
*.pcf.gz
*.pdb
*.tar.bz2
*.tar.gz
#
# Add & Override patterns for xserver
#
# Edit the following section as needed
# For example, !report.pc overrides *.pc. See 'man gitignore'
#
doltcompile
doltlibtool
xserver.ent

108
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,108 @@
# IMAGE_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.
#
# In order to generate a new image, one should generally change the tag.
# While removing the image from the registry would also work, that's not
# recommended except for ephemeral images during development: Replacing an
# image after a significant amount of time might pull in newer versions of
# gcc/clang or other packages, which might break the build with older commits
# using the same tag.
#
# After merging a change resulting in generating a new image to the main
# repository, it's recommended to remove the image from the source repository's
# container registry, so that the image from the main repository's registry
# will be used there as well.
variables:
IMAGE_TAG: "debian-testing-20190219"
IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
IMAGE_MAIN: "registry.freedesktop.org/xorg/xserver:$IMAGE_TAG"
stages:
- docker-image
- build-and-test
debian-testing:
stage: docker-image
only:
changes:
- .gitlab-ci.yml
- .gitlab-ci/Dockerfile
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- mkdir kaniko-context
- |
echo "FROM $IMAGE_LOCAL" > kaniko-context/Dockerfile
# If the image exists in the local registry, skip to the build-and-test job
set +e
set -x
/kaniko/executor --context kaniko-context --no-push && exit 0
set +x
set -e
- |
echo "FROM $IMAGE_MAIN" > kaniko-context/Dockerfile
# Try to re-use the image from the main repository's registry, and if
# that fails, generate a local image from scratch
set +e
set -x
/kaniko/executor --context kaniko-context --destination $IMAGE_LOCAL && exit 0
set +x
set -e
- /kaniko/executor --context $CI_PROJECT_DIR/.gitlab-ci --destination $IMAGE_LOCAL
.common-build-and-test:
stage: build-and-test
image: $IMAGE_LOCAL
artifacts:
when: on_failure
paths:
- build/test/piglit-results/
cache:
paths:
- ccache/
variables:
LC_ALL: C.UTF-8
before_script:
- export CCACHE_BASEDIR="$PWD"
- export CCACHE_DIR="$PWD/ccache"
- export CCACHE_COMPILERCHECK=content
- export PATH="/usr/lib/ccache:$PATH"
- ccache --zero-stats
- ccache --show-stats
after_script:
- CCACHE_DIR="$PWD/ccache" ccache --show-stats
autotools-build-and-test:
extends: .common-build-and-test
script:
- mkdir build/
- cd build/
- ../autogen.sh --prefix=/usr
- make -j$(nproc) distcheck
- |
export PIGLIT_DIR=/root/piglit XTEST_DIR=/root/xts
set +e
set -x
make -j$(nproc) check
status=$?
cat test/piglit-results/xvfb/long-summary || :
exit $status
meson-build-and-test:
extends: .common-build-and-test
variables:
PIGLIT_DIR: /root/piglit
XTEST_DIR: /root/xts
script:
- meson -Dprefix=/usr build/
- |
ninja -C build/ install
set +e
set -x
ninja -C build/ test
status=$?
cat build/meson-logs/testlog.txt
cat build/test/piglit-results/xvfb/long-summary || :
exit $status

35
.gitlab-ci/Dockerfile Normal file
View file

@ -0,0 +1,35 @@
FROM debian:testing-slim
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive; \
echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/locale/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf && \
echo '#!/bin/sh' > /usr/sbin/policy-rc.d && \
echo 'exit 101' >> /usr/sbin/policy-rc.d && \
chmod +x /usr/sbin/policy-rc.d && \
echo 'deb-src https://deb.debian.org/debian testing main' >/etc/apt/sources.list.d/deb-src.list && \
apt-get update && \
apt-get install -y meson git ca-certificates ccache cmake automake autoconf libtool libwaffle-dev \
libxkbcommon-dev python3-mako python3-numpy python3-six x11-utils x11-xserver-utils xauth xvfb && \
apt-get build-dep -y xorg-server && \
\
cd /root && \
git clone https://gitlab.freedesktop.org/mesa/piglit.git && cd piglit && \
cmake -G Ninja -DPIGLIT_BUILD_GL_TESTS=OFF -DPIGLIT_BUILD_GLES1_TESTS=OFF \
-DPIGLIT_BUILD_GLES2_TESTS=OFF -DPIGLIT_BUILD_GLES3_TESTS=OFF \
-DPIGLIT_BUILD_DMA_BUF_TESTS=OFF -DPIGLIT_BUILD_GLX_TESTS=OFF && \
ninja && \
cd .. && \
git clone https://gitlab.freedesktop.org/xorg/test/xts && \
cd xts && ./autogen.sh && xvfb-run make -j$(nproc) && \
cd .. && rm -rf piglit/.git xts/.git && \
echo '[xts]' > piglit/piglit.conf && echo 'path=/root/xts' >> piglit/piglit.conf && \
find -name \*.a -o -name \*.o | xargs rm && \
\
apt-get purge -y git cmake libwaffle-dev libxkbcommon-dev \
x11-utils x11-xserver-utils xauth xvfb && \
apt-get autoremove -y --purge && apt-get clean && \
rm -f /var/lib/apt/lists/deb.debian.org_debian_dists_testing_*

366
.mailmap
View file

@ -1,366 +0,0 @@
Adam Jackson <ajax@redhat.com> <ajax@aspartame.nwnk.net>
Adam Jackson <ajax@redhat.com> <ajax@benzedrine.nwnk.net>
Adam Jackson <ajax@redhat.com> <ajax@nwnk.net>
Adam Jackson <ajax@redhat.com> <ajax@theobromine.nwnk.net>
Adam Tkac <atkac@redhat.com> <vonsch@gmail.com>
Alan Coopersmith <alan.coopersmith@oracle.com> <alan.coopersmith@sun.com>
Alan Coopersmith <alan.coopersmith@oracle.com> <alanc@alf.(none)>
Alan Hourihane <alanh@vmware.com> <alanh@fairlite.demon.co.uk>
Alan Hourihane <alanh@vmware.com> <alanh@tungstengraphics.com>
Alex Deucher <alexdeucher@gmail.com> <agd5f@yahoo.com>
Alex Deucher <alexdeucher@gmail.com> <alex@botch2.(none)>
Alex Deucher <alexdeucher@gmail.com> <alex@botch2.com>
Alex Deucher <alexdeucher@gmail.com> <alex@cube.(none)>
Alex Deucher <alexdeucher@gmail.com> <alex@samba.(none)>
Alex Deucher <alexdeucher@gmail.com> <alexander.deucher@amd.com>
Alexandr Shadchin <alexandr.shadchin@gmail.com> <Alexandr.Shadchin@gmail.com>
Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> <ander@mandriva.com.br>
Arjan van de Ven <arjan@infradead.org> <arjan@linux.intel.com>
Arkadiusz Miśkiewicz <arekm@maven.pl>
Axel Davy <davyaxel0@gmail.com> <axel.davy@ens.fr>
Bart Trojanowski <bart@jukie.net> <bart@symbio-technologies.com>
Ben Byer <bbyer@apple.com> <bbyer@bbyer.(none)>
Ben Byer <bbyer@apple.com> <bbyer@bbyer.apple.com>
Ben Byer <bbyer@apple.com> <bbyer@bbyer.local>
Ben Byer <bbyer@apple.com> <bbyer@bushing.apple.com>
Ben Byer <bbyer@apple.com> <bbyer@freedesktop.org>
Ben Byer <bbyer@apple.com> <bbyer@xyzzy.local>
Ben Gamari <bgamari.foss@gmail.com> <bgamari@gmail.com>
Ben Skeggs <bskeggs@redhat.com> <skeggsb@gmail.com>
Benjamin Close <benjamin.close@clearchain.com> <Benjamin.Close@clearchain.com>
Benjamin Tissoires <benjamin.tissoires@gmail.com> <tissoire@cena.fr>
Brian Paul <brianp@vmware.com> Brian <brian@i915.localnet.net>
Brian Paul <brianp@vmware.com> Brian <brian@yutani.localnet.net>
Brian Paul <brianp@vmware.com> <brian.paul@tungstengraphics.com>
Brice Goglin <bgoglin@debian.org> <brice.goglin@ens-lyon.org>
Carl Worth <cworth@cworth.org> <cworth@samich.home.cworth.org>
Carl Worth <cworth@cworth.org> <root@samich.home.cworth.org>
Chase Douglas <chase.douglas@canonical.com> <chase.douglas@ubuntu.com>
Chase Douglas <chase.douglas@canonical.com> <chasedouglas@gmail.com>
Christian König <christian.koenig@amd.com> <christian.koenig at amd.com>
Colin Guthrie <gmane@colin.guthr.ie> <cguthrie@mandriva.org>
Colin Harrison <colin@xming.myzen.co.uk> <colin.harrison-at-virgin.net>
Colin Harrison <colin@xming.myzen.co.uk> <colin.harrison@virgin.net>
Dan Nicholson <dbn.lists@gmail.com> <dan@conor.dwcab.com>
Daniel Drake <drake@endlessm.com> <d.drake@mmm.com>
Daniel Drake <drake@endlessm.com> <dsd@gentoo.org>
Daniel Drake <drake@endlessm.com> <dsd@laptop.org>
Daniel Martin <consume.noise@gmail.com> <daniel.martin@secunet.com>
Daniel Stone <daniels@collabora.com> <daniel.stone@nokia.com>
Daniel Stone <daniels@collabora.com> <daniel@fooishbar.org>
Dave Airlie <airlied@redhat.com> <airlied@clockmaker.usersys.redhat.com>
Dave Airlie <airlied@redhat.com> <airlied@gmail.com>
Dave Airlie <airlied@redhat.com> <airlied@linux.ie>
Dave Airlie <airlied@redhat.com> <airlied@panoply-rh.(none)>
Dave Airlie <airlied@redhat.com> <airlied@pegasus.(none)>
David Heidelberg <david@ixit.cz> David Heidelberger <david.heidelberger@ixit.cz>
David Miller <davem@davemloft.net>
David Nusinow <dnusinow@debian.org> <david@nee.(none)>
David Reveman <reveman@chromium.org> <c99drn@cs.umu.se>
David Reveman <reveman@chromium.org> <davidr@novell.com>
Demi Marie Obenour <demiobenour@gmail.com> <demi@invisiblethingslab.com>
Dodji Seketeli <dodji@seketeli.org> <dodji@openedhand.com>
Donnie Berkholz <dberkholz@gentoo.org> <donnie@supernova.(none)>
Donnie Berkholz <dberkholz@gentoo.org> <spyderous@gentoo.org>
Drew Parsons <dparsons@debian.org> <drew@emerall.com>
Drew Parsons <dparsons@debian.org> <drew@pug.localdomain>
Eamon Walsh <ewalsh@tycho.nsa.gov> <efw@eamonwalsh.com>
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@epoch.ncsc.mil>
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@moss-huskies.epoch.ncsc.mil>
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@moss-uranus.epoch.ncsc.mil>
Egbert Eich <eich@suse.de> <eich@freedesktop.org>
Egbert Eich <eich@suse.de> <eich@ovid.suse.de>
Egbert Eich <eich@suse.de> <eich@pdx.freedesktop.org>
Emil Velikov <emil.l.velikov@gmail.com> <emil.velikov@collabora.com>
Emma Anholt <emma@anholt.net> <anholt@FreeBSD.org>
Emma Anholt <emma@anholt.net> <eric@anholt.net>
Eric Engestrom <eric@igalia.com> <eric@engestrom.ch>
Eric Engestrom <eric@igalia.com> <eric.engestrom@imgtec.com>
Éric Piel <eric.piel@trempin-utc.net>
Éric Piel <eric.piel@trempin-utc.net> <E.A.B.Piel@tudelft.nl>
Erik Andrén <erik.andren@gmail.com>
Faith Ekstrand <faith.ekstrand@collabora.com> <jason@jlekstrand.net>
Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@intel.com>
Faith Ekstrand <faith.ekstrand@collabora.com> <faith@gfxstrand.net>
Felix Kuehling <felix.kuehling@amd.com> <fxkuehl@gmx.de>
François Tigeot <ftigeot@wolfpond.org>
George Sapountzis <gsapountzis@gmail.com> <gsap7@yahoo.gr>
George Staplin <gstaplin@apple.com> <gps@Georges-Workstation.local>
George Staplin <gstaplin@apple.com> <georgestaplin@george-staplins-mac-pro.local>
Haihao Xiang <haihao.xiang@intel.com>
Hans de Goede <hdegoede@redhat.com>
Hans de Goede <hdegoede@redhat.com> <j.w.r.degoede@hhs.nl>
Henry Zhao <henry.zhao@oracle.com> <henryz@localhost.localdomain>
Ian Romanick <ian.d.romanick@intel.com> <idr@localhost.localdomain>
Ian Romanick <ian.d.romanick@intel.com> <idr@umwelt.(none)>
Ian Romanick <ian.d.romanick@intel.com> <idr@us.ibm.com>
Jan Beich <jbeich@freebsd.org> <jbeich@FreeBSD.org>
Jay Cotton <jay.cotton@oracle.com> <jay.cotton@sun.com>
Jeffrey Smith <whydoubt@gmail.com>
Jeffrey Smith <whydoubt@gmail.com> <whydoubt@yahoo.com>
Jeremy C. Reed <reed@glacier.reedmedia.net> <reed@reedmedia.net>
Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@dhcp-38-248.EECS.Berkeley.EDU>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@tifa-2.local>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@tifa.local>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@yuffie.local>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremyhu@freedesktop.org>
Jeremy Uejio <jeremy.uejio@oracle.com> <jeremy.uejio@sun.com>
Jerome Glisse <jglisse@redhat.com> <glisse@freedesktop.org>
Jesse Adkins <jesserayadkins@gmail.com> <jesse_adkins7@yahoo.com>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@jbarnes-mobile.amr.corp.intel.com>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@jbarnes-t61.(none)>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@nietzche.virtuousgeek.org>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@virtuousgeek.org>
Joel Bosveld <joel.bosveld@gmail.com> <Joel.Bosveld@gmail.com>
John Tapsell <johnflux@gmail.com> <john.tapsell@john-desktop.(none)>
Jon Turney <jon.turney@dronecode.org.uk>
Julien Isorce <j.isorce@samsung.com> <julien.isorce@gmail.com>
Keith Packard <keithp@keithp.com> <keithp@dulcimer.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@guitar.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@koto.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@mandolin.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@neko.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@ukulele.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@viola.jf.intel.com>
Kevin E Martin <kem@redhat.com> <kem@freedesktop.org>
Kevin E Martin <kem@redhat.com> <kem@kem.org>
Kristian Høgsberg <krh@bitplanet.net>
Kristian Høgsberg <krh@bitplanet.net> <krh@redhat.com>
Kristian Høgsberg <krh@bitplanet.net> <krh@sasori.boston.redhat.com>
Kristian Høgsberg <krh@bitplanet.net> <krh@temari.boston.redhat.com>
Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> <lbsousajr@gmail.com>
Lina Versace <lina@kiwitree.net> <chad.versace@linux.intel.com>
Lucas Stach <dev@lynxeye.de> <l.stach@pengutronix.de>
Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
Łukasz Spintzyk <lukasz.spintzyk@synaptics.com> <lukasz.spintzyk@gmail.com>
Lyude Paul <lyude@redhat.com>
Lyude Paul <lyude@redhat.com> <cpaul@redhat.com>
Maarten Lankhorst <maarten.lankhorst@ubuntu.com> <dev@mblankhorst.nl>
Maarten Lankhorst <maarten.lankhorst@ubuntu.com> <maarten.lankhorst@canonical.com>
Marc Aurele La France <tsi@ualberta.ca> <tsi@ualberta.edu>
Mario Kleiner <mario.kleiner.de@gmail.com> <mario.kleiner@tuebingen.mpg.de>
Mark Kettenis <kettenis@openbsd.org> <mark.kettenis@xs4all.nl>
Matthew Allum <mallum@openedhand.com> <breakfast@10.am>
Matthew Allum <mallum@openedhand.com> <mallum@polystyrene.(none)>
Matthieu Herrb <matthieu@herrb.eu> <matthieu.herrb@laas.fr>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@bluenote.herrb.com>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@blues.laas.fr>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@crux.(none)>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@deville.herrb.com>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@laas.fr>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@roadrock.(none)>
Max Schwarz <Max@x-quadraht.de> <max.schwarz@online.de>
Maya Rashish <maya@NetBSD.org>
Maya Rashish <maya@NetBSD.org> <coypu@sdf.org>
Michal Srb <msrb@suse.com> <msrb@novell.com>
Michal Suchanek <hramrach@gmail.com> <hramrach@centrum.cz>
Michał Górny <gentoo@mgorny.alt.pl>
Michał Górny <gentoo@mgorny.alt.pl> <mgorny@gentoo.org>
Michael Vogt <mvo@ubuntu.com> <michael.vogt@ubuntu.com>
Michel Dänzer <michel@daenzer.net>
Michel Dänzer <michel@daenzer.net> <daenzer@debian.org>
Michel Dänzer <michel@daenzer.net> <daenzer@vmware.com>
Michel Dänzer <michel@daenzer.net> <mdaenzer@redhat.com>
Michel Dänzer <michel@daenzer.net> <michel.daenzer@amd.com>
Michel Dänzer <michel@daenzer.net> <michel@tungstengraphics.com>
Michele Baldessari <michele@redhat.com> <michele@acksyn.org>
Neil Roberts <nroberts@igalia.com> <neil@linux.intel.com>
nerdopolis <bluescreen_avenger@verizon.net> nerdopolis <rbos@rbos>
Nicolai Hähnle <nicolai.haehnle@amd.com>
Nicolai Hähnle <nicolai.haehnle@amd.com> <nhaehnle@gmail.com>
Niveditha Rau <niveditha.rau@oracle.com> <niveditha.rau@sun.com>
Oliver McFadden <oliver.mcfadden@linux.intel.com> <oliver.mcfadden@nokia.com>
Olivier Fourdan <ofourdan@redhat.com> <fourdan@xfce.org>
Owen W. Taylor <otaylor@fishsoup.net>
Owen W. Taylor <otaylor@fishsoup.net> <otaylor@huygens.home.fishsoup.net>
Owen W. Taylor <otaylor@fishsoup.net> <otaylor@redhat.com>
Pauli Nieminen <pauli.nieminen@linux.intel.com> <ext-pauli.nieminen@nokia.com>
Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <prz05@c3sl.ufpr.br>
Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <pzanoni@mandriva.com>
Pekka Paalanen <pekka.paalanen@collabora.co.uk> <pekka.paalanen@collabora.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>
Peter Hutterer <peter.hutterer@who-t.net> <whot@potoroo.wearablelab.ml.unisa.edu.au>
Peter Hutterer <peter.hutterer@who-t.net> rpm-build <rpm-build>
Pierre Willenbrock <pierre@pirsoft.de> <pierre@pirsoft.dnsalias.org>
Qiang Yu <yuq825@gmail.com> <Qiang.Yu@amd.com>
Rami Ylimaki <rami.ylimaki@vincit.fi>
Rami Ylimaki <rami.ylimaki@vincit.fi> <ext-rami.ylimaki@nokia.com>
Rémi Cardona <remi@gentoo.org>
Rémi Cardona <remi@gentoo.org> <remi.cardona@lri.fr>
Rob Clark <robclark@freedesktop.org> <robdclark@gmail.com>
Roland Bär <roland@verifysoft.de>
Roland Scheidegger <sroland@vmware.com> <rscheidegger_lists@hispeed.ch>
Roland Scheidegger <sroland@vmware.com> <sroland@tungstengraphics.com>
Roman Gilg <subdiff@gmail.com>
Roman Kapl <code@rkapl.cz>
Ross Burton <ross.burton@intel.com> <ross@burtonini.com>
Ross Burton <ross.burton@intel.com> <ross@linux.intel.com>
Sam Lau <sam.lau@oracle.com> <sam.lau@sun.com>
Simon Farnsworth <simon.farnsworth@onelan.com> <simon.farnsworth@onelan.co.uk>
Sjoerd Simons <sjoerd@collabora.com> <sjoerd.simons@collabora.co.uk>
Søren Sandmann Pedersen <sandmann@redhat.com>
Søren Sandmann Pedersen <sandmann@redhat.com> <soren.sandmann@gmail.com>
Søren Sandmann Pedersen <sandmann@redhat.com> <sandmann@daimi.au.dk>
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@l3000.localdomain>
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@redhat.com>
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@dhcp83-218.boston.redhat.com>
Stuart Kreitman <stuart.kreitman@oracle.com> <stuart.kreitman@sun.com>
Thierry Reding <treding@nvidia.com> <thierry.reding@avionic-design.de>
Thierry Reding <treding@nvidia.com> <thierry.reding@gmail.com>
Thomas Hellstrom <thellstrom@vmware.com> <thomas-at-tungstengraphics-dot-com>
Thomas Hellstrom <thellstrom@vmware.com> <thomas-at-tungstengraphics.com>
Thomas Hellstrom <thellstrom@vmware.com> <unichrome@shipmail.org>
Thomas Jaeger <thjaeger@gmail.com> <ThJaeger@gmail.com>
Tiago Vignatti <tiago.vignatti@nokia.com>
Tiago Vignatti <tiago.vignatti@nokia.com> <tiago.vignatti@Nokia.com>
Tiago Vignatti <tiago.vignatti@nokia.com> <tiagov@balalaika.(none)>
Tiago Vignatti <tiago.vignatti@nokia.com> <tv02@c3sl.ufpr.br>
Tiago Vignatti <tiago.vignatti@nokia.com> <vignatti@c3sl.ufpr.br>
Timo Aaltonen <tjaalton@debian.org> <tjaalton@cc.hut.fi>
Timo Aaltonen <tjaalton@debian.org> <tjaalton@ubuntu.com>
Tomas Carnecky <tomas.carnecky@gmail.com> <tom@dbservice.com>
Tormod Volden <debian.tormod@gmail.com> <lists.tormod@gmail.com>
Tormod Volden <debian.tormod@gmail.com> <bugzi06.fdo.tormod@xoxy.net>
Ville Syrjälä <ville.syrjala@linux.intel.com>
Ville Syrjälä <ville.syrjala@linux.intel.com> <syrjala@sci.fi>
Ville Syrjälä <ville.syrjala@linux.intel.com> <ville.syrjala@nokia.com>
Yuriy Vasilev <uuvasiliev@yandex.ru>
Zack Rusin <zackr@vmware.com> <zack@kde.org>
Zack Rusin <zackr@vmware.com> <zack@tungstengraphics.com>
Zephaniah E. Hull <warp@aehallh.com> <warp@agamemnon.b5>
Zhenyu Wang <zhenyuw@linux.intel.com> <zhenyu.z.wang@intel.com>
Zhigang Gong <zhigang.gong@intel.com> <zhigang.gong@gmail.com>
Zhigang Gong <zhigang.gong@intel.com> <zhigang.gong@linux.intel.com>
Zoltán Böszörményi <zboszor@gmail.com>
Zoltán Böszörményi <zboszor@gmail.com> <zboszor@pr.hu>

View file

@ -1,27 +1,18 @@
language: c
cache:
ccache: true
directories:
- $HOME/Library/Caches/Homebrew
cache: ccache
branches:
except:
- /appveyor.*/
os: osx
osx_image: xcode9.2
matrix:
include:
- env: TOOL=meson
- env: TOOL=autotools
- os: osx
osx_image: xcode9.2
env: DISTRO=xcode9.2
install:
- brew update
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache meson
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
script:
- ./test/scripts/build-travis-osx.sh $TOOL
- ./test/scripts/build-travis-osx.sh
- ccache -s
before_cache:
- brew cleanup

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, 2025 Oracle and/or its affiliates.
Copyright © 1987, 2003-2006, 2008-2010 Oracle and/or its affiliates.
Copyright © 1999 Keith Packard
Copyright © 2007-2009 Red Hat, Inc.
Copyright © 2005-2008 Daniel Stone

215
Makefile.am Normal file
View file

@ -0,0 +1,215 @@
AUTOMAKE_OPTIONS=nostdinc
# Required for automake < 1.14
ACLOCAL_AMFLAGS = -I m4
if COMPOSITE
COMPOSITE_DIR=composite
endif
if GLX
GLX_DIR=glx
endif
if DBE
DBE_DIR=dbe
endif
if RECORD
RECORD_DIR=record
endif
if DRI3
DRI3_DIR=dri3
endif
if PRESENT
PRESENT_DIR=present
endif
if PSEUDORAMIX
PSEUDORAMIX_DIR=pseudoramiX
endif
if GLAMOR
GLAMOR_DIR=glamor
endif
SUBDIRS = \
doc \
man \
include \
dix \
fb \
mi \
Xext \
miext \
os \
randr \
render \
Xi \
xkb \
$(PSEUDORAMIX_DIR) \
$(DBE_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
$(PRESENT_DIR) \
$(DRI3_DIR) \
exa \
$(GLAMOR_DIR) \
config \
hw \
test
if XORG
aclocaldir = $(datadir)/aclocal
aclocal_DATA = xorg-server.m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-server.pc
endif
EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh README.md
DISTCHECK_CONFIGURE_FLAGS=\
--with-xkb-path=$(XKB_BASE_DIRECTORY) \
--with-xkb-bin-directory=$(XKB_BIN_DIRECTORY) \
--with-xkb-output='$${datadir}/X11/xkb/compiled'
.PHONY: ChangeLog INSTALL
INSTALL:
$(INSTALL_CMD)
ChangeLog:
$(CHANGELOG_CMD)
dist-hook: ChangeLog INSTALL
DIST_SUBDIRS = \
doc \
man \
include \
dix \
fb \
mi \
Xext \
miext \
os \
pseudoramiX \
randr \
render \
Xi \
xkb \
dbe \
record \
xfixes \
damageext \
composite \
glx \
exa \
glamor \
config \
dri3 \
present \
hw \
test
# gross hack
relink: all
$(AM_V_at)$(MAKE) -C hw relink
install-headers: Makefile
+find . -name Makefile | while read m; do \
if grep -q install-sdkHEADERS $$m; then \
(cd `dirname "$$m"` && make install-sdkHEADERS) \
fi \
done
distcheck-hook:
cd $(srcdir) && \
meson setup _distcheck_build && \
meson configure _distcheck_build && \
ninja -C _distcheck_build && \
rm -rf _distcheck_build && \
cd -
EXTRA_DIST += \
meson_options.txt \
include/xorg-config.h.meson.in \
include/xwin-config.h.meson.in \
hw/xfree86/loader/symbol-test.c \
hw/xfree86/common/xf86Build.sh \
composite/meson.build \
config/meson.build \
damageext/meson.build \
dbe/meson.build \
dix/meson.build \
dri3/meson.build \
exa/meson.build \
fb/meson.build \
glamor/meson.build \
glx/meson.build \
hw/dmx/config/meson.build \
hw/dmx/examples/meson.build \
hw/dmx/glxProxy/meson.build \
hw/dmx/input/meson.build \
hw/dmx/meson.build \
hw/kdrive/ephyr/meson.build \
hw/kdrive/meson.build \
hw/kdrive/src/meson.build \
hw/meson.build \
hw/vfb/meson.build \
hw/xfree86/common/meson.build \
hw/xfree86/ddc/meson.build \
hw/xfree86/dixmods/meson.build \
hw/xfree86/dri2/meson.build \
hw/xfree86/dri/meson.build \
hw/xfree86/drivers/modesetting/meson.build \
hw/xfree86/exa/meson.build \
hw/xfree86/fbdevhw/meson.build \
hw/xfree86/glamor_egl/meson.build \
hw/xfree86/i2c/meson.build \
hw/xfree86/int10/meson.build \
hw/xfree86/loader/meson.build \
hw/xfree86/meson.build \
hw/xfree86/modes/meson.build \
hw/xfree86/os-support/meson.build \
hw/xfree86/parser/meson.build \
hw/xfree86/ramdac/meson.build \
hw/xfree86/shadowfb/meson.build \
hw/xfree86/vbe/meson.build \
hw/xfree86/vgahw/meson.build \
hw/xfree86/x86emu/meson.build \
hw/xfree86/xkb/meson.build \
hw/xnest/meson.build \
hw/xquartz/meson.build \
hw/xwayland/meson.build \
hw/xwin/dri/meson.build \
hw/xwin/glx/meson.build \
hw/xwin/meson.build \
hw/xwin/winclipboard/meson.build \
include/meson.build \
meson.build \
miext/damage/meson.build \
miext/shadow/meson.build \
miext/sync/meson.build \
mi/meson.build \
os/meson.build \
present/meson.build \
pseudoramiX/meson.build \
randr/meson.build \
record/meson.build \
render/meson.build \
test/bigreq/meson.build \
test/bigreq/request-length.c \
test/meson.build \
test/sync/meson.build \
test/sync/sync.c \
Xext/meson.build \
xfixes/meson.build \
Xi/meson.build \
xkb/meson.build

View file

@ -1,9 +1,3 @@
************************************************************************
* This is the now defunct 'master' branch of the xserver repository. *
* Ongoing development has moved to the 'main' branch instead. *
************************************************************************
X Server
--------
@ -25,7 +19,7 @@ Xorg mailing list:
https://lists.freedesktop.org/mailman/listinfo/xorg
The primary development code repository can be found at:
The master development code repository can be found at:
https://gitlab.freedesktop.org/xorg/xserver

View file

@ -1,50 +0,0 @@
# 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.

114
Xext/Makefile.am Normal file
View file

@ -0,0 +1,114 @@
noinst_LTLIBRARIES = libXext.la libXvidmode.la
AM_CFLAGS = $(DIX_CFLAGS)
if XORG
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
endif
# Sources always included in libXextbuiltin.la, libXext.la
BUILTIN_SRCS = \
bigreq.c \
geext.c \
shape.c \
sleepuntil.c \
sleepuntil.h \
sync.c \
syncsdk.h \
syncsrv.h \
xcmisc.c \
xtest.c
BUILTIN_LIBS =
# Optional sources included if extension enabled by configure.ac rules
# MIT Shared Memory extension
MITSHM_SRCS = shm.c shmint.h
if MITSHM
BUILTIN_SRCS += $(MITSHM_SRCS)
endif
# XVideo extension
XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
if XV
BUILTIN_SRCS += $(XV_SRCS)
endif
# XResource extension: lets clients get data about per-client resource usage
RES_SRCS = hashtable.c hashtable.h xres.c
if RES
BUILTIN_SRCS += $(RES_SRCS)
endif
# MIT ScreenSaver extension
SCREENSAVER_SRCS = saver.c
if SCREENSAVER
BUILTIN_SRCS += $(SCREENSAVER_SRCS)
endif
# Xinerama extension: making multiple video devices act as one virtual screen
XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
if XINERAMA
BUILTIN_SRCS += $(XINERAMA_SRCS)
if XORG
sdk_HEADERS += panoramiXsrv.h panoramiX.h
endif
endif
# X-ACE extension: provides hooks for building security policy extensions
# like XC-Security, X-SELinux & XTSol
XACE_SRCS = xace.c xace.h xacestr.h
if XACE
BUILTIN_SRCS += $(XACE_SRCS)
if XORG
sdk_HEADERS += xace.h xacestr.h
endif
endif
# SELinux extension: provides SELinux policy support for X objects
# requires X-ACE extension
XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
if XSELINUX
BUILTIN_SRCS += $(XSELINUX_SRCS)
BUILTIN_LIBS += $(SELINUX_LIBS)
endif
# Security extension: multi-level security to protect clients from each other
XCSECURITY_SRCS = security.c securitysrv.h
if XCSECURITY
BUILTIN_SRCS += $(XCSECURITY_SRCS)
endif
# XF86 Big Font extension
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
if XF86BIGFONT
BUILTIN_SRCS += $(BIGFONT_SRCS)
endif
# DPMS extension
DPMS_SRCS = dpms.c dpmsproc.h
if DPMSExtension
BUILTIN_SRCS += $(DPMS_SRCS)
endif
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
libXext_la_SOURCES = $(BUILTIN_SRCS)
libXext_la_LIBADD = $(BUILTIN_LIBS)
# XVidMode extension
libXvidmode_la_SOURCES = vidmode.c
EXTRA_DIST = \
$(MITSHM_SRCS) \
$(XV_SRCS) \
$(RES_SRCS) \
$(SCREENSAVER_SRCS) \
$(XACE_SRCS) \
$(XCSECURITY_SRCS) \
$(XSELINUX_SRCS) \
$(XINERAMA_SRCS) \
$(BIGFONT_SRCS) \
$(DPMS_SRCS) \
$(GE_SRCS)

View file

@ -26,18 +26,19 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "dix_priv.h"
#include "extnsionst.h"
#include <X11/extensions/bigreqsproto.h>
#include "opaque.h"
#include "extinit_priv.h"
#include "extinit.h"
static int
ProcBigReqDispatch(ClientPtr client)
@ -45,6 +46,9 @@ 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,14 +26,12 @@ 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"
@ -41,10 +39,9 @@ Equipment Corporation.
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "protocol-versions.h"
CARD16 DPMSPowerLevel = 0;
Bool DPMSDisabledSwitch = FALSE;
@ -53,178 +50,6 @@ CARD32 DPMSSuspendTime = -1;
CARD32 DPMSOffTime = -1;
Bool DPMSEnabled;
static int DPMSReqCode = 0;
static RESTYPE ClientType, DPMSEventType; /* resource types for event masks */
static XID eventResource;
typedef struct _DPMSEvent *DPMSEventPtr;
typedef struct _DPMSEvent {
DPMSEventPtr next;
ClientPtr client;
XID clientResource;
unsigned int mask;
} DPMSEventRec;
/*ARGSUSED*/ static int
DPMSFreeClient(void *data, XID id)
{
DPMSEventPtr pEvent;
DPMSEventPtr *pHead, pCur, pPrev;
pEvent = (DPMSEventPtr) data;
dixLookupResourceByType((void *) &pHead, eventResource, DPMSEventType,
NullClient, DixUnknownAccess);
if (pHead) {
pPrev = 0;
for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
pPrev = pCur;
if (pCur) {
if (pPrev)
pPrev->next = pEvent->next;
else
*pHead = pEvent->next;
}
}
free((void *) pEvent);
return 1;
}
/*ARGSUSED*/ static int
DPMSFreeEvents(void *data, XID id)
{
DPMSEventPtr *pHead, pCur, pNext;
pHead = (DPMSEventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
FreeResource(pCur->clientResource, ClientType);
free((void *) pCur);
}
free((void *) pHead);
return 1;
}
static void
SDPMSInfoNotifyEvent(xGenericEvent * from,
xGenericEvent * to)
{
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
if (from->evtype == DPMSInfoNotify) {
xDPMSInfoNotifyEvent *c = (xDPMSInfoNotifyEvent *) to;
swapl(&c->timestamp);
swaps(&c->power_level);
}
}
static int
ProcDPMSSelectInput(register ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
DPMSEventPtr pEvent, pNewEvent, *pHead;
XID clientResource;
int i;
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
client,
DixWriteAccess);
if (stuff->eventMask == DPMSInfoNotifyMask) {
if (i == Success && pHead) {
/* check for existing entry. */
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if (pEvent->client == client) {
pEvent->mask = stuff->eventMask;
return Success;
}
}
}
/* build the entry */
pNewEvent = (DPMSEventPtr)malloc(sizeof(DPMSEventRec));
if (!pNewEvent)
return BadAlloc;
pNewEvent->next = 0;
pNewEvent->client = client;
pNewEvent->mask = stuff->eventMask;
/*
* add a resource that will be deleted when
* the client goes away
*/
clientResource = FakeClientID(client->index);
pNewEvent->clientResource = clientResource;
if (!AddResource(clientResource, ClientType, (void *)pNewEvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
* of clients selecting input
*/
if (i != Success || !pHead) {
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;
}
pNewEvent->next = *pHead;
*pHead = pNewEvent;
}
else if (stuff->eventMask == 0) {
/* delete the interest */
if (i == Success && pHead) {
pNewEvent = 0;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if (pEvent->client == client)
break;
pNewEvent = pEvent;
}
if (pEvent) {
FreeResource(pEvent->clientResource, ClientType);
if (pNewEvent)
pNewEvent->next = pEvent->next;
else
*pHead = pEvent->next;
free(pEvent);
}
}
}
else {
client->errorValue = stuff->eventMask;
return BadValue;
}
return Success;
}
static void
SendDPMSInfoNotify(void)
{
DPMSEventPtr *pHead, pEvent;
xDPMSInfoNotifyEvent se;
int i;
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
serverClient,
DixReadAccess);
if (i != Success || !pHead)
return;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if ((pEvent->mask & DPMSInfoNotifyMask) == 0)
continue;
se.type = GenericEvent;
se.extension = DPMSReqCode;
se.length = (sizeof(xDPMSInfoNotifyEvent) - 32) >> 2;
se.evtype = DPMSInfoNotify;
se.timestamp = currentTime.milliseconds;
se.power_level = DPMSPowerLevel;
se.state = DPMSEnabled;
WriteEventsToClient(pEvent->client, 1, (xEvent *)&se);
}
}
Bool
DPMSSupported(void)
{
@ -261,7 +86,6 @@ int
DPMSSet(ClientPtr client, int level)
{
int rc, i;
int old_level = DPMSPowerLevel;
DPMSPowerLevel = level;
@ -285,9 +109,6 @@ DPMSSet(ClientPtr client, int level)
if (screenInfo.gpuscreens[i]->DPMS != NULL)
screenInfo.gpuscreens[i]->DPMS(screenInfo.gpuscreens[i], level);
if (DPMSPowerLevel != old_level)
SendDPMSInfoNotify();
return Success;
}
@ -299,8 +120,8 @@ ProcDPMSGetVersion(ClientPtr client)
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_DPMS_MAJOR_VERSION,
.minorVersion = SERVER_DPMS_MINOR_VERSION
.majorVersion = DPMSMajorVersion,
.minorVersion = DPMSMinorVersion
};
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
@ -391,10 +212,8 @@ ProcDPMSEnable(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSEnableReq);
DPMSEnabled = TRUE;
if (!was_enabled) {
if (!was_enabled)
SetScreenSaverTimer();
SendDPMSInfoNotify();
}
return Success;
}
@ -402,8 +221,6 @@ ProcDPMSEnable(ClientPtr client)
static int
ProcDPMSDisable(ClientPtr client)
{
Bool was_enabled = DPMSEnabled;
/* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
@ -411,8 +228,6 @@ ProcDPMSDisable(ClientPtr client)
DPMSSet(client, DPMSModeOn);
DPMSEnabled = FALSE;
if (was_enabled)
SendDPMSInfoNotify();
return Success;
}
@ -483,8 +298,6 @@ ProcDPMSDispatch(ClientPtr client)
return ProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return ProcDPMSSelectInput(client);
default:
return BadRequest;
}
@ -494,16 +307,42 @@ 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);
@ -512,10 +351,34 @@ 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);
@ -524,16 +387,16 @@ SProcDPMSForceLevel(ClientPtr client)
}
static int _X_COLD
SProcDPMSSelectInput(ClientPtr client)
SProcDPMSInfo(ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
swapl(&stuff->eventMask);
return ProcDPMSSelectInput(client);
REQUEST(xDPMSInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int _X_COLD
SProcDPMSDispatch(ClientPtr client)
{
@ -542,21 +405,19 @@ SProcDPMSDispatch(ClientPtr client)
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
return SProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
return SProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return SProcDPMSSelectInput(client);
return SProcDPMSInfo(client);
default:
return BadRequest;
}
@ -571,8 +432,6 @@ DPMSCloseDownExtension(ExtensionEntry *e)
void
DPMSExtensionInit(void)
{
ExtensionEntry *extEntry;
#define CONDITIONALLY_SET_DPMS_TIMEOUT(_timeout_value_) \
if (_timeout_value_ == -1) { /* not yet set from config */ \
_timeout_value_ = ScreenSaverTime; \
@ -585,15 +444,8 @@ DPMSExtensionInit(void)
DPMSPowerLevel = DPMSModeOn;
DPMSEnabled = DPMSSupported();
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
eventResource = FakeClientID(0);
if (DPMSEnabled && ClientType && DPMSEventType &&
(extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSCloseDownExtension, StandardMinorOpcode))) {
DPMSReqCode = extEntry->base;
GERegisterExtension(DPMSReqCode, SDPMSInfoNotifyEvent);
}
if (DPMSEnabled)
AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSCloseDownExtension, StandardMinorOpcode);
}

View file

@ -23,32 +23,26 @@
* 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_priv.h"
#include "extinit.h"
DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
GEExtension GEExtensions[MAXEXTENSIONS];
/** 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)))
/* 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 */
};
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
@ -95,6 +89,11 @@ ProcGEQueryVersion(ClientPtr client)
return Success;
}
static int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
ProcGEQueryVersion,
};
/************************************************************/
/* swapped request handlers */
/************************************************************/
@ -102,12 +101,19 @@ static int _X_COLD
SProcGEQueryVersion(ClientPtr client)
{
REQUEST(xGEQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcGEQueryVersion(client);
return (*ProcGEVector[stuff->ReqType]) (client);
}
static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
SProcGEQueryVersion
};
/************************************************************/
/* callbacks */
/************************************************************/
@ -116,29 +122,26 @@ SProcGEQueryVersion(ClientPtr client)
static int
ProcGEDispatch(ClientPtr client)
{
REQUEST(xReq);
GEClientInfoPtr pGEClient = GEGetClient(client);
switch (stuff->data) {
case X_GEQueryVersion:
return ProcGEQueryVersion(client);
default:
REQUEST(xGEReq);
if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
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)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_GEQueryVersion:
return SProcGEQueryVersion(client);
default:
REQUEST(xGEReq);
if (stuff->ReqType >= GENumberRequests)
return BadRequest;
}
return (*SProcGEVector[stuff->ReqType]) (client);
}
/* Reset extension. Called on server shutdown. */
@ -177,16 +180,24 @@ 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 (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode))
FatalError("GEInit: AddExtensions failed.\n");
if ((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0) {
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
else {
FatalError("GEInit: AddExtensions failed.\n");
}
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
/************************************************************/

View file

@ -25,12 +25,50 @@ 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,5 +1,5 @@
/*
* Copyright © 2019 Red Hat, Inc.
* 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"),
@ -20,18 +20,32 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Adam Jackson <ajax@redhat.com>
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifndef XWAYLAND_GLX_H
#define XWAYLAND_GLX_H
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#ifdef GLXEXT
#include "glx_extinit.h"
extern _X_EXPORT __GLXprovider glamor_provider;
#endif
#endif /* XWAYLAND_GLX_H */
#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,4 +1,6 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "misc.h"
@ -238,7 +240,7 @@ unsigned
ht_generic_hash(void *cdata, const void *ptr, int numBits)
{
HtGenericHashSetupPtr setup = cdata;
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0U) << numBits);
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0) << numBits);
}
int

View file

@ -40,7 +40,7 @@ typedef struct {
int keySize;
} HtGenericHashSetupRec, *HtGenericHashSetupPtr;
/** @brief ht_create initializes a hash table for a certain hash table
/** @brief ht_create initalizes a hash table for a certain hash table
configuration
@param[out] ht The hash table structure to initialize

View file

@ -10,6 +10,7 @@ srcs_xext = [
hdrs_xext = [
'geext.h',
'geint.h',
'syncsdk.h',
]
@ -36,6 +37,7 @@ endif
if build_xace
srcs_xext += 'xace.c'
hdrs_xext += ['xace.h', 'xacestr.h']
endif
if build_xf86bigfont
@ -72,6 +74,4 @@ libxserver_xext_vidmode = static_library('libxserver_xext_vidmode',
dependencies: common_dep,
)
if build_xorg
install_data(hdrs_xext, install_dir: xorgsdkdir)
endif
install_data(hdrs_xext, install_dir: xorgsdkdir)

View file

@ -23,16 +23,18 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-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"
@ -45,17 +47,18 @@ 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"
#include "resource.h"
#include "picturestr_priv.h"
#include "picturestr.h"
#include "xfixesint.h"
#include "damageextint.h"
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -744,8 +747,8 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
j = PanoramiXNumDepths;
PanoramiXNumDepths++;
PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
PanoramiXNumDepths, sizeof(DepthRec));
PanoramiXDepths = reallocarray(PanoramiXDepths,
PanoramiXNumDepths, sizeof(DepthRec));
PanoramiXDepths[j].depth = pDepth->depth;
PanoramiXDepths[j].numVids = 0;
PanoramiXDepths[j].vids = NULL;
@ -817,11 +820,11 @@ PanoramiXConsolidate(void)
for (i = 0; i < pScreen->numVisuals; i++)
PanoramiXMaybeAddVisual(pVisual++);
root = XNFcallocarray(1, sizeof(PanoramiXRes));
root = malloc(sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
defmap = XNFcallocarray(1, sizeof(PanoramiXRes));
defmap = malloc(sizeof(PanoramiXRes));
defmap->type = XRT_COLORMAP;
saver = XNFcallocarray(1, sizeof(PanoramiXRes));
saver = malloc(sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
FOR_NSCREENS(i) {

View file

@ -39,8 +39,9 @@ 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,7 +23,9 @@ 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>
@ -45,10 +47,22 @@ 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);
@ -58,6 +72,8 @@ static int _X_COLD
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl(&stuff->window);
return ProcPanoramiXGetScreenCount(client);
@ -67,19 +83,41 @@ 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 ProcPanoramiXQueryVersion(client);
return SProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
@ -87,9 +125,9 @@ SProcPanoramiXDispatch(ClientPtr client)
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return ProcXineramaIsActive(client);
return SProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return ProcXineramaQueryScreens(client);
return SProcXineramaQueryScreens(client);
}
return BadRequest;
}

View file

@ -25,15 +25,13 @@ 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"
@ -477,7 +475,7 @@ PanoramiXConfigureWindow(ClientPtr client)
/* because we need the parent */
result = dixLookupResourceByType((void **) &pWin, stuff->window,
X11_RESTYPE_WINDOW, client, DixWriteAccess);
RT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -1107,10 +1105,6 @@ PanoramiXCopyArea(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
drawables[j]->pScreen->SourceValidate(drawables[j], 0, 0,
drawables[j]->width,
drawables[j]->height,
IncludeInferiors);
}
pitch = PixmapBytePad(width, drawables[0]->depth);
@ -2013,12 +2007,6 @@ PanoramiXGetImage(ClientPtr client)
if (rc != Success)
return rc;
}
FOR_NSCREENS_FORWARD(i) {
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
drawables[i]->width,
drawables[i]->height,
IncludeInferiors);
}
xgi = (xGetImageReply) {
.type = X_Reply,

View file

@ -26,18 +26,12 @@ 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"
@ -47,35 +41,52 @@ in this Software without prior written authorization from the X Consortium.
#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 XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "protocol-versions.h"
#include "extinit_priv.h"
// temporary workaround for win32/mingw32 name clash
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
#undef CreateWindow
#include <stdio.h>
#include "extinit.h"
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 */
@ -182,6 +193,8 @@ 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)
{
@ -204,7 +217,7 @@ MakeScreenPrivate(ScreenPtr pScreen)
if (pPriv)
return pPriv;
pPriv = calloc(1, sizeof(ScreenSaverScreenPrivateRec));
pPriv = New(ScreenSaverScreenPrivateRec);
if (!pPriv)
return 0;
pPriv->events = 0;
@ -254,7 +267,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
}
else {
if (!pEv) {
pEv = calloc(1, sizeof(ScreenSaverEventRec));
pEv = New(ScreenSaverEventRec);
if (!pEv) {
CheckScreenPrivate(pScreen);
return FALSE;
@ -353,7 +366,7 @@ ScreenSaverFreeSuspend(void *value, XID id)
}
}
/* Re-enable the screensaver if this was the last client suspending it. */
/* Reenable the screensaver if this was the last client suspending it. */
if (screenSaverSuspended && suspendingClients == NULL) {
screenSaverSuspended = FALSE;
@ -437,7 +450,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
if (pPriv && pPriv->installedMap != None) {
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
X11_RESTYPE_COLORMAP, serverClient,
RT_COLORMAP, serverClient,
DixUninstallAccess);
if (rc == Success)
(*pCmap->pScreen->UninstallColormap) (pCmap);
@ -461,7 +474,7 @@ CreateSaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
FreeResource(pSaver->wid, RT_NONE);
if (pPriv) {
UninstallSaverColormap(pScreen);
pPriv->hasWindow = FALSE;
@ -485,7 +498,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (!pWin)
return FALSE;
if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, pWin))
if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
return FALSE;
mask = 0;
@ -505,7 +518,7 @@ CreateSaverWindow(ScreenPtr pScreen)
CursorPtr cursor;
if (!pWin->optional)
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
FreeResource(pWin->drawable.id, RT_NONE);
return FALSE;
}
cursor = RefCursor(pAttr->pCursor);
@ -533,7 +546,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (wantMap == None || IsMapInstalled(wantMap, pWin))
return TRUE;
result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
serverClient, DixInstallAccess);
if (result != Success)
return TRUE;
@ -557,7 +570,7 @@ DestroySaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
FreeResource(pSaver->wid, RT_NONE);
}
pPriv->hasWindow = FALSE;
CheckScreenPrivate(pScreen);
@ -588,9 +601,9 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
ret = TRUE;
}
#ifdef XINERAMA
#ifdef PANORAMIX
if (noPanoramiXExtension || !pScreen->myNum)
#endif /* XINERAMA */
#endif
SendScreenSaverNotify(pScreen, state, force);
return ret;
}
@ -611,8 +624,6 @@ 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;
@ -634,7 +645,8 @@ ProcScreenSaverQueryInfo(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixGetAttrAccess);
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
DixGetAttrAccess);
if (rc != Success)
return rc;
@ -703,7 +715,8 @@ ProcScreenSaverSelectInput(ClientPtr client)
if (rc != Success)
return rc;
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixSetAttrAccess);
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
DixSetAttrAccess);
if (rc != Success)
return rc;
@ -713,8 +726,9 @@ ProcScreenSaverSelectInput(ClientPtr client)
}
static int
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
ScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
WindowPtr pParent;
ScreenPtr pScreen;
@ -737,6 +751,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
Colormap cmap;
ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (ret != Success)
@ -744,11 +759,11 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
pScreen = pDraw->pScreen;
pParent = pScreen->root;
ret = XaceHookScreensaverAccess(client, pScreen, DixSetAttrAccess);
ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
if (ret != Success)
return ret;
len = client->req_len - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
if (!stuff->width || !stuff->height) {
@ -833,7 +848,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
if (!pPriv)
return FALSE;
}
pAttr = calloc(1, sizeof(ScreenSaverAttrRec));
pAttr = New(ScreenSaverAttrRec);
if (!pAttr) {
ret = BadAlloc;
goto bail;
@ -884,7 +899,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
RT_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -916,7 +931,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
RT_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -999,7 +1014,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
break;
case CWColormap:
cmap = (Colormap) * pVlist;
ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
client, DixUseAccess);
if (ret != Success) {
client->errorValue = cmap;
@ -1019,7 +1034,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
}
else {
ret = dixLookupResourceByType((void **) &pCursor, cursorID,
X11_RESTYPE_CURSOR, client, DixUseAccess);
RT_CURSOR, client, DixUseAccess);
if (ret != Success) {
client->errorValue = cursorID;
goto PatchUp;
@ -1036,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
pVlist++;
}
if (pPriv->attr)
FreeResource(pPriv->attr->resource, AttrType);
FreeScreenAttr(pPriv->attr);
pPriv->attr = pAttr;
pAttr->resource = FakeClientID(client->index);
if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
@ -1053,13 +1068,16 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
}
static int
ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
ScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv;
int rc;
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate(pDraw->pScreen);
@ -1075,11 +1093,9 @@ ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
static int
ProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
REQUEST(xScreenSaverSetAttributesReq);
PanoramiXRes *draw;
PanoramiXRes *backPix = NULL;
PanoramiXRes *bordPix = NULL;
@ -1088,13 +1104,15 @@ 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 =
client->req_len -
stuff->length -
bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
@ -1149,27 +1167,26 @@ ProcScreenSaverSetAttributes(ClientPtr client)
if (orig_visual != CopyFromParent)
stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
status = ScreenSaverSetAttributes(client, stuff);
status = ScreenSaverSetAttributes(client);
}
return status;
}
#endif /* XINERAMA */
#endif
return ScreenSaverSetAttributes(client, stuff);
return ScreenSaverSetAttributes(client);
}
static int
ProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
REQUEST(xScreenSaverUnsetAttributesReq);
PanoramiXRes *draw;
int rc, i;
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
@ -1177,14 +1194,15 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
return (rc == BadValue) ? BadDrawable : rc;
for (i = PanoramiXNumScreens - 1; i > 0; i--) {
ScreenSaverUnsetAttributes(client, draw->info[i].id);
stuff->drawable = draw->info[i].id;
ScreenSaverUnsetAttributes(client);
}
stuff->drawable = draw->info[0].id;
}
#endif /* XINERAMA */
#endif
return ScreenSaverUnsetAttributes(client, stuff->drawable);
return ScreenSaverUnsetAttributes(client);
}
static int
@ -1213,7 +1231,7 @@ ProcScreenSaverSuspend(ClientPtr client)
if (suspend == TRUE)
this->count++;
else if (--this->count == 0)
FreeResource(this->clientResource, X11_RESTYPE_NONE);
FreeResource(this->clientResource, RT_NONE);
return Success;
}
@ -1225,7 +1243,7 @@ ProcScreenSaverSuspend(ClientPtr client)
/*
* Allocate a suspension record for the client, and stop the screensaver
* if it isn't already suspended by another client. We attach a resource ID
* to the record, so the screensaver will be re-enabled and the record freed
* to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first.
*/
this = malloc(sizeof(ScreenSaverSuspensionRec));
@ -1253,13 +1271,11 @@ ProcScreenSaverSuspend(ClientPtr client)
}
static int (*NormalVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,
ProcScreenSaverSelectInput,
ProcScreenSaverSetAttributes,
ProcScreenSaverUnsetAttributes,
ProcScreenSaverSuspend,
};
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
static int
ProcScreenSaverDispatch(ClientPtr client)
@ -1271,10 +1287,20 @@ 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);
@ -1284,6 +1310,7 @@ static int _X_COLD
SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
@ -1294,6 +1321,7 @@ static int _X_COLD
SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1311,6 +1339,7 @@ static int _X_COLD
SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
return ProcScreenSaverUnsetAttributes(client);
@ -1320,19 +1349,19 @@ static int _X_COLD
SProcScreenSaverSuspend(ClientPtr client)
{
REQUEST(xScreenSaverSuspendReq);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
swaps(&stuff->length);
swapl(&stuff->suspend);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
return ProcScreenSaverSuspend(client);
}
static int (*SwappedVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
SProcScreenSaverQueryVersion,
SProcScreenSaverQueryInfo,
SProcScreenSaverSelectInput,
SProcScreenSaverSetAttributes,
SProcScreenSaverUnsetAttributes,
SProcScreenSaverSuspend,
};
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
static int _X_COLD
SProcScreenSaverDispatch(ClientPtr client)

View file

@ -24,19 +24,9 @@ in this Software without prior written authorization from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#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"
#endif
#include "scrnintstr.h"
#include "inputstr.h"
@ -44,8 +34,10 @@ in this Software without prior written authorization from The Open Group.
#include "propertyst.h"
#include "colormapst.h"
#include "privates.h"
#include "registry.h"
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
#include "extinit.h"
#include "protocol-versions.h"
@ -155,7 +147,7 @@ SecurityLabelInitial(void)
/*
* Looks up a request name
*/
static inline const char *
static _X_INLINE const char *
SecurityLookupRequestName(ClientPtr client)
{
return LookupRequestName(client->majorOp, client->minorOp);
@ -206,7 +198,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.authId = pAuth->id
};
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
FreeResource(pEventClient->resource, RT_NONE);
}
/* kill all clients using this auth */
@ -312,7 +304,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
pAuth->secondsRemaining);
}
else {
FreeResource(pAuth->id, X11_RESTYPE_NONE);
FreeResource(pAuth->id, RT_NONE);
return 0;
}
} /* SecurityAuthorizationExpired */
@ -376,7 +368,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
pEventClient; pEventClient = pEventClient->next) {
if (SameClient(pEventClient, client)) {
if (mask == 0)
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
FreeResource(pEventClient->resource, RT_NONE);
else
pEventClient->mask = mask;
return Success;
@ -588,7 +580,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->authId, X11_RESTYPE_NONE);
FreeResource(stuff->authId, RT_NONE);
return Success;
} /* ProcSecurityRevokeAuthorization */
@ -613,6 +605,8 @@ static int _X_COLD
SProcSecurityQueryVersion(ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
@ -626,6 +620,8 @@ 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);
@ -633,10 +629,10 @@ SProcSecurityGenerateAuthorization(ClientPtr client)
values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
bytes_to_int32(stuff->nbytesAuthData);
if (values_offset >
client->req_len - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
return BadLength;
values = (CARD32 *) (&stuff[1]) + values_offset;
nvalues = (((CARD32 *) stuff) + client->req_len) - values;
nvalues = (((CARD32 *) stuff) + stuff->length) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);
} /* SProcSecurityGenerateAuthorization */
@ -645,6 +641,8 @@ static int _X_COLD
SProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
@ -749,12 +747,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 == X11_RESTYPE_WINDOW))
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
((WindowPtr) rec->res)->forcedBG = TRUE;
/* additional permissions for specific resource types */
if (rec->rtype == X11_RESTYPE_WINDOW)
if (rec->rtype == RT_WINDOW)
allowed |= SecurityWindowExtraMask;
/* special checks for server-owned resources */
@ -763,7 +761,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
/* additional operations allowed on root windows */
allowed |= SecurityRootWindowExtraMask;
else if (rec->rtype == X11_RESTYPE_COLORMAP)
else if (rec->rtype == RT_COLORMAP)
/* allow access to default colormaps */
allowed = requested;

View file

@ -30,8 +30,27 @@ 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,16 +24,14 @@ 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"
@ -43,9 +41,10 @@ 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_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
@ -65,10 +64,10 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
* externally by the Xfixes extension and are now defined in window.h
*/
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
static int ShapeEventBase = 0;
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
@ -266,7 +265,7 @@ ProcShapeRectangles(ClientPtr client)
client->errorValue = stuff->ordering;
return BadValue;
}
nrects = ((client->req_len << 2) - sizeof(xShapeRectanglesReq));
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
return BadLength;
nrects >>= 3;
@ -297,7 +296,7 @@ ProcShapeRectangles(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeRectangles(ClientPtr client)
{
@ -320,7 +319,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/**************
* ProcShapeMask
@ -363,7 +362,7 @@ ProcShapeMask(ClientPtr client)
srcRgn = 0;
else {
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
RT_PIXMAP, client, DixReadAccess);
if (rc != Success)
return rc;
if (pPixmap->drawable.pScreen != pScreen ||
@ -395,7 +394,7 @@ ProcShapeMask(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeMask(ClientPtr client)
{
@ -429,7 +428,7 @@ ProcPanoramiXShapeMask(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/************
* ProcShapeCombine
@ -523,7 +522,7 @@ ProcShapeCombine(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeCombine(ClientPtr client)
{
@ -552,7 +551,7 @@ ProcPanoramiXShapeCombine(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/*************
* ProcShapeOffset
@ -594,7 +593,7 @@ ProcShapeOffset(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeOffset(ClientPtr client)
{
@ -617,7 +616,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
static int
ProcShapeQueryExtents(ClientPtr client)
@ -784,7 +783,7 @@ ProcShapeSelectInput(ClientPtr client)
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
FreeResource(clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
@ -1035,32 +1034,32 @@ ProcShapeDispatch(ClientPtr client)
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeRectangles(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeRectangles(client);
case X_ShapeMask:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeMask(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeMask(client);
case X_ShapeCombine:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeCombine(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeCombine(client);
case X_ShapeOffset:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeOffset(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeOffset(client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents(client);
@ -1090,10 +1089,21 @@ 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);
@ -1106,6 +1116,8 @@ static int _X_COLD
SProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1118,6 +1130,8 @@ static int _X_COLD
SProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1130,6 +1144,8 @@ static int _X_COLD
SProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1141,6 +1157,8 @@ static int _X_COLD
SProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
return ProcShapeQueryExtents(client);
@ -1150,6 +1168,8 @@ static int _X_COLD
SProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
return ProcShapeSelectInput(client);
@ -1159,6 +1179,8 @@ static int _X_COLD
SProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
return ProcShapeInputSelected(client);
@ -1168,6 +1190,7 @@ static int _X_COLD
SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
return ProcShapeGetRectangles(client);
@ -1179,7 +1202,7 @@ SProcShapeDispatch(ClientPtr client)
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
return SProcShapeQueryVersion(client);
case X_ShapeRectangles:
return SProcShapeRectangles(client);
case X_ShapeMask:

View file

@ -28,29 +28,21 @@ 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>
#include <sys/mman.h>
#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_priv.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -60,8 +52,11 @@ in this Software without prior written authorization from The Open Group.
#include "servermd.h"
#include "shmint.h"
#include "xace.h"
#include "extinit_priv.h"
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include <sys/mman.h>
#include "protocol-versions.h"
#include "busfault.h"
/* Needed for Solaris cross-zone shared memory extension */
#ifdef HAVE_SHMCTL64
@ -90,10 +85,12 @@ in this Software without prior written authorization from The Open Group.
#define SHMPERM_MODE(p) p->mode
#endif
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#include "extinit.h"
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
@ -210,7 +207,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
if (!screen_priv) {
screen_priv = XNFcallocarray(1, sizeof(ShmScrPrivateRec));
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
@ -251,14 +248,13 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret = TRUE;
Bool ret;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
@ -304,8 +300,8 @@ ProcShmQueryVersion(ClientPtr client)
}
/*
* Simulate the access() system call for a shared memory segment,
* using the credentials from the client if available.
* Simulate the access() system call for a shared memory segement,
* using the credentials from the client if available
*/
static int
shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
@ -460,7 +456,7 @@ ProcShmDetach(ClientPtr client)
REQUEST_SIZE_MATCH(xShmDetachReq);
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
FreeResource(stuff->shmseg, RT_NONE);
return Success;
}
@ -482,8 +478,8 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
PixmapBytePad(w, depth), data);
if (!pPixmap)
return;
(void) pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC,
sx, sy, sw, sh, dx, dy);
pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
dy);
FreeScratchPixmapHeader(pPixmap);
}
else {
@ -656,9 +652,6 @@ ProcShmGetImage(ClientPtr client)
visual = wVisual(((WindowPtr) pDraw));
if (pDraw->type == DRAWABLE_WINDOW)
pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
pDraw->pScreen->SourceValidate(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
IncludeInferiors);
}
else {
if (stuff->x < 0 ||
@ -732,7 +725,7 @@ ProcShmGetImage(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
@ -867,12 +860,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return rc;
}
}
FOR_NSCREENS_FORWARD(i) {
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
drawables[i]->width,
drawables[i]->height,
IncludeInferiors);
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
@ -997,8 +984,8 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
stuff->offset);
if (pMap) {
result = XaceHookResourceAccess(client, stuff->pid,
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
break;
@ -1007,7 +994,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, X11_RESTYPE_PIXMAP, (void *) pMap)) {
if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *) pMap)) {
result = BadAlloc;
break;
}
@ -1020,7 +1007,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (result != Success) {
while (j--)
FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
FreeResource(newPix->info[j].id, RT_NONE);
free(newPix);
}
else
@ -1028,7 +1015,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
return result;
}
#endif /* XINERAMA */
#endif
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1112,8 +1099,8 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->addr +
stuff->offset);
if (pMap) {
rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
@ -1122,7 +1109,7 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) {
if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) {
return Success;
}
}
@ -1140,7 +1127,7 @@ ShmBusfaultNotify(void *context)
(unsigned int) shmdesc->resource);
busfault_unregister(shmdesc->busfault);
shmdesc->busfault = NULL;
FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
FreeResource (shmdesc->resource, RT_NONE);
}
static int
@ -1207,55 +1194,36 @@ ProcShmAttachFd(ClientPtr client)
static int
shm_tmpfile(void)
{
const char *shmdirs[] = {
"/run/shm",
"/var/tmp",
"/tmp",
};
int fd;
#ifdef HAVE_MEMFD_CREATE
fd = memfd_create("xorg", MFD_CLOEXEC|MFD_ALLOW_SEALING);
if (fd != -1) {
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK);
DebugF ("Using memfd_create\n");
return fd;
}
#endif
#ifdef SHMDIR
int fd;
char template[] = SHMDIR "/shmfd-XXXXXX";
#ifdef O_TMPFILE
for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
fd = open(shmdirs[i], O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
if (fd >= 0) {
DebugF ("Using O_TMPFILE\n");
return fd;
}
}
ErrorF ("Not using O_TMPFILE\n");
fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
if (fd >= 0) {
DebugF ("Using O_TMPFILE\n");
return fd;
}
ErrorF ("Not using O_TMPFILE\n");
#endif
for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
char template[PATH_MAX];
snprintf(template, ARRAY_SIZE(template), "%s/shmfd-XXXXXX", shmdirs[i]);
#ifdef HAVE_MKOSTEMP
fd = mkostemp(template, O_CLOEXEC);
fd = mkostemp(template, O_CLOEXEC);
#else
fd = mkstemp(template);
fd = mkstemp(template);
#endif
if (fd < 0)
continue;
unlink(template);
if (fd < 0)
return -1;
unlink(template);
#ifndef HAVE_MKOSTEMP
int flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, flags);
}
int flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, &flags);
}
#endif
return fd;
#else
return -1;
#endif
return fd;
}
return -1;
}
static int
@ -1322,7 +1290,7 @@ ProcShmCreateSegment(ClientPtr client)
}
if (WriteFdToClient(client, fd, TRUE) < 0) {
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
FreeResource(stuff->shmseg, RT_NONE);
close(fd);
return BadAlloc;
}
@ -1348,22 +1316,22 @@ ProcShmDispatch(ClientPtr client)
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShmPutImage(client);
#endif /* XINERAMA */
#endif
return ProcShmPutImage(client);
case X_ShmGetImage:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShmGetImage(client);
#endif /* XINERAMA */
#endif
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShmCreatePixmap(client);
#endif /* XINERAMA */
#endif
return ProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
@ -1388,10 +1356,20 @@ 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);
@ -1402,6 +1380,7 @@ static int _X_COLD
SProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmDetachReq);
swapl(&stuff->shmseg);
return ProcShmDetach(client);
@ -1411,6 +1390,7 @@ static int _X_COLD
SProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmPutImageReq);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1431,6 +1411,7 @@ static int _X_COLD
SProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmGetImageReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1447,6 +1428,7 @@ static int _X_COLD
SProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
swapl(&stuff->pid);
swapl(&stuff->drawable);
@ -1463,6 +1445,7 @@ SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
@ -1472,6 +1455,7 @@ static int _X_COLD
SProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
swapl(&stuff->shmseg);
swapl(&stuff->size);
@ -1485,7 +1469,7 @@ SProcShmDispatch(ClientPtr client)
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return ProcShmQueryVersion(client);
return SProcShmQueryVersion(client);
if (!client->local)
return BadRequest;

View file

@ -27,7 +27,9 @@ 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>
@ -123,7 +125,8 @@ ClientSleepUntil(ClientPtr client,
static void
ClientAwaken(ClientPtr client, void *closure)
{
AttendClient(client);
if (!client->clientGone)
AttendClient(client);
}
static int
@ -164,7 +167,7 @@ SertafiedBlockHandler(void *data, void *wt)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, X11_RESTYPE_NONE);
FreeResource(pReq->id, RT_NONE);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
@ -193,7 +196,7 @@ SertafiedWakeupHandler(void *data, int i)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, X11_RESTYPE_NONE);
FreeResource(pReq->id, RT_NONE);
}
if (!pPending) {
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,

View file

@ -49,18 +49,15 @@ 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"
@ -68,17 +65,18 @@ PERFORMANCE OF THIS SOFTWARE.
#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_priv.h"
#include "extinit.h"
/*
* Local Global Variables
@ -201,8 +199,8 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
return Success;
}
/* Failure is not an option, it's succeed or burst! */
pCur = XNFalloc(sizeof(SyncTriggerList));
if (!(pCur = malloc(sizeof(SyncTriggerList))))
return BadAlloc;
pCur->pTrigger = pTrigger;
pCur->next = pTrigger->pSync->pTriglist;
@ -331,6 +329,11 @@ 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 */
@ -352,24 +355,6 @@ 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) {
@ -398,11 +383,21 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
}
}
if (changes & XSyncCACounter) {
if (pSync != pTrigger->pSync) { /* new counter for trigger */
SyncDeleteTriggerFromSyncObject(pTrigger);
pTrigger->pSync = pSync;
newSyncObject = TRUE;
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;
}
}
}
@ -410,7 +405,8 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
* a new counter on a trigger
*/
if (newSyncObject) {
SyncAddTriggerToSyncObject(pTrigger);
if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success)
return rc;
}
else if (pCounter && IsSystemCounter(pCounter)) {
SyncComputeBracketValues(pCounter);
@ -697,7 +693,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
/* unblock the client */
AttendClient(pAwaitUnion->header.client);
/* delete the await */
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
}
static int64_t
@ -752,7 +748,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
* nothing, since it's already got them.
*/
if (!wantevents) {
FreeResource(pClients->delete_id, X11_RESTYPE_NONE);
FreeResource(pClients->delete_id, RT_NONE);
}
return Success;
}
@ -801,14 +797,8 @@ 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;
trigger = pAlarm->trigger;
delta = pAlarm->delta;
counter = trigger.pSync ? trigger.pSync->id : None;
counter = pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None;
while (mask) {
int index2 = lowbit(mask);
@ -824,24 +814,24 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
case XSyncCAValueType:
mask &= ~XSyncCAValueType;
/* sanity check in SyncInitTrigger */
trigger.value_type = *values++;
pAlarm->trigger.value_type = *values++;
break;
case XSyncCAValue:
mask &= ~XSyncCAValue;
trigger.wait_value = ((int64_t)values[0] << 32) | values[1];
pAlarm->trigger.wait_value = ((int64_t)values[0] << 32) | values[1];
values += 2;
break;
case XSyncCATestType:
mask &= ~XSyncCATestType;
/* sanity check in SyncInitTrigger */
trigger.test_type = *values++;
pAlarm->trigger.test_type = *values++;
break;
case XSyncCADelta:
mask &= ~XSyncCADelta;
delta = ((int64_t)values[0] << 32) | values[1];
pAlarm->delta = ((int64_t)values[0] << 32) | values[1];
values += 2;
break;
@ -851,8 +841,10 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
client->errorValue = *values;
return BadValue;
}
select_events_value = (Bool) (*values++);
select_events_changed = TRUE;
status = SyncEventSelectForAlarm(pAlarm, client,
(Bool) (*values++));
if (status != Success)
return status;
break;
default:
@ -861,33 +853,25 @@ 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 ((((trigger.test_type == XSyncPositiveComparison) ||
(trigger.test_type == XSyncPositiveTransition))
&& delta < 0)
if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) ||
(pAlarm->trigger.test_type == XSyncPositiveTransition))
&& pAlarm->delta < 0)
||
(((trigger.test_type == XSyncNegativeComparison) ||
(trigger.test_type == XSyncNegativeTransition))
&& delta > 0)
(((pAlarm->trigger.test_type == XSyncNegativeComparison) ||
(pAlarm->trigger.test_type == XSyncNegativeTransition))
&& pAlarm->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;
@ -897,21 +881,18 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
return Success;
}
SyncObject *
static SyncObject *
SyncCreate(ClientPtr client, XID id, unsigned char type)
{
SyncObject *pSync;
RESTYPE resType;
switch (type) {
case SYNC_COUNTER:
pSync = malloc(sizeof(SyncCounter));
resType = RTCounter;
break;
case SYNC_FENCE:
pSync = (SyncObject *) dixAllocateObjectWithPrivates(SyncFence,
PRIVATE_SYNC_FENCE);
resType = RTFence;
break;
default:
return NULL;
@ -920,11 +901,6 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
if (!pSync)
return NULL;
pSync->initialized = FALSE;
if (!AddResource(id, resType, (void *) pSync))
return NULL;
pSync->client = client;
pSync->id = id;
pSync->pTriglist = NULL;
@ -947,10 +923,13 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
if (status != Success) {
FreeResource(pFence->sync.id, X11_RESTYPE_NONE);
dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
return status;
}
if (!AddResource(id, RTFence, (void *) pFence))
return BadAlloc;
return Success;
#else
return BadImplementation;
@ -978,7 +957,8 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, int64_t initialvalue)
pCounter->value = initialvalue;
pCounter->pSysCounterInfo = NULL;
pCounter->sync.initialized = TRUE;
if (!AddResource(id, RTCounter, (void *) pCounter))
return NULL;
return pCounter;
}
@ -1005,8 +985,8 @@ SyncCreateSystemCounter(const char *name,
psci = malloc(sizeof(SysCounterInfo));
if (!psci) {
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return NULL;
FreeResource(pCounter->sync.id, RT_NONE);
return pCounter;
}
pCounter->pSysCounterInfo = psci;
psci->pCounter = pCounter;
@ -1028,7 +1008,7 @@ SyncDestroySystemCounter(void *pSysCounter)
{
SyncCounter *pCounter = (SyncCounter *) pSysCounter;
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
FreeResource(pCounter->sync.id, RT_NONE);
}
static void
@ -1141,7 +1121,7 @@ FreeAlarm(void *addr, XID id)
/* delete event selections */
while (pAlarm->pEventClients)
FreeResource(pAlarm->pEventClients->delete_id, X11_RESTYPE_NONE);
FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
SyncDeleteTriggerFromSyncObject(&pAlarm->trigger);
@ -1157,26 +1137,21 @@ static int
FreeCounter(void *env, XID id)
{
SyncCounter *pCounter = (SyncCounter *) env;
SyncTriggerList *ptl, *pnext;
pCounter->sync.beingDestroyed = TRUE;
if (pCounter->sync.initialized) {
SyncTriggerList *ptl, *pnext;
/* tell all the counter's triggers that counter has been destroyed */
for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
(*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
pnext = ptl->next;
free(ptl); /* destroy the trigger list as we go */
}
if (IsSystemCounter(pCounter)) {
xorg_list_del(&pCounter->pSysCounterInfo->entry);
free(pCounter->pSysCounterInfo->name);
free(pCounter->pSysCounterInfo->private);
free(pCounter->pSysCounterInfo);
}
/* tell all the counter's triggers that the counter has been destroyed */
for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
(*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger);
pnext = ptl->next;
free(ptl); /* destroy the trigger list as we go */
}
if (IsSystemCounter(pCounter)) {
xorg_list_del(&pCounter->pSysCounterInfo->entry);
free(pCounter->pSysCounterInfo->name);
free(pCounter->pSysCounterInfo->private);
free(pCounter->pSysCounterInfo);
}
free(pCounter);
return Success;
}
@ -1506,7 +1481,7 @@ ProcSyncDestroyCounter(ClientPtr client)
client->errorValue = stuff->counter;
return BadAccess;
}
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
FreeResource(pCounter->sync.id, RT_NONE);
return Success;
}
@ -1607,7 +1582,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, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
client->errorValue = pProtocolWaitConds->counter;
return SyncErrorBase + XSyncBadCounter;
}
@ -1627,7 +1602,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, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -1758,7 +1733,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (!SyncCheckWarnIsCounter(pTrigger->pSync,
WARN_INVALID_COUNTER_ALARM)) {
FreeResource(stuff->id, X11_RESTYPE_NONE);
FreeResource(stuff->id, RT_NONE);
return BadAlloc;
}
@ -1889,7 +1864,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->alarm, X11_RESTYPE_NONE);
FreeResource(stuff->alarm, RT_NONE);
return Success;
}
@ -1914,6 +1889,9 @@ ProcSyncCreateFence(ClientPtr client)
miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered);
if (!AddResource(stuff->fid, RTFence, (void *) pFence))
return BadAlloc;
return Success;
}
@ -1994,7 +1972,7 @@ ProcSyncDestroyFence(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->fid, X11_RESTYPE_NONE);
FreeResource(stuff->fid, RT_NONE);
return Success;
}
@ -2072,7 +2050,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, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
client->errorValue = *pProtocolFences;
return SyncErrorBase + XSyncBadFence;
}
@ -2091,7 +2069,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, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -2166,10 +2144,31 @@ 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);
@ -2182,6 +2181,7 @@ static int _X_COLD
SProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
@ -2194,6 +2194,7 @@ static int _X_COLD
SProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
@ -2206,6 +2207,7 @@ static int _X_COLD
SProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
swapl(&stuff->counter);
@ -2216,6 +2218,7 @@ static int _X_COLD
SProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
swapl(&stuff->counter);
@ -2226,6 +2229,7 @@ static int _X_COLD
SProcSyncAwait(ClientPtr client)
{
REQUEST(xSyncAwaitReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
SwapRestL(stuff);
@ -2236,6 +2240,7 @@ static int _X_COLD
SProcSyncCreateAlarm(ClientPtr client)
{
REQUEST(xSyncCreateAlarmReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
swapl(&stuff->id);
swapl(&stuff->valueMask);
@ -2248,6 +2253,7 @@ static int _X_COLD
SProcSyncChangeAlarm(ClientPtr client)
{
REQUEST(xSyncChangeAlarmReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
swapl(&stuff->alarm);
swapl(&stuff->valueMask);
@ -2259,6 +2265,7 @@ static int _X_COLD
SProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
swapl(&stuff->alarm);
@ -2269,6 +2276,7 @@ static int _X_COLD
SProcSyncDestroyAlarm(ClientPtr client)
{
REQUEST(xSyncDestroyAlarmReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
swapl(&stuff->alarm);
@ -2279,6 +2287,7 @@ static int _X_COLD
SProcSyncSetPriority(ClientPtr client)
{
REQUEST(xSyncSetPriorityReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
swapl(&stuff->id);
swapl(&stuff->priority);
@ -2290,6 +2299,7 @@ static int _X_COLD
SProcSyncGetPriority(ClientPtr client)
{
REQUEST(xSyncGetPriorityReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
swapl(&stuff->id);
@ -2300,8 +2310,8 @@ static int _X_COLD
SProcSyncCreateFence(ClientPtr client)
{
REQUEST(xSyncCreateFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
swapl(&stuff->d);
swapl(&stuff->fid);
return ProcSyncCreateFence(client);
@ -2311,6 +2321,7 @@ static int _X_COLD
SProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
swapl(&stuff->fid);
@ -2321,6 +2332,7 @@ static int _X_COLD
SProcSyncResetFence(ClientPtr client)
{
REQUEST(xSyncResetFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
swapl(&stuff->fid);
@ -2331,6 +2343,7 @@ static int _X_COLD
SProcSyncDestroyFence(ClientPtr client)
{
REQUEST(xSyncDestroyFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
swapl(&stuff->fid);
@ -2341,6 +2354,7 @@ static int _X_COLD
SProcSyncQueryFence(ClientPtr client)
{
REQUEST(xSyncQueryFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
swapl(&stuff->fid);
@ -2351,6 +2365,7 @@ static int _X_COLD
SProcSyncAwaitFence(ClientPtr client)
{
REQUEST(xSyncAwaitFenceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
SwapRestL(stuff);
@ -2364,9 +2379,9 @@ SProcSyncDispatch(ClientPtr client)
switch (stuff->data) {
case X_SyncInitialize:
return ProcSyncInitialize(client);
return SProcSyncInitialize(client);
case X_SyncListSystemCounters:
return ProcSyncListSystemCounters(client);
return SProcSyncListSystemCounters(client);
case X_SyncCreateCounter:
return SProcSyncCreateCounter(client);
case X_SyncSetCounter:
@ -2621,11 +2636,9 @@ 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
@ -2639,7 +2652,6 @@ 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;
@ -2730,7 +2742,6 @@ 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;
@ -2764,7 +2775,6 @@ 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);
@ -2802,10 +2812,8 @@ 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;
}
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
idle_time_counter->pSysCounterInfo->private = priv;
}

View file

@ -29,9 +29,6 @@
extern _X_EXPORT int
SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode);
extern _X_EXPORT SyncObject*
SyncCreate(ClientPtr client, XID id, unsigned char type);
#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \
do { \
int rc; \

View file

@ -29,7 +29,9 @@ 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
@ -275,8 +277,8 @@ ProcVidModeGetModeLine(ClientPtr client)
/*
* Older servers sometimes had server privates that the VidMode
* extension made available. So to be compatible pretend that
* there are no server privates to pass to the client.
* extention made available. So to be compatiable pretend that
* there are no server privates to pass to the client
*/
rep.privsize = 0;
@ -469,7 +471,7 @@ ProcVidModeAddModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -639,7 +641,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -668,7 +670,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
"len = %d, length = %d\n",
(unsigned long) client->req_len,
(int) sizeof(xXF86VidModeDeleteModeLineReq) >> 2,
(unsigned long) stuff->privsize, len, client->req_len);
(unsigned long) stuff->privsize, len, stuff->length);
return BadLength;
}
@ -763,7 +765,7 @@ ProcVidModeModModeLine(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
@ -806,8 +808,6 @@ 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 = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -951,8 +951,6 @@ ProcVidModeValidateModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -1054,7 +1052,7 @@ ProcVidModeSwitchToMode(ClientPtr client)
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -1705,10 +1703,19 @@ 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);
@ -1718,6 +1725,7 @@ static int _X_COLD
SProcVidModeGetAllModeLines(ClientPtr client)
{
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen);
return ProcVidModeGetAllModeLines(client);
@ -1733,6 +1741,7 @@ 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);
@ -1748,6 +1757,7 @@ SProcVidModeAddModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1776,6 +1786,7 @@ 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);
@ -1791,6 +1802,7 @@ SProcVidModeDeleteModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1819,6 +1831,7 @@ 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);
@ -1834,6 +1847,7 @@ SProcVidModeModModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1862,6 +1876,7 @@ 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);
@ -1877,6 +1892,7 @@ SProcVidModeValidateModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1899,6 +1915,7 @@ static int _X_COLD
SProcVidModeSwitchMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen);
swaps(&stuff->zoom);
@ -1909,6 +1926,7 @@ static int _X_COLD
SProcVidModeSwitchToMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swapl(&stuff->screen);
return ProcVidModeSwitchToMode(client);
@ -1918,6 +1936,7 @@ static int _X_COLD
SProcVidModeLockModeSwitch(ClientPtr client)
{
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen);
swaps(&stuff->lock);
@ -1928,6 +1947,7 @@ static int _X_COLD
SProcVidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen);
return ProcVidModeGetMonitor(client);
@ -1937,6 +1957,7 @@ static int _X_COLD
SProcVidModeGetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen);
return ProcVidModeGetViewPort(client);
@ -1946,6 +1967,7 @@ static int _X_COLD
SProcVidModeSetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
swaps(&stuff->screen);
swapl(&stuff->x);
@ -1957,6 +1979,7 @@ static int _X_COLD
SProcVidModeGetDotClocks(ClientPtr client)
{
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen);
return ProcVidModeGetDotClocks(client);
@ -1966,6 +1989,7 @@ static int _X_COLD
SProcVidModeSetClientVersion(ClientPtr client)
{
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major);
swaps(&stuff->minor);
@ -1976,6 +2000,7 @@ static int _X_COLD
SProcVidModeSetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
swaps(&stuff->screen);
swapl(&stuff->red);
@ -1988,6 +2013,7 @@ static int _X_COLD
SProcVidModeGetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen);
return ProcVidModeGetGamma(client);
@ -1999,6 +2025,7 @@ SProcVidModeSetGammaRamp(ClientPtr client)
int length;
REQUEST(xXF86VidModeSetGammaRampReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2012,6 +2039,7 @@ static int _X_COLD
SProcVidModeGetGammaRamp(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2022,6 +2050,7 @@ static int _X_COLD
SProcVidModeGetGammaRampSize(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen);
return ProcVidModeGetGammaRampSize(client);
@ -2031,6 +2060,7 @@ static int _X_COLD
SProcVidModeGetPermissions(ClientPtr client)
{
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen);
return ProcVidModeGetPermissions(client);
@ -2042,7 +2072,7 @@ SProcVidModeDispatch(ClientPtr client)
REQUEST(xReq);
switch (stuff->data) {
case X_XF86VidModeQueryVersion:
return ProcVidModeQueryVersion(client);
return SProcVidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return SProcVidModeGetModeLine(client);
case X_XF86VidModeGetMonitor:

View file

@ -17,12 +17,11 @@ 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"
@ -30,12 +29,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "xacestr.h"
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
/* Special-cased hook functions. Called by Xserver.
*/
#undef XaceHookDispatch
int
XaceHookDispatch0(ClientPtr client, int major)
XaceHookDispatch(ClientPtr client, int major)
{
/* Call the extension dispatch hook */
ExtensionEntry *ext = GetExtensionEntry(major);
@ -63,85 +63,130 @@ XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
return rec.status;
}
int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode)
/* Entry point for hook functions. Called by Xserver.
*/
int
XaceHook(int hook, ...)
{
XaceResourceAccessRec rec = { client, id, rtype, res, ptype, parent,
access_mode, Success };
CallCallbacks(&XaceHooks[XACE_RESOURCE_ACCESS], &rec);
return rec.status;
}
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 */
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;
}
if (!XaceHooks[hook])
return Success;
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;
}
va_start(ap, hook);
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;
}
/* 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);
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;
}
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);
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext)
{
XaceExtAccessRec rec = { client, ext, DixGetAttrAccess, Success };
CallCallbacks(&XaceHooks[XACE_EXT_ACCESS], &rec);
return rec.status;
}
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);
int XaceHookServerAccess(ClientPtr client, Mask access_mode)
{
XaceServerAccessRec rec = { client, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SERVER_ACCESS], &rec);
return rec.status;
}
u.send.events = va_arg(ap, xEventPtr);
u.send.count = va_arg(ap, int);
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;
}
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);
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;
}
u.recv.events = va_arg(ap, xEventPtr);
u.recv.count = va_arg(ap, int);
int XaceHookAuthAvail(ClientPtr client, XID authId)
{
XaceAuthAvailRec rec = { client, authId };
CallCallbacks(&XaceHooks[XACE_AUTH_AVAIL], &rec);
return Success;
}
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);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count)
{
XaceKeyAvailRec rec = { ev, dev, count };
CallCallbacks(&XaceHooks[XACE_KEY_AVAIL], &rec);
return Success;
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;
}
/* XaceHookIsSet

View file

@ -25,7 +25,6 @@ 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"
@ -69,10 +68,10 @@ extern _X_EXPORT int XaceHookIsSet(int hook);
/* Special-cased hook functions
*/
int XaceHookDispatch0(ClientPtr client, int major);
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
#define XaceHookDispatch(c, m) \
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
XaceHookDispatch0((c), (m)) : \
XaceHookDispatch((c), (m)) : \
Success)
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
@ -81,24 +80,6 @@ extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
extern _X_EXPORT 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.
*/
#define XaceRegisterCallback(hook,callback,data) \
@ -132,38 +113,18 @@ 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,7 +26,9 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
@ -36,7 +38,7 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit_priv.h"
#include "extinit.h"
#include <stdint.h>
@ -144,18 +146,30 @@ 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);
}
@ -168,7 +182,7 @@ SProcXCMiscDispatch(ClientPtr client)
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return ProcXCMiscGetXIDRange(client);
return SProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
default:

View file

@ -34,10 +34,12 @@
* XLoadQueryFont).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#ifdef MITSHM
#ifdef HAS_SHM
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
@ -56,24 +58,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_priv.h"
#include "extinit.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
#ifdef HAS_SHM
/* A random signature, transmitted to the clients so they can verify that the
shared memory segment they are attaching to was really established by the
@ -126,7 +126,7 @@ CheckForShmSyscall(void)
/* ========== Management of shared memory segments ========== */
#ifdef MITSHM
#ifdef HAS_SHM
#ifdef __linux__
/* On Linux, shared memory marked as "removed" can still be attached.
@ -221,7 +221,7 @@ shmdealloc(ShmDescPtr pDesc)
void
XF86BigfontFreeFontShm(FontPtr pFont)
{
#ifdef MITSHM
#ifdef HAS_SHM
ShmDescPtr pDesc;
/* If during shutdown of the server, XF86BigfontCleanup() has already
@ -240,7 +240,7 @@ XF86BigfontFreeFontShm(FontPtr pFont)
void
XF86BigfontCleanup(void)
{
#ifdef MITSHM
#ifdef HAS_SHM
while (ShmList)
shmdealloc(ShmList);
#endif
@ -277,7 +277,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(),
.gid = getegid(),
#ifdef MITSHM
#ifdef HAS_SHM
.signature = signature,
.capabilities = (client->local && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0
@ -329,7 +329,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
int nCharInfos;
int shmid;
#ifdef MITSHM
#ifdef HAS_SHM
ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
@ -339,7 +339,9 @@ ProcXF86BigfontQueryFont(ClientPtr client)
CARD16 *pUniqIndex2Index;
CARD32 nUniqCharInfos;
/* protocol version is decided based on request packet size */
#if 0
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
#else
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
stuff_flags = (client->local &&
@ -351,7 +353,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 */
@ -372,7 +374,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
nUniqCharInfos = 0;
if (nCharInfos > 0) {
#ifdef MITSHM
#ifdef HAS_SHM
if (!badSysCall)
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (pDesc) {
@ -393,7 +395,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef MITSHM
#ifdef HAS_SHM
}
#endif
/* Fill nCharInfos starting at pCI. */
@ -425,7 +427,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
}
}
#ifdef MITSHM
#ifdef HAS_SHM
if (pDesc && !badSysCall) {
*(CARD32 *) (pCI + nCharInfos) = signature;
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
@ -651,7 +653,9 @@ ProcXF86BigfontDispatch(ClientPtr client)
static int _X_COLD
SProcXF86BigfontQueryVersion(ClientPtr client)
{
/* REQUEST(xXF86BigfontQueryVersionReq); */
REQUEST(xXF86BigfontQueryVersionReq);
swaps(&stuff->length);
return ProcXF86BigfontQueryVersion(client);
}
@ -659,6 +663,8 @@ static int _X_COLD
SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);
@ -688,7 +694,7 @@ XFree86BigfontExtensionInit(void)
ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch,
XF86BigfontResetProc, StandardMinorOpcode)) {
#ifdef MITSHM
#ifdef HAS_SHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
/*
* Note: Local-clients will not be optimized without shared memory

View file

@ -2,28 +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 <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include <assert.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include "registry.h"
#include <X11/extensions/XResproto.h>
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#include "client.h"
#include "list.h"
#include "misc.h"
#include <string.h>
@ -72,7 +72,7 @@ typedef struct {
HashTable visitedResources;
/* Used by AddSubResourceSizeSpec when AddResourceSizeValue is
handling cross-references */
handling crossreferences */
HashTable visitedSubResources;
/* used when ConstructResourceBytesCtx is passed to
@ -224,8 +224,6 @@ 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++) {
@ -444,7 +442,7 @@ WillConstructMask(ClientPtr client, CARD32 mask,
client id spec
@param sendClient Which client wishes to receive this answer. Used for
byte endianness.
byte endianess.
@param client Which client are we considering.
@param mask The client id spec mask indicating which information
we want about this client.
@ -611,7 +609,7 @@ ProcXResQueryClientIds (ClientPtr client)
return rc;
}
/** @brief Swaps xXResResourceIdSpec endianness */
/** @brief Swaps xXResResourceIdSpec endianess */
static void
SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
{
@ -619,7 +617,7 @@ SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
swapl(&spec->type);
}
/** @brief Swaps xXResResourceSizeSpec endianness */
/** @brief Swaps xXResResourceSizeSpec endianess */
static void
SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
{
@ -629,7 +627,7 @@ SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
swapl(&size->useCount);
}
/** @brief Swaps xXResResourceSizeValue endianness */
/** @brief Swaps xXResResourceSizeValue endianess */
static void
SwapXResResourceSizeValue(xXResResourceSizeValue *rep)
{
@ -1080,6 +1078,7 @@ static int _X_COLD
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:

View file

@ -136,12 +136,4 @@ typedef struct {
CARD32 pad6;
} SELinuxListItemsReply;
#ifdef XSELINUX
#define SELINUX_MODE_DEFAULT 0
#define SELINUX_MODE_DISABLED 1
#define SELINUX_MODE_PERMISSIVE 2
#define SELINUX_MODE_ENFORCING 3
extern int selinuxEnforcingState;
#endif
#endif /* _XSELINUX_H */

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>
#include "dix/dix_priv.h"
#endif
#include "selection.h"
#include "inputstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "xselinuxint.h"
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
@ -37,24 +37,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define USE_SEL offsetof(SELinuxSubjectRec, sel_use_sid)
typedef struct {
char *octx;
char *dctx;
security_context_t octx;
security_context_t dctx;
CARD32 octx_len;
CARD32 dctx_len;
CARD32 id;
} SELinuxListItemRec;
Bool noSELinuxExtension = FALSE;
int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
/*
* Extension Dispatch
*/
static char *
static security_context_t
SELinuxCopyContext(char *ptr, unsigned len)
{
char *copy = malloc(len + 1);
security_context_t copy = malloc(len + 1);
if (!copy)
return NULL;
@ -69,6 +66,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
@ -85,7 +83,8 @@ ProcSELinuxQueryVersion(ClientPtr client)
static int
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
{
char *ctx = NULL;
SELinuxGetContextReply rep;
security_context_t ctx = NULL;
int len = 0;
if (sid) {
@ -94,7 +93,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
SELinuxGetContextReply rep = {
rep = (SELinuxGetContextReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
@ -118,7 +117,7 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
{
PrivateRec **privPtr = &client->devPrivates;
security_id_t *pSid;
char *ctx = NULL;
security_context_t ctx = NULL;
char *ptr;
int rc;
@ -166,7 +165,7 @@ ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset)
static int
ProcSELinuxSetDeviceContext(ClientPtr client)
{
char *ctx;
security_context_t ctx;
security_id_t sid;
DeviceIntPtr dev;
SELinuxSubjectRec *subj;
@ -341,9 +340,13 @@ static int
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
int size, int count)
{
int rc = BadAlloc, k, pos = 0;
CARD32 *buf = calloc(size, sizeof(CARD32));
int rc, k, pos = 0;
SELinuxListItemsReply rep;
CARD32 *buf;
buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
rc = BadAlloc;
goto out;
}
@ -371,7 +374,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
SELinuxListItemsReply rep = {
rep = (SELinuxListItemsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
@ -449,10 +452,8 @@ 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 (!items)
if (count && !items)
return BadAlloc;
/* Fill in the items and calculate size */
@ -620,6 +621,8 @@ SProcSELinuxDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return SProcSELinuxQueryVersion(client);
@ -686,6 +689,8 @@ SELinuxResetProc(ExtensionEntry * extEntry)
void
SELinuxExtensionInit(void)
{
ExtensionEntry *extEntry;
/* Check SELinux mode on system, configuration file, and boolean */
if (!is_selinux_enabled()) {
LogMessage(X_INFO, "SELinux: Disabled on system\n");
@ -705,7 +710,8 @@ SELinuxExtensionInit(void)
SELinuxFlaskInit();
/* Add extension to server */
AddExtension(SELINUX_EXTENSION_NAME, SELinuxNumberEvents,
SELinuxNumberErrors, ProcSELinuxDispatch,
SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode);
extEntry = AddExtension(SELINUX_EXTENSION_NAME,
SELinuxNumberEvents, SELinuxNumberErrors,
ProcSELinuxDispatch, SProcSELinuxDispatch,
SELinuxResetProc, StandardMinorOpcode);
}

View file

@ -22,19 +22,17 @@ 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>
#include <stdio.h>
#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"
#include "scrnintstr.h"
@ -42,6 +40,7 @@ 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"
@ -115,7 +114,7 @@ SELinuxLabelClient(ClientPtr client)
int fd = XaceGetConnectionNumber(client);
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
char *ctx;
security_context_t ctx;
subj = dixLookupPrivate(&client->devPrivates, subjectKey);
obj = dixLookupPrivate(&client->devPrivates, objectKey);
@ -170,7 +169,7 @@ SELinuxLabelInitial(void)
XaceScreenAccessRec srec;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
char *ctx;
security_context_t ctx;
void *unused;
/* Do the serverClient */
@ -200,7 +199,7 @@ SELinuxLabelInitial(void)
/* Do the default colormap */
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
RT_COLORMAP, serverClient, DixCreateAccess);
}
}
@ -663,7 +662,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
rec->status = rc;
/* Perform the background none check on windows */
if (access_mode & DixCreateAccess && rec->rtype == X11_RESTYPE_WINDOW) {
if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
if (rc != Success)
((WindowPtr) rec->res)->forcedBG = TRUE;
@ -765,7 +764,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxObjectRec *obj;
WindowPtr pWin;
if (rec->type != X11_RESTYPE_WINDOW)
if (rec->type != RT_WINDOW)
return;
if (rec->state != ResourceStateAdding)
return;
@ -774,7 +773,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
if (subj->sid) {
char *ctx;
security_context_t ctx;
int rc = avc_sid_to_context_raw(subj->sid, &ctx);
if (rc < 0)
@ -792,7 +791,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
if (obj->sid) {
char *ctx;
security_context_t ctx;
int rc = avc_sid_to_context_raw(obj->sid, &ctx);
if (rc < 0)
@ -848,7 +847,7 @@ void
SELinuxFlaskInit(void)
{
struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *) 0 };
char *ctx;
security_context_t ctx;
int ret = TRUE;
switch (selinuxEnforcingState) {

View file

@ -17,12 +17,13 @@ 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>
#include "dix/registry_priv.h"
#include "registry.h"
#include "xselinuxint.h"
/* selection and property atom cache */
@ -96,7 +97,7 @@ static int
SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
{
const char *name = NameForAtom(atom);
char *ctx;
security_context_t ctx;
int rc = Success;
obj->poly = 1;
@ -137,12 +138,8 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
rec = SELinuxArrayGet(&arr_atoms, atom);
if (!rec) {
rec = calloc(1, sizeof(SELinuxAtomRec));
if (!rec)
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
return BadAlloc;
if (!SELinuxArraySet(&arr_atoms, atom, rec)) {
free(rec);
return BadAlloc;
}
}
if (prop) {
@ -258,7 +255,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
{
const char *name = LookupEventName(type);
security_id_t sid;
char *ctx;
security_context_t ctx;
type &= 127;
@ -294,7 +291,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
int
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn)
{
char *ctx;
security_context_t ctx;
/* Look in the mappings of extension names to contexts */
if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EXT) < 0) {
@ -325,13 +322,13 @@ SELinuxTypeToClass(RESTYPE type)
if (type & RC_DRAWABLE)
class = SECCLASS_X_DRAWABLE;
else if (type == X11_RESTYPE_GC)
else if (type == RT_GC)
class = SECCLASS_X_GC;
else if (type == X11_RESTYPE_FONT)
else if (type == RT_FONT)
class = SECCLASS_X_FONT;
else if (type == X11_RESTYPE_CURSOR)
else if (type == RT_CURSOR)
class = SECCLASS_X_CURSOR;
else if (type == X11_RESTYPE_COLORMAP)
else if (type == RT_COLORMAP)
class = SECCLASS_X_COLORMAP;
else {
/* Need to do a string lookup */
@ -350,10 +347,10 @@ SELinuxTypeToClass(RESTYPE type)
return (security_class_t) (unsigned long) tmp;
}
char *
security_context_t
SELinuxDefaultClientLabel(void)
{
char *ctx;
security_context_t ctx;
if (selabel_lookup_raw(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0)
FatalError("SELinux: failed to look up remote-client context\n");

View file

@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dixstruct.h"
#include "privates.h"
#include "resource.h"
#include "registry.h"
#include "inputstr.h"
#include "xselinux.h"
@ -98,7 +99,7 @@ int
security_class_t SELinuxTypeToClass(RESTYPE type);
char *SELinuxDefaultClientLabel(void);
security_context_t SELinuxDefaultClientLabel(void);
void
SELinuxLabelInit(void);

View file

@ -26,22 +26,13 @@
*/
#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/mipointer_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@ -54,17 +45,21 @@
#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_priv.h"
/* XTest events are sent during request processing and may be interrupted by
#include "extinit.h"
/* XTest events are sent during request processing and may be interruped by
* a SIGIO. We need a separate event list to avoid events overwriting each
* other's memory.
*/
* other's memory */
static InternalEvent *xtest_evlist;
/**
@ -79,10 +74,10 @@ static InternalEvent *xtest_evlist;
*/
DeviceIntPtr xtestpointer, xtestkeyboard;
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
static int XTestSwapFakeInput(ClientPtr /* client */ ,
xReq * /* req */
@ -133,7 +128,7 @@ ProcXTestCompareCursor(ClientPtr client)
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
X11_RESTYPE_CURSOR, client, DixReadAccess);
RT_CURSOR, client, DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;
@ -152,35 +147,6 @@ ProcXTestCompareCursor(ClientPtr client)
return Success;
}
void
XTestDeviceSendEvents(DeviceIntPtr dev,
int type,
int detail,
int flags,
const ValuatorMask *mask)
{
int nevents = 0;
int i;
switch (type) {
case MotionNotify:
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, mask);
break;
case ButtonPress:
case ButtonRelease:
nevents = GetPointerEvents(xtest_evlist, dev, type, detail, flags, mask);
break;
case KeyPress:
case KeyRelease:
nevents =
GetKeyboardEvents(xtest_evlist, dev, type, detail);
break;
}
for (i = 0; i < nevents; i++)
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
}
static int
ProcXTestFakeInput(ClientPtr client)
{
@ -194,11 +160,13 @@ ProcXTestFakeInput(ClientPtr client)
int valuators[MAX_VALUATORS] = { 0 };
int numValuators = 0;
int firstValuator = 0;
int nevents = 0;
int i;
int base = 0;
int flags = 0;
int need_ptr_update = 1;
nev = (client->req_len << 2) - sizeof(xReq);
nev = (stuff->length << 2) - sizeof(xReq);
if ((nev % sizeof(xEvent)) || !nev)
return BadLength;
nev /= sizeof(xEvent);
@ -350,10 +318,6 @@ ProcXTestFakeInput(ClientPtr client)
return BadAccess;
dev = GetXTestDevice(dev);
/* This can only happen if we passed a slave to GetXTestDevice() */
if (!dev)
return BadAccess;
}
@ -378,6 +342,7 @@ 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--;
@ -416,7 +381,7 @@ ProcXTestFakeInput(ClientPtr client)
if ((flags & POINTER_ABSOLUTE) && firstValuator <= 1 && numValuators > 0) {
if (firstValuator == 0)
valuators[0] += root->drawable.pScreen->x;
if (firstValuator + numValuators > 1)
if (firstValuator < 2 && firstValuator + numValuators > 1)
valuators[1 - firstValuator] += root->drawable.pScreen->y;
}
}
@ -442,10 +407,26 @@ ProcXTestFakeInput(ClientPtr client)
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
switch (type) {
case MotionNotify:
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask);
break;
case ButtonPress:
case ButtonRelease:
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
flags, &mask);
break;
case KeyPress:
case KeyRelease:
nevents =
GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail);
break;
}
if (dev->sendEventsProc)
(*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
for (i = 0; i < nevents; i++)
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
if (need_ptr_update)
miPointerUpdateSprite(dev);
@ -491,6 +472,8 @@ static int _X_COLD
SProcXTestGetVersion(ClientPtr client)
{
REQUEST(xXTestGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
@ -500,6 +483,8 @@ static int _X_COLD
SProcXTestCompareCursor(ClientPtr client)
{
REQUEST(xXTestCompareCursorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
@ -514,13 +499,12 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
xEvent sev;
EventSwapPtr proc;
nev = ((client->req_len << 2) - sizeof(xReq)) / sizeof(xEvent);
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
int evtype = ev->u.u.type & 0177;
/* Swap event */
proc = EventSwapVector[evtype];
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
if (!proc || proc == NotImplemented || evtype == GenericEvent) {
if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
@ -537,12 +521,23 @@ 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)
{
@ -555,7 +550,7 @@ SProcXTestDispatch(ClientPtr client)
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
return SProcXTestGrabControl(client);
default:
return BadRequest;
}

View file

@ -21,18 +21,14 @@ 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"
@ -41,6 +37,10 @@ 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 XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
unsigned long XvXRTPort;
#endif /* XINERAMA */
#endif
static int
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
@ -1115,11 +1115,21 @@ 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);
}
@ -1129,6 +1139,7 @@ SProcXvQueryEncodings(ClientPtr client)
{
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryEncodings] (client);
}
@ -1138,6 +1149,7 @@ SProcXvGrabPort(ClientPtr client)
{
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_GrabPort] (client);
@ -1148,6 +1160,7 @@ SProcXvUngrabPort(ClientPtr client)
{
REQUEST(xvUngrabPortReq);
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_UngrabPort] (client);
@ -1158,6 +1171,7 @@ SProcXvPutVideo(ClientPtr client)
{
REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1177,6 +1191,7 @@ SProcXvPutStill(ClientPtr client)
{
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1196,6 +1211,7 @@ SProcXvGetVideo(ClientPtr client)
{
REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1215,6 +1231,7 @@ SProcXvGetStill(ClientPtr client)
{
REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1234,6 +1251,7 @@ SProcXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1257,6 +1275,7 @@ SProcXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1284,6 +1303,7 @@ SProcXvSelectVideoNotify(ClientPtr client)
{
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return XvProcVector[xv_SelectVideoNotify] (client);
}
@ -1293,6 +1313,7 @@ SProcXvSelectPortNotify(ClientPtr client)
{
REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_SelectPortNotify] (client);
}
@ -1302,6 +1323,7 @@ SProcXvStopVideo(ClientPtr client)
{
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
return XvProcVector[xv_StopVideo] (client);
@ -1312,6 +1334,7 @@ SProcXvSetPortAttribute(ClientPtr client)
{
REQUEST(xvSetPortAttributeReq);
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
swapl(&stuff->value);
@ -1323,6 +1346,7 @@ SProcXvGetPortAttribute(ClientPtr client)
{
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
return XvProcVector[xv_GetPortAttribute] (client);
@ -1333,6 +1357,7 @@ SProcXvQueryBestSize(ClientPtr client)
{
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swaps(&stuff->vid_w);
swaps(&stuff->vid_h);
@ -1346,6 +1371,7 @@ SProcXvQueryPortAttributes(ClientPtr client)
{
REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryPortAttributes] (client);
}
@ -1355,6 +1381,7 @@ SProcXvQueryImageAttributes(ClientPtr client)
{
REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->id);
swaps(&stuff->width);
@ -1367,12 +1394,13 @@ 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) = {
ProcXvQueryExtension,
SProcXvQueryExtension,
SProcXvQueryAdaptors,
SProcXvQueryEncodings,
SProcXvGrabPort,
@ -1405,7 +1433,7 @@ SProcXvDispatch(ClientPtr client)
return SXvProcVector[stuff->data] (client);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
XineramaXvStopVideo(ClientPtr client)
{
@ -1513,7 +1541,7 @@ XineramaXvShmPutImage(ClientPtr client)
}
#else
#define XineramaXvShmPutImage ProcXvShmPutImage
#endif /* MITSHM */
#endif
static int
XineramaXvPutImage(ClientPtr client)
@ -1768,17 +1796,17 @@ XineramifyXv(void)
XvProcVector[xv_PutImage] = XineramaXvPutImage;
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
}
#endif /* XINERAMA */
#endif /* PANORAMIX */
void
XvResetProcVector(void)
{
#ifdef XINERAMA
#ifdef PANORAMIX
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 /* XINERAMA */
#endif
}

View file

@ -55,6 +55,21 @@ 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;
@ -70,7 +85,18 @@ typedef struct {
ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvPortNotifyRec *XvPortNotifyPtr;
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 {
int id;
@ -169,6 +195,14 @@ 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;
@ -178,8 +212,51 @@ 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 */

View file

@ -1,84 +0,0 @@
/* 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,16 +73,14 @@ 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"
@ -90,50 +88,41 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "input.h"
#ifdef XINERAMA
#define GLOBAL
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#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)
static unsigned long XvExtensionGeneration = 0;
static unsigned long XvScreenGeneration = 0;
static unsigned long XvResourceGeneration = 0;
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
unsigned long XvResourceGeneration = 0;
int XvReqCode;
static int XvEventBase;
int XvEventBase;
int XvErrorBase;
RESTYPE XvRTPort;
static RESTYPE XvRTEncoding;
static RESTYPE XvRTGrab;
static RESTYPE XvRTVideoNotify;
static RESTYPE XvRTVideoNotifyList;
static RESTYPE XvRTPortNotify;
RESTYPE XvRTEncoding;
RESTYPE XvRTGrab;
RESTYPE XvRTVideoNotify;
RESTYPE XvRTVideoNotifyList;
RESTYPE XvRTPortNotify;
/* EXTERNAL */
@ -174,9 +163,9 @@ XvExtensionInit(void)
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
return;
}
#ifdef XINERAMA
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif /* XINERAMA */
#endif
XvScreenGeneration = serverGeneration;
}
@ -267,9 +256,9 @@ XvScreenInit(ScreenPtr pScreen)
ErrorF("XvScreenInit: Unable to allocate resource types\n");
return BadAlloc;
}
#ifdef XINERAMA
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif /* XINERAMA */
#endif
XvScreenGeneration = serverGeneration;
}
@ -371,14 +360,13 @@ static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status = TRUE;
Bool status;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
status = (*pScreen->DestroyPixmap) (pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
@ -437,7 +425,7 @@ XvdiDestroyVideoNotifyList(void *pn, XID id)
{
XvVideoNotifyPtr npn, cpn;
/* ACTUALLY DESTROY THE NOTIFY LIST */
/* ACTUALLY DESTROY THE NOTITY LIST */
cpn = (XvVideoNotifyPtr) pn;
@ -481,7 +469,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
}
static int
int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
XvPortNotifyPtr pn;
@ -823,10 +811,8 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn = pn;
while (tpn) {
if (tpn->client == client) {
if (!onoff) {
if (!onoff)
tpn->client = NULL;
FreeResource(tpn->id, XvRTVideoNotify);
}
return Success;
}
if (!tpn->client)
@ -834,7 +820,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn = tpn->next;
}
/* IF TURNING OFF, THEN JUST RETURN */
/* IF TUNNING OFF, THEN JUST RETURN */
if (!onoff)
return Success;

View file

@ -1,21 +1,22 @@
#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_priv.h"
#include "extinit.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>
@ -43,6 +44,8 @@ static RESTYPE XvMCRTContext;
static RESTYPE XvMCRTSurface;
static RESTYPE XvMCRTSubpicture;
int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
@ -287,7 +290,7 @@ ProcXvMCDestroyContext(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->context_id, X11_RESTYPE_NONE);
FreeResource(stuff->context_id, RT_NONE);
return Success;
}
@ -365,7 +368,7 @@ ProcXvMCDestroySurface(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
FreeResource(stuff->surface_id, RT_NONE);
return Success;
}
@ -493,7 +496,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
FreeResource(stuff->subpicture_id, RT_NONE);
return Success;
}

View file

@ -84,9 +84,13 @@ 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);

111
Xi/Makefile.am Normal file
View file

@ -0,0 +1,111 @@
noinst_LTLIBRARIES = libXi.la libXistubs.la
AM_CFLAGS = $(DIX_CFLAGS)
libXi_la_SOURCES = \
allowev.c \
allowev.h \
chgdctl.c \
chgdctl.h \
chgfctl.c \
chgfctl.h \
chgkbd.c \
chgkbd.h \
chgkmap.c \
chgkmap.h \
chgprop.c \
chgprop.h \
chgptr.c \
chgptr.h \
closedev.c \
closedev.h \
devbell.c \
devbell.h \
exevents.c \
exglobals.h \
extinit.c \
getbmap.c \
getbmap.h \
getdctl.c \
getdctl.h \
getfctl.c \
getfctl.h \
getfocus.c \
getfocus.h \
getkmap.c \
getkmap.h \
getmmap.c \
getmmap.h \
getprop.c \
getprop.h \
getselev.c \
getselev.h \
getvers.c \
getvers.h \
grabdev.c \
grabdev.h \
grabdevb.c \
grabdevb.h \
grabdevk.c \
grabdevk.h \
gtmotion.c \
gtmotion.h \
listdev.c \
listdev.h \
opendev.c \
opendev.h \
queryst.c \
queryst.h \
selectev.c \
selectev.h \
sendexev.c \
sendexev.h \
setbmap.c \
setbmap.h \
setdval.c \
setdval.h \
setfocus.c \
setfocus.h \
setmmap.c \
setmmap.h \
setmode.c \
setmode.h \
ungrdev.c \
ungrdev.h \
ungrdevb.c \
ungrdevb.h \
ungrdevk.c \
ungrdevk.h \
xiallowev.c \
xiallowev.h \
xibarriers.c \
xibarriers.h \
xichangecursor.c \
xichangecursor.h \
xichangehierarchy.c \
xichangehierarchy.h \
xigetclientpointer.c \
xigetclientpointer.h \
xigrabdev.c \
xigrabdev.h \
xipassivegrab.h \
xipassivegrab.c \
xiproperty.c \
xiproperty.h \
xiquerydevice.c \
xiquerydevice.h \
xiquerypointer.c \
xiquerypointer.h \
xiqueryversion.c \
xiqueryversion.h \
xiselectev.c \
xiselectev.h \
xisetclientpointer.c \
xisetclientpointer.h \
xisetdevfocus.c \
xisetdevfocus.h \
xiwarppointer.c \
xiwarppointer.h
libXistubs_la_SOURCES = \
stubs.c

View file

@ -50,15 +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 "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "exglobals.h"
#include "allowev.h"
@ -74,6 +73,7 @@ int _X_COLD
SProcXAllowDeviceEvents(ClientPtr client)
{
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));
@ -102,22 +102,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
switch (stuff->mode) {
case ReplayThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED);
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_THAWED);
AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS);
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH);
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "XIstubs.h"
#include "exglobals.h"
#include "exevents.h"
#include "chgdctl.h"
/***********************************************************************
@ -76,6 +77,7 @@ 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];
@ -115,7 +117,7 @@ ProcXChangeDeviceControl(ClientPtr client)
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceControlReq));
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceControlReq));
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
goto out;

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -73,6 +75,7 @@ int _X_COLD
SProcXChangeFeedbackControl(ClientPtr client)
{
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));
@ -435,7 +438,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
len = client->req_len - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
return rc;
@ -461,11 +464,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
break;
case StringFeedbackClass:
{
xStringFeedbackCtl *f;
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeFeedbackControlReq,
sizeof(xStringFeedbackCtl));
f = ((xStringFeedbackCtl *) &stuff[1]);
if (client->swapped) {
if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
return BadLength;

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -69,6 +71,23 @@ 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,6 +30,9 @@ 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>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "chgkmap.h"
@ -75,6 +75,7 @@ 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));
@ -105,7 +106,7 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
return ret;
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceKeyMappingReq));
len = stuff->length - 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>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "chgprop.h"
#include "grabdev.h"
@ -75,6 +75,7 @@ int _X_COLD
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -101,7 +102,7 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
stuff->count)
return BadLength;

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -65,6 +67,22 @@ 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,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -62,6 +64,21 @@ 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
@ -85,13 +102,13 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource(grab->resource, X11_RESTYPE_NONE);
FreeResource(grab->resource, RT_NONE);
}
}
/***********************************************************************
*
* Walk through the window tree, deleting event selections for this client
* Walk througth the window tree, deleting event selections for this client
* from this device from all windows.
*
*/

View file

@ -30,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ 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,6 +30,9 @@ 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,37 +78,35 @@ 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/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 "inputstr.h"
#include <X11/extensions/geproto.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 "eventconvert.h"
#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)
@ -170,49 +168,6 @@ IsTouchEvent(InternalEvent *event)
return FALSE;
}
Bool
IsGestureEvent(InternalEvent *event)
{
switch (event->any.type) {
case ET_GesturePinchBegin:
case ET_GesturePinchUpdate:
case ET_GesturePinchEnd:
case ET_GestureSwipeBegin:
case ET_GestureSwipeUpdate:
case ET_GestureSwipeEnd:
return TRUE;
default:
break;
}
return FALSE;
}
Bool
IsGestureBeginEvent(InternalEvent *event)
{
switch (event->any.type) {
case ET_GesturePinchBegin:
case ET_GestureSwipeBegin:
return TRUE;
default:
break;
}
return FALSE;
}
Bool
IsGestureEndEvent(InternalEvent *event)
{
switch (event->any.type) {
case ET_GesturePinchEnd:
case ET_GestureSwipeEnd:
return TRUE;
default:
break;
}
return FALSE;
}
/**
* @return the device matching the deviceid of the device set in the event, or
* NULL if the event is not an XInput event.
@ -606,25 +561,22 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->button = calloc(1, sizeof(ButtonClassRec));
if (!to->button)
FatalError("[Xi] no memory for class shift.\n");
to->button->numButtons = from->button->numButtons;
}
else
classes->button = NULL;
}
if (from->button->xkb_acts) {
size_t maxbuttons = max(to->button->numButtons, from->button->numButtons);
to->button->xkb_acts = XNFreallocarray(to->button->xkb_acts,
maxbuttons,
sizeof(XkbAction));
memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction));
if (!to->button->xkb_acts) {
to->button->xkb_acts = calloc(1, sizeof(XkbAction));
if (!to->button->xkb_acts)
FatalError("[Xi] not enough memory for xkb_acts.\n");
}
memcpy(to->button->xkb_acts, from->button->xkb_acts,
from->button->numButtons * sizeof(XkbAction));
sizeof(XkbAction));
}
else {
else
free(to->button->xkb_acts);
to->button->xkb_acts = NULL;
}
memcpy(to->button->labels, from->button->labels,
from->button->numButtons * sizeof(Atom));
@ -695,32 +647,13 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
/* Don't remove touch class if from->touch is non-existent. The to device
* may have an active touch grab, so we need to keep the touch class record
* around. */
if (from->gesture) {
if (!to->gesture) {
classes = to->unused_classes;
to->gesture = classes->gesture;
if (!to->gesture) {
if (!InitGestureClassDeviceStruct(to, from->gesture->max_touches))
FatalError("[Xi] no memory for class shift.\n");
}
else
classes->gesture = NULL;
}
to->gesture->sourceid = from->gesture->sourceid;
/* to->gesture->gesture is separate on the master, don't copy */
}
/* Don't remove gesture class if from->gesture is non-existent. The to device
* may have an active gesture grab, so we need to keep the gesture class record
* around. */
}
/**
* Copies the CONTENT of the classes of device from into the classes in device
* to. From and to are identical after finishing.
*
* If to does not have classes from currently has, the classes are stored in
* If to does not have classes from currenly has, the classes are stored in
* to's devPrivates system. Later, we recover it again from there if needed.
* Saves a few memory allocations.
*/
@ -813,8 +746,9 @@ UpdateDeviceMotionMask(DeviceIntPtr device, unsigned short state,
{
Mask mask;
mask = PointerMotionMask | state | motion_mask;
mask = DevicePointerMotionMask | state | motion_mask;
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
mask = PointerMotionMask | state | motion_mask;
SetMaskForEvent(device->id, mask, MotionNotify);
}
@ -1093,7 +1027,7 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
FixUpEventFromWindow(&ti->sprite, xi2, win, child, FALSE);
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
if (XaceHook(XACE_RECEIVE_ACCESS, client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
@ -1110,8 +1044,8 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
XID error;
GrabPtr grab = ti->listeners[0].grab;
BUG_RETURN(ti->listeners[0].type != TOUCH_LISTENER_GRAB &&
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
BUG_RETURN(ti->listeners[0].type != LISTENER_GRAB &&
ti->listeners[0].type != LISTENER_POINTER_GRAB);
BUG_RETURN(!grab);
client = rClient(grab);
@ -1144,8 +1078,8 @@ FindOldestPointerEmulatedTouch(DeviceIntPtr dev)
continue;
for (j = 0; j < ti->num_listeners; j++) {
if (ti->listeners[j].type == TOUCH_LISTENER_POINTER_GRAB ||
ti->listeners[j].type == TOUCH_LISTENER_POINTER_REGULAR)
if (ti->listeners[j].type == LISTENER_POINTER_GRAB ||
ti->listeners[j].type == LISTENER_POINTER_REGULAR)
break;
}
if (j == ti->num_listeners)
@ -1172,17 +1106,17 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchOwnershipEvent *ev)
{
TouchListener *listener = &ti->listeners[0]; /* new owner */
int accepted_early = listener->state == TOUCH_LISTENER_EARLY_ACCEPT;
int accepted_early = listener->state == LISTENER_EARLY_ACCEPT;
/* Deliver the ownership */
if (listener->state == TOUCH_LISTENER_AWAITING_OWNER || accepted_early)
if (listener->state == LISTENER_AWAITING_OWNER || accepted_early)
DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
listener->listener);
else if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
else if (listener->state == LISTENER_AWAITING_BEGIN) {
/* We can't punt to a pointer listener unless all older pointer
* emulated touches have been seen already. */
if ((listener->type == TOUCH_LISTENER_POINTER_GRAB ||
listener->type == TOUCH_LISTENER_POINTER_REGULAR) &&
if ((listener->type == LISTENER_POINTER_GRAB ||
listener->type == LISTENER_POINTER_REGULAR) &&
ti != FindOldestPointerEmulatedTouch(dev))
return;
@ -1225,7 +1159,7 @@ CheckOldestTouch(DeviceIntPtr dev)
{
TouchPointInfoPtr oldest = FindOldestPointerEmulatedTouch(dev);
if (oldest && oldest->listeners[0].state == TOUCH_LISTENER_AWAITING_BEGIN)
if (oldest && oldest->listeners[0].state == LISTENER_AWAITING_BEGIN)
TouchPuntToNextOwner(dev, oldest, NULL);
}
@ -1249,7 +1183,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
* haven't received one yet already */
for (i = 0; i < ti->num_listeners; i++) {
if (ti->listeners[i].listener == resource) {
if (ti->listeners[i].state != TOUCH_LISTENER_HAS_END)
if (ti->listeners[i].state != LISTENER_HAS_END)
TouchEmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
break;
}
@ -1295,12 +1229,12 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
/* For pointer-emulated listeners that ungrabbed the active grab,
* the state was forced to TOUCH_LISTENER_HAS_END. Still go
* the state was forced to LISTENER_HAS_END. Still go
* through the motions of ending the touch if the listener has
* already seen the end. This ensures that the touch record is ended in
* the server.
*/
if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
if (ti->listeners[0].state == LISTENER_HAS_END)
TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
/* The touch owner has accepted the touch. Send TouchEnd events to
@ -1311,10 +1245,10 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
while (ti->num_listeners > 1)
TouchRemoveListener(ti, ti->listeners[1].listener);
/* Owner accepted after receiving end */
if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
if (ti->listeners[0].state == LISTENER_HAS_END)
TouchEndTouch(dev, ti);
else
ti->listeners[0].state = TOUCH_LISTENER_HAS_ACCEPTED;
ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
}
else { /* this is the very first ownership event for a grab */
DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
@ -1360,8 +1294,9 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
InputClients *iclients = NULL;
*mask = NULL;
if (listener->type == TOUCH_LISTENER_GRAB ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
if (listener->type == LISTENER_GRAB ||
listener->type == LISTENER_POINTER_GRAB) {
*grab = listener->grab;
BUG_RETURN_VAL(!*grab, FALSE);
@ -1381,12 +1316,11 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
int evtype;
if (ti->emulate_pointer &&
listener->type == TOUCH_LISTENER_POINTER_REGULAR)
listener->type == LISTENER_POINTER_REGULAR)
evtype = GetXI2Type(TouchGetPointerEventType(ev));
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,7 +1335,6 @@ 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)
@ -1442,16 +1375,6 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
int nevents;
DeviceIntPtr kbd;
/* There may be a pointer grab on the device */
if (!grab) {
grab = dev->deviceGrab.grab;
if (grab) {
win = grab->window;
xi2mask = grab->xi2mask;
client = rClient(grab);
}
}
/* We don't deliver pointer events to non-owners */
if (!TouchResourceIsOwner(ti, listener->listener))
return !Success;
@ -1462,12 +1385,6 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
BUG_RETURN_VAL(nevents == 0, BadValue);
/* Note that here we deliver only part of the events that are generated by the touch event:
*
* TouchBegin results in ButtonPress (motion is handled in DeliverEmulatedMotionEvent)
* TouchUpdate results in Motion
* TouchEnd results in ButtonRelease (motion is handled in DeliverEmulatedMotionEvent)
*/
if (nevents > 1)
ptrev = &button;
@ -1530,7 +1447,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
g = AllocGrab(devgrab);
BUG_WARN(!g);
CopyPartialInternalEvent(dev->deviceGrab.sync.event, ev);
*dev->deviceGrab.sync.event = ev->device_event;
/* The listener array has a sequence of grabs and then one event
* selection. Implicit grab activation occurs through delivering an
@ -1539,19 +1456,19 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
l = &ti->listeners[ti->num_listeners - 1];
l->listener = g->resource;
l->grab = g;
//l->resource_type = X11_RESTYPE_NONE;
//l->resource_type = RT_NONE;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
l->type = TOUCH_LISTENER_POINTER_GRAB;
l->type = LISTENER_POINTER_GRAB;
else
l->type = TOUCH_LISTENER_GRAB;
l->type = LISTENER_GRAB;
}
}
if (ev->any.type == ET_TouchBegin)
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->state = LISTENER_IS_OWNER;
else if (ev->any.type == ET_TouchEnd)
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
return Success;
}
@ -1568,8 +1485,8 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
GrabPtr grab;
XI2Mask *mask;
if (ti->listeners[0].type != TOUCH_LISTENER_POINTER_REGULAR &&
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB)
if (ti->listeners[0].type != LISTENER_POINTER_REGULAR &&
ti->listeners[0].type != LISTENER_POINTER_GRAB)
return;
motion = ev->device_event;
@ -1581,6 +1498,16 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
&mask))
return;
/* There may be a pointer grab on the device */
if (!grab) {
grab = dev->deviceGrab.grab;
if (grab) {
win = grab->window;
mask = grab->xi2mask;
client = rClient(grab);
}
}
DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
win, grab, mask);
}
@ -1672,8 +1599,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
/* if emulate_pointer is set, emulate the motion event right
* here, so we can ignore it for button event emulation. TouchUpdate
* events which _only_ emulate motion just work normally */
if (emulate_pointer && (ev->any.type == ET_TouchBegin ||
(ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
if (emulate_pointer && ev->any.type != ET_TouchUpdate)
DeliverEmulatedMotionEvent(dev, ti, ev);
if (emulate_pointer && IsMaster(dev))
@ -1749,72 +1675,6 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
free(ev);
}
static BOOL
IsAnotherGestureActiveOnMaster(DeviceIntPtr dev, InternalEvent* ev)
{
GestureClassPtr g = dev->gesture;
if (g->gesture.active && g->gesture.sourceid != ev->gesture_event.sourceid) {
return TRUE;
}
return FALSE;
}
/**
* Processes and delivers a Gesture{Pinch,Swipe}{Begin,Update,End}.
*
* Due to having rather different delivery semantics (see the Xi 2.4 protocol
* spec for more information), this implements its own grab and event-selection
* delivery logic.
*/
void
ProcessGestureEvent(InternalEvent *ev, DeviceIntPtr dev)
{
GestureInfoPtr gi;
DeviceIntPtr kbd;
Bool deactivateGestureGrab = FALSE;
Bool delivered = FALSE;
if (!dev->gesture)
return;
if (IsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
return;
if (IsGestureBeginEvent(ev))
gi = GestureBeginGesture(dev, ev);
else
gi = GestureFindActiveByEventType(dev, ev->any.type);
if (!gi) {
/* This may happen if gesture is no longer active or was never started. */
return;
}
kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
event_set_state_gesture(kbd, &ev->gesture_event);
if (IsGestureBeginEvent(ev))
GestureSetupListener(dev, gi, ev);
if (IsGestureEndEvent(ev) &&
dev->deviceGrab.grab &&
dev->deviceGrab.fromPassiveGrab &&
GrabIsGestureGrab(dev->deviceGrab.grab))
deactivateGestureGrab = TRUE;
delivered = DeliverGestureEventToOwner(dev, gi, ev);
if (delivered && !deactivateGestureGrab &&
(IsGestureBeginEvent(ev) || IsGestureEndEvent(ev)))
FreezeThisEventIfNeededForSyncGrab(dev, ev);
if (IsGestureEndEvent(ev))
GestureEndGesture(gi);
if (deactivateGestureGrab)
(*dev->deviceGrab.DeactivateGrab) (dev);
}
/**
* Process DeviceEvents and DeviceChangedEvents.
*/
@ -1881,7 +1741,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
int count;
if (EventToCore(ev, &core, &count) == Success && count > 0) {
XaceHookKeyAvail(core, device, 0);
XaceHook(XACE_KEY_AVAIL, core, device, 0);
free(core);
}
}
@ -1907,7 +1767,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
* nested) to clients. */
if (event->source_type == EVENT_SOURCE_FOCUS)
return;
if (!grab && CheckDeviceGrabs(device, ev, 0))
if (!grab && CheckDeviceGrabs(device, event, 0))
return;
break;
case ET_KeyRelease:
@ -1920,7 +1780,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
if (b->map[key] == 0) /* there's no button 0 */
return;
event->detail.button = b->map[key];
if (!grab && CheckDeviceGrabs(device, ev, 0)) {
if (!grab && CheckDeviceGrabs(device, event, 0)) {
/* if a passive grab was activated, the event has been sent
* already */
return;
@ -2009,14 +1869,6 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
case ET_BarrierLeave:
ProcessBarrierEvent(ev, device);
break;
case ET_GesturePinchBegin:
case ET_GesturePinchUpdate:
case ET_GesturePinchEnd:
case ET_GestureSwipeBegin:
case ET_GestureSwipeUpdate:
case ET_GestureSwipeEnd:
ProcessGestureEvent(ev, device);
break;
default:
ProcessDeviceEvent(ev, device);
break;
@ -2033,14 +1885,14 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
int rc = Success;
Bool has_ownershipmask;
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
if (rc == Success) {
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->state = LISTENER_IS_OWNER;
/* async grabs cannot replay, so automatically accept this touch */
if (listener->type == TOUCH_LISTENER_POINTER_GRAB &&
if (listener->type == LISTENER_POINTER_GRAB &&
dev->deviceGrab.grab &&
dev->deviceGrab.fromPassiveGrab &&
dev->deviceGrab.grab->pointerMode == GrabModeAsync)
@ -2055,18 +1907,18 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
if (!TouchResourceIsOwner(ti, listener->listener)) {
if (has_ownershipmask)
state = TOUCH_LISTENER_AWAITING_OWNER;
state = LISTENER_AWAITING_OWNER;
else
state = TOUCH_LISTENER_AWAITING_BEGIN;
state = LISTENER_AWAITING_BEGIN;
}
else {
if (has_ownershipmask)
TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
if (listener->type == TOUCH_LISTENER_REGULAR)
state = TOUCH_LISTENER_HAS_ACCEPTED;
if (listener->type == LISTENER_REGULAR)
state = LISTENER_HAS_ACCEPTED;
else
state = TOUCH_LISTENER_IS_OWNER;
state = LISTENER_IS_OWNER;
}
listener->state = state;
@ -2081,14 +1933,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
{
int rc = Success;
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB) {
/* Note: If the active grab was ungrabbed, we already changed the
* state to TOUCH_LISTENER_HAS_END but still get here. So we mustn't
* state to LISTENER_HAS_END but still get here. So we mustn't
* actually send the event.
* This is part two of the hack in DeactivatePointerGrab
*/
if (listener->state != TOUCH_LISTENER_HAS_END) {
if (listener->state != LISTENER_HAS_END) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
@ -2098,14 +1950,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
* and we can continue.
*/
if (rc == Success)
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
}
goto out;
}
/* A client is waiting for the begin, don't give it a TouchEnd */
if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
listener->state = TOUCH_LISTENER_HAS_END;
if (listener->state == LISTENER_AWAITING_BEGIN) {
listener->state = LISTENER_HAS_END;
goto out;
}
@ -2113,19 +1965,19 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (ev->device_event.flags & TOUCH_REJECT ||
(ev->device_event.flags & TOUCH_ACCEPT && !TouchResourceIsOwner(ti, listener->listener))) {
/* Touch has been rejected, or accepted by its owner which is not this listener */
if (listener->state != TOUCH_LISTENER_HAS_END)
if (listener->state != LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
}
else if (TouchResourceIsOwner(ti, listener->listener)) {
Bool normal_end = !(ev->device_event.flags & TOUCH_ACCEPT);
/* FIXME: what about early acceptance */
if (normal_end && listener->state != TOUCH_LISTENER_HAS_END)
if (normal_end && listener->state != LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
if ((ti->num_listeners > 1 ||
(ti->num_grabs > 0 && listener->state != TOUCH_LISTENER_HAS_ACCEPTED)) &&
(ti->num_grabs > 0 && listener->state != LISTENER_HAS_ACCEPTED)) &&
(ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
ev->any.type = ET_TouchUpdate;
ev->device_event.flags |= TOUCH_PENDING_END;
@ -2133,7 +1985,7 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
}
if (normal_end)
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
}
out:
@ -2156,7 +2008,7 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (!TouchResourceIsOwner(ti, listener->listener))
goto out;
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->state = LISTENER_IS_OWNER;
}
else
ev->device_event.deviceid = dev->id;
@ -2166,8 +2018,8 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
xi2mask);
}
else if (ev->any.type == ET_TouchUpdate) {
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
listener->type == TOUCH_LISTENER_POINTER_GRAB)
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB)
DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab,
xi2mask);
else if (TouchResourceIsOwner(ti, listener->listener) ||
@ -2221,112 +2073,6 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
}
/**
* Attempts to deliver a gesture event to the given client.
*/
static Bool
DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
GrabPtr grab, WindowPtr win, InternalEvent *ev)
{
int err;
xEvent *xi2;
Mask filter;
Window child = DeepestSpriteWin(&gi->sprite)->drawable.id;
/* If we fail here, we're going to leave a client hanging. */
err = EventToXI2(ev, &xi2);
if (err != Success)
FatalError("[Xi] %s: XI2 conversion failed in %s"
" (%d)\n", dev->name, __func__, err);
FixUpEventFromWindow(&gi->sprite, xi2, win, child, FALSE);
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
/* Returning the value from TryClientEvents isn't useful, since all our
* resource-gone cleanups will update the delivery list anyway. */
return TRUE;
}
/**
* Given a gesture event and a potential listener, retrieve info needed for processing the event.
*
* @param dev The device generating the gesture event.
* @param ev The gesture event to process.
* @param listener The gesture event listener that may receive the gesture event.
* @param[out] client The client that should receive the gesture event.
* @param[out] win The window to deliver the event on.
* @param[out] grab The grab to deliver the event through, if any.
* @return TRUE if an event should be delivered to the listener, FALSE
* otherwise.
*/
static Bool
RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener* listener,
ClientPtr *client, WindowPtr *win, GrabPtr *grab)
{
int rc;
int evtype;
InputClients *iclients = NULL;
*grab = NULL;
if (listener->type == GESTURE_LISTENER_GRAB ||
listener->type == GESTURE_LISTENER_NONGESTURE_GRAB) {
*grab = listener->grab;
BUG_RETURN_VAL(!*grab, FALSE);
*client = rClient(*grab);
*win = (*grab)->window;
}
else {
rc = dixLookupResourceByType((void **) win, listener->listener, listener->resource_type,
serverClient, DixSendAccess);
if (rc != Success)
return FALSE;
/* note that we only will have XI2 listeners as
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;
BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
}
return TRUE;
}
/**
* Delivers a gesture to the owner, if possible and needed. Returns whether
* an event was delivered.
*/
Bool
DeliverGestureEventToOwner(DeviceIntPtr dev, GestureInfoPtr gi, InternalEvent *ev)
{
GrabPtr grab = NULL;
ClientPtr client;
WindowPtr win;
if (!gi->has_listener || gi->listener.type == GESTURE_LISTENER_NONGESTURE_GRAB) {
return 0;
}
if (!RetrieveGestureDeliveryData(dev, ev, &gi->listener, &client, &win, &grab))
return 0;
ev->gesture_event.deviceid = dev->id;
return DeliverOneGestureEvent(client, dev, gi, grab, win, ev);
}
int
InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
@ -2506,7 +2252,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
X11_RESTYPE_CURSOR, client, DixUseAccess);
RT_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2516,7 +2262,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHookDeviceAccess(client, dev, access_mode);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
return rc;
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
@ -2572,7 +2318,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHookDeviceAccess(client, dev, access_mode);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
return rc;
@ -2605,7 +2351,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
X11_RESTYPE_CURSOR, client, DixUseAccess);
RT_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2615,7 +2361,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHookDeviceAccess(client, dev, access_mode);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
return rc;
@ -2632,8 +2378,8 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
/* Touch grab */
int
GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
int type, GrabParameters *param, GrabMask *mask)
GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
GrabParameters *param, GrabMask *mask)
{
WindowPtr pWin;
GrabPtr grab;
@ -2646,12 +2392,12 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHookDeviceAccess(client, dev, DixGrabAccess);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGrabAccess);
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
mask, param, type, 0, NullWindow, NullCursor);
mask, param, XI_TouchBegin, 0, NullWindow, NullCursor);
if (!grab)
return BadAlloc;
@ -2693,7 +2439,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
if (i == EMASKSIZE) {
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(others->resource, X11_RESTYPE_NONE);
FreeResource(others->resource, RT_NONE);
return Success;
}
}
@ -2781,12 +2527,6 @@ FreeInputMask(OtherInputMasks ** imask)
*imask = NULL;
}
#define XIPropagateMask (KeyPressMask | \
KeyReleaseMask | \
ButtonPressMask | \
ButtonReleaseMask | \
PointerMotionMask)
void
RecalculateDeviceDeliverableEvents(WindowPtr pWin)
{
@ -2813,7 +2553,7 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin)
inputMasks->deliverableEvents[i] |=
(wOtherInputMasks(tmp)->deliverableEvents[i]
& ~inputMasks->dontPropagateMask[i] &
XIPropagateMask);
PropagateMask[i]);
}
if (pChild->firstChild) {
pChild = pChild->firstChild;
@ -2927,7 +2667,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
return Success;
/* If the input focus is PointerRootWin, send the event to where
* the pointer is if possible, then perhaps propagate up to root. */
* the pointer is if possible, then perhaps propogate up to root. */
if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(d);
@ -2959,7 +2699,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
break;
}
}
else if (!XaceHookSendAccess(client, NULL, pWin, ev, count))
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count))
DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab);
return Success;
}
@ -3120,7 +2860,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
ic = inputMasks->inputClients;
for (i = 0; i < EMASKSIZE; i++)
inputMasks->dontPropagateMask[i] = 0;
FreeResource(ic->resource, X11_RESTYPE_NONE);
FreeResource(ic->resource, RT_NONE);
}
}
@ -3226,7 +2966,7 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
{
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
if (mask & ~XIPropagateMask) {
if (mask & ~PropagateMask[maskndx]) {
client->errorValue = mask;
return BadValue;
}
@ -3236,19 +2976,14 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
inputMasks->dontPropagateMask[maskndx] = mask;
}
else {
if (!inputMasks) {
int ret = AddExtensionClient(pWin, client, 0, 0);
if (ret != Success)
return ret;
inputMasks = wOtherInputMasks(pWin);
BUG_RETURN_VAL(!inputMasks, BadAlloc);
}
if (!inputMasks)
AddExtensionClient(pWin, client, 0, 0);
inputMasks = wOtherInputMasks(pWin);
inputMasks->dontPropagateMask[maskndx] = mask;
}
RecalculateDeviceDeliverableEvents(pWin);
if (inputMasks && ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, RT_NONE);
return Success;
}
@ -3342,7 +3077,6 @@ 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

@ -44,6 +44,7 @@ extern int DeviceBusy;
extern int BadClass;
/* Note: only the ones needed in files other than extinit.c are declared */
extern const Mask DevicePointerMotionMask;
extern const Mask DevicePointerMotionHintMask;
extern const Mask DeviceFocusChangeMask;
extern const Mask DeviceStateNotifyMask;
@ -55,6 +56,8 @@ extern const Mask DevicePresenceNotifyMask;
extern const Mask DevicePropertyNotifyMask;
extern const Mask XIAllMasks;
extern Mask PropagateMask[];
extern int DeviceValuator;
extern int DeviceKeyPress;
extern int DeviceKeyRelease;

View file

@ -51,7 +51,9 @@ SOFTWARE.
*/
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
@ -60,17 +62,11 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#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 "extinit_priv.h"
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -133,8 +129,13 @@ SOFTWARE.
* breaks down. The device needs the dev->button->motionMask. If DBMM is
* the same as BMM, we can ensure that both core and device events can be
* delivered, without the need for extra structures in the DeviceIntRec. */
const Mask DeviceKeyPressMask = KeyPressMask;
const Mask DeviceKeyReleaseMask = KeyReleaseMask;
const Mask DeviceButtonPressMask = ButtonPressMask;
const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
const Mask DeviceProximityMask = (1L << 4);
const Mask DeviceStateNotifyMask = (1L << 5);
const Mask DevicePointerMotionMask = PointerMotionMask;
const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
const Mask DeviceButton1MotionMask = Button1MotionMask;
const Mask DeviceButton2MotionMask = Button2MotionMask;
@ -152,6 +153,7 @@ const Mask DevicePropertyNotifyMask = (1L << 19);
const Mask XIAllMasks = (1L << 20) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
static struct dev_type {
Atom type;
@ -256,19 +258,19 @@ static int (*ProcIVector[]) (ClientPtr) = {
/* For swapped clients */
static int (*SProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
NULL, /* 0 */
SProcXGetExtensionVersion, /* 1 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
SProcXListInputDevices, /* 2 */
SProcXOpenDevice, /* 3 */
SProcXCloseDevice, /* 4 */
SProcXSetDeviceMode, /* 5 */
SProcXSelectExtensionEvent, /* 6 */
SProcXGetSelectedExtensionEvents, /* 7 */
SProcXChangeDeviceDontPropagateList, /* 8 */
SProcXGetDeviceDontPropagateList, /* 9 */
SProcXGetDeviceMotionEvents, /* 10 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
SProcXChangeKeyboardDevice, /* 11 */
SProcXChangePointerDevice, /* 12 */
SProcXGrabDevice, /* 13 */
SProcXUngrabDevice, /* 14 */
SProcXGrabDeviceKey, /* 15 */
@ -276,30 +278,30 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXGrabDeviceButton, /* 17 */
SProcXUngrabDeviceButton, /* 18 */
SProcXAllowDeviceEvents, /* 19 */
ProcXGetDeviceFocus, /* 20 */
SProcXGetDeviceFocus, /* 20 */
SProcXSetDeviceFocus, /* 21 */
ProcXGetFeedbackControl, /* 22 */
SProcXGetFeedbackControl, /* 22 */
SProcXChangeFeedbackControl, /* 23 */
ProcXGetDeviceKeyMapping, /* 24 */
SProcXGetDeviceKeyMapping, /* 24 */
SProcXChangeDeviceKeyMapping, /* 25 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
SProcXGetDeviceModifierMapping, /* 26 */
SProcXSetDeviceModifierMapping, /* 27 */
SProcXGetDeviceButtonMapping, /* 28 */
SProcXSetDeviceButtonMapping, /* 29 */
SProcXQueryDeviceState, /* 30 */
SProcXSendExtensionEvent, /* 31 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
SProcXDeviceBell, /* 32 */
SProcXSetDeviceValuators, /* 33 */
SProcXGetDeviceControl, /* 34 */
SProcXChangeDeviceControl, /* 35 */
ProcXListDeviceProperties, /* 36 */
SProcXListDeviceProperties, /* 36 */
SProcXChangeDeviceProperty, /* 37 */
SProcXDeleteDeviceProperty, /* 38 */
SProcXGetDeviceProperty, /* 39 */
SProcXIQueryPointer, /* 40 */
SProcXIWarpPointer, /* 41 */
SProcXIChangeCursor, /* 42 */
ProcXIChangeHierarchy, /* 43 */
SProcXIChangeHierarchy, /* 43 */
SProcXISetClientPointer, /* 44 */
SProcXIGetClientPointer, /* 45 */
SProcXISelectEvents, /* 46 */
@ -362,6 +364,8 @@ RESTYPE RT_INPUTCLIENT;
extern XExtensionVersion XIVersion;
Mask PropagateMask[EMASKSIZE];
/*****************************************************************
*
* Versioning support
@ -516,7 +520,7 @@ static void
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -540,7 +544,7 @@ static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -854,74 +858,6 @@ SBarrierEvent(xXIBarrierEvent * from,
swapl(&to->eventid);
}
static void
SGesturePinchEvent(xXIGesturePinchEvent* from,
xXIGesturePinchEvent* to)
{
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
swaps(&to->deviceid);
swapl(&to->time);
swapl(&to->detail);
swapl(&to->root);
swapl(&to->event);
swapl(&to->child);
swapl(&to->root_x);
swapl(&to->root_y);
swapl(&to->event_x);
swapl(&to->event_y);
swapl(&to->delta_x);
swapl(&to->delta_y);
swapl(&to->delta_unaccel_x);
swapl(&to->delta_unaccel_y);
swapl(&to->scale);
swapl(&to->delta_angle);
swaps(&to->sourceid);
swapl(&to->mods.base_mods);
swapl(&to->mods.latched_mods);
swapl(&to->mods.locked_mods);
swapl(&to->mods.effective_mods);
swapl(&to->flags);
}
static void
SGestureSwipeEvent(xXIGestureSwipeEvent* from,
xXIGestureSwipeEvent* to)
{
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
swaps(&to->deviceid);
swapl(&to->time);
swapl(&to->detail);
swapl(&to->root);
swapl(&to->event);
swapl(&to->child);
swapl(&to->root_x);
swapl(&to->root_y);
swapl(&to->event_x);
swapl(&to->event_y);
swapl(&to->delta_x);
swapl(&to->delta_y);
swapl(&to->delta_unaccel_x);
swapl(&to->delta_unaccel_y);
swaps(&to->sourceid);
swapl(&to->mods.base_mods);
swapl(&to->mods.latched_mods);
swapl(&to->mods.locked_mods);
swapl(&to->mods.effective_mods);
swapl(&to->flags);
}
/** Event swapping function for XI2 events. */
void _X_COLD
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
@ -973,24 +909,28 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
SBarrierEvent((xXIBarrierEvent *) from,
(xXIBarrierEvent *) to);
break;
case XI_GesturePinchBegin:
case XI_GesturePinchUpdate:
case XI_GesturePinchEnd:
SGesturePinchEvent((xXIGesturePinchEvent*) from,
(xXIGesturePinchEvent*) to);
break;
case XI_GestureSwipeBegin:
case XI_GestureSwipeUpdate:
case XI_GestureSwipeEnd:
SGestureSwipeEvent((xXIGestureSwipeEvent*) from,
(xXIGestureSwipeEvent*) to);
break;
default:
ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
break;
}
}
/**************************************************************************
*
* Allow the specified event to have its propagation suppressed.
* The default is to not allow suppression of propagation.
*
*/
static void
AllowPropagateSuppress(Mask mask)
{
int i;
for (i = 0; i < MAXDEVICES; i++)
PropagateMask[i] |= mask;
}
/**************************************************************************
*
* Record an event mask where there is no unique corresponding event type.
@ -1011,6 +951,23 @@ SetEventInfo(Mask mask, int constant)
EventInfo[ExtEventIndex++].type = constant;
}
/**************************************************************************
*
* Allow the specified event to be restricted to being selected by one
* client at a time.
* The default is to allow more than one client to select the event.
*
*/
static void
SetExclusiveAccess(Mask mask)
{
int i;
for (i = 0; i < MAXDEVICES; i++)
ExtExclusiveMasks[i] |= mask;
}
/**************************************************************************
*
* Assign the specified mask to the specified event.
@ -1072,16 +1029,20 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceBusy += extEntry->errorBase;
BadClass += extEntry->errorBase;
SetMaskForExtEvent(KeyPressMask, DeviceKeyPress);
SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
AllowPropagateSuppress(DeviceKeyPressMask);
SetCriticalEvent(DeviceKeyPress);
SetMaskForExtEvent(KeyReleaseMask, DeviceKeyRelease);
SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
AllowPropagateSuppress(DeviceKeyReleaseMask);
SetCriticalEvent(DeviceKeyRelease);
SetMaskForExtEvent(ButtonPressMask, DeviceButtonPress);
SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
AllowPropagateSuppress(DeviceButtonPressMask);
SetCriticalEvent(DeviceButtonPress);
SetMaskForExtEvent(ButtonReleaseMask, DeviceButtonRelease);
SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
AllowPropagateSuppress(DeviceButtonReleaseMask);
SetCriticalEvent(DeviceButtonRelease);
SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
@ -1089,7 +1050,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
SetMaskForExtEvent(PointerMotionMask, DeviceMotionNotify);
SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
AllowPropagateSuppress(DevicePointerMotionMask);
SetCriticalEvent(DeviceMotionNotify);
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
@ -1107,6 +1069,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess(DeviceButtonGrabMask);
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,20 @@ 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,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -70,6 +72,7 @@ int _X_COLD
SProcXGetDeviceControl(ClientPtr client)
{
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return (ProcXGetDeviceControl(client));

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ 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.
@ -80,7 +97,6 @@ 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,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
@ -60,6 +62,20 @@ 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,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -62,6 +64,21 @@ 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,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ 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,6 +30,9 @@ 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>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#endif
#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,6 +76,7 @@ int _X_COLD
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
return (ProcXGetDeviceDontPropagateList(client));
@ -118,8 +119,6 @@ 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,6 +74,7 @@ int _X_COLD
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(client));

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -72,6 +74,7 @@ int _X_COLD
SProcXGetExtensionVersion(ClientPtr client)
{
REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes);
return (ProcXGetExtensionVersion(client));
@ -91,7 +94,7 @@ ProcXGetExtensionVersion(ClientPtr client)
REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (client->req_len != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
if (stuff->length != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
stuff->nbytes))
return BadLength;

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -74,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 (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
@ -107,7 +109,7 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
@ -151,7 +153,7 @@ ProcXGrabDevice(ClientPtr client)
* set when XI starts up) and binary OR's the device's mask to whatever the
* event mask for the given event type was.
* If an error occurs, it is sent to the client. Errors are generated if
* - if the device given in the event class is invalid
* - if the device given in the event classs is invalid
* - if the device in the class list is not the device given as parameter (no
* error if parameter is NULL)
*

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#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"
@ -74,6 +75,7 @@ int _X_COLD
SProcXGrabDeviceButton(ClientPtr client)
{
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
@ -105,7 +107,7 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST(xGrabDeviceButtonReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
return BadLength;
@ -123,7 +125,7 @@ ProcXGrabDeviceButton(ClientPtr client)
}
else {
mdev = PickKeyboard(client);
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#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"
@ -74,6 +75,7 @@ int _X_COLD
SProcXGrabDeviceKey(ClientPtr client)
{
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
@ -103,7 +105,7 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
return BadLength;
@ -121,7 +123,7 @@ ProcXGrabDeviceKey(ClientPtr client)
}
else {
mdev = PickKeyboard(client);
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}

View file

@ -50,15 +50,16 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "gtmotion.h"
/***********************************************************************
@ -71,6 +72,7 @@ int _X_COLD
SProcXGetDeviceMotionEvents(ClientPtr client)
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);

View file

@ -50,24 +50,38 @@ 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
@ -295,7 +309,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 = XaceHookDeviceAccess(client, d, DixGetAttrAccess);
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
if (rc == Success)
return FALSE;
@ -336,7 +350,7 @@ ProcXListInputDevices(ClientPtr client)
};
/* allocate space for saving skip value */
skip = calloc(inputInfo.numDevices, sizeof(Bool));
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
return BadAlloc;
@ -363,10 +377,6 @@ 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,6 +32,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -64,6 +66,21 @@ 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,6 +30,9 @@ 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,21 +32,35 @@ from The Open Group.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#endif
#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,6 +30,9 @@ 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,21 +50,23 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.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 "grabdev.h"
#include "selectev.h"
extern Mask ExtExclusiveMasks[];
static int
HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
XEventClass * cls, CARD16 *count)
@ -121,6 +123,7 @@ int _X_COLD
SProcXSelectExtensionEvent(ClientPtr client)
{
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -147,7 +150,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
return BadLength;
@ -172,7 +175,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
}
if ((ret =
SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
tmp[i].mask, DeviceButtonGrabMask)) != Success)
tmp[i].mask, ExtExclusiveMasks[i])) != Success)
return ret;
}

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#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"
@ -82,11 +83,12 @@ SProcXSendExtensionEvent(ClientPtr client)
EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
swapl(&stuff->destination);
swaps(&stuff->count);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
return BadLength;
@ -132,7 +134,7 @@ ProcXSendExtensionEvent(ClientPtr client)
REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
return BadLength;

View file

@ -50,18 +50,32 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#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.
@ -78,7 +92,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
REQUEST(xSetDeviceButtonMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSetDeviceButtonMappingReq) + stuff->map_length))
return BadLength;

View file

@ -30,6 +30,9 @@ 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,18 +50,32 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#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.
@ -86,7 +100,7 @@ ProcXSetDeviceValuators(ClientPtr client)
.status = Success
};
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
stuff->num_valuators)
return BadLength;

View file

@ -30,6 +30,9 @@ 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,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
@ -73,6 +75,7 @@ int _X_COLD
SProcXSetDeviceFocus(ClientPtr client)
{
REQUEST(xSetDeviceFocusReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
swapl(&stuff->focus);
swapl(&stuff->time);

View file

@ -50,19 +50,34 @@ 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.
@ -79,7 +94,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
REQUEST(xSetDeviceModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
(stuff->numKeyPerModifier << 1))
return BadLength;

Some files were not shown because too many files have changed in this diff Show more