Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend/wayland: wp_viewporter support #3445

Merged
merged 12 commits into from
Jul 11, 2024

Conversation

RAOF
Copy link
Contributor

@RAOF RAOF commented Jun 26, 2024

Accidentally all squashed together into a single mega-commit, here's wp_viewporter.

You can test with the weston-scaler client in... weston, and also with canonical/wlcs#340

@RAOF RAOF requested a review from a team as a code owner June 26, 2024 08:27
Copy link
Contributor

@mattkae mattkae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall makes sense, but some initial comments about error handling

include/platform/mir/graphics/renderable.h Show resolved Hide resolved
src/server/frontend_wayland/wl_surface.cpp Outdated Show resolved Hide resolved
src/server/frontend_wayland/wl_surface.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits

include/platform/mir/graphics/renderable.h Show resolved Hide resolved
Comment on lines 41 to 44
coords.top = sample_rect.top().as_value() / buffer_size.height.as_uint32_t();
coords.bottom = sample_rect.bottom().as_value() / buffer_size.height.as_uint32_t();
coords.left = sample_rect.left().as_value() / buffer_size.width.as_uint32_t();
coords.right = sample_rect.right().as_value() / buffer_size.width.as_uint32_t();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. All this .as_value() ... .as_uint32_t() makes me wonder if there's an operator missing in our geometry. This would look safer:

coords.top = sample_rect.top() / buffer_size;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've ended up with sample_rect.top() / buffer_size.width (as sample_rect.top() / buffer_size is ambiguous).

@@ -14,32 +14,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mir/gl/tessellation_helpers.h"
#include "mir/geometry/forward.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd that we'd want forward.h in an implementation file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, we don't, but clangd always wants to pull it in. I missed this one!

src/server/frontend_wayland/wp_viewporter.cpp Outdated Show resolved Hide resolved
src/server/frontend_wayland/wp_viewporter.h Outdated Show resolved Hide resolved
/**
* Have the source or destination values changed since the last call to dirty()?
*/
auto dirty() -> bool;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure "dirty" is the best name here. Obvious interpretations are "is dirty" and "make dirty", but this is neither. And the actual meaning won't be obvious reading the code that calls it. Even the comment isn't clear about what the first call does.

Maybe unchanged_since_last_call()?

Or, unreported_changes()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone for changed_since_last_resolve(), and updated the implementation slightly to make that true.

Copy link
Contributor

@mattkae mattkae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be a good implementation to me! I will let Alan get it over the line

@AlanGriffiths
Copy link
Collaborator

"This branch has conflicts that must be resolved"

RAOF and others added 11 commits July 10, 2024 17:25
We can provide an interface to the rest of the frontend to calculate
the details `WlSurface` needs and keep all the protocol error generation
code in with the `wp_viewporter` rather than spread across multiple files.
We now have a requirement for both the actual value of `scale` and for
its reciprocal. Rather than storing the reciprocal and calculating the
original value when needed, store the original value and calculate the
reciprocal when needed.
…types.

It's fine to implicitly convert `Size` -> `SizeD` or `SizeF` -> `SizeD`; these
conversions lose no information.

Use this to simplify some `RectangleD` constructions in the code
We change this to `changed_since_last_resolve()`.
@RAOF RAOF force-pushed the MIRENG-215-MIRENG-418-wp-viewporter-support branch from 054fda9 to 3c948ff Compare July 10, 2024 07:26
@@ -18,6 +18,7 @@
#define MIR_GL_TESSELLATION_HELPERS_H_
#include "mir/gl/primitive.h"
#include "mir/geometry/displacement.h"
#include "mir/geometry/rectangle.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks spurious

Copy link
Collaborator

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK now

@AlanGriffiths AlanGriffiths enabled auto-merge July 11, 2024 09:24
@AlanGriffiths AlanGriffiths added this pull request to the merge queue Jul 11, 2024
Merged via the queue into main with commit ef638b6 Jul 11, 2024
34 of 36 checks passed
@AlanGriffiths AlanGriffiths deleted the MIRENG-215-MIRENG-418-wp-viewporter-support branch July 11, 2024 10:39
@Fuseteam
Copy link

Fuseteam commented Aug 8, 2024

This closes #2599 i think

@AlanGriffiths AlanGriffiths mentioned this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants