Commit Graph

1897 Commits

Author SHA1 Message Date
Monsterovich
73a366ffe0 Added xcb-util to README 2023-06-17 01:27:20 +02:00
Monsterovich
043703e58f Merge remote-tracking branch 'upstream/next' into fix-event-handling 2023-06-17 01:25:12 +02:00
Nikolay Borodin
c065ad1b8d Refactored meson.build 2023-06-17 01:15:38 +02:00
Nikolay Borodin
56745b64d7 core: event code refactoring 2023-06-17 01:08:47 +02:00
Nikolay Borodin
07303ce2cb core: added proper event handling for XESetWireToEvent 2023-06-16 23:54:37 +02:00
Yuxuan Shui
01bb26012c Merge pull request #1000 from absolutelynothelix/set-texture-on-repeat 2023-06-16 19:02:27 +01:00
Yuxuan Shui
e2ecef92ba Merge pull request #1007 from absolutelynothelix/egl-allow-max-brightness 2023-06-16 18:48:11 +01:00
Maxim Solovyov
ecbc8b50ed backend: xrender: set created picture to repeat when binding a pixmap 2023-06-16 19:42:36 +03:00
Maxim Solovyov
9f9cff3b06 options: unify unavailability reporting of some options
unify unavailability reporting of the max-brightness, window-shader-fg
and window-shader-fg-rule options
2023-06-16 18:36:02 +03:00
Maxim Solovyov
4d724047ef options: handle max-brightness option better
allow it's use with the egl backend and report it's unavailability
better
2023-06-16 18:35:53 +03:00
Yuxuan Shui
5e22434387 Merge pull request #1073 from EpsilonKu/patch-1 2023-06-15 14:08:56 +01:00
Kurenshe Nurdaulet
0deaa9a241 Update discord link 2023-06-15 13:23:49 +06:00
Yuxuan Shui
ac55ce7b56 Merge pull request #1004 from absolutelynothelix/egl-allow-windows-shaders 2023-06-14 00:34:18 +01:00
Yuxuan Shui
9956844647 backend: log more timing info
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-14 00:26:30 +01:00
Yuxuan Shui
037fd4c07b Merge pull request #1022 from absolutelynothelix/xrescheck-xcb-composite-named-windows-pixmaps-test 2023-06-13 17:25:55 +01:00
Yuxuan Shui
6b80280af0 Merge pull request #1009 from absolutelynothelix/fix-gl-deinit-leak 2023-06-13 15:07:27 +01:00
Maxim Solovyov
223872bc7f backend: dummy: do not leak owned pixmaps
free pixmaps which ownership was transferred to the backend
2023-06-12 23:41:25 +03:00
Maxim Solovyov
1e398b9c24 backend: dummy: fix a typo in the dummy_get_blur_size function
"reisze_region" => "resize_region"
2023-06-12 23:11:20 +03:00
Maxim Solovyov
8245de27ed backend: gl: do not leak back and default mask textures
they're generated during backend initialization and now deleted during
deinitialization
2023-06-12 21:24:57 +03:00
Maxim Solovyov
5826adf853 backend: gl: remove gl_delete_texture function
it wasn't used and it's hard to call it a shortcut
2023-06-12 21:17:28 +03:00
Yuxuan Shui
5b6f6ecbf5 backend: egl: print egl error when eglCreateImage failed
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-12 12:03:37 +01:00
Yuxuan Shui
6af0251f2a readme: add some badges and a link to our discord
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-12 12:00:39 +01:00
Yuxuan Shui
608423a5ce Merge pull request #968 from yshui/pacing 2023-06-12 11:46:17 +01:00
Yuxuan Shui
d0c121ec83 core: print some timing info from draw_callback_impl
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-10 23:23:24 +01:00
Yuxuan Shui
6a69cdb002 options: add a no-frame-pacing option
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-10 14:33:57 +01:00
Yuxuan Shui
7d9692360b core: use SCHED_RR scheduling
Make picom realtime to reduce latency, and make rendering times more
predictable to help pacing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-10 14:33:45 +01:00
Yuxuan Shui
b6e7ea5639 core: don't update render statistics if we didn't actually render
Sometimes a scheduled render can end up doing nothing, e.g. if the
damage region is empty. In that case we don't have valid data to
collect and thus shouldn't update the statistics.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-10 14:33:36 +01:00
Yuxuan Shui
8e1f3c92f5 core: factor out code for estimating the rendering time budget
Add a render_statistics type to encapsulate all the statistics done on
rendering times. And use that to estimate the time budget for rendering
and frame pacing.

Tweak the rolling window utilities a bit so we can reuse one rolling
window for multiple statistics.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-10 14:33:24 +01:00
Yuxuan Shui
336cb0917a core: check we have both frame time and render time before pacing
We only checked render time. If we don't have frame time estimates, we
would divide by zero and end up with wild scheduling delays.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:33 +01:00
Yuxuan Shui
fcb9dc8cfd core: make sure unredirection happens when screen is off
So when the screen is off, we calls queue_redraw, hoping draw_callback
will be called and unredirects the screen. However, queue_redraw doesn't
queue another redraw when one is already queued. Redraws can be queued
in two ways: one is timer based, which is fine, because it will be
triggered no matter what; the other is frame based, which is triggered
by Present events.

When the screen is off, X server, depends on the driver, could send
abnormal Present events, which we ignore. But that also means queued
frame based redraw will stop being triggered.

Those two factors combined means sometimes unredirection does not happen
when the screen is off. Which means we aren't going to free the GL
context, which are still receiving Present events, but can't handle
them, because we are not rendering anything with GL. In the end all
these causes memory usage to balloon, until the screen is turned on and
we start rendering again.

And all these is not caught by leak checkers because this technically is
not a leak, as everything is eventually freed.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:31 +01:00
Yuxuan Shui
edeb17ad46 core: don't fully trust msc from present complete notify
Sometimes X sends bogus complete notifies with invalid msc number.
Instead use a saved msc number to get the next complete notify.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:30 +01:00
Yuxuan Shui
1899ef0d49 core: only check present timer alignment in the first frame
Timer can sometimes drift randomly, like when the system is suspended.
we don't want to disable frame pacing for that

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:29 +01:00
Yuxuan Shui
480fd24da6 core: stop sending NotifyMsc if frame pacing is disabled
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:28 +01:00
Yuxuan Shui
a4fae2b60a core: better frame pacing function
Details explained in the comments on schedule_render().

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:26 +01:00
Yuxuan Shui
47ffaf0a38 core: workaround X present event quirk
When the screen turns off, X sometimes sends present complete notify for
the same frame multiple times, or even events with invalid msc/ust
number.

This will cause us to ignore it and not send a subsequent NotifyMsc
request, causing the complete notify to stop.

Now we send NotifyMsc regardless to keep the events going.

Also detect when the complete notifies skip frames, divide the interval
by frame count to estimate frame time in that case.

Upstream bug report:
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1418

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:25 +01:00
Yuxuan Shui
86d3739374 core: frame pacing
Use frame timing and render time statistic to pace frames.

Right now the criteria are simple:

* Don't render multiple frames in one vblank cycle. Otherwise the
  rendered frame will be delay multiple cycles, which isn't ideal.
* Start rendering as late as possible while still hitting vblank.

Refresh rate is estimated from a rolling average of frame timing. Render
time is predicted from the rolling maximum of past 128 frames. The
window size still needs to be investigated.

Remove glFinish calls and GL_MaxFramesAllowed=1, frame pacing superseeds
them.

Professionals might laugh at how rudimentary this is, but hopefully this
is better than what we had before. Which is absolutely nothing at all.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:24 +01:00
Yuxuan Shui
2a4e32babf backend: add last_render_time interface.
Used for querying how long render takes to complete, used for frame
pacing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:23 +01:00
Yuxuan Shui
64a97b57b5 core: collect frame timing information.
Needed to estimate refresh rate, and for us to stay in phase with
vblank.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:21 +01:00
Yuxuan Shui
62fcfe5d1a backend: remove unused parameter 'ignore_damage'
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-06-08 20:35:16 +01:00
Yuxuan Shui
3aed5599c3 glx: calculate residual in both directions
We only considered residual in the positive direction, i.e. we would set
dithering to zero if the color is (whole number + 0.0001). But we should
also set dithering to zero if color is (whole number - 0.0001).

Fixes #1064
2023-05-08 15:01:50 +01:00
Yuxuan Shui
05ef18d78f Merge pull request #1044 from yshui/alanpq 2023-04-01 11:32:30 +01:00
Yuxuan Shui
379f67f5c2 tests: add corner-radius-rules to the parsing test
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-04-01 11:27:05 +01:00
oofsauce
6d459badbc Add corner-radius-rules configuration option
This option accepts a list of patterns and overrides the corner radii of
matching windows

Authored-by: oofsauce <alanpanayotov@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-04-01 11:26:10 +01:00
Yuxuan Shui
838f1f097c Merge pull request #1023 from absolutelynothelix/xrescheck-xcb-render-pictures-test 2023-03-30 09:06:37 +01:00
Maxim Solovyov
ce7758a07b backend: fix leak in default_backend_render_shadow 2023-02-13 03:36:00 +03:00
Yuxuan Shui
cee1287562 github: update git-clang-format-lint action
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-29 16:23:26 +00:00
Yuxuan Shui
317275abf6 Merge pull request #995 from absolutelynothelix/begone-xinerama 2023-01-29 15:36:04 +00:00
Maxim Solovyov
986b3c1cb3 core: drop xinerama
there are two x extensions for working with monitors (especially
multiple): xinerama and randr. xinerama is old, feature-poor and in
general isn't used anymore compared to the randr: new, feature-rich and
widely-used. for some reason we were using both of them, so let's drop
xinerama to keep things simple, clean and small. and to be modern.

the drop was done in three steps:
* first step was to replace all the xinerama-based code with the
  randr-based one and to replace or remove all the xinerama mentions;
* second step was to replace the xinerama's terminology with the
  randr's one. xinerama was referring only to the word "screen", while
  randr refers to multiple words and i think the word "monitor" is the
  most suitable for us and, hopefully, clear both to a contributor and
  to an end user;
* third step was to refactor the new randr-based code if needed and to
  address related todo's (mostly about moving related functions
  elsewhere).

all the steps were done well except addressing a leftover todo about
moving the win_update_monitor function to the x.c which wasn't done.

the xinerama-shadow-crop option was renamed to crop-shadow-to-monitor,
but it's previous name is still accepted, has effect and the
deprecation message is printed to preserve backwards-compatibility.
2023-01-29 10:51:12 +03:00
Yuxuan Shui
102a0bc5e0 backend: mask can be null in blur()
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-29 06:35:28 +00:00
Maxim Solovyov
11840cb658 options: allow use of windows shaders for the egl backend
and notify a user better if the shader interface is not available
2023-01-21 18:16:52 +03:00