hwc: Add support for Secure display
- Identify secure display layer in the hwc_list - Need to set both SECURE_OVERLAY and SECURE_DISPLAY flags for the secure display layer - Disable idle timeout for secure display usecase, as GPU should not be accessing secure display layer Change-Id: I555910db77c466b5e103b24b4f0ec7f47bb210a5
This commit is contained in:
committed by
Arun Kumar K.R
parent
164f6d038e
commit
ba713389c2
@@ -146,6 +146,10 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage,
|
||||
flags |= private_handle_t::PRIV_FLAGS_HW_TEXTURE;
|
||||
}
|
||||
|
||||
if(usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) {
|
||||
flags |= private_handle_t::PRIV_FLAGS_SECURE_DISPLAY;
|
||||
}
|
||||
|
||||
flags |= data.allocType;
|
||||
int eBaseAddr = int(eData.base) + eData.offset;
|
||||
private_handle_t *hnd = new private_handle_t(data.fd, size, flags,
|
||||
|
||||
@@ -70,6 +70,9 @@ enum {
|
||||
|
||||
/* CAMERA heap is a carveout heap for camera, is not secured*/
|
||||
GRALLOC_USAGE_PRIVATE_CAMERA_HEAP = 0x00400000,
|
||||
|
||||
/* This flag is used for SECURE display usecase */
|
||||
GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY = 0x00800000,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -162,6 +165,7 @@ struct private_handle_t : public native_handle {
|
||||
PRIV_FLAGS_ITU_R_601 = 0x00200000,
|
||||
PRIV_FLAGS_ITU_R_601_FR = 0x00400000,
|
||||
PRIV_FLAGS_ITU_R_709 = 0x00800000,
|
||||
PRIV_FLAGS_SECURE_DISPLAY = 0x01000000,
|
||||
};
|
||||
|
||||
// file-descriptors
|
||||
|
||||
@@ -480,7 +480,7 @@ bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
|
||||
|
||||
const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
|
||||
|
||||
if(sIdleFallBack) {
|
||||
if(sIdleFallBack && !ctx->listStats[mDpy].secureUI) {
|
||||
ALOGD_IF(isDebug(), "%s: Idle fallback dpy %d",__FUNCTION__, mDpy);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -710,6 +710,7 @@ void setListStats(hwc_context_t *ctx,
|
||||
ctx->listStats[dpy].isDisplayAnimating = false;
|
||||
ctx->listStats[dpy].roi = ovutils::Dim(0, 0,
|
||||
(int)ctx->dpyAttr[dpy].xres, (int)ctx->dpyAttr[dpy].yres);
|
||||
ctx->listStats[dpy].secureUI = false;
|
||||
|
||||
optimizeLayerRects(ctx, list, dpy);
|
||||
|
||||
@@ -721,6 +722,9 @@ void setListStats(hwc_context_t *ctx,
|
||||
if (layer->flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
|
||||
ctx->listStats[dpy].isDisplayAnimating = true;
|
||||
}
|
||||
if(isSecureDisplayBuffer(hnd)) {
|
||||
ctx->listStats[dpy].secureUI = true;
|
||||
}
|
||||
#endif
|
||||
// continue if number of app layers exceeds MAX_NUM_APP_LAYERS
|
||||
if(ctx->listStats[dpy].numAppLayers > MAX_NUM_APP_LAYERS)
|
||||
@@ -1246,6 +1250,13 @@ void setMdpFlags(hwc_layer_1_t *layer,
|
||||
}
|
||||
}
|
||||
|
||||
if(isSecureDisplayBuffer(hnd)) {
|
||||
// Secure display needs both SECURE_OVERLAY and SECURE_DISPLAY_OV
|
||||
ovutils::setMdpFlags(mdpFlags,
|
||||
ovutils::OV_MDP_SECURE_OVERLAY_SESSION);
|
||||
ovutils::setMdpFlags(mdpFlags,
|
||||
ovutils::OV_MDP_SECURE_DISPLAY_OVERLAY_SESSION);
|
||||
}
|
||||
//No 90 component and no rot-downscale then flips done by MDP
|
||||
//If we use rot then it might as well do flips
|
||||
if(!(transform & HWC_TRANSFORM_ROT_90) && !rotDownscale) {
|
||||
|
||||
@@ -102,6 +102,7 @@ struct ListStats {
|
||||
// This will be set to true during animation, otherwise false.
|
||||
bool isDisplayAnimating;
|
||||
ovutils::Dim roi;
|
||||
bool secureUI; // Secure display layer
|
||||
};
|
||||
|
||||
struct LayerProp {
|
||||
@@ -304,6 +305,11 @@ static inline bool isExtCC(const private_handle_t* hnd) {
|
||||
return (hnd && (hnd->flags & private_handle_t::PRIV_FLAGS_EXTERNAL_CC));
|
||||
}
|
||||
|
||||
//Return true if the buffer is intended for Secure Display
|
||||
static inline bool isSecureDisplayBuffer(const private_handle_t* hnd) {
|
||||
return (hnd && (hnd->flags & private_handle_t::PRIV_FLAGS_SECURE_DISPLAY));
|
||||
}
|
||||
|
||||
template<typename T> inline T max(T a, T b) { return (a > b) ? a : b; }
|
||||
template<typename T> inline T min(T a, T b) { return (a < b) ? a : b; }
|
||||
|
||||
|
||||
@@ -261,6 +261,7 @@ enum eMdpFlags {
|
||||
OV_MDP_PIPE_FORCE_DMA = MDP_OV_PIPE_FORCE_DMA,
|
||||
OV_MDP_DEINTERLACE = MDP_DEINTERLACE,
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user