[WIP][Wayland] Allow to take full resolution screenshot when scaling is used
Needs ReviewPublic

Authored by meven on Wed, Nov 20, 6:22 PM.

Details

Reviewers
davidedmundson
Summary

My Progress so far.
I can get a properly 4K screenshot.
But this relies on an hardocoded value

BUG: 409762
FIXED-IN: 5.18

Diff Detail

Repository
R108 KWin
Branch
master
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 19019
Build 19037: arc lint + arc unit
meven created this revision.Wed, Nov 20, 6:22 PM
Restricted Application added a project: KWin. · View Herald TranscriptWed, Nov 20, 6:22 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
meven requested review of this revision.Wed, Nov 20, 6:22 PM

This approach will probably fail when the geometry stretches across multiple outputs with different scales.

meven added a comment.Wed, Nov 20, 6:53 PM

This approach will probably fail when the geometry stretches across multiple outputs with different scales.

I am well aware, this a naive and basic approach to gather some learning feedback.
And Those changes are only needed for Wayland.
I need to break the geometry by screen get their scale and then put all together in a virtualScreenGeometry according to the passed Geometry.
But I need to learn how to get there, dig in the code and/or ask questions if I may.
I have a two screens system at home to test this.

This approach will probably fail when the geometry stretches across multiple outputs with different scales.

I am well aware, this a naive and basic approach to gather some learning feedback.
And Those changes are only needed for Wayland.
I need to break the geometry by screen get their scale and then put all together in a virtualScreenGeometry according to the passed Geometry.
But I need to learn how to get there, dig in the code and/or ask questions if I may.
I have a two screens system at home to test this.

It's great that you are working on this! This was just a thought that came to me upon realizing that everyting goes though this method.

Hmm further thinking about this. Assuming a geometry stretches across two screens. On has a scaling of two and the other not. Would then one side of the image be double the size than the other one because we want the full resolution? Or would you scale the lower resolution half of the image up?

On has a scaling of two and the other not. Would then one side of the image be double the size than the other one because we want the full resolution? Or would you scale the lower resolution half of the image up?

I think it has to be uniform.

effects/screenshot/screenshot.cpp
620

Good question.

Use of Qt methods is slightly weird, as kwin implements it's own QPA which means we're reading things via an abstraction layer rather than directly. In theory it should work, but you're going to struggle to tie a QScreen to what's being rendered.

Ideally we would want to use KWin::Screens() but that's not exposed to effects.

GLRenderTarget::virtualScreenScale() is currently only set to screen->scale during the paint method. This is postPaint. We could set it during pre/postPaint too.

627–630

Avoid the term scaled in any variable name.

It can mean scaled from logical to device, or scaled from device to logical. Which means it fails to convey the one piece of important information you're trying to say.

use something like"deviceGeometry"

meven updated this revision to Diff 70097.Thu, Nov 21, 10:52 AM
meven marked an inline comment as done.

Rename variable to proper name

meven added a comment.Thu, Nov 21, 2:14 PM

GLRenderTarget::virtualScreenScale() is currently only set to screen->scale during the paint method.

I guess you are evoking in your comment scene_opengl.cpp:662.
There for m_backend->perScreenRendering (wayland case) SceneOpenGL::paint() calls Scene::paintScreen() that then calls effects->postPaintScreen().
I don't get how the static data at GLRenderTarget::virtualScreenScale are not available.
I don't see where some other code might call postPaintScreen.
I am missing something. If you could just point me to the right direction.

This is postPaint. We could set it during pre/postPaint too.

I'd like to understand how to make it available to the effects.
I dug D8490 and D4948 for inspiration.