Commit Graph

1434 Commits

Author SHA1 Message Date
Yuxuan Shui f227e6c8c7
ci: enable more build types
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-12 15:17:28 +01:00
Yuxuan Shui 9f136ca2e4
ci: add more build types
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-12 15:15:42 +01:00
Yuxuan Shui 583cf35bed
Fix compiler warnings in release builds
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-12 15:12:17 +01:00
Yuxuan Shui 065f9ffd4d
test.h: update to yshui/test.h@9e5fc7b
Fix unit tests on *BSD systems

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-12 14:56:59 +01:00
yshui 2d1621aee4
Merge pull request #250 from jbeich/no_opengl
Unbreak build without OpenGL
2019-10-12 14:46:51 +01:00
Jan Beich bd5a5fb568 Unbreak -Dopengl=false clean build
In file included from ../src/x.c:17:
../src/backend/gl/glx.h:10:10: fatal error: 'GL/glx.h' file not found
 #include <GL/glx.h>
         ^~~~~~~~~~
2019-10-12 13:29:10 +00:00
Yuxuan Shui 945dc179f5
meson.build: make sure xcb packages are recent enough
Fixes #248

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-11 18:11:45 +01:00
Yuxuan Shui 1ca01ec456
Make sure window cannot enter fading when unredirected
Firstly, this breaks the assumption that when we redirect the screen,
all window is either mapped or unmapped, causing a assertion failure.

Secondly, if transition window into fading when the screen is not
redirected, the fading will not progress until the screen is redirected,
probably not the desired result.

Fixes #246

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-11 18:01:13 +01:00
Yuxuan Shui 93f0d80572
options: enable use-damage by default
Since user reports indicate it has real performance benefits.

Also add a command line flag for turning use-damage off.

Fixes #242

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:52:07 +01:00
Yuxuan Shui a69ed89114
Treat first frame after redirection differently
Because first frame no window has their pixmap bound, which doesn't
happen in frames after the first. If a window is unmapped in that frame,
the compositor will try to render a window with no pixmap bound if
fading is enabled.

Now we keep track if we are in the first frame, and if that's the case
we skip fading in unmap/destroy.

Fixes #239, bug number 2

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:40:09 +01:00
Yuxuan Shui f493447b33
win: clear PIXMAP_STALE in {unmap,destroy}_win_start
Also make sure unmapped/destroyed windows don't have PIXMAP_STALE flag
set.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:09:40 +01:00
Yuxuan Shui 0fc6f9aee2
core: bind shadow immediate in initialize_backend
This simplifies the logic a bit since we know a shadow is always bound
(if needed) when the screen is redirected.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:04:09 +01:00
Yuxuan Shui d5e8cf655c
core: rename some functions for clarity
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-28 23:43:36 +01:00
Yuxuan Shui 9fc388e5bc
tests/issue239_2: add comments
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-28 23:29:19 +01:00
Yuxuan Shui df67fb2508
tests: add testcase for #239, bug number 2
If a window is unmapped during the draw_callback re-run when the screen
is just redirected, that window won't get a chance to acquire a pixmap.
If fading is enabled, the compositor will try to render that window and
crash.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-28 23:23:24 +01:00
Yuxuan Shui 0c7a19fda6
backend: glx: add support for setting vsync
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-25 23:20:48 +01:00
yshui db37f74140
Merge pull request #241 from jenav/next
Fix build error: initializer element is not constant
2019-09-25 14:33:39 +01:00
Jerónimo Navarro 94c8927d7b win_defs.h: fix #240 2019-09-25 09:47:36 -03:00
Yuxuan Shui 33a106e254
win: don't ignore SHADOW_STALE flag on unmapped windows
Previously all image stale flags are ignored when processing an unmapped
window. If a window gains a shadow during its fading out transition, the
shadow flag will be set, but shadow won't actually be generated, causing
a NULL pointer dereference during render.

Fixes #239

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:52:26 +01:00
Yuxuan Shui c85c9ef1cc
win: set session::pending_updates in win_set_shadow
Otherwise shadow won't get generated in next critical section, causing
NULL pointer dereference or assertion failure in next render.

Partially fixes #239

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:52:11 +01:00
Yuxuan Shui 44fd3f93f7
tests: add test case for #239
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:36:09 +01:00
Yuxuan Shui 33aa805048
tests: support specifying config files for tests
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:22:17 +01:00
Yuxuan Shui bfb6cad648
tests: put test cases into their own folder
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:22:17 +01:00
Yuxuan Shui 8628e498c5
win: rename win_get_name to win_update_name
Make explicit the fact that it modifies the win struct.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:22:17 +01:00
Yuxuan Shui 1a1540a5a6
events: don't call win_get_name for logging
win_get_name _updates_ the name of the window by querying the X server,
thus potentially changes the behaviour of the compositor when logging is
turned on (e.g. we could fail to detect window name changes, because the
name was blindly updated in a logging call without handling the name change).

We shouldn't do that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:21:07 +01:00
Yuxuan Shui 73ea5d2bfb
backend: dummy: add more sanity checks
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:19:28 +01:00
Yuxuan Shui a0bb392d8c
core: process window updates before recheck_focus
recheck_focus rejects focus of unmapped windows, so we have to make sure
pending maps of windows are processed before we call recheck_focus.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-21 05:11:28 +01:00
Yuxuan Shui 3e17f11d6d
options: remove deprecation message about --glx-fshader
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-21 01:37:31 +01:00
yshui 0063738754
Merge pull request #236 from liskin/memleaks
fix a few memory leaks reported by valgrind
2019-09-20 14:52:17 +00:00
Tomas Janousek 23421b2ff8 win: fix memory leak in fill_win
Fixes the following memory leak reported by valgrind:

    1,056 bytes in 24 blocks are definitely lost in loss record 83 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x11FD5B: fill_win (win.c:1165)
       by 0x117CE6: handle_new_windows (compton.c:1266)
       by 0x118065: _draw_callback (compton.c:1333)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x11AD65: session_run (compton.c:2226)

This one out of multiple code paths forgot to free the structure. Yeah,
manual memory management is hard. :-)
2019-09-20 10:15:59 +02:00
Tomas Janousek fcec9fcd39 core: fix memory leak in _draw_callback
Fixes the following memory leak reported by valgrind:

    992 bytes in 31 blocks are definitely lost in loss record 81 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x118094: _draw_callback (compton.c:1335)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x11AD65: session_run (compton.c:2226)
       by 0x11B005: main (compton.c:2308)

To prevent accidentaly reusing the freed structure, wrap it in a lexical
scope.
2019-09-20 10:15:59 +02:00
Tomas Janousek a7170cef81 backend: driver: fix memory leak (r2 not freed)
Fixes the following memory leaks reported by valgrind:

    96 bytes in 1 blocks are definitely lost in loss record 54 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B266: detect_driver (driver.c:34)
       by 0x119949: session_init (compton.c:1879)
       by 0x11AEF0: main (compton.c:2285)

    96 bytes in 1 blocks are definitely lost in loss record 55 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B266: detect_driver (driver.c:34)
       by 0x11795E: redir_start (compton.c:1202)
       by 0x115C76: paint_preprocess (compton.c:629)
       by 0x1182BD: _draw_callback (compton.c:1380)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
2019-09-20 10:15:59 +02:00
Tomas Janousek bd122c738d backend: driver: fix memory leak (randr_version not freed)
Fixes the following memory leaks reported by valgrind:

    32 bytes in 1 blocks are definitely lost in loss record 15 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B16F: detect_driver (driver.c:20)
       by 0x119949: session_init (compton.c:1879)
       by 0x11AEF0: main (compton.c:2285)

    32 bytes in 1 blocks are definitely lost in loss record 16 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B16F: detect_driver (driver.c:20)
       by 0x11795E: redir_start (compton.c:1202)
       by 0x115C76: paint_preprocess (compton.c:629)
       by 0x1182BD: _draw_callback (compton.c:1380)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)

Also, free(randr_version) in the error path as well.
2019-09-20 10:15:59 +02:00
yshui b38a5ae366
Merge pull request #238 from yshui/window-updates
Window updates
2019-09-20 01:29:43 +00:00
yshui 3060fe8f2c
Merge pull request #235 from liskin/readme-deps
README: fix typo in debian deps
2019-09-20 01:28:03 +00:00
Yuxuan Shui 3766aa2c79
win: make sure delayed image update is always used
Convert several places where the window image is bound/unbound directly
to use image flags. Make sure window image updates only happen in one
place.

Remove win_bind_image function since its no longer used after this.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:48 +01:00
Yuxuan Shui 39a609acb0
event: do delayed window mapping
This remove the only case where map_win_start is called outside of the
X critical section.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:48 +01:00
Yuxuan Shui 9f3d3f2fba
win: add functions for delayed window updates
And a window update flag for mapping the window.

Also make sure related functions consider the case where the given window
has pending updates.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:46 +01:00
Yuxuan Shui 16bff8ff41
win: add managed_win_internal
Which includes the pending update flags for the window.

Using an internal struct makes sure the window update flags are opaque outside
of win.c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:15 +01:00
Yuxuan Shui b9bf4fed60
win: rename some functions
rename map_win, unmap_win, destroy_win to map_win_start,
unmap_win_start, destroy_win_start respectively. To clarify their
intended functions. Also rename the corresponding finish_* functions to
*_finish so they are consistent.

Also some very minor code clean ups.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:15 +01:00
Yuxuan Shui fd570e1b78
win: split unmap_win into unmap and destroy
Instead of doing both unmapping and destroying in the same function,
since that complicates the logic.

Also since now destroy_win handles both the managed and unmanaged cases,
remove destroy_unmanage_win function.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:11 +01:00
Yuxuan Shui eecee130b8
win: split WIN_FLAGS_IMAGE_STALE
Split it into PIXMAP_STALE and SHADOW_STALE, this allows us to update
pixmaps and shadow images separately.

Also added PIXMAP_NONE and SHADOW_NONE, as redundancy to detect logic
errors.

Convenient constants and functions are provided for updating pixmap and
shadow together.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 01:25:07 +01:00
Yuxuan Shui 1549997811
win: remove map_win_by_id
Since it has only one user.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 01:24:57 +01:00
Yuxuan Shui 5787c17ebe
Promote some log_trace to log_debug
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-19 17:23:48 +01:00
Yuxuan Shui ebb52567c0
core: move the X critical section into a function
Also move handle_root_flags into the critical section.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-19 17:20:52 +01:00
Yuxuan Shui 7df9245c81
win: move image update code into a function
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-19 16:59:36 +01:00
Tomas Janousek 90c71a7014 README: fix typo in debian deps 2019-09-19 16:02:44 +02:00
Yuxuan Shui de5d5ca9bb
event.c: run clang-format
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 23:28:16 +01:00
Yuxuan Shui 48687b985d
Make potentially window destroying functions take simple pointers
Instead of pointer to pointer. The two level of pointers were used to
inform the caller the window has been destroyed (pointer set to NULL).

Now, destruction of windows are now signaled by the return value, which
is marked `must_use`.

Problem with taking pointer to pointer is that they tends to pollute the
function signatures a little bit. And we are not using it well anyways.
A lot of the callers passes pointers to local variables to those
functions, so the information about window destruction doesn't actually
bubble up. So, we switch to use just one level of pointers instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 23:14:03 +01:00
Yuxuan Shui 127b1ac3a4
win: remove some unreachable code
finish_destroy_win has unreachable code after a return statement

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 22:46:25 +01:00