diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp index c3610951..2f24684a 100644 --- a/libgralloc/alloc_controller.cpp +++ b/libgralloc/alloc_controller.cpp @@ -294,6 +294,7 @@ int IonController::allocate(alloc_data& data, int usage) // for targets/OEMs which do not need HW level protection // do not set ion secure flag & MM heap. Fallback to IOMMU heap. ionFlags |= ION_HEAP(ION_IOMMU_HEAP_ID); + data.allocType |= private_handle_t::PRIV_FLAGS_PROTECTED_BUFFER; } } else if(usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) { //MM Heap is exclusively a secure heap. diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h index 75b8349c..d64914e1 100644 --- a/libgralloc/gralloc_priv.h +++ b/libgralloc/gralloc_priv.h @@ -193,6 +193,8 @@ struct private_handle_t : public native_handle { PRIV_FLAGS_NOT_MAPPED = 0x00001000, // Display on external only PRIV_FLAGS_EXTERNAL_ONLY = 0x00002000, + // Set by HWC for protected non secure buffers + PRIV_FLAGS_PROTECTED_BUFFER = 0x00004000, PRIV_FLAGS_VIDEO_ENCODER = 0x00010000, PRIV_FLAGS_CAMERA_WRITE = 0x00020000, PRIV_FLAGS_CAMERA_READ = 0x00040000, diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp index 43ae916c..3e160729 100644 --- a/libhwcomposer/hwc_fbupdate.cpp +++ b/libhwcomposer/hwc_fbupdate.cpp @@ -157,6 +157,8 @@ bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *lis } ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; + ovutils::setMdpFlags(mdpFlags, + ovutils::OV_MDP_SMP_FORCE_ALLOC); ovutils::eZorder zOrder = static_cast(fbZorder); hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); @@ -280,6 +282,8 @@ bool FBUpdateSplit::configure(hwc_context_t *ctx, overlay::Overlay& ov = *(ctx->mOverlay); ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; + ovutils::setMdpFlags(mdpFlags, + ovutils::OV_MDP_SMP_FORCE_ALLOC); ovutils::eZorder zOrder = static_cast(fbZorder); ovutils::eTransform orient = static_cast(layer->transform); @@ -442,6 +446,8 @@ bool FBSrcSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, mTileEnabled)); ovutils::eMdpFlags mdpFlags = OV_MDP_BLEND_FG_PREMULT; + ovutils::setMdpFlags(mdpFlags, + ovutils::OV_MDP_SMP_FORCE_ALLOC); ovutils::eZorder zOrder = static_cast(fbZorder); ovutils::PipeArgs parg(mdpFlags, diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp index 2904e6fe..a1e240a6 100644 --- a/libhwcomposer/hwc_mdpcomp.cpp +++ b/libhwcomposer/hwc_mdpcomp.cpp @@ -2061,7 +2061,7 @@ int MDPCompNonSplit::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, PipeLayerPair& PipeLayerPair) { MdpPipeInfoNonSplit& mdp_info = *(static_cast(PipeLayerPair.pipeInfo)); - eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION; + eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE; eZorder zOrder = static_cast(mdp_info.zOrder); eDest dest = mdp_info.index; @@ -2117,7 +2117,7 @@ int MDPCompNonSplit::configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, MdpYUVPipeInfo& mdp_info = *(static_cast(PipeLayerPair.pipeInfo)); eZorder zOrder = static_cast(mdp_info.zOrder); - eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION; + eMdpFlags mdpFlagsL = ovutils::OV_MDP_FLAGS_NONE; eDest lDest = mdp_info.lIndex; eDest rDest = mdp_info.rIndex; @@ -2349,7 +2349,7 @@ int MDPCompSplit::configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, MdpYUVPipeInfo& mdp_info = *(static_cast(PipeLayerPair.pipeInfo)); eZorder zOrder = static_cast(mdp_info.zOrder); - eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION; + eMdpFlags mdpFlagsL = ovutils::OV_MDP_FLAGS_NONE; eDest lDest = mdp_info.lIndex; eDest rDest = mdp_info.rIndex; @@ -2369,7 +2369,7 @@ int MDPCompSplit::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, MdpPipeInfoSplit& mdp_info = *(static_cast(PipeLayerPair.pipeInfo)); eZorder zOrder = static_cast(mdp_info.zOrder); - eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION; + eMdpFlags mdpFlagsL = ovutils::OV_MDP_FLAGS_NONE; eDest lDest = mdp_info.lIndex; eDest rDest = mdp_info.rIndex; @@ -2616,7 +2616,7 @@ int MDPCompSrcSplit::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, calcExtDisplayPosition(ctx, hnd, mDpy, crop, dst, transform, orient); int downscale = getRotDownscale(ctx, layer); - eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION; + eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE; setMdpFlags(ctx, layer, mdpFlags, downscale, transform); if(lDest != OV_INVALID && rDest != OV_INVALID) { diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp index 1f3e99a5..d28f397d 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -1648,6 +1648,13 @@ void setMdpFlags(hwc_context_t *ctx, hwc_layer_1_t *layer, if(isSecureBuffer(hnd)) { ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_SECURE_OVERLAY_SESSION); + ovutils::setMdpFlags(mdpFlags, + ovutils::OV_MDP_SMP_FORCE_ALLOC); + } + + if(isProtectedBuffer(hnd)) { + ovutils::setMdpFlags(mdpFlags, + ovutils::OV_MDP_SMP_FORCE_ALLOC); } if(isSecureDisplayBuffer(hnd)) { diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h index 68bc741a..39b90ff9 100644 --- a/libhwcomposer/hwc_utils.h +++ b/libhwcomposer/hwc_utils.h @@ -458,6 +458,12 @@ static inline bool isSecureBuffer(const private_handle_t* hnd) { return (hnd && (private_handle_t::PRIV_FLAGS_SECURE_BUFFER & hnd->flags)); } +// Returns true if the buffer is protected +static inline bool isProtectedBuffer(const private_handle_t* hnd) { + return (hnd && (private_handle_t::PRIV_FLAGS_PROTECTED_BUFFER & hnd->flags)); +} + + static inline bool isTileRendered(const private_handle_t* hnd) { return (hnd && (private_handle_t::PRIV_FLAGS_TILE_RENDERED & hnd->flags)); } diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h index 2b8e3030..1f67a7fd 100644 --- a/liboverlay/overlayUtils.h +++ b/liboverlay/overlayUtils.h @@ -223,7 +223,6 @@ enum eMdpFlags { OV_MDP_SECURE_OVERLAY_SESSION = MDP_SECURE_OVERLAY_SESSION, OV_MDP_SECURE_DISPLAY_OVERLAY_SESSION = MDP_SECURE_DISPLAY_OVERLAY_SESSION, OV_MDP_SOURCE_ROTATED_90 = MDP_SOURCE_ROTATED_90, - OV_MDP_BACKEND_COMPOSITION = MDP_BACKEND_COMPOSITION, OV_MDP_BLEND_FG_PREMULT = MDP_BLEND_FG_PREMULT, OV_MDP_FLIP_H = MDP_FLIP_LR, OV_MDP_FLIP_V = MDP_FLIP_UD, @@ -232,6 +231,7 @@ enum eMdpFlags { OV_MDSS_MDP_BWC_EN = MDP_BWC_EN, OV_MDSS_MDP_DUAL_PIPE = MDSS_MDP_DUAL_PIPE, OV_MDP_SOLID_FILL = MDP_SOLID_FILL, + OV_MDP_SMP_FORCE_ALLOC = MDP_SMP_FORCE_ALLOC, }; enum eZorder {