hwcomposer: In Mdss,secure content policy applies to layer buffer
In Mdss, mSecureMode is never set, instead the secure content flag
has been set/unset on each layer buffer.
Change-Id: I3283533c11206e189ce70dbc84776b2cff3a909d
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 9cc5c24..7a3adbb 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -226,6 +226,12 @@
return false;
}
+bool isSecureModePolicy(int mdpVersion) {
+ if (mdpVersion < qdutils::MDSS_V5)
+ return true;
+ else
+ return false;
+}
//Crops source buffer against destination and FB boundaries
void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 0005582..5316347 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -130,6 +130,7 @@
void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
const int fbWidth, const int fbHeight, int orient);
bool isSecuring(hwc_context_t* ctx);
+bool isSecureModePolicy(int mdpVersion);
bool isExternalActive(hwc_context_t* ctx);
//Helper function to dump logs
diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp
index 16d0c89..13f3cdd 100644
--- a/libhwcomposer/hwc_video.cpp
+++ b/libhwcomposer/hwc_video.cpp
@@ -52,19 +52,20 @@
//index guaranteed to be not -1 at this point
hwc_layer_1_t *layer = &list->hwLayers[yuvIndex];
-
- private_handle_t *hnd = (private_handle_t *)layer->handle;
- if(ctx->mSecureMode) {
- if (! isSecureBuffer(hnd)) {
- ALOGD_IF(VIDEO_DEBUG, "%s: Handle non-secure video layer"
- "during secure playback gracefully", __FUNCTION__);
- return false;
- }
- } else {
- if (isSecureBuffer(hnd)) {
- ALOGD_IF(VIDEO_DEBUG, "%s: Handle secure video layer"
- "during non-secure playback gracefully", __FUNCTION__);
- return false;
+ if (isSecureModePolicy(ctx->mMDP.version)) {
+ private_handle_t *hnd = (private_handle_t *)layer->handle;
+ if(ctx->mSecureMode) {
+ if (! isSecureBuffer(hnd)) {
+ ALOGD_IF(VIDEO_DEBUG, "%s: Handle non-secure video layer"
+ "during secure playback gracefully", __FUNCTION__);
+ return false;
+ }
+ } else {
+ if (isSecureBuffer(hnd)) {
+ ALOGD_IF(VIDEO_DEBUG, "%s: Handle secure video layer"
+ "during non-secure playback gracefully", __FUNCTION__);
+ return false;
+ }
}
}
if(configure(ctx, dpy, layer)) {