hwc: Trigger dynamic refresh-rate change for more usecases
* Until now it's been the case that refresh-rates were set to
the standard values of 24, 30, 48 and 60 for video playback
usecases. Since of the most panel vendors can only support
refresh-rates above 45, in many of the use-cases with fps < 45,
dynamic change in panel refresh rate doesn't happen.
* To address this, following are the changes done:
1. Refresh-rate will no longer be limited to standard values
for video-playback usecases and any value above the
minfpsSupported which is advertised by the mdss driver will
be considered.
2. If the fps of the use-case is 'x' and it falls less than
minfpsSupported, a multiple of it 'k*x' will be considered as
the new refresh-rate, provided k*x < 60. If
abs(k*x - stdRefreshRate) < 2, set the refresh-rate to the
standard value rather than k*x.
* With the above two optimizations in place, if the panel has
a minfpsSupported value of 45, and if the use-case fps is 12,
the new refresh-rate would be set as 12 * 4(= 48) instead of 60
which had been the case.
* The above two optimizations will result in dynamic change in
refresh-rate happening more often, in local video and streaming
use-cases and will help in improving DOU(Days Of Use) metric.
Change-Id: I2051e4d91280867135bf592e8f561911adcb6228
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index f0f8e77..84d4fde 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -352,6 +352,8 @@
void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
hwc_rect_t& inRect, hwc_rect_t& outRect);
+uint32_t getRefreshRate(hwc_context_t* ctx, uint32_t requestedRefreshRate);
+
uint32_t roundOff(uint32_t refreshRate);
void setRefreshRate(hwc_context_t *ctx, int dpy, uint32_t refreshRate);