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

wl: Fix the validation of the exported image in outputs with scale factor #637

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

psaavedra
Copy link
Member

@psaavedra psaavedra commented Oct 30, 2023

The patch fixes a basic logic bug inside of the on_export_wl_egl_image(). The error is in the incorrect use of scale_factor (actually defined for the WebPage zooming) instead of the current_output->scale for validating the exported image geometry.

The change also unifies inside of the new validate_exported_geometry() function the shared code used for validating the sizes of the exported images.

This fixes regression added in e533fce.

Thanks to Adrian Perez de Castro [email protected] for reporting the issue.

@psaavedra psaavedra self-assigned this Oct 30, 2023
@aperezdc aperezdc added the bug Something isn't working label Oct 30, 2023
@aperezdc
Copy link
Member

I tested this locally and doesn't work, the surface never gets a buffer attached. The end of the log with G_MESSAGES_DEBUG=Cog-Core,Cog-Wayland set shows the following:

Cog-Wayland-INFO: 15:43:03.233: Output 0x560adcb510a0 is 3840x2160 @ 60.00Hz
Cog-Wayland-INFO: 15:43:03.233: Got scale factor 2 for output 0x560adcb510a0
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.233: output_handle_done: Using 0x560adcb510a0 as initial output
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.241: New XDG toplevel configuration: (0, 0)
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.534: Exported geometry 1024x768, does not match surface geometry 2048x1536, skipping.
Cog-Core-Message: 15:43:03.534: <file:///home/aperez/wpe/cog> Load started.
Cog-Core-Message: 15:43:03.544: <file:///home/aperez/wpe/cog> Loading...
Cog-Core-Message: 15:43:03.562: <file:///home/aperez/wpe/cog> Loaded successfully.
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.574: Exported geometry 1024x768, does not match surface geometry 2048x1536, skipping.

So it never considers that the surface geometry matches the exported image size.

…ctor

The patch fixes a basic logic bug inside of the on_export_wl_egl_image().
The error is in the incorrect use of scale_factor (actually defined for the
WebPage zooming) instead of the current_output->scale for validating the
exported image geometry.

The change also unifies inside of the new validate_exported_geometry()
function the shared code used for validating the sizes of the exported images.

This fixes regression added in e533fce.

Thanks to Adrian Perez de Castro <[email protected]> for reporting the issue.
The device scale factor could be different and the scale of the exported
image should be also updated.
@psaavedra psaavedra force-pushed the psaavedra/fix_on_export_with_device_scale branch from 640ad32 to a39d663 Compare October 30, 2023 14:32
@psaavedra
Copy link
Member Author

psaavedra commented Oct 30, 2023

I tested this locally and doesn't work, the surface never gets a buffer attached. The end of the log with G_MESSAGES_DEBUG=Cog-Core,Cog-Wayland set shows the following:

Cog-Wayland-INFO: 15:43:03.233: Output 0x560adcb510a0 is 3840x2160 @ 60.00Hz
Cog-Wayland-INFO: 15:43:03.233: Got scale factor 2 for output 0x560adcb510a0
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.233: output_handle_done: Using 0x560adcb510a0 as initial output
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.241: New XDG toplevel configuration: (0, 0)
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.534: Exported geometry 1024x768, does not match surface geometry 2048x1536, skipping.
Cog-Core-Message: 15:43:03.534: <file:///home/aperez/wpe/cog> Load started.
Cog-Core-Message: 15:43:03.544: <file:///home/aperez/wpe/cog> Loading...
Cog-Core-Message: 15:43:03.562: <file:///home/aperez/wpe/cog> Loaded successfully.
(cog:2318920): Cog-Wayland-DEBUG: 15:43:03.574: Exported geometry 1024x768, does not match surface geometry 2048x1536, skipping.

So it never considers that the surface geometry matches the exported image size.

your are right. I noticed that also in a second round of tests. The second commit should fix this situation. The problem is, because we set the scale factor in the view backend in the View resize action, then we need to force a view resize every time the output scale handler is called. This guarantee the exported image is generated according the expected output scale factor.

@aperezdc
Copy link
Member

Tested, this now works flawlessly. Thanks!

@psaavedra
Copy link
Member Author

Tested, this now works flawlessly. Thanks!

Awesome. Thanks for ✅✅. Rebasing and merging.

@psaavedra psaavedra merged commit 7ebaeb7 into master Oct 31, 2023
5 checks passed
@psaavedra psaavedra deleted the psaavedra/fix_on_export_with_device_scale branch October 31, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants