Commit Graph

15723 Commits

Author SHA1 Message Date
Eric Anholt
4b5326aeba glamor: Remove many unused glamor util functions.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:11:09 -07:00
Eric Anholt
117d614d1b glamor: Require GL_OES_texture_border_clamp for GLES2.
The extension came out in 2000, and all Mesa-supported hardware that
can do glamor supports it.  We were already relying on the ARB version
being present on desktop.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:10:53 -07:00
Adam Jackson
7a5ddf8da5 test: Re-enable a couple of GetImage tests
Fixed in 6c6f09aac.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-28 15:48:24 -04:00
Francois Tigeot
c7a9161da5 Enable XTRANS_SEND_FDS on FreeBSD, DragonFly and OpenBSD
This code is based on local patches which had been sitting in
FreeBSD and OpenBSD ports.

Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
Signed-off-by: François Tigeot <ftigeot@wolfpond.org>
2016-09-28 15:47:04 -04:00
Keith Packard
6c6f09aac7 xace: Don't censor window borders
GetImage is allowed to return window border contents, so don't remove
that from the returned image.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-28 15:25:07 -04:00
Hans de Goede
380c2ca25e XF86VidMode: Fix free() on walked pointer
Based on: https://patchwork.freedesktop.org/patch/85636/

Rewritten to just not walk the pointer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emi Velikov <emil.l.velikov@gmail.com>
2016-09-28 14:53:39 -04:00
Hans de Goede
220d327ee0 Xext: Fix a memory leak
Based on: https://patchwork.freedesktop.org/patch/85636/

Rewritten to also free the resources allocated by
panoramix_setup_ids().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emi Velikov <emil.l.velikov@gmail.com>
2016-09-28 14:53:39 -04:00
Michael Thayer
3abf791ab8 modesetting: only fall back to drmModeSetCursor() on -EINVAL
This change effectively reverts commit 074cf58.  We were falling back from
drmModeSetCursor2() to drmModeSetCursor() whenever the first failed.  This
fall-back only makes sense on pre-mid-2013 kernels which implemented the
cursor_set hook but not cursor_set2, and in this case the call to
drmModeSetCursor2() will always return -EINVAL.  Specifically, a return
value of -ENXIO usually means that neither are supported.

Signed-off-by: Michael Thayer <michael.thayer@oracle.com>
[hdegoede@redhat.com: initialize ret to -EINVAL]
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Daniel Martin
363f4273dd modesetting: Consume all available udev events at once
We get multiple udev events for actions like docking a laptop into its
station or plugging a monitor to the station. By consuming as much
events as we can, we reduce the number of output re-evalutions.

I.e. having a Lenovo X250 in a ThinkPad Ultra Dock and plugging a
monitor to the station generates 5 udev events. Or having 2 monitors
attached to the station and docking the laptop generates 7 events.

It depends on the timing how many events can consumed at once.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
[hdegoede@redhat.com: Keep goto out so that we always call RRGetInfo()]
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Qiang Yu
ea91db4b83 config: fix GPUDevice fail when AutoAddGPU off + BusID
This fix is for the following xorg.conf can work:

Section "ServerFlags"
        Option  "AutoAddGPU" "off"
EndSection

Section "Device"
        Identifier "Amd"
        Driver "ati"
        BusID "PCI:1:0:0"
EndSection

Section "Device"
        Identifier "Intel"
        Driver "modesetting"
        BusID "pci:0:2:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device "Intel"
        GPUDevice "Amd"
EndSection

Without AutoAddGPU off, modesetting DDX will also be loaded
for GPUDevice.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Laszlo Ersek
ca8d88e503 xfree86: recognize primary BUS_PCI device in xf86IsPrimaryPlatform()
The new platform bus code and the old PCI bus code overlap. Platform bus
can handle any type of device, including PCI devices, whereas the PCI code
can only handle PCI devices. Some drivers only support the old style
PCI-probe methods, but the primary device detection code is server based,
not driver based; so we might end up with a primary device which only has
a PCI bus-capable driver, but was detected as primary by the platform
code, or the other way around.

(The above paragraph was shamelessly stolen from Hans de Goede, and
customized.)

The latter case applies to QEMU's virtio-gpu-pci device: it is detected as
a BUS_PCI primary device, but we actually probe it first (with the
modesetting driver) through xf86platformProbeDev(). The
xf86IsPrimaryPlatform() function doesn't recognize the device as primary
(it bails out as soon as it sees BUS_PCI); instead, we add the device as a
secondary graphics card under "autoAddGPU". In turn, the success of this
automatic probing-as-GPU prevents xf86CallDriverProbe() from proceeding to
the PCI probing.

The result is that the server exits with no primary devices detected.

Commit cf66471353 ("xfree86: use udev to provide device enumeration for
kms devices (v10)") added "cross-bus" matching to xf86IsPrimaryPci(). Port
that now to xf86IsPrimaryPlatform(), so that we can probe virtio-gpu-pci
as a primary card in platform bus code.

Cc: Adam Jackson <ajax@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Keith Packard <keithp@keithp.com>
Cc: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-By: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Kyle Guinn
44968da376 xfree86: Fix null pointer dereference
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93675
Signed-off-by: Kyle Guinn <elyk03@gmail.com>
[hdegoede@redhat.com: Simplify by adding 2 if conds together with &&]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
David CARLIER
127e0569ca xfree86: small memory leaks fixes
A couple of memory leaks fixes and avoiding bit shifting on an
unitialized value.

[hdegoede@redhat.com: Split out some non free fixes in separate patches]
[hdegoede@redhat.com: Don't touch ancient (and weird) os/rpcauth.c code]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Adam Jackson
d51cce7992 xephyr: Don't crash if the server advertises zero xv adaptors
Useless as an XVideo implementation with zero adaptors might be, it's
apparently a thing in the wild. Catch this case and bail out of xv init
if it happens.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Hans de Goede
445271ec00 glx: Always enable EXT_texture_from_pixmap for DRI swrast glx
Prior to commit f95645c6f7 ("glx: Don't enable EXT_texture_from_pixmap
unconditionally") DRI glx would always advertise EXT_texture_from_pixmap.

That commit moved the setting of the extension in the extension bits from
__glXInitExtensionEnableBits to its callers so that
__glXInitExtensionEnableBits can be used more generally, but at the same
time made the setting of EXT_texture_from_pixmap conditionally on
__DRI_TEX_BUFFER being present.

This has result in an unintended behavior change which breaks e.g.
compositors running on llvmpipe. This commit makes the DRI swrast glx code
advertise EXT_texture_from_pixmap unconditionally again fixing this.

Fixes: f95645c6f7 ("glx: Don't enable EXT_texture_from_pixmap unconditionally")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Only add unconditional advertising of GLX_EXT_texture_from_pixmap
 to glxdriswrast.c, do not also add it to glxdri2.c
2016-09-28 14:53:39 -04:00
Hans de Goede
02ff0a5d7e xf86RandR12: Fix XF86VidModeSetGamma triggering a BadImplementation error
Commit b4e46c0444 ("xfree86: Hook up colormaps and RandR 1.2 gamma code")
dropped the providing of a pScrn->ChangeGamma callback from the xf86RandR12
code. Leaving pScrn->ChangeGamma NULL in most cases.

This triggers the BadImplementation error in xf86ChangeGamma() :

    if (pScrn->ChangeGamma)
        return (*pScrn->ChangeGamma) (pScrn, gamma);

    return BadImplementation;

Which causes X-apps using XF86VidModeSetGamma to crash with a
X protocol error.

This commit fixes this by re-introducing the xf86RandR12ChangeGamma
helper removed by the commit and adjusting it to work with the new
combined palette / gamma code.

Fixes: b4e46c0444 ("xfree86: Hook up colormaps and RandR 1.2 gamma code")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-28 14:53:39 -04:00
Hans de Goede
a58dd678bf xf86RandR12: Move calculating of shift inside init_one_component
This is a preparation patch to allow easier usage of init_one_component
outside of xf86RandR12CrtcInitGamma.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-28 14:53:39 -04:00
Hans de Goede
299cbb9267 modesetting: Fix reverse prime update lagging on secondary GPU outputs
When using secondary GPU outputs the primary GPU's blockhandler
will copy changes from its framebuffer to a pixmap shared with the
secondary GPU.

In reverse prime setups the secondary GPU's blockhandler will do another
copy from the shared pixmap to its own framebuffer.

Before this commit, if the primary GPU's blockhandler would run after
the secondary GPU's blockhandler and no events were pending, then the
secondary GPU's blockhandler would not run until some events came in
(WaitForSomething() would block in the poll call), resulting in the
secondary GPU output sometimes showing stale contents (e.g. a just closed
window) for easily up to 10 seconds.

This commit fixes this by setting the timeout passed into the
blockhandler to 0 if any shared pixmaps were updated by the primary GPU,
forcing an immediate re-run of all blockhandlers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-09-28 14:53:39 -04:00
Hans de Goede
e8695100b1 modesetting: Fix reverse prime partial update issues on secondary GPU outputs
When using reverse prime we do 2 copies, 1 from the primary GPU's
framebuffer to a shared pixmap and 1 from the shared pixmap to the
secondary GPU's framebuffer.

This means that on the primary GPU side the copy MUST be finished,
before we start the second copy (before the secondary GPU's driver
starts processing the damage on the shared pixmap).

This fixes secondary outputs sometimes showning (some) old fb contents,
because of the 2 copies racing with each other, for an example of
what this looks like see:

https://fedorapeople.org/~jwrdegoede/IMG_20160915_130555.jpg

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-28 14:53:39 -04:00
Olivier Fourdan
862a3dab28 xwayland: Clear up x_cursor on UnrealizeCursor()
In Xwayland's xwl_unrealize_cursor(), the x_cursor is cleared up only
when a device value is provided to the UnrealizeCursor() routine, but
if the device is NULL as called from FreeCursor(), the corresponding
x_cursor for the xwl_seat is left untouched.

This might cause a segfault when trying to access the unrealized
cursor's devPrivates in xwl_seat_set_cursor().

A possible occurrence of this is the client changing the cursor, the
Xserver calling FreeCursor() which does UnrealizeCursor() and then
the Wayland server sending a pointer enter event, which invokes
xwl_seat_set_cursor() while the seat's x_cursor has just been
unrealized.

To avoid this, walk through all the xwl_seats and clear up all x_cursor
matching the cursor being unrealized.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:23:59 -04:00
Olivier Fourdan
b79eaf1184 xwayland: handle EAGAIN on Wayland fd
wl_display_flush() can fail with EAGAIN and Xwayland would make this a
fatal error.

When this happens, it means that Xwayland has flooded the Wayland file
descriptor, either because the Wayland compositor cannot cope or more
likely because of a deadlock situation where the Wayland compositor is
blocking, waiting for an X reply while Xwayland tries to write data to
the Wayland file descriptor.

The general consensus to avoid the deadlock is for the Wayland
compositor to never issue blocking X11 roundtrips, but in practice
blocking rountrips can occur in various places, including Xlib calls
themselves so this is not always achievable without major surgery in the
Wayland compositor/Window manager.

What this patch does is to avoid dispatching to the Wayland file
descriptor until it becomes available for writing again, while at the
same time continue processing X11 requests to release the deadlock.

This is not perfect, as there is still the possibility of another X
client hammering the connection and we'll still fail writing to the
Wayland connection eventually, but this improves things enough to avoid
a 100% repeatable crash with vlc and gtkperf.

Also, it is worth considering that window managers and Wayland
compositors such as mutter already have a higher priority than other
regular X clients thanks to XSyncSetPriority(), mitigating the risk.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1278159
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=763400
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-09-28 14:23:59 -04:00
Rui Matos
36e1a058c5 xwayland: Close the shm fd as early as possible
Keeping the shm fd open beyond pixmap creation means we can easily
reach the open file descriptor limit if an X client asks us to create
that many pixmaps. Instead, let's get the wl_buffer immediatly so that
we can destroy the shm pool and close the fd before being asked to
create more.
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2016-09-28 14:23:59 -04:00
Adam Jackson
fd4a6dc06f glamor: Fall back to software for CopyPlane if we need to
glUniform4ui is available starting in GL{,ES} 3.0. Technically it's
also in EXT_gpu_shader4, but that's not worth supporting. There was also
a MESA_shading_language_130 spec proposed at one point; if that ever
gets finished, we can update epoxy to know about it and fix up the
feature check.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-28 12:52:05 -04:00
Eric Anholt
c49e820f79 test: Run xts against Xephyr -glamor when present
v2: Drop x8r8g8b8 skip, now that it's fixed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:51 -04:00
Eric Anholt
5392ea5525 test: Switch our testing X server to being spawned with simple-xinit
Once I introduced a second X server being tested, I found that startx
hit races in choosing a display.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:46 -04:00
Eric Anholt
283840c295 test: Update piglit HTML even when tests all pass
I was confused by the behavior I'd written before.  keithp and
mattst88 responded with shock that I would have made it so surprising,
as well.

v2: Point to index.html instead of problems.html, which won't exist if
    we had no problems.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:40 -04:00
Eric Anholt
022fea767c test: Fix parsing of piglit results
The "dmesg-fail" line was matching our "fail" regex, so if you didn't
have those we would ignore fails.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:35 -04:00
Eric Anholt
7fe5b9c02c test: Make the piglit-running script callable with an arbitrary server
v2: Check that SERVER_COMMAND is set.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:30 -04:00
Eric Anholt
7ac130a066 test: Add a little xinit-like program for starting servers for testing
The normal xinit is racy because it doesn't use -displayfd.  This
implements the bare minimum for testing purposes, using -displayfd to
sequence starting the client, and avoids adding yet another dependency
to the server.

v2: Fix asprintf error checks.
v3: Add error checking for fork(), clarify calloc() arg.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:20 -04:00
Eric Anholt
8d5e0c07b9 test: Handle srcdir != builddir in Xvfb testing
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:44:04 -04:00
Eric Anholt
add4979260 ephyr: Add a mode for skipping redisplay in glamor
This speeds up headless testing of Xephyr -glamor with softpipe from
"a test per minute or so" to "a test every few seconds".

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-09-28 12:43:41 -04:00
Eric Anholt
453f813bb4 glamor: Properly handle mask formats without alpha.
Even if the pixmap's storage has alpha, it may have been uploaded with
garbage in the alpha channel, so we need to force the shader to set
alpha to 1.  This was broken way back in
355334fcd9.

Fixes rendercheck -t composite -f x8r8g8b8.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-26 10:16:06 -07:00
Eric Anholt
905c877f09 glamor: Require that pixmap depths match for Render copies.
The copy optimization in d37329cba4
replicated a bug from last time we did a copy optimization: CopyArea
is only defined for matching depths.  This is only a problem at 15 vs
16 depth right now (24 vs 32 would also have matching Render formats,
but they should work) but be strict in case we store other depths
differently in the future.

Fixes rendercheck -t blend -o src -f x4r4g4b4,x3r4g4b4

v2: Drop excessive src->depth == dst->depth check that snuck in.
v3: Switch back to src->depth == dst->depth
v4: Touch up commit message (s/bpp/depth).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-26 10:15:58 -07:00
Eric Anholt
b87a075674 glamor: Fix some awful formatting of some fallback debug code.
This was clearly x-indent.sh damage.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-26 10:15:38 -07:00
Mark Kettenis
ba199cb901 glamor: Make glamor_sync_init work with --disable-xshmfence
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-25 11:00:24 -07:00
Matthieu Herrb
8bb4b11298 glamor: Make glamor_name_from_pixmap work without DRI3
This function is used by the modesetting driver to implement DRI2 and
shouldn't fail on systems that don't support DRI3.

v2: Drop stale commit message wording, fix compiler warning (by anholt)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-25 10:59:14 -07:00
Eric Engestrom
128d40b2dd glamor: fix spelling mistakes
v2: Fix "orignal" too (review feedback by ajax, change by anholt)_

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-25 10:40:08 -07:00
Keith Packard
ade315386c Require xproto 7.0.31
xproto 7.0.30 had a typo which caused compiles to fail on anything
other than clang

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-23 09:52:35 +03:00
Jeremy Huddleston Sequoia
f72ff1f7ac XQuartz: Silence an expected TSan warning
This code is safe.  If the data race fails, the result is that we take the
lock and recheck.

==================
WARNING: ThreadSanitizer: data race (pid=31401)
  Read of size 1 at 0x00010f5d2500 by thread T11:
    #0 wait_for_mieq_init darwinEvents.c:102 (X11.bin+0x00010003155a)
    #1 -[X11Application(Private) sendX11NSEvent:] X11Application.m:1330 (X11.bin+0x00010001d652)
    #2 __28-[X11Application sendEvent:]_block_invoke X11Application.m:476 (X11.bin+0x00010001887f)
    #3 __tsan::invoke_and_release_block(void*) <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x00000005d97b)
    #4 _dispatch_client_callout <null>:33 (libdispatch.dylib+0x0000000020ef)

  Previous write of size 1 at 0x00010f5d2500 by thread T8:
    [failed to restore the stack]

  Location is global 'mieqInitialized' at 0x00010f5d2500 (X11.bin+0x000100599500)

  Thread T11 (tid=4367138, running) created by thread T-1
    [failed to restore the stack]

  Thread T8 (tid=4367130, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x000100039d2d)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039b96)
    #3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cd54)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5b2)
    #5 server_main quartzStartup.c:136 (X11.bin+0x000100039fbb)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002e25)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e09)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x0001000056a4)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: data race darwinEvents.c:102 in wait_for_mieq_init
==================

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-22 14:55:03 -07: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
Jeremy Huddleston Sequoia
8bc4727f47 XQuartz: pbproxy shouldn't need to wait for server initialization.
Just block on the socket like every other client does.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-22 14:55:02 -07:00
Jeremy Huddleston Sequoia
81493d3098 XQuartz: Remove X11ApplicationFatalError
AppKit handles crashes on app launch with their own dialog now, so we shouldn't need to do this ourselves.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-22 14:55:02 -07:00
Jeremy Huddleston Sequoia
9153ec8464 XQuartz: Don't respond to SIGALRM on the AppKit thread
==================
WARNING: ThreadSanitizer: data race (pid=69627)
  Write of size 8 at 0x00010dae73f8 by main thread (mutexes: write M262):
    #0 SmartScheduleTimer utils.c:1245 (X11.bin+0x0001004b21f9)
    #1 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, my_siginfo_t*, void*) <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000279f6)
    #2 __CFRunLoopRun <null>:77 (CoreFoundation+0x000000087e17)
    #3 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #4 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #5 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #6 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #7 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #8 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #9 start <null>:29 (libdyld.dylib+0x000000005254)

  Previous read of size 8 at 0x00010dae73f8 by thread T7:
    [failed to restore the stack]

  Location is global 'SmartScheduleTime' at 0x00010dae73f8 (X11.bin+0x0001005b03f8)

  Mutex M262 (0x7d300000bd10) created at:
    #0 pthread_mutex_init <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000253c3)
    #1 __CFRunLoopCreate <null>:77 (CoreFoundation+0x000000054e63)
    #2 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #3 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #4 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #5 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #6 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #7 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #8 start <null>:29 (libdyld.dylib+0x000000005254)

  Thread T7 (tid=4051693, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x0001000398dd)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039813)
    #3 X11ApplicationMain X11Application.m:1286 (X11.bin+0x00010001c804)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #5 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: data race utils.c:1245 in SmartScheduleTimer
==================
==================
WARNING: ThreadSanitizer: signal handler spoils errno (pid=69627)
    #0 SmartScheduleTimer utils.c:1244 (X11.bin+0x0001004b21a0)
    #1 __CFRunLoopRun <null>:77 (CoreFoundation+0x000000087e17)
    #2 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #3 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #4 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #5 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #6 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #7 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #8 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: signal handler spoils errno utils.c:1244 in SmartScheduleTimer
==================

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-22 14:55:01 -07:00
Jeremy Huddleston Sequoia
2740dc1937 dix: Silence TSan warnings when checking for pending input
V2: Moves InputCheckPending() into dix.h

Bumps required version of xproto to 7.0.30

==================
WARNING: ThreadSanitizer: data race (pid=4943)
  Read of size 4 at 0x00010c4e3854 by thread T8:
    #0 WaitForSomething WaitFor.c:237 (X11.bin+0x00010049216c)
    #1 Dispatch dispatch.c:413 (X11.bin+0x000100352ed9)
    #2 dix_main main.c:287 (X11.bin+0x00010036e894)
    #3 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)

  Previous write of size 4 at 0x00010c4e3854 by thread T12 (mutexes: write M856, write M1976):
    #0 mieqEnqueue mieq.c:263 (X11.bin+0x000100448d14)
    #1 DarwinSendDDXEvent darwinEvents.c:641 (X11.bin+0x000100033613)
    #2 DarwinProcessFDAdditionQueue_thread darwinEvents.c:338 (X11.bin+0x000100032039)

  Location is global 'miEventQueue' at 0x00010c4e3850 (X11.bin+0x0001005ab854)

  Mutex M856 (0x00010c4c8c80) created at:
    #0 pthread_mutex_lock <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000321fe)
    #1 DarwinListenOnOpenFD darwinEvents.c:300 (X11.bin+0x000100031607)
    #2 socket_handoff bundle-main.c:288 (X11.bin+0x000100002b40)
    #3 __do_request_fd_handoff_socket_block_invoke bundle-main.c:379 (X11.bin+0x0001000029ba)
    #4 __tsan::invoke_and_release_block(void*) <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x00000005d97b)
    #5 _dispatch_client_callout <null>:33 (libdispatch.dylib+0x0000000020ef)

  Mutex M1976 (0x00010c4e3d68) created at:
    #0 pthread_mutex_init <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000253c3)
    #1 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
    #2 TimerSet WaitFor.c:343 (X11.bin+0x0001004926c2)
    #3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d7f)
    #4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069f1a)
    #5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467095)
    #6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440399)
    #7 DarwinScreenInit darwin.c:285 (X11.bin+0x0001000303bb)
    #8 AddScreen dispatch.c:3908 (X11.bin+0x00010036c417)
    #9 InitOutput darwin.c:671 (X11.bin+0x00010002fdeb)
    #10 dix_main main.c:197 (X11.bin+0x00010036e228)
    #11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)

  Thread T8 (tid=4198779, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x000100039dad)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039c16)
    #3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cde4)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a642)
    #5 server_main quartzStartup.c:136 (X11.bin+0x00010003a03b)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002eb5)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e99)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100005734)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

  Thread T12 (tid=4198797, running) created by thread T8 at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread darwinEvents.c:121 (X11.bin+0x000100031ecf)
    #2 DarwinEQInit darwinEvents.c:365 (X11.bin+0x000100031860)
    #3 InitInput darwin.c:571 (X11.bin+0x00010002ea09)
    #4 dix_main main.c:261 (X11.bin+0x00010036e7ce)
    #5 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)

SUMMARY: ThreadSanitizer: data race WaitFor.c:237 in WaitForSomething
==================
==================
WARNING: ThreadSanitizer: data race (pid=22841)
  Write of size 4 at 0x000105bbd864 by main thread (mutexes: write M1945):
    #0 mieqEnqueue mieq.c:263 (X11.bin+0x000100448cf4)
    #1 DarwinSendDDXEvent darwinEvents.c:642 (X11.bin+0x000100033693)
    #2 -[X11Controller set_window_menu:] X11Controller.m:275 (X11.bin+0x0001000222fd)
    #3 -[X11Application set_window_menu:] X11Application.m:486 (X11.bin+0x000100018b44)
    #4 -[X11Application handleMachMessage:] X11Application.m:177 (X11.bin+0x000100016678)
    #5 __NSFireMachPort <null>:69 (Foundation+0x00000009b62b)
    #6 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
    #7 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
    #8 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002e65)
    #9 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e49)
    #10 mach_startup_server mach_startupServer.c:399 (X11.bin+0x0001000056e4)
    #11 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #12 start <null>:29 (libdyld.dylib+0x000000005254)

  Previous read of size 4 at 0x000105bbd864 by thread T7:
    #0 Dispatch dispatch.c:434 (X11.bin+0x000100352fc8)
    #1 dix_main main.c:287 (X11.bin+0x00010036e874)
    #2 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Location is global 'miEventQueue' at 0x000105bbd860 (X11.bin+0x0001005ab864)

  Mutex M1945 (0x000105bbdd78) created at:
    #0 pthread_mutex_init <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000253c3)
    #1 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
    #2 TimerSet WaitFor.c:348 (X11.bin+0x0001004926c2)
    #3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d3f)
    #4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069eda)
    #5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467075)
    #6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440379)
    #7 DarwinScreenInit darwin.c:285 (X11.bin+0x00010003036b)
    #8 AddScreen dispatch.c:3914 (X11.bin+0x00010036c3f7)
    #9 InitOutput darwin.c:671 (X11.bin+0x00010002fd9b)
    #10 dix_main main.c:197 (X11.bin+0x00010036e208)
    #11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Thread T7 (tid=4257217, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x000100039d6d)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039bd6)
    #3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cd94)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
    #5 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002e65)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e49)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x0001000056e4)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: data race mieq.c:263 in mieqEnqueue
==================

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-22 14:55:01 -07:00
Keith Packard
7ff8a74945 os: Clear saved poll events in listen so that edge triggering works
When a client is marked as write blocked, clear any old 'write ready'
bit in the osfds structure so that a new indication of write ready
(which is marked as edge trigggered) will trigger the callback.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Matthieu Herrb <matthieu@herrb.eu>
2016-09-22 14:55:01 -07:00
Keith Packard
1d365f1ffe os: Ready clients with pending output aren't flushed, so set NewOutputPending
When a client with pending output is ready (has request data pending),
FlushAllOutput will skip it to get all of the requests processed
before sending any queued output. That means FlushAllOutput is going
to return with some output pending to a client which isn't known to be
write blocked. And that means NewOutputPending needs to be set so that
FlushAllOutput will get called again to actually go flush this client.

It might be interesting to try just flushing the client to send any
queued data along the way. This patch just restores the server
behavior to what it was before the ospoll changes.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Matthieu Herrb <matthieu@herrb.eu>
2016-09-22 14:55:00 -07:00
Jeremy Huddleston Sequoia
d0c5d205a9 dix: Make InitCoreDevices() failures more verbose.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-21 21:11:40 +10:00
Mihail Konev
5794bdd528 xkb: fix turbo-repeat of RedirectKey-ed keysyms
RedirectKey() action had been broken by commit 2e6190.
A dropped check caused over-intense autorepeat of keysyms enriched
with the action.

Previous to this commit, the check wrapped the entire switch() block,
which was dropped with the move to a separate function.

Restore the checking.

Signed-off-by: Mihail Konev <k.mvc@ya.ru>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-21 17:33:43 +10:00
Keith Packard
fc1c358b95 Bump to 1.18.99.901 (1.19 RC1)
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-19 09:02:57 -07:00
Jonas Ådahl
5998da7855 dix: Incroduce CursorConfinedTo vfunc in Screen
This function will be called when a pointer is grabbed non-root window
set as the 'confineTo'. This will enable the ddx to handle the
confinement their own way.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-19 08:55:02 -07:00