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>
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>
../hw/dmx/config/dmxparse.c: In function ‘dmxConfigCreateOption’:
../hw/dmx/config/dmxparse.c:385:13: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
strncpy(option->string + offset, p->string, len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/config/dmxparse.c:383:23: note: length computed here
int len = strlen(p->string);
^~~~~~~~~~~~~~~~~
The thing it's warning about is intentional, the surrounding code does
its own nul-termination. Make that obvious by using memcpy instead.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
This threw:
../hw/dmx/input/dmxarg.c: In function ‘dmxArgParse’:
../hw/dmx/input/dmxarg.c:128:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(tmp, string, len);
^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/input/dmxarg.c:126:11: note: length computed here
len = strlen(string) + 2;
^~~~~~~~~~~~~~
This code predates xstrtokenize, but that's no excuse.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
../hw/dmx/dmxpixmap.c: In function ‘dmxBitmapToRegion’:
../include/regionstr.h:174:22: warning: ‘Box.x1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
(_pReg)->extents = *(_pBox);
~~~~~~~~~~~~~~~~~^~~~~~~~~~
../hw/dmx/dmxpixmap.c:208:12: note: ‘Box.x1’ was declared here
BoxRec Box;
^~~
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
snprintf doesn't terminate the string if it truncates, so things like
this are lurking crashers:
../hw/dmx/dmxprop.c: In function ‘dmxPropertyIdentifier.part.0’:
../hw/dmx/dmxprop.c:94:36: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 123 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
^~ ~~~~~~~~
../hw/dmx/dmxprop.c:94:5: note: ‘snprintf’ output 7 or more bytes (assuming 262) into a destination of size 128
snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/dmxprop.c: In function ‘dmxPropertyWindow’:
../hw/dmx/dmxprop.c:372:36: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
^~
../hw/dmx/dmxprop.c:372:5: note: ‘snprintf’ output between 3 and 140 bytes into a destination of size 128
snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We could be more precise about termination, but meh.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
A cosmetic change for automake (though we have to replicate some of
xorg-macros.m4 in manpages.am now), but meson's configure_file() wants
@-delimited strings.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
/home/ajax/git/xserver/at/../hw/dmx/input/dmxinputinit.c: In function ‘dmxInputInit’:
/home/ajax/git/xserver/at/../hw/dmx/input/dmxinputinit.c:1019:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int found;
Signed-off-by: Adam Jackson <ajax@redhat.com>
Add a stub for Xnest so it continues to link, but otherwise we support
GLX on every server so there's no need to make every DDX add it.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Problem: Xdmx exit with error "(Fatal Error) dmx: Unknown input argument: "
if local input driver is specified (example: -input local,usb-kbd,usb-mou).
Cause: code block for remote input drivers is placed in code path common
for all drivers.
Fix: affected code block moved to remote input driver code path part.
Signed-off-by: Raimonds Cicans <ray@apollo.lv>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This header is a truly ancient remnant of the SGI SI code, which used
the same struct for visual/fbconfig state on both sides of the wire.
We're not using this struct ourselves so let's stop depending on the
header.
Signed-off-by: Adam Jackson <ajax@redhat.com>
String arguments as elements in the array passed to the link_with
argument in meson's executable() functions are not valid and will end up
causing the build file generation to file. This actually ended up
exposing a bug in meson that caused it not to report where in the
meson.build file it was failing:
https://github.com/mesonbuild/meson/pull/2527
The proper way to have a variable that can contain either an empty link
target or an actual link target is:
some_target = []
if some_cond
some_target = static_library(...)
endif
This way if some_cond is False, some_target gets set to [], gets passed
to executable() in the link_with array, and then gets removed by array
flattening.
This also unbreaks Xwayland builds with -Dglx=false, the thing that
originally made me notice this.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
Fixes several dozen cases like:
../hw/dmx/examples/ev.c: In function ‘main’:
../hw/dmx/examples/ev.c:147:29: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
tmp = "X";
^
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
../hw/dmx/dmx.c:66:12: warning: redundant redeclaration of ‘PanoramiXNumScreens’ [-Wredundant-decls]
extern int PanoramiXNumScreens;
^~~~~~~~~~~~~~~~~~~
In file included from ../hw/dmx/dmx.c:65:0:
../Xext/panoramiXsrv.h:11:22: note: previous declaration of ‘PanoramiXNumScreens’ was here
extern _X_EXPORT int PanoramiXNumScreens;
^~~~~~~~~~~~~~~~~~~
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Since commit 3ef16dfb98, "dmx: fix
linking", linking dmx is broken for me:
CCLD Xdmx.exe
../../render/.libs/librender.a(glyph.o): In function `HashGlyph':
/wip/xserver/build.x86_64/../render/glyph.c:168: undefined reference to `x_sha1_init'
/wip/xserver/build.x86_64/../render/glyph.c:174: undefined reference to `x_sha1_update'
/wip/xserver/build.x86_64/../render/glyph.c:177: undefined reference to `x_sha1_update'
/wip/xserver/build.x86_64/../render/glyph.c:180: undefined reference to `x_sha1_final'
../../render/.libs/librender.a(mipict.o): In function `miClipPictureReg':
/wip/xserver/build.x86_64/../render/mipict.c:233: undefined reference to `pixman_region_n_rects'
/wip/xserver/build.x86_64/../render/mipict.c:234: undefined reference to `pixman_region_n_rects'
/wip/xserver/build.x86_64/../render/mipict.c:235: undefined reference to `pixman_region_rectangles'
/wip/xserver/build.x86_64/../render/mipict.c:236: undefined reference to `pixman_region_rectangles'
/wip/xserver/build.x86_64/../render/mipict.c:248: undefined reference to `pixman_region_init'
/wip/xserver/build.x86_64/../render/mipict.c:251: undefined reference to `pixman_region_not_empty'
/wip/xserver/build.x86_64/../render/mipict.c:261: undefined reference to `pixman_region_not_empty'
../../render/.libs/librender.a(mipict.o): In function `miComputeCompositeRegion':
/wip/xserver/build.x86_64/../render/mipict.c:340: undefined reference to `pixman_region_init'
The change this was fixing appears to be effectively reverted by
542d9f6807, so just revert commit
3ef16dfb98.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
gcc/glibc think the snprintf in dmxExecOS() might truncate. Yes, it
might, and we also don't care. Just delete all this.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
Modern glibc is very insistent that you care about whether write()
succeeds:
../hw/dmx/input/usb-keyboard.c: In function ‘kbdUSBCtrl’:
../hw/dmx/input/usb-keyboard.c:292:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(priv->fd, &event, sizeof(event));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This appears to be essentially unused. The only known client-side
library for the SELinux extension is xcb, which does not look for the
name "Flask". The "SGI-GLX" alias for GLX appears to be a bit of
superstition at this point, NVIDIA's driver does not expose it and Mesa
does not check for it.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
Our top-level glx.h include already provides all of the tokens we use,
and fixes redefinition warnings in the meson build.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Building xserver with meson -Db_lto=true found this! Check it:
../hw/dmx/dmx.c:66:22: warning: type of ‘XRT_WINDOW’ does not match
original declaration [-Wlto-type-mismatch]
extern unsigned long XRT_WINDOW;
^
../include/resource.h:58:18: note: type ‘RESTYPE’ should match type ‘long
unsigned int’
typedef uint32_t RESTYPE;
^
../Xext/panoramiX.c:85:9: note: ‘XRT_WINDOW’ was previously declared here
RESTYPE XRT_WINDOW;
^
../Xext/panoramiX.c:85:9: note: code may be misoptimized unless
-fno-strict-aliasing is used
I have never managed successfully to build xserver with LTO with
autotools, so, score one for meson.
Get the decl from panoramiXsrv.h, which includes panoramiX.h first anyway.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
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>
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>
A null pointer dereference can occur in dmxSync, because TimerForce
does not handle a null pointer.
dmxSyncTimer is set to NULL a few lines above on a certain condition,
which happened on my machine. The explicit NULL check allowed me to
start Xdmx again without a segmentation fault.
Reviewed-by: Adam Jackson <ajax@redhat.com>
This touches everything that ends up in the Xorg binary; the big missing
part is GLX since that's all generated code. Cuts about 14k from the
binary on amd64.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
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>
This uses the wrapper in case we need to emulate poll with select
as we do on Windows.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This removes the last uses of fd_set from the server interfaces
outside of the OS layer itself.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Use SetNotifyFd instead, with the hope that someday someone will come
fix this to be more efficient -- right now, the wakeup handler is
doing the event reading, instead of the notify callback.
v2: no need to patch dmxsigio.c as it has been removed.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This new libXfont API eliminates exposing internal X server symbols to
the font library, replacing those with a struct full of the entire API
needed to use that library.
v2: Use libXfont2 instead of libXfont_2
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This code was broken anyway. Note that DEVICE_OFF would make dmx think
_no_ devices were using SIGIO anymore, which means 'xinput disable' on
your mouse would probably do weird things to your keyboard too. Rather
than try to repair that and keep SIGIO working on this one niche DDX,
just rip it out and use the thread model like everyone else.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
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>
The current SIGIO signal handler method, used at generation of input events,
has a bunch of oddities. This patch introduces an alternative way using a
thread, which is used to select() all input device file descriptors.
A mutex was used to control the access to input structures by the main and input
threads. Two pipes to emit alert events (such hotplug ones) and guarantee the
proper communication between them was also used.
Co-authored-by: Fernando Carrijo <fcarrijo@freedesktop.org>
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
v2: Fix non-Xorg link. Enable where supported by default.
This also splits out the actual enabling of input threads to
DDX-specific patches which follow
v3: Make the input lock recursive
v4: Use regular RECURSIVE_MUTEXes instead of rolling our own
Respect the --disable-input-thread configuration option by
providing stubs that expose the same API/ABI.
Respond to style comments from Peter Hutterer.
v5: use __func__ in inputthread debug and error mesages.
Respond to style comments from Peter Hutterer.
v6: use AX_PTHREAD instead of inlining pthread tests.
Suggested by Emil Velikov <emil.l.velikov@gmail.com>
v7: Use pthread_sigmask instead of sigprocmask when using threads
Suggested by Adam Jackson <ajax@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
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>
Also change the dot font setting back to the default of Helvetica as
doxygen no longer ships FreeSans.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>