Only commit XdgOutput::done if changed
ClosedPublic

Authored by davidedmundson on Feb 23 2019, 3:44 PM.

Details

Summary

XdgOutput no-ops if one calls setLogicalSize(someSize) and someSize matches the last sent size

However, as we have an explicit done signal, we currently end up sending this regardless.

This patches tracks if we've made any changes to commit in the done event.

CCBUG: 400987

Diff Detail

Repository
R127 KWayland
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Feb 23 2019, 3:44 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 23 2019, 3:44 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
davidedmundson requested review of this revision.Feb 23 2019, 3:44 PM
romangg accepted this revision.Feb 24 2019, 12:07 PM
romangg added a subscriber: romangg.

I just tested it and it works. As you said in D19253 has same caveat as I pointed out not being in sync with wl_output::done event in case resolution and scale factor change at the same time such that logical size stays the same.

But let's merge this patch, which is nicer than my solution in D19253, as a quick fix for every other case.

This revision is now accepted and ready to land.Feb 24 2019, 12:07 PM

Maybe add a TODO comment on merge to the setLogicalSize (that it does not handle the size plus scale change correctly in every case).

Also CCBUG: 400987

Maybe add a TODO comment on merge to the setLogicalSize (that it does not handle the size plus scale change correctly in every case).

Can you expand on what you mean?

Maybe add a TODO comment on merge to the setLogicalSize (that it does not handle the size plus scale change correctly in every case).

Can you expand on what you mean?

I thought we discussed this problem already in the other diff. Example:

Single 4K Monitor is used in 1080p with 1 times scaling: logical size is 1080p
Now an atomic change comes of: Resolution set to 4K, scaling factor to 2. This triggers a wl_output::done event, but the logical size stays the same, i.e. not necessary set the dirty bit.

I just realize with our current KWin/KWayland code, which has to set the logical size on every pixelSize and scale change we do not have this problem at the moment, but later if we want to send only one done event per atomic configuration change a single wl_output::done event might be generated but not the respective xdg_output::done event.

davidedmundson retitled this revision from WIP: Alternate approach to D19253 to Only commit XdgOutput::done if changed.Feb 25 2019, 11:26 AM
davidedmundson edited the summary of this revision. (Show Details)
davidedmundson edited the test plan for this revision. (Show Details)
davidedmundson edited the summary of this revision. (Show Details)Feb 25 2019, 11:28 AM

I wouldn't say it's handling it incorrectly. In the scenario you've give the logical size hasn't changed.

a single wl_output::done event might be generated but not the respective xdg_output::done event.

I was under the impression that xwayland expects an xdg_output::done to have a corresponding wl_output::done, but not necessarily the other way round?

If we do need them to always be paired we'll have the same issue if you change refresh rate without changing the resolution.

The only long term option I can think of that would fix that is exposing the dirty bit publicly and having kwin do:

if (output->isDirty() || xdgOutput->isDirty()) {
  output->done();
  xdgOutput->done();
}

(after porting Output to this same pattern)

This revision was automatically updated to reflect the committed changes.