Commit Graph

1158 Commits

Author SHA1 Message Date
Yuxuan Shui 5d321c85f5
Don't release window resource when unredirected
Because when the screen is unredirected, the window resource would have
already been freed. Fix a NULL pointer deref.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 01:35:52 +00:00
Yuxuan Shui 684d95988d
Fix one un-guarded use of backend_data
Fixes #127

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-07 23:54:13 +00:00
Yuxuan Shui f2aeb848ec
Put the whole vtable in backend_list
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-07 21:08:51 +00:00
Yuxuan Shui 7e3976947b
Fix crash when using monitor-repaint
If monitor-repaint is not implemented by the backend, compton will
crash. This commit fix the crash by not doing monitor-repaint in that
case.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 22:37:53 +00:00
Yuxuan Shui d0fd21e167
Drop support for Composite < 0.2
Rational: current workaround for Composite < 0.2 doesn't work with the
GLX backend, it also doesn't handle window border properly. Plus,
Composite 0.2 came out more than a decade ago, it's safe to assume
everyone has it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 22:14:23 +00:00
Yuxuan Shui eed5ea719e
Implement monitor repaint in new xrender
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 20:27:10 +00:00
Yuxuan Shui c387a266dc
backend interface: prepare is optional
Also remove xrender's prepare since it overwrite part of the screen
outside the damage region, causing rendering problems.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 20:27:10 +00:00
Yuxuan Shui de30ef14ae
backend: move the head of the damage ring after paint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 20:27:10 +00:00
Yuxuan Shui c57f267535
backend interface: Add visible hint
Pass the visible region of the image to the backend, so the backend
could optimize based on that information.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-04 23:02:58 +00:00
Yuxuan Shui a2ae36c1d6
backend_common: fix shadow generation with opacity
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-04 23:02:35 +00:00
Yuxuan Shui 3ab4107fda
Fix NULL pointer deref in configure_root
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-04 22:53:49 +00:00
Yuxuan Shui 7b664de74e
win: Remove win::pixmap
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-04 00:09:05 +00:00
yshui 0d7f505dd6
Merge pull request #125 from yshui/new-new-backend
new_backend: New interface
2019-03-03 22:21:12 +00:00
Yuxuan Shui 3707f792fb
new_backend: New interface
Move more logic out of the backend. The backends are now more agnostic
to what happens in compton.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-03 22:18:34 +00:00
Yuxuan Shui 11c8655206
Fix build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-27 06:33:30 +00:00
Yuxuan Shui 26214f312f
x: create_picture_with_{visual, pictfmt} don't need session_t
Take xcb_connection_t and xcb_drawable_t instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-27 00:30:27 +00:00
Yuxuan Shui 0ceee9aad1
solid_picture and build_shadow shouldn't take session_t
Pass xcb_connection_t and xcb_drawable_t instead, which is what these
functions need.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-26 23:21:11 +00:00
Yuxuan Shui 7e7c54761e
Remove an undocumented option
Removed --glx-reinit-on-root-change.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 21:18:48 +00:00
Yuxuan Shui 2699367b46
Handle xcb_wait_for_special_events failure
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 01:43:01 +00:00
Yuxuan Shui 29ceea8412
Implement buffer_age() for the new xrender backend
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 01:16:57 +00:00
Yuxuan Shui 244c23140d
Remove the ability to change vsync method via dbus
Supporting this will complicate the new backends.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 00:48:51 +00:00
Yuxuan Shui b76ff9fe5b
Add a TODO comment
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 00:29:05 +00:00
Yuxuan Shui 59ca5c9628
Remove one undocumented option
Removed --reredir-on-root-change

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 00:26:54 +00:00
Yuxuan Shui f16d00a6a2
Split configure_win into two
One for configuring root, one for regular windows.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 00:25:45 +00:00
Yuxuan Shui 7a446ca1f4
Slightly better error handling
Handle backend initialization failure.

Also actually disable vsync when it's not supported in the new xrender
backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-25 00:22:10 +00:00
Yuxuan Shui 72a977eed5
Allow double buffering in the new xrender backend
If PresentPixmap choose to use the Flip mode, we cannot reuse the same
buffer for rendering for the next frame. Add double buffering for that
case.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-24 23:53:46 +00:00
Yuxuan Shui 28cf35e43b
Wait for PresentCompleteNotify
Don't use idle fence. There is no reliable & portable way to obtain a
fence Present will like. Intel driver wants a DRI3 fence, NVIDIA driver
doesn't support DRI3, and wants a XSync fence (I am not even sure, since
Present doesn't really work with the NVIDIA driver. And using the fence
on NVIDIA driver causes compton to use 100% CPU).

Just don't bother.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-24 23:29:48 +00:00
Yuxuan Shui e986ebceda
Allow win_on_win_size_change to be called on UNMAPPED windows
This can happen when the window has just been created

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-23 00:25:10 +00:00
Yuxuan Shui b92182416c
Don't stop fading for window size change
Window size change cause window resource to be released and re-acquired,
so it cannot work on unmapped windows.

Previously we make sure of that by skipping fading and change if the
window is mapped. Now we just make sure that functino is never called
with an unmapped window.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-23 00:18:12 +00:00
Yuxuan Shui 1005e61553
Delay reconfiguration of unmapped windows
If a window is being faded out because of unmapping, don't handle its
configuration notify. Avoid freeing pixmap of a window that is being
faded out, because that will cause paint to fail.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-23 00:14:26 +00:00
Yuxuan Shui 8d639f41e9
Make sure only MAPPED state can transition to FADING
win_update_focused transition window into FADING without checking their
current state, resulting into unmapping windows being brought into
FADING state and stops unmapping.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-23 00:11:29 +00:00
Yuxuan Shui 9cce1efe3f
Call glxext_init from glx_init
Make sure we query the extensions.

Also don't start glx string marker logger for new backends yet.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 23:25:31 +00:00
Yuxuan Shui 23ee4c6cbe
Add missing check for experimental_backends
Fixes #121

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 22:32:49 +00:00
Yuxuan Shui 6487047526
Add install instructions to README
Closes #120

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 18:24:46 +00:00
Yuxuan Shui f120f9b754
Make sure map_win initialize win::win_data
Previously it is initialized by win_update_bounding_shape, so
configure_win is called when win_data == NULL and state ==
WSTATE_MAPPING, which is an invalid state for a `win` to be in.

Now map_win explicitly calls backend->prepare_win. This is not very
efficient since win_update_bounding_shape will reinit it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:53:41 +00:00
Yuxuan Shui e82bc0ca23
Silence a warning in release build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:15:25 +00:00
Yuxuan Shui 350933a054
Cleanups
* Make some functions in win.c pure
* Remove unused code
* Fix misuse of attr_const, const functions shouldn't exam data pointed
  to by its pointer arguments.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:08:08 +00:00
Yuxuan Shui 69826a0844
Add some TODOs
reg_ignore is a bit complicated.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 04:11:58 +00:00
Yuxuan Shui d145808e69
Fix new backend related crash
Use of invalid backend_info_t.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:51:26 +00:00
Yuxuan Shui a7f373dec3
Starting the deprecation process for --sw-opti
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:42:03 +00:00
Yuxuan Shui 6909597ee3
Use monotonic clock for time
Remove handling of the so-called "time disorders".

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:36:51 +00:00
Yuxuan Shui 934c269f9b
Update win::reg_ignore_valid when destroying window
When destroying a window, set window->next->reg_ignore_valid to false,
since its reg_ignore is not valid anymore.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:00:27 +00:00
Yuxuan Shui 6c71146f1c
Don't call map_win() in add_win()
Only case where you want to map window in add_win() is during compton
startup, when compton is registering existing windows. Otherwise,
add_win() is always called for newly created windows, so there will
always be a MapNotify coming up for that window. If we map newly created
windows in add_win(), we will try to map it a second time when the MapNotify
arrives.

So, just don't call map_win() from add_win(). For compton startup, we
explicitly call map_win() after calling add_win() in session_init.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 02:29:06 +00:00
Yuxuan Shui ff37cf9756
Don't start fading when screen is unredirected
If a window is destroyed and starts to fade out when screen is
unredirected, when the screen become redirected again, we will generate
errors when trying to render that window.

Also make sure the assumption that all window are either MAPPED or
UNMAPPED when screen is unredirected holds.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 02:12:07 +00:00
Yuxuan Shui 9aaf0fc707
Fix a use-after-free
paint_preprocess takes head of the window list as an argument. The
actual head of the window list might be freed and deleted during processing
of fade, but paint_preprocess will keep using the old head of the list,
thus uses freed memory.

Solution is just don't pass the head as an argument. paint_preprocess
will use session_t::list directly.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 01:40:04 +00:00
Yuxuan Shui 64e08cc1e3
Fix memory leaks when using the new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 18:21:40 +00:00
Yuxuan Shui c2f274ca8a
Fix some problems in new backend integration
Fix several use of uninitialized/unallocated variables when using
--experimental-backends

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 18:17:16 +00:00
Yuxuan Shui 417e12bc62
Don't call init_render when using new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 18:04:04 +00:00
yshui 72a921da2c
Merge pull request #109 from yshui/integrate-new-backends
Integrate new backends
2019-02-20 17:55:03 +00:00
Yuxuan Shui b0c5db9f5a
Let old/new backends co-exist
Now both the old and the new backends are compiled in, the user can
choose which one to use with a command line switch.

Lower the barrier for testing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 17:52:24 +00:00