Yuxuan Shui
1a327b06ab
Fix abort because we used log too early
...
Can't use log in get_early_config.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-08 22:46:28 +00:00
Yuxuan Shui
343140f845
Reuse glx_has_extension for old backend
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-08 22:34:53 +00:00
Yuxuan Shui
edb8b38eef
Tile root pixmap in the glx backend
...
In X, background pixmap is tiled (meaning they are repeated to filled
the window) by default. So, in the glx backend, we mimic this behavior
by binding the background pixmap of the root window (aka, the wallpaper)
to texture that repeats.
Fixes #107
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-08 21:48:39 +00:00
Yuxuan Shui
5fffb6f3f6
Fork as early as possible
...
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 >
2019-02-08 01:33:42 +00:00
Yuxuan Shui
fec43acfaa
Add missing headers
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 22:47:42 +00:00
Yuxuan Shui
33c1cd439b
Fix memory leak of dbus service names
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 22:47:32 +00:00
Yuxuan Shui
a019ff453b
Make get_early_config even earlier
...
Also improve the management of X Display and session_t.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 22:45:44 +00:00
Yuxuan Shui
2867ac7a1c
Remove unused screenshot code
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 22:16:32 +00:00
Yuxuan Shui
68c77cd7d8
Add log_remove_target
...
Don't need to deinit+init struct log any more just to switch log target
:)
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 21:50:20 +00:00
Yuxuan Shui
049cc94e7a
Coding style change
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 21:37:13 +00:00
Yuxuan Shui
22bc79369e
Review the use of XFlush and xcb_flush
...
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 >
2019-02-07 01:11:13 +00:00
Yuxuan Shui
856ad4b230
Wrap root window background prop check
...
It might be reused by the backends.
Depends on what the backend API ends up look like.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 00:34:48 +00:00
Yuxuan Shui
7d00b89364
x_get_pictform_for_visual should return const *
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 00:22:16 +00:00
Yuxuan Shui
aa9c439cc6
Improve the interface of glx_find_fbconfig
...
Remove the dependence of xcb_render types in glx.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-07 00:04:43 +00:00
Yuxuan Shui
f19766f15a
Fix FBConfig cost calculation
...
Double buffering only doubles the color buffer, not the depth and
stencil.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 19:33:31 +00:00
Yuxuan Shui
2263bab2ff
Consider buffer size and double buffering as well
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 19:15:30 +00:00
Yuxuan Shui
519bf8500b
Prefer FBConfig with smaller depth + stencil buffer
...
Reduce GPU memory usage to what it was before fix-fbconfig.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 19:06:33 +00:00
Yuxuan Shui
39b612a8a4
Delete irrelevant comments
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 18:53:28 +00:00
Yuxuan Shui
b1d8687b31
Add copyright notice to backend/**
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 18:47:36 +00:00
yshui and GitHub
6a5ad609ba
Merge pull request #104 from yshui/fix-fbconfig
...
Fix fbconfig lookup
2019-02-03 18:43:58 +00:00
Yuxuan Shui
388a7f3ad4
Fix leaking of root_tile FBConfig
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 18:41:47 +00:00
Yuxuan Shui
24370f44e6
Cache FBConfig used for shadows
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 18:41:47 +00:00
Yuxuan Shui
8922312e42
Refactor FBConfig lookup
...
Background: To bind a Xorg window content to a OpenGL FBConfig, which
has to match the color format the Xorg window is using.
Previously, compton just find a FBConfig that has the same depth. This
led to chjj/compton#477 , which has been fixed by a ugly hack.
The commit refactor the lookup mechanism to take as much into
consideration as we reasonably can. Hopefully preventing similar
breakages in the future.
Also, some code sharing between the old and new glx backend.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 18:41:47 +00:00
Yuxuan Shui
7ac351e5b5
Move some default_* functions to backend_common.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 18:41:02 +00:00
Yuxuan Shui
b061789a84
Add helper function x_get_visual_depth
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 16:49:04 +00:00
yshui and GitHub
386f5fb8c6
Merge pull request #105 from yshui/no-session_t-season1
...
Most of the x_* functions don't need session_t
2019-02-03 16:03:59 +00:00
Yuxuan Shui
17c8517abc
Most of the x_* functions don't need session_t
...
Replace session_t parameter with xcb_connection_t if that's the only
thing needed.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-03 15:59:31 +00:00
Yuxuan Shui
ad3dc5d233
Move session_t::pictfmts into x.c
...
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 >
2019-02-03 15:14:18 +00:00
Yuxuan Shui
0be3fb5ea2
Remove some unused macros/ifdefs
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 22:19:15 +00:00
Yuxuan Shui
eadb09ee0d
Remove glx_mark
...
glx_mark is part of the logging system now, so no need for the old
functions.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 22:05:53 +00:00
Yuxuan Shui
7d10db6531
Move deallocation of damage_ring to deinit_render
...
Fix a memory leak when compton is reset.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 22:05:43 +00:00
Yuxuan Shui
6eff9ebf8b
Variable name change
...
win::destroyed to win::destroying, because it make slightly more sense.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 19:43:42 +00:00
Yuxuan Shui
8371d6a0b7
Replace glDrawBuffers with glDrawBuffers
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 19:30:07 +00:00
Yuxuan Shui
94505bbcf4
Fix compiling on older gcc
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 02:12:08 +00:00
Yuxuan Shui
0947148fcc
Fix compiler warnings
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 02:00:15 +00:00
Yuxuan Shui
465a968ddd
Parse number locale-independently
...
Previously we were using glibc's strtod function to parse floating point
numbers. The problem is, strtod is locale dependent. Meaning 7,7 might
be parsed as two numbers (7 and 7) in one locale, and parsed as one
number (7 point 7) in another locale. This is undesirable.
We need to set the locale to a value we know to make number parsing
consistently. We could use setlocale(), but that is not thread-safe. We
can also use uselocale(), which is thread-safe, but doesn't cover strtod
(Yeah, some of the locale-aware functions only acknowledge the global
locale, not the thread local one).
So in frustration, I just wrote a simple floating point number parser
myself. This parser obviously doesn't cover all cases strtod covers, but
is good enough for our needs.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-02-02 01:28:15 +00:00
Yuxuan Shui
3f5a4d570c
Fix memory leak in glx_init_blur
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-31 22:47:04 +00:00
Yuxuan Shui
b76a4234e5
Fix NULL dereference in glx_update_fbconfig
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-31 22:46:12 +00:00
Yuxuan Shui
543bbe6a39
Fix NULL pointer dereference in glx_init_blur
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-31 22:40:17 +00:00
Yuxuan Shui
a0739b7d86
Update CONTRIBUTORS
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-30 22:47:02 +00:00
Yuxuan Shui
205427d7da
Exit with exit code 1 when argument parsing failed
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-30 22:19:05 +00:00
Yuxuan Shui
83c32e1dd6
Tweak the wording in man page
...
Make it clearer how command line options and config file options are related.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-30 20:53:34 +00:00
Yuxuan Shui
c11c24b3f2
Improve config file search order
...
Previously the search order is:
~/.config/compton/compton.conf
/etc/xdg/compton/compton.conf
~/.config/compton.conf
/etc/xdg/compton.conf
...
Now the search order is:
~/.config/compton/compton.conf
~/.config/compton.conf
~/.compton.conf
/etc/xdg/compton/compton.conf
...
In other word, compton will now search all possible user config file
path first before searching for a system config file.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-30 00:27:14 +00:00
Yuxuan Shui
f7d4dff099
Use strncpy for string_utils functions
...
Also removed mstrjoin3 since it's not used.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-30 00:12:12 +00:00
Yuxuan Shui
9d64decf2a
compton -h should quit after printing help
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-29 23:36:34 +00:00
Yuxuan Shui
83eff258b7
Remove mentions of dbe from the man page
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-29 23:24:52 +00:00
Yuxuan Shui
1627a91c76
Use glDrawBuffer instead of glDrawBuffers in glx_blur_dst
...
glDrawBuffers doesn't take GL_BACK, which is what we are passing. And we
are using only one buffer argument anyway, no need to use glDrawBuffers.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-29 23:18:44 +00:00
Yuxuan Shui
4e14eec2ba
Remove a redundant glEnd in glx_dim_dst
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-29 22:27:05 +00:00
yshui and GitHub
4881de924a
Merge pull request #94 from MisterDA/misspellings
...
Fix small misspellings
2019-01-28 11:59:09 +00:00
Yuxuan Shui
198dcdb987
gl_common: fix coordinate mismatch
...
Xorg uses top left as origin, OpenGL uses lower left. So we need to flip
the y axis, and make sure we are using the right points as origin of
windows.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-28 01:14:41 +00:00
Yuxuan Shui
3b21365e94
gl_common: fix rendering
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-28 00:48:26 +00:00
Yuxuan Shui
6e454adff1
glx (new backend): Add some missing functions
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-28 00:04:01 +00:00
Yuxuan Shui
8c71f3fcbe
Move some macros around
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 23:57:43 +00:00
Yuxuan Shui
5364c8ac9b
Add backend_info_t::max_buffer_age
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 19:45:40 +00:00
Yuxuan Shui
d92a546beb
Fix includes and typos in new backends
2019-01-27 19:34:26 +00:00
Yuxuan Shui
22f0d10c65
Make backend_info_t::buffer_age optional
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 19:32:07 +00:00
Yuxuan Shui
b50f15c835
Adapt paint_all_new to new interface
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 19:29:02 +00:00
Yuxuan Shui
e898526afb
Add glx_backend to backend_list
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 19:28:15 +00:00
Yuxuan Shui
99b3c4575f
Fix handling of region == NULL in paint_all_new
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 18:21:42 +00:00
yshui and GitHub
5a1975909a
Merge pull request #93 from yshui/gl-reuse
...
Reuse some code from the new gl backend
2019-01-27 18:18:51 +00:00
Yuxuan Shui
061dd8e52e
Reuse some code from the new gl backend
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 18:16:28 +00:00
Yuxuan Shui
290ec7fb04
Don't pretend that we have glStringMarker
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-27 17:45:38 +00:00
Yuxuan Shui
6c6dd6ad7d
Remove unused session_t argument from gl_has_extension
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-26 23:08:32 +00:00
Yuxuan Shui
031356069a
new glx: Add glx_present
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-26 18:01:24 +00:00
yshui and GitHub
4bc2870ddf
Merge pull request #86 from yshui/damage-ring
...
Make buffer age not glx specific
2019-01-26 15:11:13 +00:00
Yuxuan Shui
e80ff8530e
Make buffer age not glx specific
...
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 >
2019-01-26 15:07:09 +00:00
Yuxuan Shui
5e49ab0861
Make sure draw_idle is stopped in all cases
...
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 >
2019-01-25 00:35:24 +00:00
yshui and GitHub
377b18a00f
Merge pull request #89 from yshui/fmodules
...
Even more includes
2019-01-20 22:14:00 +00:00
Yuxuan Shui
f649a949e2
Even more includes
...
Expand the modulemap to cover some of the system headers too.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-20 22:09:22 +00:00
yshui and GitHub
4bdbd48e55
Merge pull request #88 from yshui/fmodules
...
Improve the header includes, cont'd
2019-01-20 17:12:48 +00:00
Yuxuan Shui
916e23861a
Improve the header includes, cont'd
...
Also check in the modulemap file, and add a option to build with clang's
-fmodules.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-20 17:10:06 +00:00
Yuxuan Shui
1e0deea57f
Improve the include situation
...
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 >
2019-01-18 23:30:44 +00:00
Yuxuan Shui
c93789f5e9
Enable the glStringMarker logger when available
...
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 >
2019-01-09 21:58:16 +00:00
Yuxuan Shui
fed4634250
Check in .clang-format
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-08 22:14:09 +00:00
Yuxuan Shui
dd02ea31ae
Fix copying damage region with wrong size
...
Fortunately this hasn't caused problems...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-08 21:34:56 +00:00
Yuxuan Shui
72e3468694
Add backend_info_t::buffer_age
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-08 21:32:54 +00:00
Yuxuan Shui
3e475d00b3
Enable more build tests
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-02 20:43:01 +00:00
Yuxuan Shui
82e8b09d56
Move paint_all_new to backend.c
...
Fix build with -Dnew_backends=false. And more build test for this case.
Fixes #83
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-02 20:36:33 +00:00
Yuxuan Shui
34eb14fb0f
Tweak the default shadow-radius
...
We need to make the radius 1.5x bigger to achieve the same effect.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-02 11:14:27 +00:00
Yuxuan Shui
6d3ea3564b
Implement vsync for the new xrender backend
...
We use the Present extension for that, since it is the best option we
have.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-01 14:59:56 +00:00
Yuxuan Shui
6413ccbd71
Improve XSync extension detection
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-01 14:09:55 +00:00
Yuxuan Shui
428c24a6fa
Speed up shadow generation for small windows
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-01 11:35:59 +00:00
Yuxuan Shui
3686bf7a33
Use functions in backend/backend_common.c
...
Build backend_common.c even when new_backend=false.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-01 11:01:47 +00:00
Yuxuan Shui
4aeffa36b8
Refactor shadow generation
...
Trying to make the code easier to understand. The logic is unchanged.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2019-01-01 10:54:21 +00:00
Yuxuan Shui
edb1139507
Add some comments to backend.h
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 23:30:45 +00:00
Yuxuan Shui
86713c8170
Add make_shadow and paint_all_new to backend_common.c
...
Also made make_shadow private in render.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 14:30:58 +00:00
Yuxuan Shui
3b2e149369
Add missing include in x.h
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 14:30:53 +00:00
Yuxuan Shui
0b94bde004
Remove unused variable in backend/xrender.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 14:08:35 +00:00
Yuxuan Shui
6226ab1228
Fix memory leak in backend/xrender.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 08:22:57 +00:00
Yuxuan Shui
cb12430633
Use options_t::shadow_radius for shadow size calculation
...
No need to access gaussian_map
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 08:15:36 +00:00
Yuxuan Shui
4039a6db64
Remove all use of psglx from backend/glx.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 07:37:49 +00:00
Yuxuan Shui
a2022661e6
Move glx_init_blur to gl_common.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 07:18:38 +00:00
Yuxuan Shui
8629fee78f
Fix some static analyzer complains in glx.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 06:54:59 +00:00
Yuxuan Shui
f322bd4a53
Remove backend/gl/glx.h
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 01:53:25 +00:00
Yuxuan Shui
61f55f69a6
Add backend/gl/glx.c to build
...
Still a long way to go for the glx backend.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 01:32:31 +00:00
Yuxuan Shui
3e7b7bd608
Move glx_fbconfig_t to opengl.c
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-31 00:38:13 +00:00
Yuxuan Shui
e7a8adf2cc
Clear ps->sync_fence after error, part 2
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-30 22:13:30 +00:00
Yuxuan Shui
14f357ea2b
Clean up ps->sync_fence after error
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-30 08:05:16 +00:00
Yuxuan Shui
d12b3c1e1d
Add missing header files
...
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-30 08:00:22 +00:00
Yuxuan Shui
4bfed7f7e3
Use one global XSync fence
...
And only sync once per frame.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com >
2018-12-30 07:43:24 +00:00