//Cache stats, figure out the state, config overlay bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list) { sIsModeOn = false; if((!ctx->mMDP.hasOverlay) || (qdutils::MDPVersion::getInstance().getMDPVersion() <= qdutils::MDP_V4_0)) { ALOGD_IF(VIDEO_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__); return false; } if(sYuvLayerIndex == -1) { return false; } chooseState(ctx); //if the state chosen above is CLOSED, skip this block. if(sState != ovutils::OV_CLOSED) { hwc_layer_1_t *yuvLayer = &list->hwLayers[sYuvLayerIndex]; hwc_layer_1_t *ccLayer = NULL; if(sCCLayerIndex != -1) ccLayer = &list->hwLayers[sCCLayerIndex]; if(configure(ctx, yuvLayer, ccLayer)) { markFlags(&list->hwLayers[sYuvLayerIndex]); sIsModeOn = true; } } ALOGD_IF(VIDEO_DEBUG, "%s: stats: yuvCount = %d, yuvIndex = %d," "IsYuvLayerSkip = %d, ccLayerIndex = %d, IsModeOn = %d", __FUNCTION__, sYuvCount, sYuvLayerIndex, sIsYuvLayerSkip, sCCLayerIndex, sIsModeOn); return sIsModeOn; }
//Cache stats, figure out the state, config overlay bool ExtOnly::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list) { sIsModeOn = false; if(!ctx->mMDP.hasOverlay) { ALOGD_IF(EXTONLY_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__); return false; } if(sExtIndex == -1) { return false; } chooseState(ctx); //if the state chosen above is CLOSED, skip this block. if(sState != ovutils::OV_CLOSED) { hwc_layer_1_t *extLayer = &list->hwLayers[sExtIndex]; if(configure(ctx, extLayer)) { markFlags(extLayer); sIsModeOn = true; } } ALOGD_IF(EXTONLY_DEBUG, "%s: stats: extCount = %d, extIndex = %d," "IsExtBlock = %d, IsModeOn = %d", __func__, sExtCount, sExtIndex, sIsExtBlock, sIsModeOn); return sIsModeOn; }
//Cache stats, figure out the state, config overlay bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) { sIsModeOn = false; if(!ctx->hasOverlay) { ALOGD_IF(VIDEO_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__); return false; } chooseState(ctx); //if the state chosen above is CLOSED, skip this block. if(sState != ovutils::OV_CLOSED) { if(configure(ctx, &list->hwLayers[sYuvLayerIndex])) { markFlags(&list->hwLayers[sYuvLayerIndex]); } } ALOGD_IF(VIDEO_DEBUG, "%s: stats: yuvCount = %d, yuvIndex = %d," "IsModeOn = %d, IsSkipLayer = %d", __FUNCTION__, sYuvCount, sYuvLayerIndex, sIsModeOn, sIsLayerSkip); return sIsModeOn; }
Sequence & DecodableModel::choose(Sequence & h, Sequence & path, int i, int size) const { assert(path.size() == h.size()); int state = chooseFirstState(); if (((i - 1) < (int) path.size()) && (i - 1) >= 0) state = path[i - 1]; int l = 0; while ((int) h.size() < (i + size)) { chooseObservation(h, i + l, state); for (int k = i + l; k < (int) h.size(); k++, l++) { if (k < (int) path.size()) path[k] = state; else path.push_back(state); } state = chooseState(state); // next state } h.resize(size); path.resize(size); return h; }
//Cache stats, figure out the state, config overlay bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list, int dpy) { int yuvIndex = ctx->listStats[dpy].yuvIndex; sIsModeOn[dpy] = false; if(!ctx->mMDP.hasOverlay) { ALOGD_IF(VIDEO_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__); return false; } if(yuvIndex == -1 || ctx->listStats[dpy].yuvCount != 1) { return false; } //index guaranteed to be not -1 at this point hwc_layer_1_t *yuvLayer = &list->hwLayers[yuvIndex]; private_handle_t *hnd = (private_handle_t *)yuvLayer->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; } } chooseState(ctx, dpy, yuvLayer); if(configure(ctx, dpy, yuvLayer)) { markFlags(yuvLayer); sIsModeOn[dpy] = true; } return sIsModeOn[dpy]; }