Commit Graph

15692 Commits

Author SHA1 Message Date
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
Jonas Ådahl
daf48a3aba dix: Introduce CursorWarpedTo vfunc in Screen
This new vfunc will be called, if set, after a client has issued a
WarpPointer request. This is necessary for implementing pointer warp
emulation in Xwayland.

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:54:56 -07:00
Keith Packard
3ef51c5c74 Bump version to 1.18.99.2
Prepare for 1.19 RC1

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:57:23 -07:00
Keith Packard
86038dfd42 os: Add 'ospoll.h' to Makefile.am
Distribute this source file.

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:57:23 -07:00
Keith Packard
56972d007d include: Add 'xserver_poll.h' to Makefile.am
Make sure this file is included in the tarball.

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:57:23 -07:00
Keith Packard
61b159f5a7 hw/xwin: Add 'dri' to DIST_SUBDIRS
This creates the needed Makefile.in files during 'make dist' or 'make
distcheck'

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:57:23 -07:00
Keith Packard
93f474e49b Remove 'dixfontstubs.h' from include EXTRA_DIST
This file was removed when moving to the new libXfont API, but
accidentally left in EXTRA_DIST.

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:57:23 -07:00
Michel Dänzer
5b9f3ea250 xfree86/modes: Set RandR primary output from CreateScreenResources
Fixes XRRGetOutputPrimary and xrandr not reporting a primary output after
startup. This was especially confusing when an output was explicitly
marked as primary using Option "Primary" in Section "Monitor".

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:00:08 -07:00
Michel Dänzer
bd8ecd9be1 Add SyncSharedPixmap ScreenRec hook
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 09:52:14 -07:00
Qiang Yu
7f6fa4e449 modesetting: fix compile error when --disable-glamor
Move ms_flush_drm_events out of GLAMOR ifdef.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97586
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 08:54:22 -07:00
Jeremy Huddleston Sequoia
d81f9ce12a dix/dispatch: Fix SmartScheduleClient interval adjustment to use best rather than pClient
pClient does not contain a live value after the transition to lists

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

Application Specific Information:
X.Org X Server 1.18.99.1 Build Date: 20160910
=================================================================
==16921==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000108ce3834 at pc 0x000108880766 bp 0x7000045f76c0 sp 0x7000045f76b8
READ of size 4 at 0x000108ce3834 thread T6
    #0 0x108880765 in SmartScheduleClient dispatch.c:365
    #1 0x10887ecc5 in Dispatch dispatch.c:422
    #2 0x1088c05f1 in dix_main main.c:301
    #3 0x1082aabba in server_thread quartzStartup.c:66
    #4 0x7fffc5f16aaa in _pthread_body (libsystem_pthread.dylib+0x3aaa)
    #5 0x7fffc5f169f6 in _pthread_start (libsystem_pthread.dylib+0x39f6)
    #6 0x7fffc5f161fc in thread_start (libsystem_pthread.dylib+0x31fc)

Regressed-in: 8f1edf4bd3
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-15 21:41:22 -07:00
Keith Packard
265c4e6653 Merge remote-tracking branch 'jturney/master' 2016-09-15 21:32:46 -07:00
Keith Packard
3caf671ed2 config/dbus: Initialize dbus fd to -1 so teardown doesn't use fd 0
The dbus teardown code is called when the server fatal errors even if
that is before dbus has ever been initialized.  By statically
initializing the value of bus_info.fd, we avoid calling RemoveNotifyFd
on stdin.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-15 21:30:38 -07:00
Jon Turney
f5f4d32ac7 Add Windows-DRI extension
If windowsdriproto headers are available, build a Windows-DRI extension,
which supports requests to enable local clients to directly render GL to a
Windows drawable:

- a query to check if WGL is being used on a screen
- a query to map a fbconfigID to a native pixelformatindex
- a query to map a drawable to a native handle

Windows-DRI can only be useful if we are using WGL, so make an note if WGL
is active on a screen.

Make validGlxDrawable() public

Adjust glxWinSetPixelFormat() so it doesn't require a context, just a
screen and config.

That enables factoring out the deferred drawable creation code as
glxWinDeferredCreateDrawable()

Enhance glxWinDeferredCreateDrawable(), so that pixmaps are placed into a
file mapping, so they exist in memory which can be shared with the direct
rendering process.

Currently, this file mapping is accessed by a name generated from the XID.
This will not be unique across multiple server instances. It would perhaps
be better, although more complicated, to use an anonymous file mapping, and
then duplicate the handle for the direct rendering process.

Use glxWinDeferredCreateDrawable() to ensure the native handle exists for
the Windows-DRI query to map a drawable to native handle.

v2:
Various printf format warning fixes

v3:
Fix format warnings on x86
Move some uninteresting windows-dri output to debug log level

v4:
check for windowsdriproto when  --enable-windowsdri
use windowsdriproto_CFLAGS

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2016-09-15 20:10:29 +01:00
Keith Packard
52d6a1e832 Hold input lock for deviceProc
This ensures that the deviceProc is never called while the input
thread is processing data from the device.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-15 07:50:38 +10:00
Keith Packard
dfc91f0f63 Hold input lock while calling input device SetProperty callback
This keeps the input driver SetProperty function from being called
while input events are being processed.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-15 07:50:34 +10:00
Alan Coopersmith
c4799f186b os: Use pthread_setname_np to set thread names if available
Autoconf logic borrowed from glib

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-13 16:55:26 -04:00
Alan Coopersmith
75c1d04650 os: OsSigHandler should not show rtld errors for unrelated signals
If RTLD_DI_SETSIGNAL is set to let us turn runtime linker/loader errors
into catchable signals, then we should only show the errors when catching
that signal, instead of tossing out red herrings to distract people with
unrelated crashes long after their last failed symbol lookup (especially
when using drivers built to support multiple API's by checking which
symbols are available before calling them).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2016-09-13 16:16:40 -04:00
Jeremy Huddleston Sequoia
065eb66124 os/inputthread: Fix setting of cloexec on file descriptors
O_CLOEXEC is not a file bit.  It is not setable with F_SETFL.  One must
use it when calling open(2).  To set it cloexec on an existing fd,
F_SETFD and FD_CLOEXEC must be used.

This also fixes a build failure regression on configurations that don't
have O_CLOEXEC defined.

cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
Regressed-in: 30ac756798

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2016-09-13 16:10:56 -04:00
Jeremy Huddleston Sequoia
a5769de0f5 Xext/shm: Fix usage of F_GETFD to match standard
flags = fcntl(fd, F_GETFD) is compliant.

fcntl(fd, F_GETFD, &flags) is non-compliant (Linux extension?)

cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2016-09-13 10:00:51 -07:00
Jeremy Huddleston Sequoia
7def2fea30 Xquartz: Update for removal of AddEnabledDevice and RemoveEnabledDevice
Regressed-in: be5a513fee
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-13 10:00:51 -07:00
Jeremy Huddleston Sequoia
4f4ecd0f41 XQuartz: Cleanup CPPFLAGS that are no longer necessary on darwin
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-13 10:00:51 -07:00
Jeremy Huddleston Sequoia
33d595255d XQuartz: Fix the issue where the h key could be come "stuck" after hiding XQuartz with cmd-h
The issue was that we set a flag to ignore the k key's up event when sent
the cmd-h down event, but because the cmd-h keycode hides XQuartz, we
became !_x_active by the time the event is delivered which caused us to
go down a differnet codepath rather than getting a chance to ignore it.
We then incorrectly ignored the next h up key.

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

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2016-09-13 10:00:51 -07:00
Hans de Goede
d8e05c0475 modesetting: Fall back to primary crtc for vblank for drawables on slave outputs
This fixes glxgears running at 1 fps when fully covering a slave-output
and the modesetting driver is used for the master gpu.

Reported-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-13 11:18:43 -04:00
Hans de Goede
7ade8ba10e modesetting: ms_covering_crtc: Allow calling on non modesetting Screens
99% of the code in ms_covering_crtc is video-driver agnostic. Add a
screen_is_ms parameter when when FALSE skips the one ms specific check,
this will allow calling ms_covering_crtc on slave GPUs.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-13 11:18:41 -04:00
Hans de Goede
238248d67e modesetting: Implement DRI2InfoRec version 9 callbacks
Implement the CreateBuffer2 / DestroyBuffer2 / CopyRegion2 DRI2InfoRec
version 9 callbacks, this is necessary for being an offload source
provider with DRI2.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-13 11:18:38 -04:00
Hans de Goede
03a7c50202 modesetting: ms_dri2_create_buffer: check screen of existing front buffers
If a frontbuffer drawable already has a pixmap, make sure it was created
on the right screen.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-13 11:18:28 -04:00
Hans de Goede
35c4e96ed1 randr: Fix crtc_bounds when using rotation combined with reflection
Before this commit crtc_bounds() did not take reflection into account,
when using reflection with 0 / 180 degree rotation this was not an
issue because of the default in the switch-case doing the right thing.

But when using 90 / 270 degree rotation we would also end up in the
default which is wrong in this case. This would lead to the cursor
being constrained to a height x height area of the monitor.

This commit masks out the reflection bits for the switch-case,
making crtc_bounds return the correct bounds and fixing the
problematic cursor constraining.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:27:30 +02:00
Dave Airlie
7b634067c1 xf86Cursor: Add hw cursor support for prime
Currently with PRIME if we detect a secondary GPU,
we switch to using SW cursors, this isn't optimal,
esp for the intel/nvidia combinations, we have
no choice for the USB offload devices.

This patch checks on each slave screen if hw
cursors are enabled, and also calls set cursor
and move cursor on all screens.

Cc: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13 10:27:19 +02:00
Hans de Goede
df88008f92 xf86Cursor: Deal with rotation on GPU screens using a hw-cursor
When a slave-output is rotated the transformation is done on the blit
from master to slave GPU, so crtc->transform_in_use is not set, but we
still need to adjust the mouse position for things to work.

This commit modifies xf86_crtc_transform_cursor_position to not rely
on crtc->f_framebuffer_to_crtc, so that it can be used with GPU screens
too and always calls it for crtcs with any form of rotation.

Note not using crtc->f_framebuffer_to_crtc means that crtc->transform
will not be taken into account, that is ok, because when we've a transform
active hw-cursors are not used and xf86_crtc_transform_cursor_position
will never get called.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:27:12 +02:00
Hans de Goede
f82fd47016 xf86Cursor: Fix xf86_crtc_rotate_coord using width/height wrongly
xf86_crtc_rotate_coord should be the exact inverse operation of
xf86_crtc_rotate_coord_back, but when calculating x / y for 90 / 270
degrees rotation it was using height to calculate x / width to calculate y,
instead of the otherway around.

This was likely not noticed before since xf86_crtc_rotate_coord
until now was only used with cursor_info->MaxWidth and
cursor_info->MaxHeight, which are usally the same.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:27:07 +02:00
Hans de Goede
b0b04cb266 xf86Cursor: Fix xf86CurrentCursor to work on slave GPU Screens
The CurrentCursor is always attached to the master GPU.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:27:05 +02:00