gbm_bo_create_with_modifiers implies the GBM_BO_USE_SCANOUT flag, which
disables complex (tiled or compressed) formats that cannot be used for
scanout. This reduces performance. We don't need to scan out buffers
created for sceencasting/etc., so this is suboptimal.
By switching to gbm_bo_create_with_modifiers2, we can explicitly pass
the flags and avoid falling back to lower performance formats. Also add
a config check and fall back to the old version, to retain compatibility
with older mesa versions.
Since modifiers are listed in preference order, the last one is usually
the most general fallback. If we drop it, we risk winding up with no
usable modifiers.
On Apple GPUs with the Asahi driver, the received modifiers are usually
compressed, twiddled, and linear. Dropping linear means we only request
complex formats. But then gbm_bo_create_with_modifiers always requests
a scanout-capable BO which cannot support complex formats, and we wind
up with nothing. This breaks screencasting on these platforms.
The main motivation behind this change is to share rendering code
between windows and the cursor, specifically the Item class which
requires a Scene.
Note that Scene subclasses are responsible for issuing
ItemRenderer::renderItem() calls. The main reason for that is the
current architecture of the effects system, specifically we need to call
some effects hooks before and after painting a window.
eglSwapBuffers() used to flush rendering commands but now that we render
to dmabufs, we need somehow to flush the rendering commands to the dmabuf.
It fixes some of the weird rendering issues that I see sometimes.
The contents of the cursor can be either a normal image or a wl_surface.
At the moment, we get an image from the wl_surface. But it's going to be
changed so we use SurfaceItem to render wl_surface cursors.
SurfaceCursorSource provides the way to get the wl_surface handle from
the cursor. In order to provide backwards compatibility, it also provides
a QImage.
The damaged signal is wired to the KWaylandServer::Cursor::changed
signal to indicate when the cursor image changes, makes sense.
But it can create issues if you repaint cursor SurfaceItem when the
SurfaceInterface::damaged signal is emitted. There might be other
signals that we need to wait for to invalidate SurfaceItem's state.
The SurfaceInterface::committed is a better signal. When it's emitted,
the surface commit has been completed. Technically, it's different from
the damaged signal, but in practice they are equivalent. GTK and Qt
always damage the cursor surface.
It makes the behavior of the ItemRendererQPainter compatible with the
behavior of the ItemRendererOpenGL. It is needed to ensure that the
cursor layer is properly cleared too.
This is needed to establish explicit connection between an item and the
scene it belongs to. For now, the scene must be known at the item
construction time. Perhaps it can be improved in the future by items
inheriting their scene from the parent item, but the scene would need to
be refactored more so there's a root item or something like that.
Currently, Item schedules repaints taking output geometry into account,
but that's going to work poorly for cases other than workspace scene.
Moving from Output to SceneDelegate also allows us to unify some X11 and
Wayland specific code paths in Item.
Furthermore, it ensures that effects->paintScreen() won't remove pending
repaints for the output.
It makes more sense for an output layer to return the render target fbo.
The user of the render target will then take appropriate steps to bind
the fbo. It reduces the amount of boilerplate code in output layers too.
The goal is to create surface items for things that are not in the
workspace scene. RenderBackend perhaps is not a great place for these
factory functions. On the other hand, this change merely rewires code
from Scene to RenderBackend. I think that in distant future we could
make surface items pick surface texture type on their own, for what it's
worth that's what we would do in QtQuick.
Remove "kwin", it's repetitive and doesn't add new information. In
addition to that, prefixing commits that change kcms will become more
straightforward. There's more than one scheme people use, some include
"kwin", some don't.
In the QML code we set the text of the KNS button to `i18n("Get New Desktop Effects...")`.
Consequently we should use the same terminology in the knsrc file.
BUG: 463021
There's no any way to integrate OffscreenQuickView into the scene graph.
So make the EffectsHandlerImpl responsible for drawing quick views until
the corresponding item is introduced (requires a lot and a lot of
refactoring in effects) or the design of kwin changes so much that we
don't need this special code path.
ItemRenderer class provides Item rendering facilities. The main
motivation behind this change is to extract code that can be used to
render both normal windows as well as the cursor.
With current and broken behavior in Mesa, the timeout will always be
reached. GPU resets don't take anywhere near even a second, making
the user wait for 10s has no use.