Skip to content

Commit 222357f

Browse files
committed
workaround to set the WM refresh rate to 48 Hz for tuna devices only
this is TEMPORARY until we can do this properly. Bug: 5572464 Change-Id: I6537706d636a83a4a50e2900d6b829dd89b6f245
1 parent 2ccc47b commit 222357f

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,6 @@ public class WindowManagerService extends IWindowManager.Stub
226226
*/
227227
static final int DEFAULT_FADE_IN_OUT_DURATION = 400;
228228

229-
/**
230-
* Frame rate. TODO: Replace with Display.getRefreshRate() when that is reliable.
231-
*/
232-
static final int FRAME_RATE = 48;
233-
234229
/**
235230
* If true, the window manager will do its own custom freezing and general
236231
* management of the screen during rotation.
@@ -8687,7 +8682,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
86878682
if (needRelayout) {
86888683
requestAnimationLocked(0);
86898684
} else if (animating) {
8690-
requestAnimationLocked(currentTime+(1000/FRAME_RATE)-SystemClock.uptimeMillis());
8685+
final int refreshTimeUs = (int)(1000 / mDisplay.getRefreshRate());
8686+
requestAnimationLocked(currentTime + refreshTimeUs - SystemClock.uptimeMillis());
86918687
}
86928688

86938689
// Finally update all input windows now that the window changes have stabilized.

services/surfaceflinger/Android.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
3030
LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE
3131
endif
3232

33+
ifneq (,$(findstring $(TARGET_DEVICE),tuna toro maguro))
34+
LOCAL_CFLAGS += -DREFRESH_RATE=48
35+
endif
36+
3337

3438
LOCAL_SHARED_LIBRARIES := \
3539
libcutils \

services/surfaceflinger/DisplayHardware/DisplayHardware.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ void DisplayHardware::init(uint32_t dpy)
141141
mDpiY = mNativeWindow->ydpi;
142142
mRefreshRate = fbDev->fps;
143143

144+
145+
/* FIXME: this is a temporary HACK until we are able to report the refresh rate
146+
* properly from the HAL. The WindowManagerService now relies on this value.
147+
*/
148+
#ifndef REFRESH_RATE
149+
mRefreshRate = fbDev->fps;
150+
#else
151+
mRefreshRate = REFRESH_RATE;
152+
#warning "refresh rate set via makefile to REFRESH_RATE"
153+
#endif
154+
144155
EGLint w, h, dummy;
145156
EGLint numConfigs=0;
146157
EGLSurface surface;

0 commit comments

Comments
 (0)