Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78cd762a authored by Oleg Blinnikov's avatar Oleg Blinnikov
Browse files

Added synchronization of displays refresh rates

SurfaceFlinger supports only one refresh rate,
but in case displays have different refresh rates
this may lead to undesirable artifacts, also
during switching of internal display refresh rates
the external display may also blink for some reason.

This CL adds vote which aims to synchronize refresh
rates across displays.

Test: atest com.android.server.display.mode.DisplayObserverTest
Bug: 242093547
Change-Id: I0bf525c9b212a9b41efe43dcb32fbbe206892591
parent 2c484175
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5245,6 +5245,10 @@
         config_externalDisplayPeakRefreshRate and config_externalDisplayPeakWidth are non-zero. -->
    <integer name="config_externalDisplayPeakHeight">0</integer>

    <!-- Enable synchronization of the displays refresh rates by applying the default low refresh
         rate. -->
    <bool name="config_refreshRateSynchronizationEnabled">false</bool>

    <!-- The display uses different gamma curves for different refresh rates. It's hard for panel
         vendors to tune the curves to have exact same brightness for different refresh rate. So
         flicker could be observed at switch time. The issue is worse at the gamma lower end.
+1 −0
Original line number Diff line number Diff line
@@ -4234,6 +4234,7 @@
  <java-symbol type="integer" name="config_externalDisplayPeakRefreshRate" />
  <java-symbol type="integer" name="config_externalDisplayPeakWidth" />
  <java-symbol type="integer" name="config_externalDisplayPeakHeight" />
  <java-symbol type="bool" name="config_refreshRateSynchronizationEnabled" />
  <java-symbol type="integer" name="config_defaultRefreshRateInZone" />
  <java-symbol type="array" name="config_brightnessThresholdsOfPeakRefreshRate" />
  <java-symbol type="array" name="config_ambientThresholdsOfPeakRefreshRate" />
+2 −1
Original line number Diff line number Diff line
@@ -500,6 +500,8 @@ public class DisplayDeviceConfig {

    public static final String DEFAULT_ID = "default";

    public static final int DEFAULT_LOW_REFRESH_RATE = 60;

    private static final float BRIGHTNESS_DEFAULT = 0.5f;
    private static final String ETC_DIR = "etc";
    private static final String DISPLAY_CONFIG_DIR = "displayconfig";
@@ -513,7 +515,6 @@ public class DisplayDeviceConfig {
    private static final int DEFAULT_PEAK_REFRESH_RATE = 0;
    private static final int DEFAULT_REFRESH_RATE = 60;
    private static final int DEFAULT_REFRESH_RATE_IN_HBM = 0;
    private static final int DEFAULT_LOW_REFRESH_RATE = 60;
    private static final int DEFAULT_HIGH_REFRESH_RATE = 0;
    private static final float[] DEFAULT_BRIGHTNESS_THRESHOLDS = new float[]{};

+11 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ public class DisplayManagerFlags {
            Flags.FLAG_ENABLE_MODE_LIMIT_FOR_EXTERNAL_DISPLAY,
            Flags::enableModeLimitForExternalDisplay);

    private final FlagState mDisplaysRefreshRatesSynchronizationState = new FlagState(
            Flags.FLAG_ENABLE_DISPLAYS_REFRESH_RATES_SYNCHRONIZATION,
            Flags::enableDisplaysRefreshRatesSynchronization);

    /** Returns whether connected display management is enabled or not. */
    public boolean isConnectedDisplayManagementEnabled() {
        return mConnectedDisplayManagementFlagState.isEnabled();
@@ -100,6 +104,13 @@ public class DisplayManagerFlags {
        return mExternalDisplayLimitModeState.isEnabled();
    }

    /**
     * @return Whether displays refresh rate synchronization is enabled.
     */
    public boolean isDisplaysRefreshRatesSynchronizationEnabled() {
        return mDisplaysRefreshRatesSynchronizationState.isEnabled();
    }

    private static class FlagState {

        private final String mName;
+8 −0
Original line number Diff line number Diff line
@@ -57,3 +57,11 @@ flag {
    bug: "242093547"
    is_fixed_read_only: true
}

flag {
    name: "enable_displays_refresh_rates_synchronization"
    namespace: "display_manager"
    description: "Enables synchronization of refresh rates across displays"
    bug: "294015845"
    is_fixed_read_only: true
}
Loading