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>
gcc 5.1 throws a rather amusing warning here:
glxcmdsswap.c: In function ‘__glXSwapQueryExtensionsString’:
glxcmdsswap.c:439:1: warning: function might be candidate for attribute
‘noreturn’ [-Wsuggest-attribute=noreturn]
__glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
This is entirely accurate, albeit curiously phrased: swapping some bits
hanging off the end of a null pointer will make Xdmx crash, so from the
perspective of code generation the function will indeed not return.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Make the maximum number of clients user configurable, either from the command
line or from xorg.conf
This patch works by using the MAXCLIENTS (raised to 512) as the maximum
allowed number of clients, but allowing the actual limit to be set by the
user to a lower value (keeping the default of 256).
There is a limit size of 29 bits to be used to store both the client ID and
the X resources ID, so by reducing the number of clients allowed to connect to
the X server, the user can increase the number of X resources per client or
vice-versa.
Parts of this patch are based on a similar patch from Adam Jackson
<ajax@redhat.com>
This now requires at least xproto 7.0.28
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
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>
Gets rid of 16 instances of gcc 4.8 warnings:
In file included from dmxgc.c:41:0:
dmx.h:327:23: warning: assignment discards ‘const’ qualifier from
pointer target type [enabled by default]
(_saved)->_entry = (_actual)->_entry; \
^
dmxgc.h:80:5: note: in expansion of macro ‘DMX_WRAP’
DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC)); \
^
dmxgc.c:192:5: note: in expansion of macro ‘DMX_GC_FUNC_EPILOGUE’
DMX_GC_FUNC_EPILOGUE(pGC);
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of 9 instances of gcc 4.8 warning:
glxcmds.c: In function ‘CreateContext’:
glxcmds.c:378:13: warning: passing argument 1 of ‘glxIsExtensionSupported’
discards ‘const’ qualifier from pointer target type [enabled by default]
else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
^
In file included from glxserver.h:49:0,
from glxcmds.c:41:
glxscreens.h:53:12: note: expected ‘char *’ but argument is of type
‘const char *’
extern int glxIsExtensionSupported(char *ext);
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of these gcc 4.8 warnings:
dmxcb.c:50:12: warning: redundant redeclaration of ‘PanoramiXPixWidth’
[-Wredundant-decls]
extern int PanoramiXPixWidth;
^
In file included from dmxcb.c:49:0:
../../Xext/panoramiXsrv.h:12:22: note: previous declaration of
‘PanoramiXPixWidth’ was here
extern _X_EXPORT int PanoramiXPixWidth;
^
dmxcb.c:51:12: warning: redundant redeclaration of ‘PanoramiXPixHeight’
[-Wredundant-decls]
extern int PanoramiXPixHeight;
^
In file included from dmxcb.c:49:0:
../../Xext/panoramiXsrv.h:13:22: note: previous declaration of
‘PanoramiXPixHeight’ was here
extern _X_EXPORT int PanoramiXPixHeight;
^
dmxcb.c:52:12: warning: redundant redeclaration of ‘PanoramiXNumScreens’
[-Wredundant-decls]
extern int PanoramiXNumScreens;
^
In file included from dmxcb.c:49:0:
../../Xext/panoramiXsrv.h:11:22: note: previous declaration of
‘PanoramiXNumScreens’ was here
extern _X_EXPORT int PanoramiXNumScreens;
^
dmxpict.c:60:12: warning: redundant redeclaration of ‘RenderErrBase’
[-Wredundant-decls]
extern int RenderErrBase;
^
In file included from ../../render/glyphstr.h:29:0,
from ../../render/picturestr.h:28,
from dmx.h:65,
from dmxpict.c:42:
../../render/picture.h:176:22: note: previous declaration of ‘RenderErrBase’
was here
extern _X_EXPORT int RenderErrBase;
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of 8 instances of gcc 4.8 warning:
In file included from glxcmds.c:38:0:
../../../hw/dmx/dmxfont.h:57:12: warning: redundant redeclaration of
‘dmxFontPrivateIndex’ [-Wredundant-decls]
extern int dmxFontPrivateIndex;
^
In file included from glxcmds.c:35:0:
../../../hw/dmx/dmx.h:388:12: note: previous declaration of
‘dmxFontPrivateIndex’ was here
extern int dmxFontPrivateIndex; /**< Private index for Fonts */
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of gcc 4.8 warnings:
dmxinputinit.c: In function ‘dmxInputScanForExtensions’:
dmxinputinit.c:877:14: warning: declaration of ‘display’ shadows a global declaration [-Wshadow]
Display *display;
^
In file included from ../../../include/windowstr.h:60:0,
from dmxinputinit.c:72:
../../../include/opaque.h:52:30: warning: shadowed declaration is here [-Wshadow]
extern _X_EXPORT const char *display;
^
glxcmds.c: In function ‘__glXCreatePbuffer’:
glxcmds.c:3397:21: warning: declaration of ‘pc’ shadows a parameter [-Wshadow]
CARD32 *pc = (CARD32 *) (be_req + 1);
^
glxcmds.c:3314:52: warning: shadowed declaration is here [-Wshadow]
__glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
^
glxscreens.c: In function ‘CalcServerVersionAndExtensions’:
glxscreens.c:139:35: warning: declaration of ‘req’ shadows a previous local [-Wshadow]
xGLXQueryServerStringReq *req;
^
glxscreens.c:68:26: warning: shadowed declaration is here [-Wshadow]
xGLXQueryVersionReq *req;
^
glxscreens.c:140:36: warning: declaration of ‘reply’ shadows a previous local [-Wshadow]
xGLXQueryServerStringReply reply;
^
glxscreens.c:69:27: warning: shadowed declaration is here [-Wshadow]
xGLXQueryVersionReply reply;
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
This doesn't just make gcc sad, it makes my brain sad.
Change from:
for (i = 0; i < dmxNumScreens; i++) {
int i;
for (i = 0; i < nconfigs; i++) {
for (j = 0; j < dmxScreen->beNumVisuals; j++) {
to the easier to follow:
for (i = 0; i < dmxNumScreens; i++) {
for (j = 0; j < nconfigs; j++) {
for (k = 0; k < dmxScreen->beNumVisuals; k++) {
Gets rid of gcc 4.8 warning:
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:765:17: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
int i;
^
dmxinit.c:608:9: warning: shadowed declaration is here [-Wshadow]
int i;
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of gcc 4.8 warnings:
dmxscrinit.c: In function ‘dmxBEScreenInit’:
dmxscrinit.c:83:15: warning: unused variable ‘gcvals’ [-Wunused-variable]
XGCValues gcvals;
^
dmxwindow.c: In function ‘dmxResizeWindow’:
dmxwindow.c:860:19: warning: variable ‘pSibPriv’ set but not used [-Wunused-but-set-variable]
dmxWinPrivPtr pSibPriv;
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of gcc 4.8 warnings:
dmxprint.c: In function ‘dmxConfigPrintPair’:
dmxprint.c:284:25: warning: format not a string literal,
argument types not checked [-Wformat-nonliteral]
p->ysign < 0 ? '-' : '+', p->y);
^
dmxprint.c:289:9: warning: format not a string literal,
argument types not checked [-Wformat-nonliteral]
dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Gets rid of gcc 4.8 warnings:
dmxparse.c: In function ‘dmxConfigLog’:
dmxparse.c:61:5: warning: function might be possible candidate for
‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
vprintf(format, args); /* RATS: All calls to dmxConfigLog from
^
dmxprint.c: In function ‘dmxConfigOutput’:
dmxprint.c:149:9: warning: function might be possible candidate for
‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
pos += vfprintf(str, format, args); /* assumes no newlines! */
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
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>
This existed to be passed to the bs recovery routine; since we back all
planes, we don't care.
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
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>
v2: Fix another path spotted by keithp
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Flagged by cppcheck 1.64:
[hw/dmx/config/xdmxconfig.c:306] -> [hw/dmx/config/xdmxconfig.c:323]:
(warning) Possible null pointer dereference: fs - otherwise
it is redundant to check it against null.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Build fbcmap_mi.c once, rather than once for each DDX, and make it part of libfb
or libwfb convenience library.
Since 84e8de1271 we don't have fbcmap.c
This is a sort of revert of 17d85387d1
v2: Remove libkdrivestubs.la from configure.ac
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Looping around LoadExtension() meant that ExtensionModuleList was reallocated
on every extension. Using LoadExtensionList() we pass an array thus the
function can do the reallocation in one go, and then loop and setup the
ExtensionModuleList.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
v2: Update ephyr [Keith Packard]
v3: Eliminate const warnings in LoadExtensionList [Keith Packard]
Signed-off-by: Keith Packard <keithp@keithp.com>
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
dmxAddExtensions takes an argument to determine if it should just
initialize the DMX extension, or both DMX & GLX, but if GLX wasn't
compiled in, the entire call was #ifdef'ed out, leaving the DMX
extension unavailable.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Provides both a software implementation using timers and driver hooks
to base everything on vblank intervals.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Adds DRM compatible fences using futexes.
Uses FD passing to get pixmaps from DRM applications.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>