hwc: vds: Configure WB as secure if output buf. handle is secure
When we receive a buffer handle that is secure, we configure WB as
secure; otherwise we continue as normal.
Change-Id: I497e257352c103c5da7ac2dc3fd4d7fe0e0b3953
diff --git a/libhwcomposer/hwc_virtual.cpp b/libhwcomposer/hwc_virtual.cpp
index 600ba8d..6ae4e42 100644
--- a/libhwcomposer/hwc_virtual.cpp
+++ b/libhwcomposer/hwc_virtual.cpp
@@ -78,6 +78,11 @@
delete ctx->mMDPComp[dpy];
ctx->mMDPComp[dpy] = NULL;
}
+ // We reset the WB session to non-secure when the virtual display
+ // has been disconnected.
+ if(!Writeback::getInstance()->setSecure(false)) {
+ ALOGE("Failure while attempting to reset WB session.");
+ }
}
}
@@ -136,6 +141,15 @@
Writeback::getInstance()->setOutputFormat(
utils::getMdpFormat(format));
+ // Configure WB as secure if the output buffer handle is secure.
+ if(isSecureBuffer(ohnd)){
+ if(! Writeback::getInstance()->setSecure(true))
+ {
+ ALOGE("Failed to set WB as secure for virtual display");
+ return false;
+ }
+ }
+
int fd = -1; //FenceFD from the Copybit
hwc_sync(ctx, list, dpy, fd);