Commit Graph

733 Commits

Author SHA1 Message Date
Povilas Kanapickas 5163fc8bc2 Implement gesture processing logic 2021-05-30 13:26:42 +03:00
Jeremy Huddleston Sequoia 65b27d82f2 xquartz: Call PseudoramiXExtensionInit() through InitOutput() just like xwin
Fixes: https://github.com/XQuartz/XQuartz/issues/140
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-04-07 16:11:59 -07:00
Jan Beich 376eaadde3 meson: hide C API if Xorg is disabled (like autotools)
When building only Xwayland using Meson some files are always installed.
This causes package conflict if Xwayland is built separately from Xorg.

  include/xorg/compositeext.h
  include/xorg/damage.h
  include/xorg/damagestr.h
  include/xorg/dbestruct.h
  include/xorg/dri3.h
  include/xorg/fb.h
  include/xorg/fboverlay.h
  include/xorg/fbpict.h
  include/xorg/fbrop.h
  include/xorg/geext.h
  include/xorg/geint.h
  include/xorg/glyphstr.h
  include/xorg/mi.h
  include/xorg/micmap.h
  include/xorg/micoord.h
  include/xorg/migc.h
  include/xorg/miline.h
  include/xorg/mioverlay.h
  include/xorg/mipict.h
  include/xorg/mipointer.h
  include/xorg/mipointrst.h
  include/xorg/mistruct.h
  include/xorg/misync.h
  include/xorg/misyncfd.h
  include/xorg/misyncshm.h
  include/xorg/misyncstr.h
  include/xorg/mizerarc.h
  include/xorg/panoramiX.h
  include/xorg/panoramiXsrv.h
  include/xorg/picture.h
  include/xorg/picturestr.h
  include/xorg/present.h
  include/xorg/presentext.h
  include/xorg/randrstr.h
  include/xorg/rrtransform.h
  include/xorg/shadow.h
  include/xorg/shmint.h
  include/xorg/syncsdk.h
  include/xorg/vndserver.h
  include/xorg/wfbrename.h
  include/xorg/xace.h
  include/xorg/xacestr.h
  include/xorg/xorg-server.h
  include/xorg/xvdix.h
  include/xorg/xvmcext.h
  share/aclocal/xorg-server.m4

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-03-11 00:22:36 +00:00
Matthieu Herrb b2d96b5cd4 Avoid sequences of malloc(0) / free() by checking the length.
This has an impact on heap fragmentation.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2021-03-08 20:32:54 +00:00
Olivier Fourdan 5429791b1c Revert "mi: Shortcut miDoCopy/miCopyArea based on clipList"
This reverts commit f665a9c9e6.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1108
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1128
2021-01-29 13:51:06 +00:00
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
Olivier Fourdan a81c98e42a mi: Don't log the full extension list on disable
When enabling or disabling an extension which is not known to the
Xserver, it will log an error message and list the extensions it knows
about.

That clutters the logs when the Xserver is Xwayland spawned by the
Wayland compositor who doesn't actually know the list of extensions
enabled at build time in the Xserver.

Considering that disabling a non-existing extension is a no-op anyway,
list all the extensions available only when attempting to enable an
extension which the Xserver doesn't know about.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-01-29 12:52:09 +00:00
Povilas Kanapickas 5eb985e353 mi: Add a callback to notify driver about input event submission
This is useful for mock input drivers that control the server in
integration tests. Given that input submission happens on a different
thread than processing, it's otherwise impossible for the driver to
synchronize with the completion of the processing of submitted events.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-09-24 17:33:22 +00: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
Adam Jackson 417e4553f1 misprite: Stop wrapping GetImage/GetSpans
SourceValidate handles this for us consistently now.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-10-30 16:26:01 +00:00
Adam Jackson ff310903f3 mi: Add a default no-op miSourceValidate
Slightly simplifies the callers since they don't need to check for
non-NULL anymore.

I do extremely hate the workarounds here to suppress misprite taking the
cursor down though. Surely there's a better way.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-10-30 16:26:01 +00:00
Adam Jackson 9155e0c7c6 mi: Fix undefined memcpy in mieqGrowQueue
The first time we get here, eventQueue->events is NULL.
2019-10-15 14:06:37 -04:00
Adam Jackson 3671a3ee88 mi: Fix undefined shift in miSetVisualTypesAndMasks
The masks we end up building will occupy all 32 bits of an unsigned int,
which means we had better build the shifts out of unsigned ints, because
left-shifting a signed int all the way into the sign bit is undefined.
2019-10-15 14:05:58 -04:00
Hans de Goede fbd2bb9dd0 mi: Use GC clipregion instead of drawable in miDoCopy/miCopyArea
As discussed in issue #829 the "mi: Shortcut miDoCopy/miCopyArea based
on clipList" change leads to pointer-trails (area under pointer not
restored when it moves) when using a software cursor.

Checking pGC->pCompositeClip instead of pDstDrawable->clipList fixes
this problem.

Fixes: #829
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-08-06 18:01:37 +00:00
Jon Turney 965eda947d mi: Provide ffs when compiling using MinGW
I don't know how I feel about the promise made in 2e7f790b :)
2019-05-18 14:59:38 +00:00
Adam Jackson 4e101e7e3b mi: Simplify a conditional in miHandleExposures
miHandleExposures does two things: computes the region for which to
generate expose events, and (if the destination is a window) paints the
exposed regions with the background. The bit of this conditional we're
deleting here asserts that the source is either a pixmap or a window
without backing store. The only other possibility is a window _with_
backing store. In the old backing store implementation, this was where
you would recover bits from backing store. Since our "backing store" is
the redirected window pixmap, we know we've already copied all we could,
because CopyArea had already seen the entire window pixmap. So now in
that third case, we are still drawing to a pixmap (so there's no
background to paint) and we are still not generating events, so we can
exit early.

The comment above the function about recovering bits from backing store
is clearly misleading, so delete that too.
2019-04-12 21:53:03 +00:00
Adam Jackson f665a9c9e6 mi: Shortcut miDoCopy/miCopyArea based on clipList
This is maybe one more comparison, but it catches FullyObscured windows
slightly earlier, so it's kind of a wash. The important thing is this
allows for paintable but unmapped windows, which will have non-empty
clipList.
2019-03-11 17:02:28 +00:00
Adam Jackson bf991a5f98 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>
2019-01-16 20:11:24 +00:00
Adam Jackson d78ac2f159 mi: Factor out miSaveScreen
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:01 -04:00
Adam Jackson 801977e825 mi: Hush mieqSetHandler for no-op changes
If we set the handler to the thing it's already set to, that's fine.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-12 19:18:05 +00:00
Dave Airlie c4591ea171 mibltblt: free prgnSrcClip on error path.
Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-09-12 12:26:48 +10:00
Adam Jackson 57e872301f mi: Hush an almost certainly bogus warning
In file included from ../mi/miexpose.c:83:
../mi/miexpose.c: In function ‘miHandleExposures’:
../include/regionstr.h:174:22: warning: ‘expBox.y2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     (_pReg)->extents = *(_pBox);
     ~~~~~~~~~~~~~~~~~^~~~~~~~~~
../mi/miexpose.c:139:12: note: ‘expBox.y2’ was declared here
     BoxRec expBox;
            ^~~~~~

etc. It's initialized if (extents), and then only read if (extents),
but gcc doesn't seem to figure that out. Whatever, bzero it to be
explicit.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:49 -04:00
Thierry Reding 88c7b8bf4b meson: Distribute more SDK headers
Install missing headers to the SDK directory to allow external modules
to properly build against the SDK. After this commit, the list of files
installed in the SDK include directory is the same as the list of files
installed by the autotools-based build.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-04-02 13:42:08 -04:00
Emil Velikov ac13d740bf mi: Mention extension loading in verbose logs
Listing the extensions is useful, despite being annoying for normal
usecases. Print it only when extra (lvl 3) vebose is requested.

v2: Move the logging to InitExtensions(), as requested by Adam.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-02-21 13:24:29 -05:00
Laurent Carlier e790bc621b dga: #if XFreeXDGA → #ifdef XFreeXDGA
../include/events.h:32:14: error: #if with no expression

Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
2018-02-19 13:14:43 -05:00
Adam Jackson 5d87e4f713 miinitext: Remove separate extension toggle list
This was only separate because GLX was loadable. The frontend is now
linked statically, so we can use the static extension list directly.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14 17:04:48 -05:00
Adam Jackson 67c303fff3 miinitext: Load GLX on the mi path
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>
2018-02-14 17:04:48 -05:00
Adam Jackson c2b2f06aa0 miinitext: General cleanup (v2)
This really just wants to be the list of disable booleans and
initialization functions, and nothing else. Stop including the protocol
headers from extinit.h, remove a stray mention of xgl, and move an
XInput declaration to a better place.

v2: A bunch of drivers assume they'll get the DPMS tokens implicitly,
so add it to globals.h.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2018-01-22 17:28:12 -05:00
Adam Jackson 2e7f790b57 dix: Remove ffs.c
Your libc has ffs, I promise.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2017-11-06 17:22:46 -05:00
Adam Jackson 933d80ba93 misprite: Clean up some preprocessor abuse
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-05-18 16:59:02 -04:00
Adam Jackson 57c223002c misprite: Remove some dead cache variables
Unused since Keith ported misprite to damage in '04.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-05-18 16:59:02 -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
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
Adam Jackson 0803918e64 fb: Remove 24bpp support (v3)
v2:
- Require power-of-two bpp in ScreenInit
- Eliminate fbCreatePixmapBpp

v3
- Squash in the exa and glamor changes so we can remove pRotatedPixmap
  in the same stroke.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-17 15:14:42 -04:00
Adam Jackson 0d7f05ed99 miarc: "Cache" arc span data for dashed arcs
This avoids recomputing the span data for every dash. x11perf thinks
this is a pretty modest speedup:

    832919.4       840471.1 ( 1.009)   100-pixel dashed ellipse
    672353.1       680652.2 ( 1.012)   100-pixel double-dashed ellipse
     13748.9        24287.9 ( 1.767)   100-pixel wide dashed ellipse
      9236.3        21298.2 ( 2.306)   100-pixel wide double-dashed ellipse

But part of the reason it's so modest there is that the arcs are
relatively small (100 pixel diameter at line width 10, so ~6000 pixels)
and the dashes relatively large (30 on 20 off so ~6 dashes per
quadrant).

With larger arcs and finer dashes this is much more impressive. A fairly
trivial testcase of a single 15000x13000 arc with the default {2, 2}
dash pattern drops from ~3500 milliseconds to 10 milliseconds.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-02 11:08:39 -05:00
Adam Jackson 849c825855 miarc: Make the caller free the arc span data
drawArc does some fairly expensive computation, but it's only sensitive
to arc width/height. Thread the span data up through the call chain so
it's at least possible for the caller to cache things.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-02 11:08:39 -05:00
Adam Jackson 9426c5500b miarc: Style cleanup for miWideArc
Outdent, normalize comment formatting, and use 'goto out' idiom for
error paths. No functional change.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-02 11:08:39 -05:00
Adam Jackson 8b170c4447 mi: Add include guards to migc.h
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-02-16 15:10:32 -05:00
Jeremy Huddleston Sequoia 7d6ebf3f4e XQuartz: Adopt input_lock() and input_unlock()
This allows us to remove darwinEvents_lock() and darwinEvents_unlock()
and remove the serverRunning hack from dix

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-22 14:55:02 -07:00
Keith Packard 2b9f8ae986 mi: Remove spurious call to OsReleaseSignals from mieqGrowQueue
This call wasn't converted to 'input_unlock()' when the SIGIO code was
removed from the server, and so when the queue growing was reworked to
be done from the input thread, it got left sitting here. As the caller
now manages the lock, we don't need to switch this to input_unlock at
this point.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-11 21:55:06 -07: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 05a793f5b3 dix: Switch to the libXfont2 API (v2)
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>
2016-07-18 15:25:59 -04:00
Adam Jackson 5bcdd1cc75 dix: Update some comments to reflect the new non-SIGIO input model
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-06-08 11:36:32 -04:00
Keith Packard e2df803fca mi: Grow event queue while reading events
Now that events are read at normal process time, we can use malloc to
grow the event queue instead of discarding events.

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 30ac756798 Create a threaded mechanism for input [v7]
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>
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 4d649d5177 mi: Remove miPointerRec from API
This moves the definition of miPointerRec from mipointrst.h to
mipointer.c so that it is no longer visible in the API, allowing it to
be changed while the API/ABI is frozen.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-05-25 11:05:37 -04:00
Keith Packard 3f9015b6dc xwayland: Move sprite invalidation logic into mipointer
This creates a function that invalidates the current sprite and forces
a sprite image reload the next time the sprite is checked, moving that
logic out of the xwayland sources and allowing the miPointerRec
structure to be removed from the server API.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-25 11:00:56 -04:00
Jeremy Huddleston 610dd8a58a mi: Correct a miscall of abs() to instead call fabs()
miarc.c:1714:9: warning: using integer absolute value function
'abs' when
      argument is of floating point type [-Wabsolute-value,Semantic Issue]
    if (abs(parc->angle2) >= 360.0)
        ^
miarc.c:1714:9: note: use function 'fabs' instead [Semantic Issue]
    if (abs(parc->angle2) >= 360.0)
        ^~~
        fabs

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-10-19 11:49:52 -04:00
Andy Ritger d2a6962474 mi: Log an error if mieqProcessInputEvents() recurses.
v2:

Uses BUG_WARN_MSG to also provide a stack trace. (Peter Hutterer)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Andy Ritger <aritger@nvidia.com>
2015-09-23 11:07:23 -04:00