static void
_removeVideoSurfaceFromDevice (VideoDevice * vd, VideoSurface * vs)
{
  VS_FLOW ("Fun %s in\n", __FUNCTION__);
  VideoSurface *pvs = DEVICE2HEADSURFACE (vd);
  if (pvs == vs) {
    SET_DEVICEHEADSURFACE (vd, NEXTSURFACE (vs));
  } else {
    while (NEXTSURFACE (pvs) != vs) {
      pvs = NEXTSURFACE (pvs);
    }
    SET_NEXTSURFACE (pvs, NEXTSURFACE (vs));
  }

}
void
_fillDeviceLocalAlphaBuf (VideoDevice * vd, char *lbuf0, char *lbuf1)
{
  VideoSurface *vs = DEVICE2HEADSURFACE (vd);
  int stride = vd->disp.right - vd->disp.left;
  while (vs) {
    int xoff, yoff;
    int width, height;
    int i;
    char *bufp0, *bufp1;
    xoff = vs->adjustdesrect.left - vd->disp.left;
    yoff = vs->adjustdesrect.top - vd->disp.top;
    width = vs->adjustdesrect.right - vs->adjustdesrect.left;
    height = vs->adjustdesrect.bottom - vs->adjustdesrect.top;
    bufp0 = lbuf0 + stride * yoff + xoff;
    bufp1 = lbuf1 + stride * yoff + xoff;
    for (i = 0; i < height; i++) {
      memset (bufp0, ALPHA_SOLID, width);
      bufp0 += stride;
      memset (bufp1, ALPHA_SOLID, width);
      bufp1 += stride;
    }
    vs = NEXTSURFACE (vs);
  };
}
static void
_addVideoSurface2Device (VideoDevice * vd, VideoSurface * vs)
{
  VS_FLOW ("Fun %s in\n", __FUNCTION__);
  VideoSurface *pvs = DEVICE2HEADSURFACE (vd);

  vs->nextid = 0;

  if (pvs) {
    while (NEXTSURFACE (pvs))
      pvs = NEXTSURFACE (pvs);
    SET_NEXTSURFACE (pvs, vs);
  } else {
    SET_DEVICEHEADSURFACE (vd, vs);
  }
}
예제 #4
0
VSFlowReturn 
_configMasterVideoLayer(void * vshandle, void  * config)
{
    VS_FLOW("Fun %s in\n", __FUNCTION__);

    VideoSurface * vs;
    vs = (VideoSurface *)vshandle;

    if (NEXTSURFACE(vs)==NULL)
        return VS_FLOW_OK;

    VideoDevice * vd=SURFACE2DEVICE(vs);
      
    VS_LOCK(gVSlock);

    _removeVideoSurfaceFromDevice(vd,vs);
    _addVideoSurface2Device(vd,vs);
    
    _refreshOnDevice(vd);

    VS_UNLOCK(gVSlock);
    VS_FLOW("Fun %s out\n", __FUNCTION__);

    return VS_FLOW_OK;
}
static void
_reconfigAllVideoSurfaces (VideoDevice * vd)
{
  VS_FLOW ("Fun %s in\n", __FUNCTION__);

  VideoSurface *vs = DEVICE2HEADSURFACE (vd);
  while (vs) {
    _initVSIPUTask (vs);
    vs = NEXTSURFACE (vs);
  }
}
예제 #6
0
/*=============================================================================
FUNCTION:           render2VideoSurface

DESCRIPTION:        This function render a new frame on specific video surface
                    It also will refresh other video surfaces in same video device
                    automaticallly.
==============================================================================*/
VSFlowReturn 
render2VideoSurface(void * vshandle, SourceFrame * frame, SourceFmt * srcfmt)
{
    VS_FLOW("Fun %s in\n", __FUNCTION__);

    VideoDevice * vd;
    VideoSurface * vsurface, *vsurface1;
    Updated updated;

    if ((vshandle==NULL)||(frame==NULL)){
        VS_ERROR("%s: parameters error!\n", __FUNCTION__);
        return VS_FLOW_PARAMETER_ERROR;
    }

    vsurface = (VideoSurface *)vshandle;

    if (vsurface->status == VS_STATUS_INVISIBLE) /* no need to render */
        return VS_FLOW_OK;
    
    vsurface->paddr = frame->paddr;
    vsurface->rendmask = 0;/*clear mask*/
    
    vd = SURFACE2DEVICE(vsurface);

    if (sem_trywait(gVSlock))
        return VS_FLOW_PENDING;



    vsurface1 = DEVICE2HEADSURFACE(vd);

    memset((void *)(&updated), 0, sizeof(Updated));
    while(vsurface1){
        if (_needRender(vsurface1, &updated, vd->renderidx)){
            _renderSuface(vsurface1, vd, &updated);
        }
        vsurface1 = NEXTSURFACE(vsurface1);
    };

    _FlipOnDevice(vd);

#if 0 /* no need to sleep anymore */
    if (vd->cnt>1)
        usleep(10000);
#endif

done:
    VS_UNLOCK(gVSlock);

    VS_FLOW("Fun %s out\n", __FUNCTION__);
    return VS_FLOW_OK;
err:
    return VS_FLOW_ERROR;
}
static void
_refreshOnDevice (VideoDevice * vd)
{
  VideoSurface *vs = DEVICE2HEADSURFACE (vd);
  Updated update;
  while (vs) {
    vs->rendmask = 0;
    _renderSuface (vs, vd, &update);
    vs = NEXTSURFACE (vs);
  }
  _FlipOnDevice (vd);
}
예제 #8
0
VSFlowReturn 
_configMasterVideoSurface(void * vshandle, void  * config)
{
    VS_FLOW("Fun %s in\n", __FUNCTION__);
    DestinationFmt * des = (DestinationFmt *)config;

    VideoSurface * vs;
    SourceFmt src;
    vs = (VideoSurface *)vshandle;

    VS_MESSAGE("reconfig win from "WIN_FMT" to "WIN_FMT"\n", WIN_ARGS(&vs->desfmt.rect), WIN_ARGS(&des->rect));

    VideoDevice * vd=SURFACE2DEVICE(vs);

      
    VS_LOCK(gVSlock);
    vs->desfmt = *des;
    vs->outside = _adjustDestRect(&des->rect, vd);
    vs->adjustdesrect = des->rect;

    if (NEXTSURFACE(vs)){
        _removeVideoSurfaceFromDevice(vd,vs);
        _addVideoSurface2Device(vd,vs);
    }

    _clearVideoSurfaceBackground(vd, vs);
    
    if (_checkOnDevice(vd)){
        _reconfigAllVideoSurfaces(vd);
        _setDeviceConfig(vd);
    }else{
        _initVSIPUTask(vs);
    }
    if (vd->setalpha)
        _setAlpha(vd);

    vs->mainframeupdate = 1;

    if (vs->itask.mode){
        _reconfigSubFrameBuffer(vs);
        vs->mainframeupdate = 0;
        _updateSubFrame(vs);
    }

    
    _refreshOnDevice(vd);

    VS_UNLOCK(gVSlock);
    VS_FLOW("Fun %s out\n", __FUNCTION__);

    return VS_FLOW_OK;

}