hwc: Add dynamic fps support for PPP
Some apps like camera and video are running on
less fps than panel refresh rate. Hence setting
dynamic fps will help in reducing BW voting for PPP.
Change-Id: I236fe96d5c6547044083774388887638f9e32958
diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp
index 9783896..f205dfc 100644
--- a/libcopybit/copybit.cpp
+++ b/libcopybit/copybit.cpp
@@ -64,6 +64,7 @@
int relFence;
struct mdp_buf_sync sync;
struct blitReq list;
+ uint8_t dynamic_fps;
};
/**
@@ -219,6 +220,7 @@
struct mdp_blit_req *req, int flags)
{
req->alpha = dev->mAlpha;
+ req->fps = dev->dynamic_fps;
req->transp_mask = MDP_TRANSP_NOP;
req->flags = dev->mFlags | flags;
// check if we are blitting to f/b
@@ -250,7 +252,7 @@
for (unsigned int i=0 ; i<l->count ; i++) {
ALOGE("%d: src={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
" dst={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
- " flags=%08x"
+ " flags=%08x, fps=%d"
,
i,
l->req[i].src.width,
@@ -267,7 +269,8 @@
l->req[i].dst_rect.y,
l->req[i].dst_rect.w,
l->req[i].dst_rect.h,
- l->req[i].flags
+ l->req[i].flags,
+ l->req[i].fps
);
}
#endif
@@ -315,6 +318,9 @@
if (value >= 256) value = 255;
ctx->mAlpha = (uint8_t)value;
break;
+ case COPYBIT_DYNAMIC_FPS:
+ ctx->dynamic_fps = (uint8_t)value;
+ break;
case COPYBIT_DITHER:
if (value == COPYBIT_ENABLE) {
ctx->mFlags |= MDP_DITHER;
@@ -747,6 +753,9 @@
ctx->device.flush_get_fence = flush_get_fence;
ctx->device.clear = clear_copybit;
ctx->mAlpha = MDP_ALPHA_NOP;
+ //dynamic_fps is zero means default
+ //panel refresh rate for driver.
+ ctx->dynamic_fps = 0;
ctx->mFlags = 0;
ctx->sync.flags = 0;
ctx->relFence = -1;
diff --git a/libcopybit/copybit.h b/libcopybit/copybit.h
index 6428023..1fc17ed 100644
--- a/libcopybit/copybit.h
+++ b/libcopybit/copybit.h
@@ -79,6 +79,7 @@
/* FB height */
COPYBIT_FRAMEBUFFER_HEIGHT = 8,
COPYBIT_FG_LAYER = 9,
+ COPYBIT_DYNAMIC_FPS = 10,
};
/* values for copybit_set_parameter(COPYBIT_TRANSFORM) */
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 68f168a..5b8d05d 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -810,7 +810,13 @@
ALOGE("%s: Framebuffer handle is NULL", __FUNCTION__);
return -1;
}
-
+ uint32_t dynamic_fps = 0;
+#ifdef DYNAMIC_FPS
+ MetaData_t *mdata = hnd ? (MetaData_t *)hnd->base_metadata : NULL;
+ if (mdata && (mdata->operation & UPDATE_REFRESH_RATE)) {
+ dynamic_fps = roundOff(mdata->refreshrate);
+ }
+#endif
// Set the copybit source:
copybit_image_t src;
src.w = getWidth(hnd);
@@ -1025,6 +1031,7 @@
layerTransform);
//TODO: once, we are able to read layer alpha, update this
copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255);
+ copybit->set_parameter(copybit, COPYBIT_DYNAMIC_FPS, dynamic_fps);
copybit->set_parameter(copybit, COPYBIT_BLEND_MODE,
layer->blending);
copybit->set_parameter(copybit, COPYBIT_DITHER,