Commit graph

128 commits

Author SHA1 Message Date
Vlad Zahorodnii
52beb213e7 kwineffects: Make GLRenderTarget and GLVertexBuffer work without global coords and scale
Because the GLRenderTarget and the GLVertexBuffer use the global
coordinate system, they are not ergonomic in render layers.

Assigning the device pixel ratio to GLRenderTarget and GLVertexBuffer is
an interesting api design choice too. Scaling is a window system
abstraction, which is absent in OpenGL or Vulkan. For example, it's not
possible to create an OpenGL texture with a scale factor of 2. It only
works with device pixels.

This change makes the GLRenderTarget and the GLVertexBuffer more
ergonomic for usages other than rendering the workspace by removing all
the global coordinate system and scaling stuff. That's the
responsibility of the users of those two classes.
2022-02-15 12:17:56 +02:00
Vlad Zahorodnii
eea94660dc utils: Extract DamageJournal in its own file 2022-02-15 11:38:51 +02:00
Xaver Hugl
dece547a75 backends/drm: refactor surface handling
In order to support layered rendering and tiled outputs KWin needs to be
able to split rendering of outputs into multiple surfaces. This commit
prepares the drm backend for that, by moving most of the code in EglGbmBackend
out to a EglGbmSurface class, which will later be used for overlay surfaces
and rendering to multiple connectors side by side.

In doing that, this commit also cleans up the code a bit, removes a lot of
now unnecessary multi-gpu stuff and potentially makes modesets a little
bit more efficient by re-using resources more often.
2022-02-15 09:12:23 +00:00
Xaver Hugl
9dc4c7309e backends/drm: move damage tracking into DumbSwapchain 2022-02-15 09:12:23 +00:00
Xaver Hugl
5d317641a4 backends/drm: move damage tracking into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
cfdb303012 backends/drm: inline renderFramebufferToSurface
And also remove an unnecessary makeContextCurrent
2022-02-15 09:12:23 +00:00
Xaver Hugl
c498d31aa7 backends/drm: move makeContextCurrent into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
4d0998cfed backends/drm: fix legacy dpms 2022-02-15 08:17:17 +00:00
Vlad Zahorodnii
3da9e017a0 cmake: Use target-based ecm_qt_declare_logging_category()
This makes CMakeLists.txt code depend less on variables.
2022-02-14 07:29:15 +00:00
Tobias C. Berner
feffa184fb Add missing errno.h include 2022-02-10 10:14:02 +01:00
Vlad Zahorodnii
0ad239a92d Fix mouse pointer disappearing after using zoom effect on X11
Currently, the Cursors::currentCursorChanged signal is wired to the
updateCursor() function which calls xcb_xfixes_hide_cursor() or
xcb_xfixes_show_cursor() depending if the cursor is hidden. However, the
currentCursorChanged signal can be emitted if the cursor changed, e.g. a
new pixmap attached, or its visibility status changes.

The zoom effect hides the pointer, but when user hovers ui elements, it
will most likely change and result in more than one xcb_xfixes_hide_cursor()
calls.

It appears like xcb_xfixes_hide_cursor() is implemented as a reference
counter, i.e. if xcb_xfixes_hide_cursor() is called two times, then you
must call xcb_xfixes_show_cursor() two times as well.

This change adds a dedicated signal to indicate whether the cursor is
hidden to avoid calling xcb_xfixes_hide_cursor() multiple times while
the screen is scaled.

BUG: 448537
2022-02-10 07:07:03 +00:00
Xaver Hugl
d0c12ac54d backends/drm: ignore modifier env var if modifiers are not supported
Otherwise we might crash
2022-02-08 20:09:08 +01:00
Xaver Hugl
569a994644 backends/drm: don't log addFB failure for direct scanout
It can spam the log and isn't really useful

BUG: 449556
FIXED-IN: 5.24
2022-02-06 00:10:14 +00:00
Xaver Hugl
e8eb55ad2e backends/drm: port away from mode indices
They're error prone and don't really work for changing modes. Having
a current mode in DrmConnector also doesn't work well together with
the transactional style of how DrmPipeline operates
2022-02-05 14:16:18 +00:00
Xaver Hugl
e6fb6ff5d3 backends/x11/standalone: only use sRGB configurations with depth 24
Credit goes to Mario Kleiner, who bisected this issue.

BUG: 423014
2022-01-31 16:23:16 +00:00
Vlad Zahorodnii
aebe1ab3a4 backends/drm: Detect more connector types 2022-01-28 14:41:16 +00:00
Xaver Hugl
bbc5952f19 backends/drm: don't assume we shouldn't use modifiers without IN_FORMATS
Instead, use a linear modifier
2022-01-27 20:46:30 +00:00
Xaver Hugl
216d0d6c45 backends/drm: only accept xrgb with legacy
xrgb is effectively universally supported, other formats may not be.
In order to make sure things work everywhere, assume only xrgb is supported.
2022-01-27 20:46:30 +00:00
Xaver Hugl
83275c3f31 backends/drm: add warning if no matching mode can be found 2022-01-27 18:40:00 +00:00
Xaver Hugl
74b1fb0ab5 backends/drm: round refresh rate values from KScreen configs
The implicit cast effectively rounds the value down, which make the
refresh rate be different from what KScreen actually wrote.
A better fix would be to use integers instead of floating point numbers
but that needs to happen in KScreen.

BUG: 448778
2022-01-27 18:40:00 +00:00
Xaver Hugl
b0173c236c backends/drm: don't read configuration of zero outputs
Doesn't make any sense and can cause crashes
2022-01-27 18:40:00 +00:00
Xaver Hugl
d67a0b006a backends/drm: guard against wrong KScreen configs 2022-01-27 18:40:00 +00:00
Vlad Zahorodnii
e2a393ce2d Move utils.h file to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
0e1d65d5a2 Move opengl context attribute builders to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
293b2244ac Move xcbutils to utils directory 2022-01-25 16:56:33 +00:00
Xaver Hugl
db1f7414b7 backends/drm: add additional check for direct scanout buffers
While in principle Mesa should already check if the buffer can be scanned
out, this may not always work. If we can't create a framebuffer object for
the buffer, fall back to compositing.

CCBUG: 448818
2022-01-24 21:23:05 +01:00
Xaver Hugl
c952c3a3ae backends/drm: add environment variable KWIN_DRM_NO_DIRECT_SCANOUT
Can be useful for debugging
2022-01-24 21:23:03 +01:00
Xaver Hugl
b5d2b0fb3b backends/drm: do current crtc check without detachments 2022-01-24 09:13:08 +00:00
Xaver Hugl
ca6fcbb2a1 backends/drm: make finding connector<->crtc combinations more efficient
Encoders are not really relevant for the test result, except that one of
the encoders for the connector must be compatible with the crtc.
The kernel usually exposes only a single encoder per connector for this
reason, but if a driver exposes multiple then that means KWin will do a
lot more tests than is necessary.
In order to prevent that from happening, do fewer syscalls and simplify
code, only check supported encoders once per connector.
2022-01-24 09:13:08 +00:00
Vlad Zahorodnii
59b21a0130 Fix -Wreorder-ctor 2022-01-21 11:33:42 +00:00
Weng Xuetian
e64f60ce08
Fix force xrgb 8888
19c471405e7eb4b6026db24d776d205125dbc013 introduced a regression if
there are two gbm backend and the backend fail to choose drm format.

This fix does two things:
1. Current buffer format should not be reset after create new buffer,
   otherwise current.format may just be empty after resetOutput.
2. force xrgb 8888 need to be set on the primary backend.

BUG: 448790
2022-01-19 15:46:38 -08:00
Xaver Hugl
50c167c94b backends/drm: fix reallocation check
When no modifiers are used at all, we shouldn't check them.

BUG: 448557
2022-01-19 10:31:33 +00:00
Xaver Hugl
e0a8fa778e backends/drm: fix output changes with the placeholder output
As the placeholder output gets added or removed in response to other outputs
getting enabled or disabled, the output list may change while iterating over
them and applying changes.

BUG: 448454
BUG: 448474
CCBUG: 448697
FIXED-IN: 5.24
2022-01-18 21:36:23 +00:00
Xaver Hugl
85cd40c49a backends/drm: remove unused variable 2022-01-17 08:56:41 +00:00
Xaver Hugl
090b687126 backends/drm: prevent some detachments 2022-01-17 08:56:41 +00:00
Xaver Hugl
b2d401cddb backends/drm: re-add KWIN_FORCE_SW_CURSOR
It was accidentally dropped
2022-01-16 18:19:04 +01:00
Xaver Hugl
de7b429528 backends/drm: remove the now unnecessary check for supported formats
As formats are per output and also checked on crtc changes, there
is no reason to restrict used formats to those that are supported
by all primary planes anymore.
2022-01-14 20:09:03 +01:00
Xaver Hugl
fe9a3f45c0 backends/drm: ensure correct format+modifiers pairs for surfaces
When the crtcs get switched around between outputs, their primary
planes and thus the supported formats also get switched around. In
order to make sure that doesn't cause any problems, always check
whether or not the format+modifiers used are supported.
2022-01-14 20:06:05 +01:00
Xaver Hugl
0ecfbb0d1c backends/drm: if multi-gpu copy fails, disable deep color
The format XRGB8888 is effectively universally supported. If everything
else fails, try to fall back to that
2022-01-14 15:44:53 +00:00
Xaver Hugl
0a3922e29d backends/drm: use the correct format for CPU copy
BUG: 448376
2022-01-14 15:44:53 +00:00
Xaver Hugl
802d855785 backends/drm: support link-status
Userspace is expected to do a modeset and set link-status to good again,
if link-status gets bad. This is needed to prevent some black screen situations.

BUG: 448177
2022-01-14 10:31:32 +00:00
Xaver Hugl
2564886f7f backends/drm: fix legacy crash
CCBUG: 447680
2022-01-12 21:23:37 +00:00
Arjen Hiemstra
352e92e32f Support global defaults for input devices
This adds support for reading values from a "Libinput/Defaults" group in
the input config file. This allows specifying global defaults for
devices, that are preferred over the libinput defaults. Because of the
cascading mechanisms of KConfig, this then allows distributions and
hardware vendors to supply system-wide defaults for devices.
2022-01-11 12:24:01 +00:00
Arjen Hiemstra
0319a66ead Refactor libinput::Device::ConfigData
Rather than an awkward combination of template functions, function
pointers and multiple calls to almost-the-same-but-not-entirely
functions, make ConfigData itself a template and use type erasure to
store them in the config map. This makes the data object aware of its
type and allows us to specialise the reading of config values through
template specialisation. It also removes the need for multiple
constructors and setters in the ConfigData object.
2022-01-11 12:24:01 +00:00
Xaver Hugl
d18e631d47 backends/drm: hide cursor again
Before 6a99bfd2, the DrmBackend took care of checking this. Now it
needs to be explicitly checked in DrmOutput
2022-01-05 16:39:56 +01:00
Xaver Hugl
81905dbfaa backends/drm: properly handle pending transformations
AbstractWaylandOutput::pixelSize returns the size with already set transformation
applied but the render backends need the pending transformation
2022-01-04 22:22:57 +00:00
Xaver Hugl
b06ec13ead backends/drm: test crtc+connector combinations with hardware rotation
This should enable KWin to use hardware rotation in more situations. As
a fallback all hardware rotation is disabled and the test is done again
2022-01-04 22:22:57 +00:00
Xaver Hugl
dc5cddd33f backends/drm: ensure hardware transforms are properly applied and tested
Testing only the pipeline that this output uses is not enough and can
cause breakage on multi-monitor setups.
2022-01-04 22:22:57 +00:00
Xaver Hugl
2af3f46357 backends/drm: adjust logging verbosity 2022-01-04 22:22:57 +00:00
Vlad Zahorodnii
5f83f2a781 Replace abort() with Q_ASSERT and Q_UNREACHABLE
This change replaces abort() with Q_ASSERT and Q_UNREACHABLE() macros to
make kwin code base consistent. Besides that, Q_UNREACHABLE may
potentially provide the compiler more info that can be used to generate
more efficient machine code.
2022-01-04 10:28:42 +02:00