This removes the "OpenGLIsUnsafe" flag and replaces it with a timestamp
that we can check to see how long ago we tried enabling compositing, so
we can retry it if a certain amount of time has elapsed.
BUG: 452344
The drm fd can get stuck in readable state, in which case the
QSocketNotifier will fire the activated signal as often as it can
leading to high cpu usage.
We need to read() the drm fd in order to make the socket notifier stop
firing QSocketNotifier::activated.
This change removes the m_platform->isActive() check to ensure that
drmHandleEvent() gets called, in general, it should be safe as we only
notify the outputs about completed pageflips.
BUG: 452726
With this change, when the specified output is disconnected, it will
just behave as if none were selected but when it's connected again it
will pick it back up.
BUG: 456857
Remember to release all resources before the wayland socket goes:
- release the seat as we give up a seat
- release the ssdManager
- release the output decoration with the output itself
Otherwise they leak and stay dangling.
Currently the Workspace processes output updates as they occur, e.g.
when the drm backend scans connectors, the Workspace will handle
hotplugged outputs one by one or if an output configuration changes the
mode of several outputs, the workspace will process output layout
updates one by one instead of handling it in one pass. The main reason
for the current behavior is simplicity.
However, that can create issues because it's possible that the output
layout will be temporarily in degenerate state and features such as
sticking windows to their outputs will be broken.
In order to fix that, this change makes the Workspace process batched
output updates. There are several challenges - disconnected outputs have
to be alive when the outputsQueried signal is emitted, the workspace
needs to determine what outputs have been added or removed on its own.
The proposed way to handle unplugged gpus allows us to ensure that
removed outputs' lifetime can be extended to the moment when the
Platform::outputsQueried signal is emitted.
Besides that, it's possible to extend this code a bit further to make
sure that output updates are batched when hotplugging multiple gpus,
e.g. after resuming, etc.
Currently, we effectively almost everywhere need DrmOutput outputs,
DrmVirtualOutput outputs are needed only in a couple of places. There's
not a lot that we gain from storing real and virtual outputs in one
list, it adds unnecessary casting, etc. Ideally, virtual outputs must
come from a different backend, the current approach is not scalable.
This std::sort() function traces its origin back to
cbbd684430. The sort step was necessary to
ensure that we get same configuration hash regardless the order in which
outputs were connected.
On the other hand, our KWinKScreenIntegration code already does that so
it seems excessive to sort outputs the second time.
Placeholder outputs are not rendered so they don't need render data.
Also, this simplifies the control flow when the last real output is
removed. The Platform::screensQueried signal won't be emitted inside a
Platform::screensQueried slot.
Things such as Output, InputDevice and so on are made to be
multi-purpose. In order to make this separation more clear, this change
moves that code in the core directory. Some things still link to the
abstraction level above (kwin), they can be tackled in future refactors.
Ideally code in core/ should depend either on other code in core/ or
system libs.
If multiple properties that affect the geometry change, then the
Output::geometryChanged() signal will be emitted multiple times, which
in its turn may force the Workspace to re-arrange windows, etc.
With this, the geometryChanged signal will be emitted in more expected
fashion only once as long as relevant property changes are batched.
Backends aren't the right layer to take care of placeholder outputs, and
don't really have enough information to do it either. This also fixes a
crash, because the placeholder output currently gets created too late
Currently, the main user of these two functions is the X11 standalone
platform.
This change ports that code to Workspace::geometry(), which is not great
but the X11 backend already depends on the Workspace indirectly via the
Screens. Not sure if it's worth making the standalone X11 backend track
the xinerama rect internally.
The main motivation behind moving kscreen integration to the
Workspace is to make output configuration work the same way
regardless of the backend and simplify the drm backend.
Currently, we pass the logical size but setGeometry() expects the size
in device pixels. It fixes "kwin_wayland --scale 2" shrinking on every
configure event.
If the platform does not support configuring outputs, applying a config
must fail. However, almost all output backends support output
configuring except, perhaps, the x11 backend, but that case doesn't
matter.
It implicitly already is not copyable, due to the unique_ptr member.
However, Qt6 moc code isn't realizing that and fails to compile the
DrmPlane Q_GADGET sub-class of this.
Buffers with implicit modifiers from another GPU must not be imported, as
the layouts may not be compatible.
For buffers with incompatible modifiers, direct scanout can also be rejected
early, saving some computational power.
BUG: 457851