Commit Graph

52 Commits

Author SHA1 Message Date
Maxim Solovyov
a667886959 xrender: make corner-radius respect inactive-dim
for the new xrender backend it's enough to clip with a rounded rectangle after dimming, not before

partially fixes #867
2023-01-23 07:34:35 +03:00
Maxim Solovyov
6c08650f3c xrender: fix leak in release_rounded_corner_cache
calling wrong free function did nothing and produced ton of x errors

fixes at least #892
2023-01-23 07:34:35 +03:00
Maxim Solovyov
7f533c0b23 xrender: fix leak in deinit
and check should we actually free something

fixes at least #960
2023-01-23 07:34:35 +03:00
Maxim Solovyov
efa3d9c227 xrender: fix leak in bind_pixmap 2023-01-23 07:34:35 +03:00
Yuxuan Shui
0278a1fb0b backend: xrender: fix using of invalid picture when vsync is disabled
Fixes #974

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-23 07:34:35 +03:00
Yuxuan Shui
227cb55ca5 backend: xrender: set update region for PresentPixmap request
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-23 07:34:35 +03:00
Yuxuan Shui
2173654fbd options: add dithered-present option
See also 0a2cd0f14e

Related: #602

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-23 07:34:35 +03:00
Yuxuan Shui
84407099a9 backend: give backends more flexibility regarding shadow creation
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-26 05:42:51 +01:00
Yuxuan Shui
137a47261c backend: xrender: handle blur mask
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-25 03:47:22 +01:00
Yuxuan Shui
9e8373e3e0 backend: add mask parameter to blur
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-25 02:59:01 +01:00
Yuxuan Shui
4bf7669ec3 backend: xrender: handle masks
There are some complications, when sampling pixels outside a
xrender picture, xrender doesn't support a behaviour similar to OpenGL's
clamp to border. So we give the masks an extra 1-pixel outer rim, so
we can control what color the outside pixels would be, by using the
"Pad" repeat mode.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-25 02:50:57 +01:00
Yuxuan Shui
9b419504e8 backend: add the make_mask interface
This is used to create image masks that can be used to mask out
`compose` regions. For example, this can be used to mask out window body
so shadow won't be painted on them.

This could be more efficient than using rectangular regions for masking,
when there are a large number of rectangles; or more flexible, in the
case of window with rounded corners.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-24 08:39:21 +01:00
Yuxuan Shui
e50be3173f backend: remove the read_pixel interface.
Sample the border color in the shader instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-01-24 17:34:38 +00:00
Yuxuan Shui
1c7a4ff5a3 backend: xrender: fix clone_image
We were using default_clone_image, but:

1) it's copying the wrong type, xrender_image has an extra member.
2) it doesn't clone the rounded corner cache properly, that has to be
   separately reference counted.

Reported-in: #728
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-11-20 01:27:24 +00:00
Yuxuan Shui
ffb8bc5b29 backend: xrender: fix accidentally deleted refcount decrement
Thanks, @tryone144

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-11-08 00:23:36 +00:00
Yuxuan Shui
1dea294051 backend: xrender: cache rounded rectangle mask
xcb_render_triangle is slow because (at least for Glamor) it's
rasterizing the triangles on CPU.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-10-25 13:48:45 +01:00
Yuxuan Shui
76db8cca06 backend: xrender: handle corner radius
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-10-25 13:46:45 +01:00
Bernd Busse
0c7e237a75 backend: xrender: Force 32-bit ARGB visual for alpha target pixmaps
Force a 32-bit ARGB visual when cloning pixmaps for
`IMAGE_OP_APPLY_ALPHA`.
Fixes non-transparent frames for 24-bit windows (without alpha-channel)
even when using `frame-opacity != 1`.

fixes: #342
2021-06-24 21:49:38 +02:00
Yuxuan Shui
710e5fd7a0 backend: remove image operation BAKE
It's not used.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-20 06:59:55 +01:00
Yuxuan Shui
2a60836a9b backend: split image_op into image_op and set_image_property
Currently there is some inconsistency in how image_op is implemented
across backends. The glx backend applies some of the image operations
lazily, and not always in the order the operations were made; while the
xrender backend applies the operations eagerly. This can lead to
different render result in some cases.

Instead of trying to preserving the order of operations, which would be
unnecessary, we re-model the API to better reflect the implementation.
We make it clear that setting the property doesn't change the image
data, and properties are only applied during composition and in a
specific order.

This makes sure the render result looks consistent across backends.
Should also improve the performance of the xrender backend, even if only
slightly.

Also distill out the property management code so they can be shared.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-20 06:49:38 +01:00
Yuxuan Shui
21dfe20794 backend: rename copy -> clone_image
This feels more appropriate as this operation doesn't necessarily copy
data.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-14 01:58:30 +01:00
Yuxuan Shui
d9c9742132 backend: xrender: implement read_pixel
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-09 01:51:33 +01:00
Yuxuan Shui
1ada765436 backend: xrender: make backend functions static
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-09 01:36:09 +01:00
Yuxuan Shui
d974367a04 backend: xrender: remove root_pict from _xrender_data
It's unused in the backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-26 07:53:03 +00:00
Yuxuan Shui
f5fb2648fd x: remove more of session_t parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-26 07:51:03 +00:00
Yuxuan Shui
c5145479b0 Fix several memory leaks
* src/event.c: expose_root: region is not freed
* backend/xrender/xrender.c:
    * bind_pixmap: the reply `r` is not freed
    * blur: reg_op_resized is not freed

Spotted-by: Samuel Hand <samuel.d.hand@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-09-05 16:45:21 +01:00
Bernd Busse
33c5a5a36b Add support for new blur method dual_kawase [WIP]
**Work-in-Progress**

Add `dual_kawase` to configuration and argument parsing. Allow `kawase`
for backward compatibility. Add `--blur-strength` parameter for
blur-method `dual_kawase`.

Update documentation to reflect the new blur-method and parameters.
2020-08-31 14:06:17 +02:00
Yuxuan Shui
8c1b0657ff Refresh the TODO comments
Removed the outdated ones, clarified some of them, and assigned them to
me.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-08-30 15:25:58 +01:00
Bernd Busse
7cf13906ae backend: xrender: use correct REPEAT mode when creating blur textures
Create pictures used for bluring with REPEAT attribute set to PAD (same logic
as GL_CLAMP_TO_EDGE in OpenGL). Fixes darkening at the screen edges with
larger blur radii caused by sampling out of texture bounds.

Related: 4b0ff37b36
2020-06-08 20:40:02 +02:00
Yuxuan Shui
8b37fcb1d8 backend: xrender: fix array size off-by-one
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 21:07:02 +00:00
Rytis Karpuska
ec76c5f286 parameterize max brightness limit 2019-11-09 17:56:38 +02:00
Yuxuan Shui
8ddbebb5d1 rename: replace "compton" in the codebase
leftovers:

1) config file path. Has to implement compatibility functionalities before
  we can change it.

2) links in man pages. Has to migrate the repo first.

3) _COMPTON_SHADOW, it has become a defacto standard, so we have to keep
   supporting it.

4) dbus names, undecided whether we should/could change it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-23 20:24:20 +01:00
Yuxuan Shui
0ba7761bd5 Untangle headers
Thanks, clang -fmodules.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-10 00:56:26 +01:00
Yuxuan Shui
3434ea25f4 new xrender: fix nothing gets rendered without vsync
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 20:25:17 +01:00
Yuxuan Shui
357968c815 options: remove a spurious warning
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:44:42 +01:00
Yuxuan Shui
d37a4136ee new xrender: implement partial updates
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:31:45 +01:00
Yuxuan Shui
f86d6b7cbd backend: update present interface for partial updates
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:05:00 +01:00
Yuxuan Shui
bb756b2238 Fix compiler warning about unused parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:27:02 +01:00
Yuxuan Shui
4c9ded837f new backend: add interface for query blur size
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-24 23:27:51 +01:00
Yuxuan Shui
4c460a7bd5 new xrender: fix black border around blurred area
Similar fix to 6d646b54.

Also ping #50

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 19:49:23 +01:00
Yuxuan Shui
182a207afd new xrender: fix offset when using multi-pass blur
Also makes the code a bit more readable by replacing stateful variables.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 18:55:20 +01:00
Yuxuan Shui
0b0d896ffe Add debug mode
When enabled, the result will be redirected to a window, and compton
won't take over the screen.

Makes debugging easier.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 16:20:00 +01:00
Yuxuan Shui
67f0ec773a new backends: blur interface update
To prepare for different blur methods, the blur interface of backends
has been splitted into two parts.

Now to use blur, a blur context must be created first; then, the blur
method should be called with the blur context created.

Updated the existing backends to the new interface. Also implemented
handling of the new blur options.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 19:26:41 +01:00
Yuxuan Shui
1da726047a new backend: don't assume center of blur kernel is 1
Also fill the center of parsed kernel with 1. This shouldn't change the
behavior of the old backends since they will modify the center of the
kernels.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 01:03:37 +01:00
Yuxuan Shui
fa8faaf91d Remember the number of blur kernels
Don't count the number of blur kernels everytime.

Fixes #188

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-07 22:21:06 +01:00
Yuxuan Shui
abb089e605 Lift the MAX_BLUR_PASS limit
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-07 07:04:50 +01:00
Yuxuan Shui
b9a3b67f9c new backend: xrender: fix INVER_COLOR_ALL
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 22:15:38 +01:00
Yuxuan Shui
294aae11ff Fix xrender APPLY_ALPHA
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:22:20 +01:00
Yuxuan Shui
80c7b2f7ec new backend: glx: implement IMAGE_OP_APPLY_ALPHA
Slight change to the backend_operations::fill interface.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:35 +01:00
Yuxuan Shui
be673f93c6 backend: add interfaces for readiness reporting
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:33 +01:00