Commit Graph

439 Commits

Author SHA1 Message Date
Olivier Fourdan 3cdac5ba07 mi: List extensions in usage message
Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.

v2:
 * Print the header message in the ListStaticExtensions() (Peter
   Hutterer)
 * Do not export ListStaticExtensions() as Xserver API

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-01-29 12:52:09 +00:00
Michel Dänzer add3df2001 Consolidate fourcc.h
Move the copy in hw/xfree86/common to include/, and remove the one in
hw/kdrive/src/.

Fixes DIX glamor code including an xfree86 DDX header.
2020-09-15 11:43:16 +02:00
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Sven Joachim 47387916fb Fix various spelling errors 2019-10-01 17:05:28 +00:00
Jon Turney 2764128e9f Fix missing prototype warning for xf86_find_platform_device_by_devnum()
../hw/kdrive/src/kdrive.c:999:1: warning: no previous prototype for ‘xf86_find_platform_device_by_devnum’ [-Wmissing-prototypes]

Place the same guards around this stub as are around including the
hotplug.h header which declares the prototype.
2019-04-17 13:57:38 +01:00
Adam Jackson 03b2125005 dix: Remove LegalModifier()
This hasn't done anything besides return TRUE in a long long time.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:17 -04:00
Adam Jackson a23eba2a91 dix: Merge AbortDDX into ddxGiveUp
These are so close to identical that most DDXes implement one in terms
of the other. All the relevant cases can be distinguished by the error
code, so merge the functions together to make things simpler.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:12 -04:00
Eric Anholt e3e5265743 meson: Remove XXX for libconfig in kdrive.
This is already included in ephyr (the only kdrive server left)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-02 10:27:26 -04:00
Adam Jackson d8ec33fe05 glx: Use vnd layer for dispatch (v4)
The big change here is MakeCurrent and context tag tracking. We now
delegate context tags entirely to the vnd layer, and simply store a
pointer to the context state as the tag data. If a context is deleted
while it's current, we allocate a fake ID for the context and move the
context state there, so the tag data still points to a real context. As
a result we can stop trying so hard to detach the client from contexts
at disconnect time and just let resource destruction handle it.

Since vnd handles all the MakeCurrent protocol now, our request handlers
for it can just be return BadImplementation. We also remove a bunch of
LEGAL_NEW_RESOURCE, because now by the time we're called vnd has already
allocated its tracking resource on that XID.

v2: Update to match v2 of the vnd import, and remove more redundant work
like request length checks.

v3: Add/remove the XID map from the vendor private thunk, not the
backend. (Kyle Brenneman)

v4: Fix deletion of ghost contexts (Kyle Brenneman)

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14 17:04:44 -05:00
Adam Jackson bed2830099 kdrive: remove KdSignalWrapper etc.
This no longer does anything useful.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-12-13 11:11:47 -05:00
Daniel Martin d5379b350f Use ARRAY_SIZE all over the tree
Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with
the ARRAY_SIZE macro from dix.h when possible. A semantic patch for
coccinelle has been used first. Additionally, a few macros have been
inlined as they had only one or two users.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-30 13:45:20 -04:00
Eric Anholt 11c133aafe meson: Fix kdrive build.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 11:04:40 +10:00
Adam Jackson b7376fb933 kdrive: Remove dead slots from KdCardFuncs
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-05-03 16:01:25 -04:00
Adam Jackson c42311a9d7 kdrive: Remove KdOsFuncs
Only the Init slot was used, and Xephyr can just as easily do that
initialization directly.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-05-03 16:00:54 -04:00
Adam Jackson c0375dced3 kdrive: static and dead code cleanup
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-05-03 16:00:52 -04:00
Eric Anholt 1549e30372 Add a Meson build system alongside autotools.
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest,
and Xdmx so far.  The outline of Xquartz/Xwin support is in tree, but
hasn't been built yet.  The unit tests are also not done.

The intent is to build this as a complete replacement for the
autotools system, then eventually replace autotools.  meson is faster
to generate the build, faster to run the bulid, shorter to write the
build files in, and less error-prone than autotools.

v2: Fix indentation nits, move version declaration to project(), use
    existing meson_options for version-config.h's vendor name/web.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 15:25:27 -07:00
Adam Jackson 7f1ef9289d dix: Lift DPMS to a screen hook
Following on from the previous change, this adds a DPMS hook to the
ScreenRec and uses that to infer DPMS support. As a result we can drop
the dpms stub code from Xext.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-27 15:59:42 -04:00
Eric Anholt 190c2adf4a kdrive: Drop kdrive-config.h.
It had nothing left in it that was used but wasn't in dix-config.h.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-03-23 13:17:36 -04:00
Eric Anholt 1b1a8c4817 kdrive: Unifdef KDRIVE_EVDEV.
ajax deleted the evdev driver in the removal of fbdev and the linux
backend.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-03-23 13:14:13 -04:00
Peter Hutterer d13cb97442 ddx: add new call to purge input devices that weren't added
Special case for the systemd-logind case in xfree86: when we're vt-switched
away and a device is plugged in, we get a paused fd from logind. Since we
can't probe the device or do anything with it, we store that device in the
xfree86 and handle it later when we vt-switch back. The device is not added to
inputInfo.devices until that time.

When the device is removed while still vt-switched away, the the config system
never notifies the DDX. It only runs through inputInfo.devices and our device
was never added to that.

When a device is plugged in, removed, and plugged in again while vt-switched
away, we have two entries in the xfree86-specific list that refer to the same
device node, both pending for addition later. On VT switch back, the first one
(the already removed one) will be added successfully, the second one (the
still plugged-in one) fails. Since the fd is correct, the device works until
it is removed again. The removed devices' config_info (i.e. the syspath)
doesn't match the actual device we addded tough (the input number increases
with each plug), it doesn't get removed, the fd remains open and we lose track
of the fd count. Plugging the device in again leads to a dead device.

Fix this by adding a call to notify the DDX to purge any remainders of devices
with the given config_info, that's the only identifiable bit we have at this
point.

https://bugs.freedesktop.org/show_bug.cgi?id=97928

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-10-26 15:35:07 +10:00
Keith Packard fb0802113b Remove readmask from screen block/wakeup handler
With no users of the interface needing the readmask anymore, we can
remove it from the argument passed to these functions.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:27:51 -04:00
Keith Packard fa7b70a9b8 kdrive: Only enable threaded input if we have input devices
When there aren't any devices, the input thread is going to be pretty
lonely, so don't bother to even start it.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-20 15:47:06 +10:00
Adam Jackson 6178b1c91c dix: Use OsSignal() not signal()
As the man page for the latter states:

    The effects of signal() in a multithreaded process are unspecified.

We already have an interface to call sigaction() instead, use it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-06-08 11:36:31 -04:00
Keith Packard e69061e605 kdrive: Use threaded input
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 16:07:54 -07:00
Keith Packard 0bbb5aabf7 kdrive: Don't lock input across read in KdNotifyFd
We won't need these locks with the new threaded input code as it holds
the input lock across all of the input device I/O operations.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 16:07:54 -07:00
Keith Packard 6a5a4e6037 Remove SIGIO support for input [v5]
This removes all of the SIGIO handling support used for input
throughout the X server, preparing the way for using threads for input
handling instead.

Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls
to stub functions input_lock/input_unlock so that we don't lose this
information.

xfree86 SIGIO support is reworked to use internal versions of
OsBlockSIGIO and OsReleaseSIGIO.

v2: Don't change locking order (Peter Hutterer)
v3: Comment weird && FALSE in xf86Helper.c
    Leave errno save/restore in xf86ReadInput
    Squash with stub adding patch (Peter Hutterer)
v4: Leave UseSIGIO config parameter so that
    existing config files don't break (Peter Hutterer)
v5: Split a couple of independent patch bits out
    of kinput.c (Peter Hutterer)

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 16:07:54 -07:00
Keith Packard 8cf832c288 kdrive: Remove unneeded AddEnabledDevice/RemoveEnabledDevice calls
kdrive uses the NotifyFd interface, which handles all of the necessary
fd configuration in the OS layer. Having it also use the old
EnableDevice interfaces is incorrect.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 16:07:54 -07:00
Laércio de Sousa 9c88cb9b05 kdrive/ephyr: map host X server's keymap into Xephyr, if supported
Currently Xephyr doesn't inherit host X server's keymap, which
may lead to keymap mismatches when using a non-US keyboard in a
window inside Xephyr. This patch makes Xephyr change its keymap
to match host X server's one (unless XKB support is disabled),
using xcb-xkb to retrieve the needed XKB controls.
This implementation is analogous to Xnest one at commit 83fef4235.

Supersedes: https://patchwork.freedesktop.org/patch/67504

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-03-01 11:00:34 -05:00
Laércio de Sousa daa6d2d58f config/udev: distinguish between real keyboards and other key devices
This patch introduces a new flag ATTR_KEY for hotplugged input devices,
so we can better distinguish between real keyboards (i.e. devices with
udev property ID_INPUT_KEYBOARD="1") and other key input devices like
lid switches, power buttons, etc.

All supported hotplug backends (udev, hal, and wscons) will set both
flags ATTR_KEY and ATTR_KEYBOARD for real keyboards, but udev backend
will set ATTR_KEY, but not ATTR_KEYBOARD, for non-keyboard key input
devices (hal and wscons will set both flags in any case). With this
distinction, kdrive input hotplugging mechanism will be allowed to only
grab real keyboards, as other key input devices are currently not
supported.

In order to don't break current behaviour, this patch will replace all
ATTR_KEYBOARD occurrences with ATTR_KEY in hw/xfree86/common/xf86Xinput.c.

[ajax: Just add ATTR_KEY, don't re-number the other attributes]

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-03-01 10:46:48 -05:00
Laércio de Sousa 40e32e9fc9 kdrive: add options to set default XKB properties
This patch introduces convenient command-line options -xkb-rules,
-xkb-model, -xkb-layout, -xkb-variant, and -xkb-options, to set default
values for these properties.

These options can be handful for cases in which compile-time default
values don't match user locale, since kdrive doesn't support InputClass
matching rules yet and not all Linux distros provide default rules to
store these values in udev properties (which by the way is a discouraged
practice).

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-03-01 10:46:31 -05:00
Laércio de Sousa 0cf3d72be6 kdrive: introduce input hot-plugging support for udev and hal backends (#33140)
This patch introduces input hot-plugging support for kdrive-based
applications in multi-seat context. This feature is enabled by passing
-seat option with desired seat name. All keyboard/mouse devices assigned
to that seat will be automatically grabbed by kdrive.

It supports udev and hal backends for input hot-plugging support.
Another patches may be required for wscons backend.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=33140

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-03-01 10:46:13 -05:00
Daniel Stone e957a2e5dd dix: Add hybrid full-size/empty-clip mode to SetRootClip
216bdbc735 removed the SetRootClip call in the XWayland output-hotplug
handler when running rootless (e.g. as a part of Weston/Mutter), since
the root window has no storage, so generating exposures will result in
writes to invalid memory.

Unfortunately, preventing the segfault also breaks sprite confinement.
SetRootClip updates winSize and borderSize for the root window, which
when combined with RRScreenSizeChanged calling ScreenRestructured,
generates a new sprite-confinment area to update it to the whole screen.

Removing this call results in the window geometry being reported
correctly, but winSize/borderSize never changing from their values at
startup, i.e. out of sync with the root window geometry / screen
information in the connection info / XRandR.

This patch introduces a hybrid mode, where we update winSize and
borderSize for the root window, enabling sprite confinement to work
correctly, but keep the clip emptied so exposures are never generated.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-02-22 13:26:31 -05:00
Laércio de Sousa 0b80da0d18 kdrive: set "evdev" driver for input devices automatically, if available.
If kdrive input driver "evdev" is available, no other driver was
explicitly set for a given input device, and its kernel device node is
/dev/input/event*, this patch will make kdrive set "evdev" driver
automatically for such device.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-02-08 15:04:20 -05:00
Laércio de Sousa 6d6fd688ec kdrive: fix up NewInputDeviceRequest() implementation
This patch simplifies NewInputDeviceRequest() implementation in
kinput.c, making use of improved KdParseKbdOptions() /
KdParsePointerOptions() and merging several "if (ki)"/"if (pi)" clauses.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-02-08 15:04:07 -05:00
Keith Packard 483c2a1adf hw/kdrive: Use NotifyFd for kdrive input devices
This switches the kdrive code to use FD notification for input
devices, rather than the block and wakeup handlers.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:18 -05:00
Richard PALO e6b106715f Replace 'sun' with '__sun'
Globally replace #ifdef and #if defined usage of 'sun' with '__sun'
such that strict ISO compiler modes such as -ansi or -std=c99 can be used.

Signed-off-by: Richard PALO <richard@NetBSD.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-11-30 11:51:22 -05:00
Egbert Eich 44d0fd435a kdrive/UnregisterFd: Fix off by one
The number of FDs has been decremented already, therefore the
number contained the index of the top one that is to me moved down.

This problem was introduced by:
  commit 1110b71e36
  Author: Chris Clayton <chris2553@googlemail.com>

    kdrive: fix build error on gcc 4.8 for out-of-bounds array access

The reason for the warning was likely a confused compiler.
Hoping to reduce the confusion by moving the decrement behind the end
if the copy loop.

Signed-off-by: Egbert Eich <eich@suse.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-30 11:48:08 -05:00
Eric Anholt 88355cedfc kdrive: Remove dead debug arrays.
These have never been used in the history of the tree, and were
producing string literal const loss warnings.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2015-09-23 15:17:22 -04:00
Alan Coopersmith dc5acaa28a Convert hw/kdrive to new *allocarray functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:58:08 -07:00
Peter Hutterer f485a1af64 Drop valuator mask argument from GetKeyboardEvents
Nothing was using it and if anyone had they would've gotten a warning and
noticed that it doesn't actually work. Drop this, it has been unused for years.

Input ABI 22

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2015-03-13 12:31:21 +10:00
Adam Jackson 73e2383b73 dix: Always store GC client clip as a region (v2)
Again, this changes FixesCreateRegionFromGC to throw BadMatch when fed a
GC with no client clip.

v2: Fix Xnest and some variable names (Keith)

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-27 15:46:05 -04:00
Keith Packard d634ecdf82 Merge remote-tracking branch 'ajax/dead-code' 2014-10-09 15:08:31 +02:00
Adam Jackson 0d30d44a8c dix: Drop the third argument from WindowExposuresProcPtr
A careful read shows that it was always NULL.  It hasn't always been; as
the DDX spec indicates, it was the "occluded region that has backing
store", but since that backing store code is long gone, we can nuke it.

mi{,Overlay}WindowExposures get slightly simpler here, and will get even
simpler in just a moment.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:44 +02:00
Adam Jackson a8c6fc46c0 kdrive: Remove vestigial reference to fbInitValidateTree
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-08 16:01:35 +02:00
Adam Jackson 645063cd93 exa, kdrive: Remove redundant BitsPerPixel macros
We already get this from servermd.h

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-08 10:10:39 +02:00
Laércio de Sousa 376f4de8ae kdrive: add support to +X+Y syntax in -screen option parsing
This patch enhances current -screen option parsing for kdrive-based
applications. It can parse strings like
<WIDTH>x<HEIGHT>+<XOFFSET>+<YOFFSET>, storing X and Y offsets
in KdScreenInfo instances.

For negative values, this patch supports +-X+-Y (not -X-Y) syntax.

It will allow e.g. proper Xephyr window placement for multiseat
purposes.

Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-21 20:14:54 -05:00
Eric Anholt 3714f54016 kdrive: Remove a dead struct.
It's never been used in the history of the tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-07 12:39:53 -07:00
Eric Anholt ef258fa4fd xv: Drop the ClientPtr from the interface to the DDX.
Nobody was using it.

v2: Merge the hunk that was accidentally in the previous commit into
    this one.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-07 12:39:53 -07:00
Eric Anholt 850b268e2b xv: Remove the no-op AllocatePort/FreePort interfaces.
v2: Fix accidentally squashed-in change for dropping client from the
    arguments, which should have been in the next commit.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com> (v2)
2014-08-07 12:39:48 -07:00
Eric Anholt 41d4a626c6 kdrive: Don't bother explicitly clearing new window privates to NULL.
Privates are initially cleared to zero by dixInitPrivates().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00