hwc_overlay

来源:互联网 发布:程序员没有女朋友组图 编辑:程序博客网 时间:2024/06/05 12:03

1,

/* this layer is to be drawn into the framebuffer by SurfaceFlinger */

HWC_FRAMEBUFFER;



 /* this layer will be handled in the HWC */
HWC_OVERLAY = 1,


2,

android_vendor_asus_tilapia /proprietary /hwcomposer.tegra3.so


3, 三星驱动

https://bitbucket.org/seandroid/device-samsung-crespo/src/c932ac3b9f8a53a5c433dc7d3cfa2fb5d45a7eb9/libhwcomposer/SecHWC.cpp?at=seandroid

static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list){    struct hwc_context_t* ctx = (struct hwc_context_t*)dev;    int overlay_win_cnt = 0;    int compositionType = 0;    int ret;    //if geometry is not changed, there is no need to do any work here    if( !list || (!(list->flags & HWC_GEOMETRY_CHANGED)))        return 0;    //all the windows are free here....    for (int i = 0; i < NUM_OF_WIN; i++) {        ctx->win[i].status = HWC_WIN_FREE;        ctx->win[i].buf_index = 0;    }    ctx->num_of_hwc_layer = 0;    ctx->num_of_fb_layer = 0;    LOGV("%s:: hwc_prepare list->numHwLayers %d", __func__, list->numHwLayers);    for (int i = 0; i < list->numHwLayers ; i++) {        hwc_layer_t* cur = &list->hwLayers[i];        if (overlay_win_cnt < NUM_OF_WIN) {            compositionType = get_hwc_compos_decision(cur);            if (compositionType == HWC_FRAMEBUFFER) {                cur->compositionType = HWC_FRAMEBUFFER;                ctx->num_of_fb_layer++;            } else {                ret = assign_overlay_window(ctx, cur, overlay_win_cnt, i);                if (ret != 0) {                    cur->compositionType = HWC_FRAMEBUFFER;                    ctx->num_of_fb_layer++;                    continue;                }                cur->compositionType = HWC_OVERLAY;                cur->hints = HWC_HINT_CLEAR_FB;                overlay_win_cnt++;                ctx->num_of_hwc_layer++;            }        } else {            cur->compositionType = HWC_FRAMEBUFFER;            ctx->num_of_fb_layer++;        }    }    if(list->numHwLayers != (ctx->num_of_fb_layer + ctx->num_of_hwc_layer))        LOGV("%s:: numHwLayers %d num_of_fb_layer %d num_of_hwc_layer %d ",                __func__, list->numHwLayers, ctx->num_of_fb_layer,                ctx->num_of_hwc_layer);    if (overlay_win_cnt < NUM_OF_WIN) {        //turn off the free windows        for (int i = overlay_win_cnt; i < NUM_OF_WIN; i++) {            window_hide(&ctx->win[i]);            reset_win_rect_info(&ctx->win[i]);        }    }    return 0;}
static int get_hwc_compos_decision(hwc_layer_t* cur){    if(cur->flags & HWC_SKIP_LAYER || !cur->handle) {        LOGV("%s::is_skip_layer %d cur->handle %x",                __func__, cur->flags & HWC_SKIP_LAYER, (uint32_t)cur->handle);        return HWC_FRAMEBUFFER;    }    IMG_native_handle_t *prev_handle = (IMG_native_handle_t *)(cur->handle);    int compositionType = HWC_FRAMEBUFFER;    /* check here....if we have any resolution constraints */    if (((cur->sourceCrop.right - cur->sourceCrop.left) < 16) ||        ((cur->sourceCrop.bottom - cur->sourceCrop.top) < 8))        return compositionType;    if ((cur->transform == HAL_TRANSFORM_ROT_90) ||        (cur->transform == HAL_TRANSFORM_ROT_270)) {        if(((cur->displayFrame.right - cur->displayFrame.left) < 4)||           ((cur->displayFrame.bottom - cur->displayFrame.top) < 8))            return compositionType;        } else if (((cur->displayFrame.right - cur->displayFrame.left) < 8) ||                   ((cur->displayFrame.bottom - cur->displayFrame.top) < 4))         return compositionType;    if((prev_handle->usage & GRALLOC_USAGE_PHYS_CONTIG) &&       (cur->blending == HWC_BLENDING_NONE))        compositionType = HWC_OVERLAY;    else        compositionType = HWC_FRAMEBUFFER;    LOGV("%s::compositionType %d bpp %d format %x usage %x",            __func__,compositionType, prev_handle->uiBpp, prev_handle->iFormat,            prev_handle->usage & GRALLOC_USAGE_PHYS_CONTIG);    return  compositionType;}
 




0 0
原创粉丝点击