Commit Graph

17 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Bernie Innocenti 0c67eb983c [decorations] Fix rendering for depth 30 (10bpc)
When the display is set to 30-bit depth (10-bit per color component),
decorations of some clients appear garbled when compositing is disabled.
This is because the pixel format of the QImage in which the decorations
were rendered differed from the the X pixmap into which the pixels were
being copied by means of xcb_put_image().

For lack of a more robust way, this change guesses A2RGB30 for depth=30,
and keeps using ARGB32 as before for any other depth. I don't expect
anything other to 32bpp to be supported by KWin anyway.

Tested on amdgpu with KWIN_OPENGL_INTERFACE=egl.

BUG: 406302
FIXED-IN: 5.19.4
2020-07-10 13:08:53 +00:00
Vlad Zahorodnii bd52b6791e Schedule a decoration repaint when client is resized
Summary:
If a client has been resized, it doesn't necessarily mean that the
decoration theme will schedule full repaint of the window frame. In
OpenGL and Xrender scene, we have a little hack that forces a full
repaint of window borders. However, we don't have one in QPainter
scene which causes all sorts of weird looking artifacts when resizing
a server-side decorated client.

We could add yet another hack in the QPainter scene, but a better
approach to tackle this problem would be to make DecoratedClient
schedule a full repaint of the decoration. It makes code in scene
plugins more straightforward and prevents us from repeating the same
mistake again.

Test Plan:
No longer able to see invisible decoration borders when
using QPainter render backend.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26927
2020-01-28 18:42:17 +02:00
Vlad Zahorodnii af71763be5 [scene] Fix decoration texture bleeding
Summary:
Quite long time ago, window decorations were painted on real X11 windows.
The nicest thing about that approach is that we get both contents of the
client and the frame window at the same time. However, somewhere around
KDE 4.2 - 4.3 times, decoration rendering architecture had been changed
to what we have now.

I've mentioned the previous decoration rendering design because it didn't
have a problem that the new design has, namely the texture bleeding issue.

In the name of better performance, opengl scene puts all decoration parts
to an atlas. This is totally reasonable, however we must be super cautious
about things such as the GL_LINEAR filter.

The GL_LINEAR filter may need to sample a couple of neighboring texels
in order to produce the final texel value. However, since all decoration
parts now live in a single texture, we have to make sure that we don't
sample texels that belong to another decoration part.

This patch fixes the texture bleeding problem by padding each individual
decoration part in the atlas. There is another solution for this problem
though. We could render a window into an offscreen texture and then map
that texture on the transformed window geometry. This would work well and
we definitely need an offscreen rendering path in the opengl scene,
however it's not feasible at the moment since we need to break the window
quads API. Also, it would be great to have as less as possible stuff going
on between invocation of Scene::Window::performPaint() and getting the
corresponding pixel data on the screen.

There is a good chance that the new padding stuff may make you vomit. If
it does so, I'm all ears for the suggestions how to make the code more
nicer.

BUG: 257566
BUG: 360549
CCBUG: 412573
FIXED-IN: 5.18.0

Reviewers: #kwin

Subscribers: fredrik, kwin, fvogt

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25611
2020-01-09 15:13:07 +02:00
Vlad Zahorodnii 6e000314b3 Revert the fix for the texture bleeding issue
This reverts commit 9151bb7b9e.
This reverts commit ac4dce1c20.
This reverts commit 754b72d155.

In order to make the fix work, we need to redirect the client window
instead of the frame window. However, we cannot to do that because
Xwayland expects the toplevel window(in our case, the frame window)
to be redirected.

Another solution to the texture bleeding issue must be found.

CCBUG: 257566
CCBUG: 360549
2019-12-02 19:45:15 +02:00
Vlad Zahorodnii ac4dce1c20 [scene] Fix decoration texture bleeding
Summary:
Quite long time ago, window decorations were painted on real X11 windows.
The nicest thing about that approach is that we get both contents of the
client and the frame window at the same time. However, somewhere around
KDE 4.2 - 4.3 times, decoration rendering architecture had been changed
to what we have now.

I've mentioned the previous decoration rendering design because it didn't
have a problem that the new design has, namely the texture bleeding issue.

In the name of better performance, opengl scene puts all decoration parts
to an atlas. This is totally reasonable, however we must be super cautious
about things such as the GL_LINEAR filter.

The GL_LINEAR filter may need to sample a couple of neighboring texels
in order to produce the final texel value. However, since all decoration
parts now live in a single texture, we have to make sure that we don't
sample texels that belong to another decoration part.

This patch fixes the texture bleeding problem by padding each individual
decoration part in the atlas. There is another solution for this problem
though. We could render a window into an offscreen texture and then map
that texture on the transformed window geometry. This would work well and
we definitely need an offscreen rendering path in the opengl scene,
however it's not feasible at the moment since we need to break the window
quads API. Also, it would be great to have as less as possible stuff going
on between invocation of Scene::Window::performPaint() and getting the
corresponding pixel data on the screen.

There is a good chance that the new padding stuff may make you vomit. If
it does so, I'm all ears for the suggestions how to make the code more
nicer.

BUG: 257566
BUG: 360549
CCBUG: 412573
FIXED-IN: 5.18.0

Reviewers: #kwin

Subscribers: fredrik, kwin, fvogt

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25611
2019-12-02 15:08:44 +02:00
David Edmundson fc887ab907 Render GL Window decorations at the correct scale
Summary:
Under wayland we support high DPI putting by putting a separation
between the logical co-ordinate system and the resolution of rendered
assets.

When a window is on a high DPI screen, we should render at the higher
resolution.

Like the window scaling this handles any combination of a 2x scaled
decoration being rendered on a 1x screen or vice versa.

---
This patch is a bit different from the other scaling stuff. We have to
generate the quads *before* we have an updated texture with the new
scale. This means the scale isn't attached to the buffer like elsewhere.

That's why I added a property in TopLevel so there's still one canonical
source and things can't get out of sync.

BUG: 384765

Test Plan:
Crystal clear breeze and oxygen decos on my @2x display
Drag windows to attached @1x display, things still look OK when across 2
screens
Changing the scale of a screen updated the decos instantly

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8600
2017-11-01 17:59:11 +00:00
David Edmundson 7e6721ece0 Scaled decorations in QPainter mode
Summary:
Under wayland we support high DPI putting by putting a separation
between the logical co-ordinate system and the resolution of rendered
assets.

I didn't include window decorations in the previous wayland scaling
patchset. They were drawn them at a standard resolution, which is
implicitly scaled up.

This uses the Qt scaling, meaning oxygen and breeze (and others) get
perfect high DPI support with zero client changes.

Like the window scaling this handles any combination of a 2x scaled
decoration being rendered on a 1x screen or vice versa.

CCBUG: 384765

Test Plan:
export KWIN_COMPOSE=Q
Had two screens of different scales
It was the right size on both (as before)
Was super-sharp on the fancy screen

Reviewers: #plasma, hetzenecker, graesslin

Reviewed By: #plasma, graesslin

Subscribers: ngraham, graesslin, plasma-devel, kwin, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8504
2017-10-30 13:27:48 +00:00
Martin Flöser 23ef40e638 Move the X11 Decoration Renderer into the X11 standalone platform
Summary:
Not needed except for X11/non-composited usage, so should be in the
plugin instead of core.

Platform API is extended to create a decoration renderer.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7444
2017-09-01 17:49:32 +02:00
Martin Gräßlin 9fb27bc0ba [decoration] Use client's depth in X11Renderer for put_image
If the Client uses ARGB the depth is not 24, thus we should use
the actual depth from the Client.

BUG: 342757
2015-01-12 11:43:29 +01:00
Martin Gräßlin d81e5697bf Ensure that the X11Renderer doesn't render after reparente to Deleted 2014-12-02 14:13:28 +01:00
Martin Gräßlin cb9cbae36e Decoration::paint takes the repaint region 2014-11-11 09:39:45 +01:00
Martin Gräßlin b22317458c Override ::reparent in X11Renderer
Required to stop and disconnect the timer. Otherwise it's possible
that the render is invoked after the Client got destroyed. This
happened for example with e.g. opening Kickoff.
2014-08-11 11:41:08 +02:00
Martin Gräßlin 2b20aa8bd0 Drop CoordinateMode from Client::layoutDecorationRects
It's unused without the padding.
2014-07-25 14:02:27 +02:00
Martin Gräßlin c12199a8e0 Pass Decoration::Renderer to Deleted and use it in the Scenes
The Renderer gets reparented to the Deleted. While passing it to
the Deleted the Scene's implementation can ensure that the buffers
are up to date. After passing to Deleted it's no longer allowed to
call the render method.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 0030eb7f84 Initial import of support for new KDecoration2 based decorations
NOTE: this is not working completely yet, lots of code is still ifdefed
other parts are still broken.

The main difference for the new decoration API is that it is neither
QWidget nor QWindow based. It's just a QObject which processes input
events and has a paint method to render the decoration. This means all
the workarounds for the QWidget interception are removed. Also the paint
redirector is removed. Instead each compositor has now its own renderer
which can be optimized for the specific case. E.g. the OpenGL compositor
renders to a scratch image which gets copied into the combined texture,
the XRender compositor copies into the XPixmaps.

Input events are also changed. The events are composed into QMouseEvents
and passed through the decoration, which might accept them. If they are
not accpted we assume that it's a press on the decoration area allowing
us to resize/move the window. Input events are not completely working
yet, e.g. wheel events are not yet processed and double click on deco
is not yet working.

Overall KDecoration2 is way more stateful and KWin core needs more
adjustments for it. E.g. borders are allowed to be disabled at any time.
2014-07-25 14:02:26 +02:00