bool Hwcomposer::commit(size_t numDisplays,
                         hwc_display_contents_1_t **displays)
{
    bool ret = true;

    log.v("commit display count %d\n", numDisplays);

    //Mutex::Autolock _l(mLock);

    if (!initCheck())
        return false;

    if (!numDisplays || !displays) {
        log.e("commit: invalid parameters");
        return false;
    }

    void *hwContexts = getContexts();
    int count = 0;
    if (!hwContexts) {
        log.e("Hwcomposer::commit: invalid hwContexts");
        return false;
    }

    for (size_t i = 0; i < numDisplays; i++) {
        IDisplayDevice *device = mDisplayDevices.itemAt(i);
        if (!device) {
            log.v("commit: device %d doesn't exist", i);
            continue;
        }

        if (!device->isConnected()) {
            log.v("commit: device %d is disconnected", i);
            continue;
        }

        ret = device->commit(displays[i], hwContexts, count);
        if (ret == false) {
            log.e("commit: failed to do commit for device %d", i);
            continue;
        }
    }

    // commit hwContexts to hardware
    ret = commitContexts(hwContexts, count);
    if (ret == false) {
        log.e("Hwcomposer::commit: failed to commit hwContexts");
        return false;
    }

    return ret;
}
Beispiel #2
0
void CompositeViewer::renderingTraversals( bool needMakeCurrentInThisThread )
{
    Contexts contexts;
    getContexts( contexts );

    bool doneMakeCurrentInThisThread = false;

    for( Contexts::iterator itr = contexts.begin( );
            itr != contexts.end( ); ++itr )
    {
        if(( *itr )->valid( ))
        {
            if( needMakeCurrentInThisThread )
            {
                doneMakeCurrentInThisThread = true;
                makeCurrent( *itr );
            }
            ( *itr )->runOperations( );
        }
    }

    if( doneMakeCurrentInThisThread )
        releaseContext( );
}