Loading services/core/java/com/android/server/display/DisplayModeDirector.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -635,7 +635,9 @@ public class DisplayModeDirector { // which is within the render rate range // which is within the render rate range // - 90hz is not in range as none of the even divisors (i.e. 90, 45, 30) // - 90hz is not in range as none of the even divisors (i.e. 90, 45, 30) // fall within the acceptable render range. // fall within the acceptable render range. final int divisor = (int) Math.ceil(physicalRefreshRate / summary.maxRenderFrameRate); final int divisor = (int) Math.ceil((physicalRefreshRate / summary.maxRenderFrameRate) - FLOAT_TOLERANCE); float adjustedPhysicalRefreshRate = physicalRefreshRate / divisor; float adjustedPhysicalRefreshRate = physicalRefreshRate / divisor; if (adjustedPhysicalRefreshRate < (summary.minRenderFrameRate - FLOAT_TOLERANCE)) { if (adjustedPhysicalRefreshRate < (summary.minRenderFrameRate - FLOAT_TOLERANCE)) { if (mLoggingEnabled) { if (mLoggingEnabled) { Loading services/tests/servicestests/src/com/android/server/display/DisplayModeDirectorTest.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -298,6 +298,18 @@ public class DisplayModeDirectorTest { assertThat(desiredSpecs.primary.physical.min).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.physical.min).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.physical.max).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.physical.max).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.baseModeId).isEqualTo(60); assertThat(desiredSpecs.baseModeId).isEqualTo(60); votes.clear(); votes.put(Vote.PRIORITY_USER_SETTING_PEAK_RENDER_FRAME_RATE, Vote.forRenderFrameRates(0, 60 - error)); votes.put(Vote.PRIORITY_USER_SETTING_MIN_RENDER_FRAME_RATE, Vote.forRenderFrameRates(60 + error, Float.POSITIVE_INFINITY)); director.injectVotesByDisplay(votesByDisplay); desiredSpecs = director.getDesiredDisplayModeSpecs(DISPLAY_ID); assertThat(desiredSpecs.primary.render.min).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.render.max).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.baseModeId).isEqualTo(60); } } @Test @Test Loading Loading
services/core/java/com/android/server/display/DisplayModeDirector.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -635,7 +635,9 @@ public class DisplayModeDirector { // which is within the render rate range // which is within the render rate range // - 90hz is not in range as none of the even divisors (i.e. 90, 45, 30) // - 90hz is not in range as none of the even divisors (i.e. 90, 45, 30) // fall within the acceptable render range. // fall within the acceptable render range. final int divisor = (int) Math.ceil(physicalRefreshRate / summary.maxRenderFrameRate); final int divisor = (int) Math.ceil((physicalRefreshRate / summary.maxRenderFrameRate) - FLOAT_TOLERANCE); float adjustedPhysicalRefreshRate = physicalRefreshRate / divisor; float adjustedPhysicalRefreshRate = physicalRefreshRate / divisor; if (adjustedPhysicalRefreshRate < (summary.minRenderFrameRate - FLOAT_TOLERANCE)) { if (adjustedPhysicalRefreshRate < (summary.minRenderFrameRate - FLOAT_TOLERANCE)) { if (mLoggingEnabled) { if (mLoggingEnabled) { Loading
services/tests/servicestests/src/com/android/server/display/DisplayModeDirectorTest.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -298,6 +298,18 @@ public class DisplayModeDirectorTest { assertThat(desiredSpecs.primary.physical.min).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.physical.min).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.physical.max).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.physical.max).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.baseModeId).isEqualTo(60); assertThat(desiredSpecs.baseModeId).isEqualTo(60); votes.clear(); votes.put(Vote.PRIORITY_USER_SETTING_PEAK_RENDER_FRAME_RATE, Vote.forRenderFrameRates(0, 60 - error)); votes.put(Vote.PRIORITY_USER_SETTING_MIN_RENDER_FRAME_RATE, Vote.forRenderFrameRates(60 + error, Float.POSITIVE_INFINITY)); director.injectVotesByDisplay(votesByDisplay); desiredSpecs = director.getDesiredDisplayModeSpecs(DISPLAY_ID); assertThat(desiredSpecs.primary.render.min).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.primary.render.max).isWithin(FLOAT_TOLERANCE).of(60); assertThat(desiredSpecs.baseModeId).isEqualTo(60); } } @Test @Test Loading