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

Fix X11 screen size when using fractional "scale-up" mode #694

Merged
merged 3 commits into from
May 23, 2024

Commits on May 12, 2024

  1. meta-monitor-manager-xrandr.c: fix crtc disabling

    CRTCs must also be disabled if the requested screen size is, in any
    dimension, smaller than what the screen size would be without any xrandr
    scaling applied.  See, e.g., [1, 2].
    
    [1] https://lists.x.org/archives/xorg-devel/2018-March/056203.html
    [2] https://github.com/linuxmint/muffin/blob/b15de53d7bc43dbcd0136cd7f845eb7ec9d89e6a/src/backends/x11/meta-monitor-manager-xrandr.c#L851
    jknockel committed May 12, 2024
    Configuration menu
    Copy the full SHA
    74562e3 View commit details
    Browse the repository at this point in the history
  2. meta-monitor-manager-xrandr.c: fix screen size

    Only call meta_monitor_manager_xrandr_update_screen_size() when the
    CRTCs have been, if necessary, disabled.  It is always safe and
    sometimes required to call it in this state.  Previously, for instance,
    we would not call it in this state when shrinking the screen size (e.g.,
    when in fractional "scale-up" mode), but it is in fact required to call
    it in this state when using fractional "scale-up" mode.
    jknockel committed May 12, 2024
    Configuration menu
    Copy the full SHA
    652ff9b View commit details
    Browse the repository at this point in the history
  3. meta-monitor-manager-xrandr.c: screen size fixes

    In previous commits, we have fixed "scale-up" fractional mode scaling
    when done via the display settings UI.  However, there is still the
    matter of meta_monitor_manager_xrandr_update_screen_size_derived() which
    can be called on anyone's change to the xrandr configuration.
    
    Prior to this commit, to work around an issue where CRTCs must be
    disabled, this function *never* set the correct screen size when scaling
    up.  This has some horrible consequences like breaking edges on the
    sides of monitors, windows appearing completely offscreen, incorrect
    workspace previews, etc., so we should *never* do this.
    
    Let's instead try to set the correct screen size.  If it fails, that's
    fine because we are doing it via XCB and will merely log the error.
    It's better than always setting the wrong screen size.  Plus, there is
    reason to think that the screen size will already be correct anyways.
    In previous commits we already fixed *our* handling of xrandr scaling to
    correctly update the screen size when the necessary CRTCs are disabled.
    Hopefully all other tools are doing it correctly as well and we never
    have to update the screen size here. :)
    
    If this prediction proves inaccurate, we can later update this function
    to (1) check if the screen size actually needs changing and, if it does,
    then (2) disable any CRTCs that need disabling before changing the
    screen size and (3) re-enable them after the change of screen size.
    Unfortunately I don't know if there is a simpler way.
    
    In general, we have to be careful to not disable CRTCs too eagerly
    either because disabling a CRTC is typically quite easily noticed by a
    user and results in the screen turning black for a moment.
    jknockel committed May 12, 2024
    Configuration menu
    Copy the full SHA
    c3dd5a4 View commit details
    Browse the repository at this point in the history