hwc/overlay: Implement rotator caching

* A non-updating layer requiring rotation, can make use of
the older rotator buffer written when the layer got first
updated, rather than invoking a new rotator cycle.

* A rotator play is avoided in cases where incoming layer
buffer fd, offset, whf, src-rect, dst-rect, etc are similar
to that of the previous input layer to the rotator.

* For ex: In a usecase where video layer updates happen at
30fps and all other asynchrous UI updates happen at 60fps,
instead of the traditional 60 calls of rotator play per sec,
we now do only 30 thereby saving rotator bandwidth.

* Property "debug.rotcache.disable" can be used to disable
this feature.

Change-Id: I1d1c352c63007b7e0b4fee40882086ccd2f5a4aa
This commit is contained in:
Raj Kamal
2014-08-05 18:52:49 +05:30
committed by Gerrit - the friendly Code Review server
parent ee75c10fa6
commit bd3bdc6d03
6 changed files with 143 additions and 17 deletions

View File

@@ -1324,7 +1324,9 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
rotData.acq_fen_fd_cnt = 1; //1 ioctl call per rot session
}
int ret = 0;
ret = ioctl(rotFd, MSMFB_BUFFER_SYNC, &rotData);
if(not ctx->mLayerRotMap[dpy]->isRotCached(i))
ret = ioctl(rotFd, MSMFB_BUFFER_SYNC, &rotData);
if(ret < 0) {
ALOGE("%s: ioctl MSMFB_BUFFER_SYNC failed for rot sync, err=%s",
__FUNCTION__, strerror(errno));
@@ -2260,9 +2262,27 @@ void LayerRotMap::clear() {
reset();
}
bool LayerRotMap::isRotCached(uint32_t index) const {
overlay::Rotator* rot = getRot(index);
hwc_layer_1_t* layer = getLayer(index);
if(rot and layer and layer->handle) {
private_handle_t *hnd = (private_handle_t *)(layer->handle);
return (rot->isRotCached(hnd->fd,(uint32_t)(hnd->offset)));
}
return false;
}
void LayerRotMap::setReleaseFd(const int& fence) {
for(uint32_t i = 0; i < mCount; i++) {
mRot[i]->setReleaseFd(dup(fence));
if(mRot[i] and mLayer[i] and mLayer[i]->handle) {
/* Ensure that none of the above (Rotator-instance,
* layer and layer-handle) are NULL*/
if(isRotCached(i))
mRot[i]->setPrevBufReleaseFd(dup(fence));
else
mRot[i]->setCurrBufReleaseFd(dup(fence));
}
}
}