summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-09-13randr: Fix crtc_bounds when using rotation combined with reflectionprime-hw-cursor-supportHans de Goede1-1/+1
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-13xf86Cursor: Add hw cursor support for primeDave Airlie3-6/+88
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-13xf86Cursor: Deal with rotation on GPU screens using a hw-cursorHans de Goede1-11/+40
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-13xf86Cursor: Fix xf86_crtc_rotate_coord using width/height wronglyHans de Goede1-2/+2
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-13xf86Cursor: Fix xf86CurrentCursor to work on slave GPU ScreensHans de Goede1-3/+6
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-13xf86Cursor: Add xf86CheckHWCursor() helper functionDave Airlie3-8/+14
This is a preparation patch for adding prime hw-cursor support. 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>
2016-09-13randr: Add RRHasScanoutPixmap helper functionHans de Goede2-0/+25
This is a preparation patch for adding prime hw-cursor support. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13dix: Add dixPrivatesCreated helper functionDave Airlie2-0/+12
This is a preparation patch for adding prime hw-cursor support. Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13glamor: Fix crash when master gpu is using glamor and another gpu is hotpluggedHans de Goede1-0/+10
When a GPU gets hotplugged while X is already running, glamor_egl_init() gets called and changes the current egl context, without updating lastGLContext, potentially causing the next glamor call on another GPU to run in the wrong context. This causes glamor to e.g. crash in the next glamor_create_pixmap() call (called through the master's screen->CreatePixmap), note this is not the only troublesome entry point I've seen other backtraces when using a compositing window manager. Set lastGLContext to NULL to force the next glamor_make_current() call to set the right context. Note that we cannot use glamor_make_current() here to replace the eglMakeCurrent() call and update lastGLContext for us because glamor_make_current takes a glamor_priv struct as argument and that has not been created yet when glamor_egl_init() gets called. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13modesetting: Remove some dead codeHans de Goede1-2/+0
The "if (pixmap) ..." block this commit removes is inside an "if (pixmap == NULL) ..." block, so it will never execute. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2016-09-13modesetting: ms_covering_crtc: Remove unused arguments, make staticHans de Goede2-19/+6
Remove unused arguments from ms_covering_crtc, make it static as it is only used in vblank.c. While at it also change its first argument from a ScrnInfoPtr to a ScreenPtr, this makes the next patch in this patch-set cleaner. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13modesetting: Fix msSharePixmapBacking returning a non-linear boHans de Goede1-1/+2
glamor_fd_from_pixmap() may return a tiled bo, which is not suitable for sharing with another GPU as tiling usually is GPU specific. Switch to glamor_shareable_fd_from_pixmap(), which always returns a linear bo. This fixes mis-rendering when running the mode setting driver on the master gpu in a dual-gpu setup and running an opengl app with DRI_PRIME=1. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13glamor: Add glamor_shareable_fd_from_pixmap()Hans de Goede2-0/+40
Add glamor_shareable_fd_from_pixmap function to get dma-buf fds suitable for sharing across GPUs (not using GPU specific tiling). This is necessary for the modesetting driver to correctly implement the DRI2 SharePixmapBacking callback. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-07xkb: fix check for appending '|' character when applying rulesRan Benita1-1/+1
There are two ways to separate multiple files in XKB include statements: '+' will cause the later file to override the first in case of conflict, while '|' will cause it augment it (this is done by xkbcomp). '!' is unrelated here. Currently, if someone tries to use '|' in a rule instead of '+', it won't have any effect. Since '|' is practically never used, this wasn't noticed. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-06glx: Fix computation of GLX_X_RENDERABLE fbconfig attributeAdam Jackson9-56/+31
>From the GLX spec: "GLX_X_RENDERABLE is a boolean indicating whether X can be used to render into a drawable created with the GLXFBConfig. This attribute is True if the GLXFBConfig supports GLX windows and/or pixmaps." Every backend was setting this to true unconditionally, and then the core ignored that value and sent true unconditionally on its own. This is broken for ARB_fbconfig_float and EXT_fbconfig_packed_float, which only apply to pbuffers, which are not renderable from non-GLX APIs. Instead compute GLX_X_RENDERABLE from the supported drawable types. The dri backends were getting _that_ wrong too, so fix that as well. This is not a functional change, as there are no mesa drivers that claim to support __DRI_ATTRIB_{UNSIGNED_,}FLOAT_BIT yet. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-06xwayland: Process queued events before making wayland mods effectiveRui Matos1-5/+6
Since xwayland's initial commit we have had a check to not process wayland modifier events while one of our surfaces has keyboard focus since the normal xkb event processing keeps our internal modifier state up to date and if we use the modifiers we get from the compositor we mess up that state. This was slightly changed in commit 10e9116b3f709bec6d6a50446c1341441a0564e4 to allow the xkb group to be set from the wayland event while we have focus in case the compositor triggers a group switch. There's a better solution to the original problem though. Processing queued events before overriding the xkb state with the compositor's allows those events to be sent properly modified to X clients while any further events will be modified with the wayland modifiers as intended. This allows us to fully take in the wayland modifiers, including depressed ones, which fixes an issue where we wouldn't be aware of already pressed modifiers on enter. Signed-off-by: Rui Matos <tiagomatos@gmail.com> Tested-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-02test: Run some XTS5 integration tests against Xvfb if possible.Eric Anholt3-3/+135
By default the tests will be skipped. However, if you set XTEST_DIR to the repo of a built X Test Suite and PIGLIT_DIR to a piglit repo (no build necessary), make check will run piglit's xts-render tests against Xvfb. We could run more of XTS5, but I haven't spent the time identifying what additional subset would be worth running, since much of it is only really testing the client libraries. We want to make sure that we keep the runtime down, and this subset of the test suite took 92 seconds according to piglit. Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-09-02modesetting: add DRI2 page flip supportQiang Yu5-15/+257
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-02modesetting: move common page flip handle to pageflip.cQiang Yu3-87/+105
The common page flip handle framework can be shared with DRI2 page flip. Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-02modesetting: move ms_do_pageflip to pageflip.cQiang Yu4-252/+300
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-02modesetting: make ms_do_pageflip generic for share with DRI2Qiang Yu1-14/+25
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-02dri2: Don't make reference to noClientExceptionAdam Jackson1-1/+1
noClientException is now never filled in with a meaningful value, it's always -1. The sole caller of this function disregards the error value in any case. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-09-02dri3: Don't do return client->noClientExceptionAdam Jackson1-2/+2
Hasn't been necessary since: commit 92ed75ac59e2d3af149cddb962efd05fc8487750 Author: Jamey Sharp <jamey@minilop.net> Date: Mon May 10 20:22:05 2010 -0700 Eliminate boilerplate around client->noClientException. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-09-02sync: Don't do return client->noClientExceptionAdam Jackson1-6/+6
Hasn't been necessary since: commit 92ed75ac59e2d3af149cddb962efd05fc8487750 Author: Jamey Sharp <jamey@minilop.net> Date: Mon May 10 20:22:05 2010 -0700 Eliminate boilerplate around client->noClientException. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-02modesetting: Hide cursor when initializing crtcHans De Goede1-0/+3
When Xorg gets started directly from a wayland-gdm the crtc still has the wayland hw cursor set. Combine this with Xorg immediately falling back to a sw cursor because a slave-output has a monitor attached at startup; and we end up with the wayland hardware cursor overlay fixed in its last position + the Xorg sw cursor resulting in 2 cursors. This commit fixes this by hiding any left-over cursors when initializing the crtc. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-09-02modesetting: Do not use function local static variablesHans De Goede2-6/+6
The modesetting driver may be driving 2 screens (slave and master gpu), which may have different behavior wrt hardware cursor support. So stop using static variables and instead store the hw-cursor support related data in a per screen struct. While at it actually make it per crtc data as in theory different crtc's could have different hw-cursor support. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-02xi2: fix FocusIn grabsMichael Thayer1-2/+2
Fix a couple of copy-and-paste errors preventing FocusIn grabs from working. Perhaps the extension version should be bumped though to distinguish between working and non-working extension versions. Signed-off-by: Michael Thayer <michael.thayer@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-24xfree86: print the module name together with the load failure messagePeter Hutterer1-16/+19
We're happily printing the error to stdout but not which module caused it... That's in the Xorg.log but that's at least one click away. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-23glamor: Declare "pos" in the composite glyph GLSL 1.20 vertex shaderMichel Dänzer1-1/+2
Fixes shader compile failure: Failed to compile VS: 0:13(43): error: `pos' undeclared 0:13(14): error: operands to arithmetic operators must be numeric 0:13(13): error: operands to arithmetic operators must be numeric Program source: #define ATLAS_DIM_INV 0.000976562500000000 attribute vec2 primitive; attribute vec2 source; varying vec2 glyph_pos; uniform vec2 fill_offset; uniform vec2 fill_size_inv; varying vec2 fill_pos; uniform vec4 v_matrix; void main() { gl_Position.xy = primitive.xy * v_matrix.xz + v_matrix.yw; gl_Position.zw = vec2(0.0,1.0); glyph_pos = source.xy * ATLAS_DIM_INV; fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv; } (EE) Fatal server error: (EE) GLSL compile failure Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97300 Reviewed-by: Keith Packard <keithp@keithp.com>
2016-08-22glamor: Handle bitplane in glamor_copy_fbo_cpuMichel Dänzer1-7/+33
This can significantly speed up at least some CopyPlane cases, e.g. indirectly for stippled fills. v2: * Make temporary pixmap the same size as the destination pixmap (instead of the destination drawable size), and fix coordinate parameters passed to fbCopyXtoX and glamor_upload_boxes. Fixes incorrect rendering with x11perf -copyplane* and crashes with the xscreensaver phosphor hack. v3: * Make the change a bit more compact and hopefully more readable by re-using the existing src_* locals in the bitplane case as well. Reported-by: Keith Raghubar <keith.raghubar@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Eric Anholt <eric@anholt.net>
2016-08-19wayland: Emulate crossing for native windowOlivier Fourdan3-2/+17
Emitting a LeaveNotify event every time the pointer leaves an X11 window may confuse focus follow mouse mode in window managers such as mutter/gnome-shell. Keep the previously found X window and compare against the new one, and if they match then it means the pointer has left an Xwayland window for a native Wayland surface, only in this case fake the crossing to the root window. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-18Fix Xorg -configure not working anymoreHans De Goede1-1/+2
Xorg -configure relies on the bus implementation, e.g. xf86pciBus.c to call xf86AddBusDeviceToConfigure(). The new xf86platformBus code does not have support for this. Almost all drivers support both the xf86platformBus and xf86pciBus nowadays, and the generic xf86Bus xf86CallDriverProbe() function prefers the new xf86platformBus probe method when available. Since the platformBus paths do not call xf86AddBusDeviceToConfigure() this results in Xorg -configure failing with the following error: "No devices to configure. Configuration failed.". Adding support for the xf86Configure code to xf86platformBus.c is non trivial and since we advise users to normally run without any Xorg.conf at all not worth the trouble. However some users still want to use Xorg -configure to generate a template config file, this commit implements a minimal fix to make things work again for PCI devices by skipping the platform probe method when xf86DoConfigure is set. This has been tested on a system with integrated intel graphics, with both the intel and modesetting drivers and restores Xorg -configure functionality on both cases. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-08-17test: Remember to swap the window argument to XIQueryPointerAdam Jackson1-0/+1
Before 5c69cb60 this wouldn't matter, because ProcXIQueryPointer manually emitted its own error before (bogusly) returning Success to the main loop. Since these tests only look at the return value of the dispatch function we'd think things succeeded even when we'd generated an error. With that fixed, the test code's failure to swap the window id would make dixLookupWindow (rightly) throw BadWindow. Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-08-16xinput: Let top-level dispatch generate the errorAdam Jackson1-2/+2
... instead of calling SendErrorToClient ourselves. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-08-16xv: Remove some dumb calls SendErrorToClientAdam Jackson1-3/+0
We already generate errors from the top level when non-Success is returned from a dispatch function, so really we were emitting errors twice. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-08-16xwayland: Fix relinking when dix changesAdam Jackson1-1/+1
Without this a change in eg Xext/ wouldn't relink Xwayland, making you wonder why your changes didn't have any effect. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-08-16config: Hold input lock across udev socket handlingKeith Packard1-1/+5
This avoids having the server running inside libudev from two threads at once, which it appears to not like. 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-08-15present: Free the fake_present OsTimerPtrOlivier Fourdan1-1/+2
Plug a leak in present_fake_queue_vblank() where the OsTimer would not be freed. 492,608 (482,816 direct, 9,792 indirect) bytes in 15,088 blocks are definitely lost in loss record 3,954 of 3,954 at 0x4C2ABDE: malloc (in vgpreload_memcheck-amd64-linux.so) by 0x586B19: TimerSet (WaitFor.c:433) by 0x4F1AA9: present_fake_queue_vblank (present_fake.c:108) by 0x4F15E0: present_pixmap (present.c:954) by 0x4F23B4: proc_present_pixmap (present_request.c:138) by 0x552BCE: Dispatch (dispatch.c:430) by 0x556C22: dix_main (main.c:300) by 0x6F0D290: (below main) (in /usr/lib/libc-2.24.so) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97065 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-08-15present: Call set_abort_flip / restore_screen_pixmap in clear_window_flipMichel Dänzer3-4/+12
We were asserting that these were called before from other places, but that isn't always the case, e.g. during server shutdown. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96951 Reported-and-Tested-by: Tod Jackson <tod.jackson@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2016-08-15present: Make present_restore_screen_pixmap handle screen->root == NULLMichel Dänzer1-2/+3
Easier than dealing with it in all paths that can end up here during server shutdown. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-15xwayland: Avoid double free of RRCrtc and RROutputOlivier Fourdan3-4/+12
At shutdown, the Xserver will free all its resources which includes the RRCrtc and RROutput created. Xwayland would do the same in its xwl_output_destroy() called from xwl_close_screen(), leading to a double free of existing RRCrtc RROutput: Invalid read of size 4 at 0x4CDA10: RRCrtcDestroy (rrcrtc.c:689) by 0x426E75: xwl_output_destroy (xwayland-output.c:301) by 0x424144: xwl_close_screen (xwayland.c:117) by 0x460E17: CursorCloseScreen (cursor.c:187) by 0x4EB5A3: AnimCurCloseScreen (animcur.c:106) by 0x4EF431: present_close_screen (present_screen.c:64) by 0x556D40: dix_main (main.c:354) by 0x6F0D290: (below main) (in /usr/lib/libc-2.24.so) Address 0xbb1fc30 is 0 bytes inside a block of size 728 free'd at 0x4C2BDB0: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4CCE5F: RRCrtcDestroyResource (rrcrtc.c:719) by 0x577541: doFreeResource (resource.c:895) by 0x5787B5: FreeClientResources (resource.c:1161) by 0x578862: FreeAllResources (resource.c:1176) by 0x556C54: dix_main (main.c:323) by 0x6F0D290: (below main) (in /usr/lib/libc-2.24.so) Block was alloc'd at at 0x4C2CA6A: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4CC6DB: RRCrtcCreate (rrcrtc.c:76) by 0x426D1C: xwl_output_create (xwayland-output.c:264) by 0x4232EC: registry_global (xwayland.c:431) by 0x76CB1C7: ffi_call_unix64 (in /usr/lib/libffi.so.6.0.4) by 0x76CAC29: ffi_call (in /usr/lib/libffi.so.6.0.4) by 0x556CEFD: wl_closure_invoke (connection.c:935) by 0x5569CBF: dispatch_event.isra.4 (wayland-client.c:1310) by 0x556AF13: dispatch_queue (wayland-client.c:1456) by 0x556AF13: wl_display_dispatch_queue_pending (wayland-client.c:1698) by 0x556B33A: wl_display_roundtrip_queue (wayland-client.c:1121) by 0x42371C: xwl_screen_init (xwayland.c:631) by 0x552F60: AddScreen (dispatch.c:3864) And: Invalid read of size 4 at 0x522890: RROutputDestroy (rroutput.c:348) by 0x42684E: xwl_output_destroy (xwayland-output.c:302) by 0x423CF4: xwl_close_screen (xwayland.c:118) by 0x4B6377: CursorCloseScreen (cursor.c:187) by 0x539503: AnimCurCloseScreen (animcur.c:106) by 0x53D081: present_close_screen (present_screen.c:64) by 0x43DBF0: dix_main (main.c:354) by 0x7068730: (below main) (libc-start.c:289) Address 0xc403190 is 0 bytes inside a block of size 154 free'd at 0x4C2CD5A: free (vg_replace_malloc.c:530) by 0x521DF3: RROutputDestroyResource (rroutput.c:389) by 0x45DA61: doFreeResource (resource.c:895) by 0x45ECFD: FreeClientResources (resource.c:1161) by 0x45EDC2: FreeAllResources (resource.c:1176) by 0x43DB04: dix_main (main.c:323) by 0x7068730: (below main) (libc-start.c:289) Block was alloc'd at at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) by 0x52206B: RROutputCreate (rroutput.c:84) by 0x426763: xwl_output_create (xwayland-output.c:270) by 0x422EDC: registry_global (xwayland.c:432) by 0x740FC57: ffi_call_unix64 (unix64.S:76) by 0x740F6B9: ffi_call (ffi64.c:525) by 0x5495A9D: wl_closure_invoke (connection.c:949) by 0x549283F: dispatch_event.isra.4 (wayland-client.c:1274) by 0x5493A13: dispatch_queue (wayland-client.c:1420) by 0x5493A13: wl_display_dispatch_queue_pending (wayland-client.c:1662) by 0x5493D2E: wl_display_roundtrip_queue (wayland-client.c:1085) by 0x4232EC: xwl_screen_init (xwayland.c:632) by 0x439F50: AddScreen (dispatch.c:3864) Split xwl_output_destroy() into xwl_output_destroy() which frees the wl_output and the xwl_output structure, and xwl_output_remove() which does the RRCrtcDestroy() and RROutputDestroy() and call the latter only when an output is effectively removed. An additional benefit, on top of avoiding a double free, is to avoid updating the screen size at shutdown. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-15dix: Pass ClientPtr to FlushCallbackMichel Dänzer2-7/+4
This change has two effects: 1. Only calls FlushCallbacks when we're actually flushing data to a client. The unnecessary FlushCallback calls could cause significant performance degradation with compositing, which is significantly reduced even without any driver changes. 2. By passing the ClientPtr to FlushCallbacks, drivers can completely eliminate unnecessary flushing of GPU commands by keeping track of whether we're flushing any XDamageNotify events to the client for which the corresponding rendering commands haven't been flushed to the GPU yet. Reviewed-by: Adam Jackson <ajax@redha.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2016-08-15xace: Fix XaceCensorImage to actually censor the right part of the imageAaron Plattner1-1/+2
The caller passes arguments into XaceCensorImage that are in window-relative coordinates. However, the pBuf that it uses to construct a temporary pixmap has its origin at (x, y) relative to the window in question. The code to convert the censor region into boxes adjusts for the Y coordinate, but leaves the X coordinate alone. The result is that if x is not zero, it censors the wrong part of the image. Fix this by just translating censorRegion into pixmap-relative coordinates and using the resulting boxes as-is. Reported-by: Fabien Lelaquais <Fabien.Lelaquais@roguewave.com> Link: https://lists.x.org/archives/xorg/2016-August/058165.html Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2016-08-15xwayland: Plug memleak in frame callbacksOlivier Fourdan2-0/+4
The frame callback set up via wl_surface_frame() needs to be freed with wl_callback_destroy() or we'll leak memory. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97065 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-08-15Autoconfig: Fix the loop adding dectected drivers to the list of screensMatthieu Herrb1-2/+1
This loop was written in a buggy style, causing a NULL driver ptr to be passed to copyScreen(). copyScreen() only uses that to generate an identifier string, so this is mostly harmless on systems that accept NULL for asprintf() "%s" format. (the generated identifiers are off by one wrt the driver names and the last one contains NULL. For systems that don't accept NULL for '%s' this would cause a segmentation fault when this code is used (no xorg.conf, but partial config in xorg.conf.d for instance). Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-08-15xfree86: vgaarb: Initialize local variable rsrc_decodesEmily Deng1-1/+1
In function xf86VGAarbiterScrnInit when the "pEnt->bus.type" is BUS_PLATFORM, the "pScrn->vgaDev" won't be set, so the "pScrn->vgaDev" is equal to zero. The variable "rsrc_decodes" in function "xf86VGAarbiterAllowDRI" is not initialized. So it will occur error when "pScrn->vgaDev == 0", and "vga_count > 1". For this case, as "pScrn->vgaDev == 0", the function "pci_device_vgaarb_get_info" will only set the value of "vga_count", but won't set the value of "rsrc_decodes", so it will has two different return values for function "xf86VGAarbiterAllowDRI" in different platforms. One platform will return TRUE, as the "rsrc_decodes" 's default value is 0, but another platform will return FALSE, as the "rsrc_decodes" 's default value is "32767", this will cause disable direct rendering. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96937 Signed-off-by: Emily Deng <Emily.Deng@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-08-15dix: Avoid writing uninitialized bytes in deliverPropertyNotifyEventKeith Packard1-4/+6
Make sure the whole event is initialized, instead of leaving the pad bytes unset. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-14os: Abandon loop after poll call when array of fds has changedKeith Packard1-0/+10
If a file descriptor is added or removed from an ospoll callback, then the arrays containing file descriptor information will have all of their indices changed, so the loop state is no longer consistent. Just bail out and let the caller come back around to try again. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-14os: Delay freeing of epoll_wait return pointers until epoll is idle.Keith Packard1-2/+23
Instead of freeing the struct ospollfd elements when the fd is removed by the user, delay that until epoll is idle so that we are sure no epoll_event structures could contain the stale pointer. This handles cases where an fd is removed from the ospoll callback interface, and also in case the OS keeps stale pointers around after the call to epoll_ctl with EPOLL_CTL_DEL. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-13xfree86: Set pScrn->pScreen before driver ScreenInit is calledKeith Packard1-2/+11
Any code called from the driver ScreenInit may want to refer to pScrn->pScreen. As the function passed to AddScreen is the first place the DDX sees a new screen, the generic code needs to make sure that value is set before passing control to the video driver's initialization code. This was found by running a driver which didn't bother to set this value when the initial colormap was installed; xf86RandR12LoadPalette tried to use pScrn->pScreen and crashed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97124 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>