hwc: Populate frame rate in rotator set
- Populate frame_rate in rotator set, so that driver
can vote for honest BW for rotator based on frame rate.
- If metadata contains source fps, frame_rate will be set
to source fps, else it will be set to primary refresh rate.
- frame_rate will be populated for primary with
source fps from metada, only when secondary is not active.
Change-Id: Icaacd0ed67ec09591d31868591680d2e86fe54a2
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 5de3081..7bc4d23 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1922,7 +1922,8 @@
int configRotator(Rotator *rot, Whf& whf,
hwc_rect_t& crop, const eMdpFlags& mdpFlags,
- const eTransform& orient, const int& downscale) {
+ const eTransform& orient, const int& downscale,
+ const uint32_t& frame_rate) {
// Fix alignments for TILED format
if(whf.format == MDP_Y_CRCB_H2V2_TILE ||
@@ -1939,6 +1940,7 @@
rot->setCrop(rotCrop);
}
+ rot->setFrameRate(frame_rate);
rot->setFlags(mdpFlags);
rot->setTransform(orient);
rot->setDownscale(downscale);
@@ -2226,8 +2228,14 @@
ctx->mLayerRotMap[dpy]->add(layer, *rot);
BwcPM::setBwc(ctx, dpy, hnd, crop, dst, transform, downscale,
mdpFlags);
+ uint32_t frame_rate = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].refreshRate;
+ if(!dpy && !isSecondaryConnected(ctx)) {
+ if(metadata && (metadata->operation & UPDATE_REFRESH_RATE))
+ frame_rate = metadata->refreshrate;
+ }
//Configure rotator for pre-rotation
- if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale) < 0) {
+ if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale,
+ frame_rate) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__);
return -1;
}
@@ -2335,8 +2343,14 @@
(*rot) = ctx->mRotMgr->getNext();
if((*rot) == NULL) return -1;
ctx->mLayerRotMap[dpy]->add(layer, *rot);
+ uint32_t frame_rate = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].refreshRate;
+ if(!dpy && !isSecondaryConnected(ctx)) {
+ if(metadata && (metadata->operation & UPDATE_REFRESH_RATE))
+ frame_rate = metadata->refreshrate;
+ }
//Configure rotator for pre-rotation
- if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale) < 0) {
+ if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale,
+ frame_rate) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__);
return -1;
}
@@ -2459,8 +2473,14 @@
(*rot) = ctx->mRotMgr->getNext();
if((*rot) == NULL) return -1;
ctx->mLayerRotMap[dpy]->add(layer, *rot);
+ uint32_t frame_rate = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].refreshRate;
+ if(!dpy && !isSecondaryConnected(ctx)) {
+ if(metadata && (metadata->operation & UPDATE_REFRESH_RATE))
+ frame_rate = metadata->refreshrate;
+ }
//Configure rotator for pre-rotation
- if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale) < 0) {
+ if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale,
+ frame_rate) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__);
return -1;
}
@@ -2577,8 +2597,14 @@
(*rot) = ctx->mRotMgr->getNext();
if((*rot) == NULL) return -1;
ctx->mLayerRotMap[dpy]->add(layer, *rot);
+ uint32_t frame_rate = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].refreshRate;
+ if(!dpy && !isSecondaryConnected(ctx)) {
+ if(metadata && (metadata->operation & UPDATE_REFRESH_RATE))
+ frame_rate = metadata->refreshrate;
+ }
//Configure rotator for pre-rotation
- if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale) < 0) {
+ if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale,
+ frame_rate) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__);
return -1;
}