hwc: Enable sync-pt for rotator on B-family

Enable sync-pt for rotator on B-family. The already existing
MSMFB_BUF_SYNC ioctl is used, with an extra member for session_id
from rotator.

Change-Id: Ib0ef6b1bc5cf1e6437090a217d7f731a3440f84b
This commit is contained in:
Saurabh Shah
2013-06-28 11:33:25 -07:00
committed by Gerrit - the friendly Code Review server
parent dd29d9f238
commit e9b5a8f04d
3 changed files with 27 additions and 36 deletions

View File

@@ -903,16 +903,11 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
int count = 0; int count = 0;
int releaseFd = -1; int releaseFd = -1;
int fbFd = -1; int fbFd = -1;
int rotFd = -1;
bool swapzero = false; bool swapzero = false;
int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion(); int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
struct mdp_buf_sync data; struct mdp_buf_sync data;
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
//Until B-family supports sync for rotator
#ifdef MDSS_TARGET
data.flags = MDP_BUF_SYNC_FLAG_WAIT;
#endif
data.acq_fen_fd = acquireFd; data.acq_fen_fd = acquireFd;
data.rel_fen_fd = &releaseFd; data.rel_fen_fd = &releaseFd;
@@ -921,34 +916,37 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
if(atoi(property) == 0) if(atoi(property) == 0)
swapzero = true; swapzero = true;
} }
bool isExtAnimating = false; bool isExtAnimating = false;
if(dpy) if(dpy)
isExtAnimating = ctx->listStats[dpy].isDisplayAnimating; isExtAnimating = ctx->listStats[dpy].isDisplayAnimating;
//Send acquireFenceFds to rotator //Send acquireFenceFds to rotator
#ifdef MDSS_TARGET
//TODO B-family
#else
//A-family
int rotFd = ctx->mRotMgr->getRotDevFd();
struct msm_rotator_buf_sync rotData;
for(uint32_t i = 0; i < ctx->mLayerRotMap[dpy]->getCount(); i++) { for(uint32_t i = 0; i < ctx->mLayerRotMap[dpy]->getCount(); i++) {
int rotFd = ctx->mRotMgr->getRotDevFd();
int rotReleaseFd = -1;
struct mdp_buf_sync rotData;
memset(&rotData, 0, sizeof(rotData)); memset(&rotData, 0, sizeof(rotData));
int& acquireFenceFd = rotData.acq_fen_fd =
ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd; &ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd;
rotData.acq_fen_fd = acquireFenceFd; rotData.rel_fen_fd = &rotReleaseFd; //driver to populate this
rotData.session_id = ctx->mLayerRotMap[dpy]->getRot(i)->getSessId(); rotData.session_id = ctx->mLayerRotMap[dpy]->getRot(i)->getSessId();
ioctl(rotFd, MSM_ROTATOR_IOCTL_BUFFER_SYNC, &rotData); int ret = 0;
close(acquireFenceFd); ret = ioctl(rotFd, MSMFB_BUFFER_SYNC, &rotData);
//For MDP to wait on. if(ret < 0) {
acquireFenceFd = dup(rotData.rel_fen_fd); ALOGE("%s: ioctl MSMFB_BUFFER_SYNC failed for rot sync, err=%s",
//A buffer is free to be used by producer as soon as its copied to __FUNCTION__, strerror(errno));
//rotator. } else {
ctx->mLayerRotMap[dpy]->getLayer(i)->releaseFenceFd = close(ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd);
rotData.rel_fen_fd; //For MDP to wait on.
ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd =
dup(rotReleaseFd);
//A buffer is free to be used by producer as soon as its copied to
//rotator
ctx->mLayerRotMap[dpy]->getLayer(i)->releaseFenceFd =
rotReleaseFd;
}
} }
#endif
//Accumulate acquireFenceFds for MDP //Accumulate acquireFenceFds for MDP
for(uint32_t i = 0; i < list->numHwLayers; i++) { for(uint32_t i = 0; i < list->numHwLayers; i++) {
@@ -1022,14 +1020,8 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
if (ctx->mCopyBit[dpy]) if (ctx->mCopyBit[dpy])
ctx->mCopyBit[dpy]->setReleaseFd(releaseFd); ctx->mCopyBit[dpy]->setReleaseFd(releaseFd);
#ifdef MDSS_TARGET
//TODO When B is implemented remove #ifdefs from here
//The API called applies to RotMem buffers
#else
//A-family
//Signals when MDP finishes reading rotator buffers. //Signals when MDP finishes reading rotator buffers.
ctx->mLayerRotMap[dpy]->setReleaseFd(releaseFd); ctx->mLayerRotMap[dpy]->setReleaseFd(releaseFd);
#endif
// if external is animating, close the relaseFd // if external is animating, close the relaseFd
if(isExtAnimating) { if(isExtAnimating) {

View File

@@ -174,11 +174,10 @@ void RotMgr::getDump(char *buf, size_t len) {
} }
int RotMgr::getRotDevFd() { int RotMgr::getRotDevFd() {
//2nd check just in case if(mRotDevFd < 0 && Rotator::getRotatorHwType() == Rotator::TYPE_MDSS) {
if(mRotDevFd < 0 && Rotator::getRotatorHwType() == Rotator::TYPE_MDP) { mRotDevFd = ::open("/dev/graphics/fb0", O_RDWR, 0);
mRotDevFd = ::open("/dev/msm_rotator", O_RDWR, 0);
if(mRotDevFd < 0) { if(mRotDevFd < 0) {
ALOGE("%s failed to open rotator device", __FUNCTION__); ALOGE("%s failed to open fb0", __FUNCTION__);
} }
} }
return mRotDevFd; return mRotDevFd;

View File

@@ -237,11 +237,11 @@ public:
* Expects a NULL terminated buffer of big enough size. * Expects a NULL terminated buffer of big enough size.
*/ */
void getDump(char *buf, size_t len); void getDump(char *buf, size_t len);
int getRotDevFd(); //Called on A-fam only int getRotDevFd();
private: private:
overlay::Rotator *mRot[MAX_ROT_SESS]; overlay::Rotator *mRot[MAX_ROT_SESS];
int mUseCount; int mUseCount;
int mRotDevFd; //A-fam int mRotDevFd;
}; };