Commit graph

550 commits

Author SHA1 Message Date
Xaver Hugl
2da1b3211e Fix login modeset 2020-12-15 20:20:10 +00:00
Vlad Zahorodnii
ecac025a2a Port wayland code away from factory methods in KWaylandServer::Display 2020-12-14 13:05:47 +00:00
Vlad Zahorodnii
6b2e6cfd53 Prevent EGL headers from including Xlib headers
One of the annoying things about EGL headers is that they include
platform headers by default, e.g. on X11, it's Xlib.h, etc.

The problem with Xlib.h is that it uses the define compiler directive to
declare constants and those constants have very generic names, e.g.
'None', which typically conflict with enums, etc.

In order to work around bad things coming from Xlib.h, we include
fixx11.h file that contains some workarounds to redefine some Xlib's
types.

There's a flag or rather two flags (EGL_NO_PLATFORM_SPECIFIC_TYPES and
EGL_NO_X11) that are cross-vendor and they can be used to prevent EGL
headers from including platform specific headers, such as Xlib.h [1]

The benefit of setting those two flags is that you can simply include
EGL/egl.h or epoxy/egl.h and the world won't explode due to Xlib.h

MESA_EGL_NO_X11_HEADERS is set to support older versions of Mesa.

[1] https://github.com/KhronosGroup/EGL-Registry/pull/111
2020-12-10 11:15:06 +02:00
Vlad Zahorodnii
8e060e7218 Prepare kwin for compiling with EGL_NO_PLATFORM_SPECIFIC_TYPES 2020-12-10 10:54:45 +02:00
Vlad Zahorodnii
5943eea4c9 Introduce Platform::{outputEnabled,outputDisabled} signals
These signals can be useful if you want to know what output exactly has
been disabled or enabled.

The outputEnabled signal is emitted after the outputAdded signal, and
the outputDisabled signal is emitted before the outputRemoved signal.
2020-12-09 17:44:00 +00:00
Vlad Zahorodnii
94201cbadd Remove unused signal in Platform 2020-12-09 16:54:15 +02:00
David Edmundson
1e2f2a28c7 Port to kwayland-server socket changes 2020-12-09 07:23:40 +00:00
Vlad Zahorodnii
279aef103e platforms/wayland: Print a warning message if buffer swap fails
If eglSwapBuffers() fails, frame scheduling will be broken. KWin can't
recover from that, but still, having a log message might be useful for
the debugging purposes.
2020-12-08 11:16:31 +00:00
Vlad Zahorodnii
592633eed7 Fix KWIN_BUILD_XRENDER_COMPOSITING build option 2020-12-08 11:23:12 +02:00
Vlad Zahorodnii
d99e6b5d2a platforms/x11: Move XRenderBackend to platformsupport directory
This change moves the XRender backend to platformsupport directory,
similar to the OpenGL and the QPainter backend. This allows to put
platform-specific logic in XRenderBackend.
2020-12-08 08:50:19 +00:00
Vlad Zahorodnii
e320f76fb0 platforms/virtual: Emit missing outputAdded signal 2020-12-03 22:06:07 +02:00
Vlad Zahorodnii
41a5362136 platforms/wayland: Add initial HiDPI support
This can be useful for test purposes and for people who have HiDPI monitors.
2020-12-03 15:59:54 +00:00
Vlad Zahorodnii
f1483b11af platforms/virtual: Emit outputAdded and outputRemoved
Otherwise things that rely on those two signals may introduce undefined
behavior in autotests.
2020-12-02 20:55:30 +02:00
Vlad Zahorodnii
9d5a1b0531 platforms/virtual: Remove redundant m_enabledOutputs
It's the same as VirtualBackend::m_outputs.
2020-12-02 20:52:01 +02:00
Vlad Zahorodnii
ebf4e082c1 platforms/hwcomposer: Emit outputAdded 2020-12-02 20:51:14 +02:00
Vlad Zahorodnii
64260000d6 platforms/fbdev: Emit outputAdded 2020-12-02 20:51:14 +02:00
Vlad Zahorodnii
2d5482b013 plugins/x11: Emit outputAdded and outputRemoved
Currently, these two signals are emitted primarily only on Wayland, but
in order to have consistent core API, it's better to emit them on X11 too.
2020-12-02 20:51:14 +02:00
Vlad Zahorodnii
389407805c platforms/drm: Properly clean up the shadow framebuffer object
In case hardware transforms can be used again, the shadow framebuffer
must be destroyed; otherwise rendered results will be distorted due to a
mismatch between the dimensions of the shadow framebuffer and the mode
size.
2020-12-02 16:05:08 +00:00
Vlad Zahorodnii
017528956b Move Scene::isPerScreenRenderingEnabled() to Platform
This way the Compositor can know if per screen rendering is enabled
before creating the Scene.
2020-12-02 15:32:30 +00:00
Vlad Zahorodnii
b94c876597 Fix crash in eglTerminate()
At the moment, the gbm_device for the primary device is destroyed before
the EGLDisplay is destroyed. This results in a crash in Mesa.

In order to fix the crash, this change ensures that the EGLDisplay is
destroyed before the gbm device.
2020-12-02 15:32:02 +00:00
Vlad Zahorodnii
afc77c82f3 platforms/x11: Set reasonable refresh rate for dummy output
A refresh rate of -1 may break compositing scheduling code that relies
on the refresh rate being valid.
2020-12-02 09:10:09 +00:00
Vlad Zahorodnii
e3e6b3de2d platforms/x11: Use correct logging category 2020-12-02 08:34:50 +00:00
Xaver Hugl
b460909212 Small refactor in the drm backends 2020-12-01 16:58:24 +00:00
Johnny Jazeix
8c3355bdc0 fix compilation in FreeBSD, errno is defined in errno.h 2020-11-29 19:31:49 +01:00
Xaver Hugl
9ab688067a Create egl backend for multiple backends and enable multi-gpu usage for the gbm backend 2020-11-28 17:53:41 +00:00
Vlad Zahorodnii
2a8395c7dd Trim trailing whitespace 2020-11-28 11:01:47 +00:00
Vlad Zahorodnii
6f83132bd1 Introduce Platform::{outputAdded, outputRemoved} signals
These new signals can be useful if you are interested only in when a
specific output gets added or removed.
2020-11-24 17:51:32 +02:00
Aleix Pol
4f484180cd Add emit to signal calls
To signify they're emitting.
2020-11-19 22:32:08 +01:00
Xaver Hugl
cb9ccdb0fd Don't check atomic property non_desktop when not using atomic mode setting 2020-11-17 08:10:51 +00:00
Vlad Zahorodnii
f26eeb9706 Use consistent naming for begin/end frame hooks
Currently, the OpenGLBackend and the QPainterBackend have hooks to
indicate the start and the end of compositing cycle, but in both cases,
the hooks have different names. This change fixes that inconsistency.
2020-11-12 09:14:57 +02:00
Vlad Zahorodnii
76303888ab Unify begin/end frame hooks in OpenGLBackend 2020-11-12 09:14:54 +02:00
Vlad Zahorodnii
755dd81e49 Refactor how per screen rendering is handled
In order to allow per screen rendering, we need the Compositor to be
able to drive rendering on each screen. Currently, it's not possible
because Scene::paint() paints all screen.

With this change, the Compositor will be able to ask the Scene to paint
only a screen with the specific id.
2020-11-11 22:03:45 +02:00
Vlad Zahorodnii
94b731c196 Prepare QPainter render backend for per screen rendering 2020-11-11 07:22:10 +00:00
Vlad Zahorodnii
edfb0a3fd9 Drop support for X11 overlay windows in QPainter render backend
It's unused.
2020-11-11 07:22:10 +00:00
Aleix Pol
d0939dee8b Prefer function pointer to slot string 2020-11-07 02:56:44 +01:00
Aleix Pol
69eb8789ba drm: Make sure the screens are turned on when we come from suspend
Listen to logind for resume notification and turn the outputs on when it
happens, much like we do when pressing a key.

This way laptops come back on when the lid opens.

BUG: 428424
2020-11-03 17:59:02 +00:00
Vlad Zahorodnii
d5203c79a0 Report partial updates on all outputs
Previously, we couldn't do it because repaints weren't tracked per each
output.
2020-10-30 20:47:05 +00:00
Vlad Zahorodnii
648dab44da platforms/drm: Don't intersect the final output damage twice 2020-10-30 09:41:37 +00:00
Vlad Zahorodnii
458ea6dc5e platforms/wayland: Enable buffer age for all outputs 2020-10-30 07:24:01 +00:00
Vlad Zahorodnii
ac203818b7 platforms/drm: Enable buffer age for all outputs 2020-10-30 07:24:01 +00:00
Ismael Asensio
3d828d891c WindowSelector: fix finding unmanaged windows
This typo was preventing the method from actually finding the
requested window if turned to be unmanaged
2020-10-29 23:33:54 +01:00
Aleix Pol
e0c965d316 Do not re-read output configuration if the outputs didn't change
They would override KScreen in case we were using a dock station that
brings 2 displays.
We'd get:
- udev: event for the first hotplughed screen
- kwin: process all screens properly (both)
- kscreen: would offer the right configuration for such displays
- udev: process the event for the second hotplug udev event
- kwin: restore the configuration
- kscreen: would think this is a conscious decision and embrace it as a
configuration

With this change we are only re-reading the configuration in case the
outputs changed.
2020-10-29 14:57:50 +00:00
Aleix Pol
f9becf8085 wayland: Make sure EDID are being fed to wayland outputs
At the moment, despite the protocol supporting it, we were not feeding
the EDIDs. KScreen was falling back to the output name so it didn't fail
horribly but it's still a good idea to provide all the data.
2020-10-29 14:57:50 +00:00
Vlad Zahorodnii
5442762371 platforms/drm: Use a software cursor if the cursor image is too big
When dragging files on the desktop, the cursor image might be just too
big for the cursor plane, in which case we need to abandon hardware
cursors for a brief moment and use a software cursor. Once the files
have been dropped and the cursor image is small enough, we can go back
to using hw cursors.

BUG: 424589
2020-10-29 08:53:07 +00:00
Vlad Zahorodnii
d5ee009ba5 Fix capitalization in the word "software" 2020-10-29 08:53:07 +00:00
Vlad Zahorodnii
7372efffc6 platforms/drm: Remove redundant args in DrmBackend::moveCursor()
Similar to the cursor image, the cursor position can be retrieved by
checking Cursors::self()->currentCursor()->pos().
2020-10-28 06:28:41 +00:00
Vlad Zahorodnii
b53d195f34 platforms/drm: Hide sw cursor if there is no pointer
Currently, if there is no pointer, only the hardware cursor will be
hidden. If the software cursor is forced, you are going to see a dead
immovable cursor.
2020-10-27 11:46:34 +02:00
Vlad Zahorodnii
c8eeefbd7d platform/drm: Fix clipped HiDPI hardware cursors
If an output is rotated, we will compute a transform matrix for the
cursor plane to rotate its contents.

In order to compute that matrix we need the rect of the cursor in the
device-independent pixels, the scale factor and the output transform.

The problem is that we provide a rect of the cursor in the native
pixels. This may result in the cursor being partially or fully clipped.

CCBUG: 424589
2020-10-27 06:04:17 +00:00
Vlad Zahorodnii
9b09f0399f Mark the cursor as rendered after performing compositing
If a cursor animation is driven purely by frame callbacks and kwin
uses hardware cursors, the cpu usage may spike to 100%.

This change addresses that issue by sending frame callbacks after a
compositing cycle has been performed.
2020-10-26 10:02:17 +02:00
Xaver Hugl
4462ecf6ef Detect some DrmConnector properties and ignore non-desktop displays
BUG: 419032
2020-10-25 19:18:06 +00:00