hwc: vpuclient: vpuClient implementation
Vpuclient is the client side for VFM in hwc. It follows the
similar pattern of prepare and draw. It has 2 step prepare
including: setVpuSession and prepare. The setVpuSession function
passes all the layers from the SF list to VFM, which marks
the layers that it can support. After this, the layer
allocation/configuration is done, and finally in prepare the
allocated pipes are passed down to VFM. The draw function
passes the handle to the VFM to draw the video layer.
Change-Id: I5d8795de35ed98716f7fa4cd48506b488cb3cb5d
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index b45a7cd..431757d 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -180,6 +180,7 @@
ATRACE_CALL();
hwc_context_t* ctx = (hwc_context_t*)(dev);
const int dpy = HWC_DISPLAY_PRIMARY;
+ bool fbComp = false;
if (LIKELY(list && list->numHwLayers > 1) &&
ctx->dpyAttr[dpy].isActive) {
@@ -188,13 +189,19 @@
reset_layer_prop(ctx, dpy, list->numHwLayers - 1);
setListStats(ctx, list, dpy);
+
+ if (ctx->mVPUClient == NULL)
+ fbComp = (ctx->mMDPComp[dpy]->prepare(ctx, list) < 0);
#ifdef VPU_TARGET
- ctx->mVPUClient->prepare(ctx, list);
+ else
+ fbComp = (ctx->mVPUClient->prepare(ctx, dpy, list) < 0);
#endif
- if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
+
+ if (fbComp) {
const int fbZ = 0;
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
}
+
if (ctx->mMDP.version < qdutils::MDP_V4_0) {
if(ctx->mCopyBit[dpy])
ctx->mCopyBit[dpy]->prepare(ctx, list, dpy);
@@ -487,13 +494,15 @@
if(ctx->mHwcDebug[dpy])
ctx->mHwcDebug[dpy]->dumpLayers(list);
- if (!ctx->mMDPComp[dpy]->draw(ctx, list)) {
+ if (ctx->mVPUClient != NULL) {
+#ifdef VPU_TARGET
+ ctx->mVPUClient->predraw(ctx, dpy, list);
+#endif
+ }
+ else if (!ctx->mMDPComp[dpy]->draw(ctx, list)) {
ALOGE("%s: MDPComp draw failed", __FUNCTION__);
ret = -1;
}
-#ifdef VPU_TARGET
- ctx->mVPUClient->draw(ctx, list);
-#endif
//TODO We dont check for SKIP flag on this layer because we need PAN
//always. Last layer is always FB
@@ -514,6 +523,11 @@
ALOGE("%s: display commit fail for %d dpy!", __FUNCTION__, dpy);
ret = -1;
}
+
+#ifdef VPU_TARGET
+ if (ctx->mVPUClient != NULL)
+ ctx->mVPUClient->draw(ctx, dpy, list);
+#endif
}
closeAcquireFds(list);