If fork is requested, we fork as early as possible, way before anything
is initialized. This way, we don't need to do the gymnastics to make
OpenGL work properly across fork.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Replace most of XFlush with xcb_flush.
Also, in a lot of places, XFlush is used as if it is XSync. Replace
those cases by using xcb's _checked version of functions and
xcb_request_check.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
As a global variable, since they shouldn't change during the period
compton is running. Also limit the scope of the variable to x.c.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Buffer age is not a glx specific concept. xrender backend can have
buffer age too, if double buffering is used (required if we want to use
Present). So, make buffer age a generic concept in compton is required
for further backend improvements.
Moved buffer age based damage aggragation out of glx as well.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously, compton fails to stop draw_idle in some cases when sw_opti
is enabled.
sw_opti is a feature that limits the draw frequence to vblank frequence.
It adds a delay to drawing when the screen is updated more frequently
than the vblank frequence. However when the delay is not used (i.e. the
screen is updated infrequent enough), compton will start drawing the
frame directly without using the delay. And specically in this case,
compton will fail to stop the draw_idle, causing a callback to be called
once per loop of the mainloop, resulting in high CPU usage.
Fixes#92
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Slightly clean up header inclusion with the help of clang's module system.
It's better for files to include the things you need directly.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
glStringMarker is usually only available when running under some
kind of GL debugger, and can be used to insert strings into the
GL command string. Writing logs using it can be useful, since it
lets us correspond GL calls with what happens in compton.
More info about the extension can be found here:
https://www.khronos.org/registry/OpenGL/extensions/GREMEDY/GREMEDY_string_marker.txt
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit introduced a new, modular backend interface. The interface
is not very good, since I don't think I fully understand all the
requirements writing a backend have. But this is a good first step.
This commit also includes an initial xrender backend written using the
new interface, and some opengl backend related helper functions, which
are taken from the old opengl backend.
However, there is not integration with the core compton yet. compton
will still use the old backend code. This commit is here so we can get
the automated build test.
What is implemented in the new xrender backend:
* Windows with transparency
* Shadow
* Opacity
* Wallpaper (getting the root pixmap)
* Blur
Known problem with the xrender backend:
* It is slower
Things that still need to be figured out:
* What is the better way to add vsync to the new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Also add a new option "log-file" to config file and command line, it
doesn the same thing as --logpath.
--logpath was never documented, and "log-file" is more consistent with
the naming of options.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
* Pass a options_t, not session_t
* Slightly improve error handling when setting vsync method via dbus
The goal here is to limit the scope of what a given function can access.
And session_t contains basically everything, so don't pass it around.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
* -d: because the standard way is to use $DISPLAY
* no-name-pixmap: undocumented debugging option
* -S: debugging option, not very useful
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
* Moved dbus prototypes from common.h to dbus.h
* Removed private function prototypes from dbus.h
* Removed private macros from dbus.h
* Hide dbus types from common.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
And improve some of the log messages. Like, when compton exits because
of unsupported options, explain which options are causing compton to
quit.
Convert some debugging messages that are guarded behind ifdef's to log_trace,
so user don't need to re-compile to enabled them.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Moved:
* Blur kernel related functions to kernel.c
* Vsync related functions to vsync.c
* paint related functions to render.c
This will make the `split-backend` branch easier to rebase.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
* string functions mstr*() are moved to string_utils.c
* allocation wrappers are moved to utils.h
* printf_* functions are moved to log.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Both methods are redundant. Prefer Mesa's own extension when available,
fall back to the old SGI extension otherwise (NVIDIA drivers for the
most part).
The old shadow kernel formula is not "wrong" per se, as the only judge
is if it looks good. However, the formula used is not really gaussian.
Also, the kernel size calculation doesn't really make sense to me.
This commit change the kernel formula to actually use a gaussian
distribution. As far as I can tell, there is no perceivable difference.
Except now the effective shadow radius is smaller for the same config.
Also, made that part of code a bit more mordern.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
libglvnd seems to return a pointer to a function that does NOTHING
for things the backing driver doesn't support.
So we check if the extension is actually advertised before using it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This cause certain window types to be ignored in deciding whether the
screen should be redirected after being unredirected.
Fixes#58
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
I just realized wintype option shadow and fade never worked. If you set
the global shadow option to true, wintype shadow option will have no effect.
Now the wintype options will properly override the global ones.
Also remove deprecated options from compton.sample.conf.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Calling ev_break() in a signal handler doesn't work. Instead, we setup a
libev ev_signal handler for this.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Remove alpha_step, and support all 256 alpha values.
1 pixel pictures don't really use that many resources.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
When using DRI2, Mesa uses XESetWireToEvent to hook into Xlib's event
handling loop, so it can get notified when certain DRI2 event happens,
which is crucial to the normal functioning of GLX.
When xcb is owning the event queue (meaning libxcb is doing all the
event handling), those functions registered by Mesa will never be
called, thus GLX will malfunction, leading to screen flickers or visual
artifacts.
This commit uses a hack from Qt to manually call those functions in
compton.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Setting it on the target buffer picture has no effect. Fix performance
problem when using xrender with virtual box.
Fixes#40
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
When this option is enabled for a window type, shadow will be drawn in
areas that are obscure by the shape of the window.
Useful when the given window type has parts of the window transparent,
and you want to have shadows in those areas.
Fixes#45
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This reverts commit 50e2259404.
Temporarily revert the removal until we have more information about this whole
thing.
Turns out a couple of drivers don't work properly without the sync fence,
including intel, llvmpipe and NVIDIA.
Although sync fence is needed, from the information I have gathered (looking
at old bug reports, protocol specifications, look at other compositors' code),
compton's usage of it is not proper. So we need to rewrite it in the future,
after we get more information from driver developers.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
It will cause compton to print out some rudimentary diagnostics.
Also small improvements of the meson.build.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Interesting this problem only surface when using GTK applications on
KDE. Maybe on other WMs there are some other events after window
restacking that triggers repaint of the window.
Fixes#28
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This was a dubious "fix" for a Nvidia driver problem. The problem was
never fully understood, and the then developers took a shotgun approach
and implemented xsync fences as a fix. Which somehow fixed the problem.
Again, I don't see any indication that the developers understood why
this "fix" worked.
(for details, see chjj/compton#152 and chjj/compton#181)
The driver problem should have been fixed almost 5 years ago. So this
shouldn't be needed anymore. In addition the way compton uses xsync fences
is apparently wrong according to the xsync spec (fences are attached to
screen, but compton uses them as if they were attached to drawables).
So, I will try removing it and see if anyone will complain. If there are
real concrete reasons why fences are needed, it will be brought back.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This is a potentially useful feature for debugging the xrender backend,
so make it a commandline option rather than an obscure compiler flag.
Also this is only usable with xrender, for glx there are better tools
for debugging.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
--dbe does not seem to have an effect on tearing, as noted in the old
manpage, and confirmed by my own testing.
So remove it, since it complicates the logic of painting.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This way we don't need to update the bounding region after window moves.
Also add some comments about the coordinate systems in compton.
Also change a few function that takes a `bool global` parameter to
always return region in local coordinates.
With libX11, the library calls an I/O error handler if the connection to
the server breaks. The default I/O error handler prints an error message
and calls exit(). This can be seen when running a "pre-xcb" compton
against Xephyr and then closing the Xephyr window:
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
after 241 requests (241 known processed) with 0 events remaining.
The current compton would just continue running. After this commit, it
instead exits with this message:
handle_queued_x_events(): X11 server connection broke (error 1)
Signed-off-by: Uli Schlachter <psychon@znc.in>