Fix secure flags value in overlay.

Remove the member "secure" from overlay_buf_info.
This member was used to indicate secure content and this info was
later extracted out into existing flags. Now we use the same flags,
right from hwc to mark secure content.

The member above had junk value, since it wasnt initialized.
This caused, normal videos to fail with IOMMU. Removal of the member and
marking the existing flags fixes this.

Change-Id: Ib5a2439fde7114c20e478fbee5e4d276680c316a
This commit is contained in:
Saurabh Shah 2012-03-07 18:10:16 -08:00 committed by Andrew Sutherland
parent 050ef1b611
commit 10d91371c2
4 changed files with 20 additions and 23 deletions

View File

@ -238,7 +238,7 @@ int ExtDispOnly::prepare(hwc_context_t *ctx, hwc_layer_t *layer, int index,
info.height = sourceCrop.bottom - sourceCrop.top;
info.format = hnd->format;
info.size = hnd->size;
info.secure = false;
const int fbnum = ctx->mHDMIEnabled; //HDMI or WFD
const bool isFg = false;

View File

@ -743,8 +743,6 @@ static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer, const int flag
info.height = hnd->height;
info.format = hnd->format;
info.size = hnd->size;
info.secure = (hnd->flags &
private_handle_t::PRIV_FLAGS_SECURE_BUFFER)? true:false;
int hdmiConnected = 0;
@ -1150,6 +1148,9 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) {
} else if (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO) && (yuvBufferCount == 1)) {
setVideoOverlayStatusInGralloc(ctx, true);
int flags = WAIT_FOR_VSYNC;
flags |= (hnd->flags &
private_handle_t::PRIV_FLAGS_SECURE_BUFFER)?
SECURE_OVERLAY_SESSION : 0;
flags |= (1 == list->numHwLayers) ? DISABLE_FRAMEBUFFER_FETCH : 0;
if (!isValidDestination(hwcModule->fbDevice, list->hwLayers[i].displayFrame)) {
list->hwLayers[i].compositionType = HWC_FRAMEBUFFER;
@ -1189,6 +1190,9 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) {
setVideoOverlayStatusInGralloc(ctx, true);
int flags = WAIT_FOR_VSYNC;
flags |= (1 == list->numHwLayers) ? DISABLE_FRAMEBUFFER_FETCH : 0;
flags |= (hnd->flags &
private_handle_t::PRIV_FLAGS_SECURE_BUFFER)?
SECURE_OVERLAY_SESSION : 0;
#ifdef USE_OVERLAY
if(prepareOverlay(ctx, &(list->hwLayers[i]), flags) == 0) {
list->hwLayers[i].compositionType = HWC_USE_OVERLAY;

View File

@ -407,7 +407,6 @@ Overlay::Overlay() : mChannelUP(false), mExternalDisplay(false),
mSrcOrientation(0) {
mOVBufferInfo.width = mOVBufferInfo.height = 0;
mOVBufferInfo.format = mOVBufferInfo.size = 0;
mOVBufferInfo.secure = false;
}
Overlay::~Overlay() {
@ -427,7 +426,6 @@ bool Overlay::startChannel(const overlay_buffer_info& info, int fbnum,
unsigned int format3D, int channel,
int flags, int num_buffers) {
int zorder = 0;
int format = getColorFormat(info.format);
mCroppedSrcWidth = info.width;
mCroppedSrcHeight = info.height;
if (format3D)
@ -435,17 +433,17 @@ bool Overlay::startChannel(const overlay_buffer_info& info, int fbnum,
if (mState == -1)
mState = OV_UI_MIRROR_TV;
mChannelUP = objOvCtrlChannel[channel].startControlChannel(info.width,
info.height, format, fbnum,
mChannelUP = objOvCtrlChannel[channel].startControlChannel(info, fbnum,
norot, uichannel,
format3D, zorder, flags);
if (!mChannelUP) {
LOGE("startChannel for fb%d failed", fbnum);
return mChannelUP;
}
bool secure = flags & SECURE_OVERLAY_SESSION;
objOvCtrlChannel[channel].setSize(info.size);
return objOvDataChannel[channel].startDataChannel(objOvCtrlChannel[channel], fbnum,
norot, info.secure, uichannel, num_buffers);
norot, secure, uichannel, num_buffers);
}
bool Overlay::closeChannel() {
@ -1250,11 +1248,6 @@ bool OverlayControlChannel::setOverlayInformation(const overlay_buffer_info& inf
mOVInfo.transp_mask = 0xffffffff;
}
mOVInfo.flags = 0;
if (info.secure) {
flags |= SECURE_OVERLAY_SESSION;
} else {
flags &= ~SECURE_OVERLAY_SESSION;
}
setInformationFromFlags(flags, mOVInfo);
mOVInfo.dpp.sharp_strength = 0;
return true;
@ -1399,26 +1392,27 @@ bool OverlayControlChannel::updateOverlaySource(const overlay_buffer_info& info,
return startOVRotatorSessions(ovBufInfo, UPDATE_REQUEST);
}
bool OverlayControlChannel::startControlChannel(int w, int h,
int format, int fbnum, bool norot,
bool OverlayControlChannel::startControlChannel(const overlay_buffer_info& info,
int fbnum, bool norot,
bool uichannel,
unsigned int format3D, int zorder,
int flags) {
int colorFormat = getColorFormat(info.format);
mNoRot = norot;
mFormat = format;
mFormat = colorFormat;
mUIChannel = uichannel;
mFBNum = fbnum;
fb_fix_screeninfo finfo;
fb_var_screeninfo vinfo;
int hw_format;
int colorFormat = format;
// The interlace mask is part of the HAL_PIXEL_FORMAT_YV12 value. Add
// an explicit check for the format
if (isInterlacedContent(format)) {
if (isInterlacedContent(colorFormat)) {
flags |= MDP_DEINTERLACE;
// Get the actual format
colorFormat = format ^ HAL_PIXEL_FORMAT_INTERLACE;
colorFormat = colorFormat ^ HAL_PIXEL_FORMAT_INTERLACE;
}
hw_format = get_mdp_format(colorFormat);
if (hw_format < 0) {
@ -1443,8 +1437,8 @@ bool OverlayControlChannel::startControlChannel(int w, int h,
return false;
overlay_buffer_info ovBufInfo;
ovBufInfo.width = w;
ovBufInfo.height = h;
ovBufInfo.width = info.width;
ovBufInfo.height = info.height;
ovBufInfo.format = hw_format;
if (!setOverlayInformation(ovBufInfo, zorder, flags, NEW_REQUEST))
return false;

View File

@ -142,7 +142,6 @@ struct overlay_buffer_info {
int height;
int format;
int size;
bool secure;
};
using android::Mutex;
@ -314,7 +313,7 @@ enum {
public:
OverlayControlChannel();
~OverlayControlChannel();
bool startControlChannel(int w, int h, int format,
bool startControlChannel(const overlay_buffer_info& info,
int fbnum, bool norot = false,
bool uichannel = false,
unsigned int format3D = 0, int zorder = 0,