Commit Graph

40 Commits

Author SHA1 Message Date
Yuxuan Shui 9ec298305a
Cache converted blur kernel
After converting from struct conv to xorg format, cache the result to
save CPU time.

And remove an unused function.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 16:45:53 +00:00
Yuxuan Shui 2e2e8e3ce0
Use struct conv for blur kernel as well
Instead of storing them as an array of xfixed.

Might cause some performance overhead for the new backend, because
it is allocating a buffer to do the conversion every frame. Will fix
later.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:39:43 +00:00
Yuxuan Shui 136ce7c9e8
Prevent GL/glx.h from defining prototypes
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-09 00:43:31 +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 b061789a84
Add helper function x_get_visual_depth
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 16:49:04 +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 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
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 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
Yuxuan Shui 80847dd3fa
Refactor the XSync fence code
Use a temporary fence everytime. Convert the Xlib XSync functions to use
xcb_sync_*.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-30 07:06:47 +00:00
Yuxuan Shui bc0382d962
Remove usage of Xlib from x.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-30 06:05:39 +00:00
Yuxuan Shui 51d03132bf
A bit more xcb conversion
None -> XCB_NONE
Window -> xcb_window_t
Atom -> xcb_atom_t

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-27 20:45:38 +00:00
Yuxuan Shui b434451abb
Lower x_print_error to log_debug
This information is only really useful for debugging anyway.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-22 14:29:26 +00:00
Yuxuan Shui 6c00d46d7a
Some new x helper functions
They should be useful for the refactored backends.

Renamed x_create_picture to x_create_picture_with_pictfmt.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-21 23:47:31 +00:00
Yuxuan Shui b5b0f4af7f
Convert printf_errf/dbgf in several files
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 16:54:51 +00:00
Yuxuan Shui 833eb966f1
Convert print_errf/dbgf in win.c and compton.c
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>
2018-12-20 03:56:31 +00:00
Yuxuan Shui baeb4572ff
Move rendering related functions out of compton.c
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>
2018-12-16 00:50:46 +00:00
Yuxuan Shui b8912fa749
Use checked allocation everywhere
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 18:57:46 +00:00
Yuxuan Shui acb81bc9a9
Add log.h to files that need it
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 17:53:17 +00:00
Yuxuan Shui 345bacf3b3
Convert wid_get_prop to xcb
This should give us sane item size, i.e. the item has the same number of
bits their format says they have.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-09 20:54:16 +00:00
Yuxuan Shui b18d46bcbd Revert "Remove xrender-sync and xrender-sync-fence"
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>
2018-11-08 18:07:18 +00:00
Yuxuan Shui 4f4201976d Fix signedness of x properties
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-01 11:12:46 +00:00
Yuxuan Shui 50e2259404 Remove xrender-sync and xrender-sync-fence
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>
2018-10-28 23:36:55 +00:00
Yuxuan Shui 16f202f4a0 Fix build when opengl is disabled 2018-10-25 23:31:57 +01:00
Uli Schlachter 37ef9c5b8a Add the xcb_connection_t to session_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:54:00 +01:00
Yuxuan Shui ee318582f5 Sort out license problems
IANAL, but I think I am allowed to add missing copyright notices for
someone else. And I did my best job using git history to figure out who
wrote which functions. So I hope everything is fine.
2018-10-03 22:14:51 +01:00
Uli Schlachter bc7767e086 Replace Xlib atom constants with XCB ones
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:53:28 +02:00
Uli Schlachter 91468c3622 Replace BadRegion with XCB_XFIXES_BAD_REGION
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:51:30 +02:00
Uli Schlachter 7c174cc3b1 Replace XserverRegion with xcb_xfixes_region_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:50:27 +02:00
Yuxuan Shui 03f33ed45c Move a couple X related functions to x.c
Also replace remaining Pixmap with xcb_pixmap_t

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 20:57:42 +01:00
Yuxuan Shui ff27ca4072 Move xerror_common to x.c
Also rename it to x_print_error

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 15:54:12 +01:00
Yuxuan Shui 56f7dd36f6 x: Add region related helper functions
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00
Yuxuan Shui 90b6aa16ad Remove ARGB as a window mode
Instead use win_has_alpha to check for alpha channel, window mode is
reserved for determine if the window is possibly transparent.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 13:49:45 +01:00
Uli Schlachter 8848676540 Add a function that allocates a pixmap and checks success
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-30 09:31:22 +02:00
Uli Schlachter 529306e65f Convert usage of XCreatePixmap to xcb
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 12:00:18 +02:00
Yuxuan Shui 209b751b25 Port more stuff to xcb
To avoid interoperability issues between xcb and xlib.
2018-09-23 22:58:49 +01:00
Yuxuan Shui 2e39fc5618 Split out win related functions to win.c
Also move static function prototypes out of compton.h. Seems like the
previous developers didn't know what header files are for.

Seems to have bugs after the split.
2018-09-10 13:46:24 +01:00