Implement wp_viewporter
AcceptedPublic

Authored by romangg on Dec 23 2019, 12:52 AM.

Details

Reviewers
davidedmundson
Group Reviewers
KWin
Maniphest Tasks
T4456: Implement viewporter protocol
Summary

This patch adds interfaces for specifying viewports via the wp_viewporter
protocol extension. This allows to make surface size and buffer independent
from each other. For example a video player can send 1080p video data while
the window of the player is of different size.

The server interface ViewportInterface is directly integrated with
SurfaceInterface. Viewport changes are double-buffered by that.

Test Plan

Added auto tests and with weston-scaler.

Diff Detail

Repository
R127 KWayland
Branch
viewporter
Lint
Lint ErrorsExcuse: unrelated code
SeverityLocationCodeMessage
Errorsrc/client/datadevicemanager.h:76CppcheckunknownMacro
Errorsrc/server/textinput_interface.h:160CppcheckunknownMacro
Unit
No Unit Test Coverage
Build Status
Buildable 20509
Build 20527: arc lint + arc unit
romangg created this revision.Dec 23 2019, 12:52 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 23 2019, 12:52 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
romangg requested review of this revision.Dec 23 2019, 12:52 AM
romangg added inline comments.Dec 23 2019, 1:17 AM
src/server/surface_interface.h
128

Needed for a call in a const function in KWin. Do we want to do it like that? Other suggestions?

Cool, I like viewporter.

src/server/surface_interface.cpp
509

C-style casts are frowned upon.

530

We're not testing this error in the case of:

buffer is set
viewporter.sourceRect is set

then later
buffer changes
viewporter.sourceRect remains the same

this should be an error too.

906

Should this be

d->current.sourceRectangle.size()/ scale()

It would be a somewhat weird case to use both viewporter and wl_buffer.scale, but it's what the spec implies and you seem to be assuming that in the kwin render path.

destinationSize would be as-is.

src/server/surface_interface.h
128

Why not just

BufferInterface *buffer() const

There's no reason why a caller would need to explicitly pick a const vs non-const version.

romangg added inline comments.Dec 23 2019, 11:57 AM
src/server/surface_interface.cpp
530

Good point. Same should be done for when the transform or scale changes.

906

How I read the spec: the source rectangle is always specified in coordinates after scale and transform. [1]

SurfaceInterface::size() returns the scaled and transformed (not yet) buffer size so since viewporter coordinates are to this base we can just directly return them.

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/blob/master/stable/viewporter/viewporter.xml#L103

src/server/surface_interface.h
128

Yea, I added the new function for API/ABI-compatibility. But if you say making the function buffer() const is not a problem in this regard I will gladly do that.

davidedmundson added inline comments.Jan 1 2020, 4:43 PM
src/server/surface_interface.cpp
906

Yeah, on re-reading I think your intepretation is right. Leave your stuff as-is.

romangg updated this revision to Diff 72575.Jan 1 2020, 8:32 PM
romangg marked 6 inline comments as done.
  • Check source rectangle on related changes, buffer rename.
romangg updated this revision to Diff 72576.Jan 1 2020, 8:38 PM
  • Cleanup
davidedmundson accepted this revision.Jan 2 2020, 2:32 PM
This revision is now accepted and ready to land.Jan 2 2020, 2:32 PM
bam added a subscriber: bam.May 24 2020, 1:06 PM