bool MdpCtrl::validateAndSet(MdpCtrl* mdpCtrlArray[], const int& count,
        const int& fbFd) {
    mdp_overlay* ovArray[count];
    memset(&ovArray, 0, sizeof(ovArray));

    for(int i = 0; i < count; i++) {
        ovArray[i] = &mdpCtrlArray[i]->mOVInfo;
    }

    struct mdp_overlay_list list;
    memset(&list, 0, sizeof(struct mdp_overlay_list));
    list.num_overlays = count;
    list.overlay_list = ovArray;

   int (*fnProgramScale)(struct mdp_overlay_list *) =
        Overlay::getFnProgramScale();
    if(fnProgramScale) {
        fnProgramScale(&list);
    }

    // Error value is based on file errno-base.h
    // 0 - indicates no error.
    int errVal = mdp_wrapper::validateAndSet(fbFd, list);
    if(errVal) {
        /* No dump for failure due to insufficient resource */
        if(errVal != E2BIG) {
            mdp_wrapper::dump("Bad ov dump: ",
                *list.overlay_list[list.processed_overlays]);
        }
        return false;
    }

    return true;
}
Esempio n. 2
0
bool MdpCtrl::validateAndSet(MdpCtrl* mdpCtrlArray[], const int& count,
        const int& fbFd) {
    mdp_overlay* ovArray[count];
    memset(&ovArray, 0, sizeof(ovArray));

    uint8_t max_horz_deci = 0, max_vert_deci = 0;

    // Decimation factor for the left and right pipe differs, when there is a
    // one pixel difference in the dst width of right pipe and the left pipe.
    // libscalar returns a failure as it expects decimation on both the pipe
    // to be same. So compare the decimation factor on both the pipes and assign
    // the maximum of it.
    for(int i = 0; i < count; i++) {
        mdp_overlay *ov_current = &mdpCtrlArray[i]->mOVInfo;
        for(int j = i + 1; j < count; j++) {
            mdp_overlay *ov_next = &mdpCtrlArray[j]->mOVInfo;
            if(ov_current->z_order == ov_next->z_order) {
                max_horz_deci = utils::max(ov_current->horz_deci,
                                           ov_next->horz_deci);
                max_vert_deci = utils::max(ov_current->vert_deci,
                                           ov_next->vert_deci);

                ov_current->horz_deci = max_horz_deci;
                ov_next->horz_deci = max_horz_deci;
                ov_current->vert_deci = max_vert_deci;
                ov_next->vert_deci = max_vert_deci;
                break;
            }
        }
        ovArray[i] = ov_current;
    }

    struct mdp_overlay_list list;
    memset(&list, 0, sizeof(struct mdp_overlay_list));
    list.num_overlays = count;
    list.overlay_list = ovArray;

   int (*fnProgramScale)(struct mdp_overlay_list *) =
        Overlay::getFnProgramScale();
    if(fnProgramScale) {
        fnProgramScale(&list);
    }

    // Error value is based on file errno-base.h
    // 0 - indicates no error.
    int errVal = mdp_wrapper::validateAndSet(fbFd, list);
    if(errVal) {
        /* No dump for failure due to insufficient resource */
        if(errVal != E2BIG) {
            mdp_wrapper::dump("Bad ov dump: ",
                *list.overlay_list[list.processed_overlays]);
        }
        return false;
    }

    return true;
}
bool MdpCtrl::validateAndSet(MdpCtrl* mdpCtrlArray[], const int& count,
        const int& fbFd) {
    mdp_overlay* ovArray[count];
    memset(&ovArray, 0, sizeof(ovArray));

    uint8_t max_horz_deci = 0, max_vert_deci = 0;

    // Decimation factor for the left and right pipe differs, when there is a
    // one pixel difference in the dst width of right pipe and the left pipe.
    // libscalar returns a failure as it expects decimation on both the pipe
    // to be same. So compare the decimation factor on both the pipes and assign
    // the maximum of it.
    for(int i = 0; i < count; i++) {
        mdp_overlay *ov_current = &mdpCtrlArray[i]->mOVInfo;
        for(int j = i + 1; j < count; j++) {
            mdp_overlay *ov_next = &mdpCtrlArray[j]->mOVInfo;
            if(ov_current->z_order == ov_next->z_order) {
                max_horz_deci = utils::max(ov_current->horz_deci,
                                           ov_next->horz_deci);
                max_vert_deci = utils::max(ov_current->vert_deci,
                                           ov_next->vert_deci);

                ov_current->horz_deci = max_horz_deci;
                ov_next->horz_deci = max_horz_deci;
                ov_current->vert_deci = max_vert_deci;
                ov_next->vert_deci = max_vert_deci;
                break;
            }
        }
        ovArray[i] = ov_current;
    }

    struct mdp_overlay_list list;
    memset(&list, 0, sizeof(struct mdp_overlay_list));
    list.num_overlays = count;
    list.overlay_list = ovArray;

   int (*fnProgramScale)(struct mdp_overlay_list *) =
        Overlay::getFnProgramScale();
    if(fnProgramScale) {
        fnProgramScale(&list);
    }

    // Error value is based on file errno-base.h
    // 0 - indicates no error.
    int errVal = mdp_wrapper::validateAndSet(fbFd, list);
    if(errVal) {
        /* No dump for failure due to insufficient resource */
        if(errVal != E2BIG && errVal != EBADSLT) {
            //ENODEV is returned when the driver cannot satisfy a pipe request.
            //This could happen if previous round's UNSET hasn't been commited
            //yet, either because of a missed vsync or because of difference in
            //vsyncs of primary and external. This is expected during
            //transition scenarios, but should be considered fatal if seen
            //continuously.
            if(errVal == ENODEV) {
                ALOGW("%s: Pipe unavailable. Likely previous UNSET pending. "
                    "Fatal if seen continuously.", __FUNCTION__);
            } else {
                ALOGE("%s failed, error %d: %s", __FUNCTION__, errVal,
                        strerror(errVal));
                mdp_wrapper::dump("Bad ov dump: ",
                        *list.overlay_list[list.processed_overlays]);
            }
        }
        return false;
    }

    return true;
}