fix: fullscreen surface oversized when --force-scale-factor is set (#329)#446
Open
aki1770-del wants to merge 1 commit intosony:masterfrom
Open
fix: fullscreen surface oversized when --force-scale-factor is set (#329)#446aki1770-del wants to merge 1 commit intosony:masterfrom
aki1770-del wants to merge 1 commit intosony:masterfrom
Conversation
…ony#329) When --fullscreen and --force-scale-factor=N are combined, the Wayland surface was created at native_width*N x native_height*N instead of the native display resolution. For example, a 800x480 display with --force-scale-factor=1.3 produced a 1040x624 surface, causing UI to render partially off-screen. Root cause: wl_output_listener.mode stored the native display pixels directly in view_properties_.width/height for the fullscreen case, but the rest of the codebase treats view_properties_ as logical DIP. The subsequent multiplication by current_scale_ in CreateRenderSurface then over-scaled the surface dimensions. force_scale_factor is intended to adjust the Flutter engine's device pixel ratio (DPR) so that UI elements appear larger, not to increase the surface buffer beyond the display's native resolution. The fix: 1. wl_output_listener.mode: when force_scale_factor is set, store the display dimensions as logical DIP (width / current_scale_), consistent with the xdg_toplevel_listener.configure callback which already does this division correctly. 2. CreateRenderSurface: when force_scale_factor is set, use display_max_width_/height_ directly for the surface dimensions to avoid floating-point rounding when current_scale_ is non-integer. The non-force_scale_factor path (auto-detected HiDPI from wl_output.scale) is unchanged. Fixes sony#329
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
--fullscreenand--force-scale-factor=Nare combined, the Wayland surface is created atnative_width × N×native_height × Ninstead of the native display resolution. On an 800×480 display with--force-scale-factor=1.3, the surface becomes 1040×624, causing UI to extend off-screen (portions rendered outside the display area).Reported in #329. Confirmed by two maintainers.
Root cause
wl_output_listener.modestores native display pixels directly inview_properties_.width/heightfor the fullscreen case. The rest of the codebase treatsview_properties_as logical DIP and multiplies bycurrent_scale_to get physical dimensions — soCreateRenderSurfaceends up atnative_px × scaleinstead ofnative_px.force_scale_factoris for adjusting the Flutter engine's device pixel ratio (DPR) so UI elements appear larger. It does not change the physical display resolution. Thewl_surface_set_buffer_scalecall receives the float value truncated to an integer (e.g. 1.3 → 1), so any surface buffer larger than native resolution is incorrect.The
xdg_toplevel_listener.configurecallback already handles this correctly (next_width_dip = width / current_scale_). This fix makeswl_output_listener.modeconsistent.Fix
Two changes, both guarded by
force_scale_factorso the auto-detected HiDPI path (wl_output.scale) is unchanged:wl_output_listener.mode: store display dimensions as logical DIP (width / current_scale_) whenforce_scale_factoris set, consistent withxdg_toplevel_listener.configure.CreateRenderSurface: usedisplay_max_width_/height_directly whenforce_scale_factoris set, avoiding floating-point rounding for non-integer scale values like 1.3.Before / after
On an 800×480 display with
--fullscreen --force-scale-factor=1.3:OnWindowSizeChangedreportsNon-
force_scale_factorpath: unchanged.Fixes #329