# HG changeset patch # User zdar # Date 1062963755 0 # Node ID 10f45897d65390e0f61986b04929136e0dbf928d # Parent 0f2182b3261fc02b518d05d408d3fa792ae09f05 Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image. diff -r 0f2182b3261f -r 10f45897d653 libvo/vo_directfb2.c --- a/libvo/vo_directfb2.c Sun Sep 07 18:58:56 2003 +0000 +++ b/libvo/vo_directfb2.c Sun Sep 07 19:42:35 2003 +0000 @@ -237,8 +237,10 @@ show_help = 1; vo_subdevice += 4; break; - } - } + } else { + vo_subdevice++; + } + } if (show_help) { mp_msg( MSGT_VO, MSGL_ERR, @@ -612,6 +614,25 @@ } } // vm end +// just for sure clear primary layer +#if DIRECTFBVERSION > 913 + ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer); + if (ret==DFB_OK) { + ret = layer->GetSurface(layer,&primary); + if (ret==DFB_OK) { + primary->Clear(primary,0,0,0,0xff); + ret = primary->Flip(primary,NULL,0); + if (ret==DFB_OK) { + primary->Clear(primary,0,0,0,0xff); + } + primary->Release(primary); + } + primary=NULL; + layer->Release(layer); + } + layer=NULL; +#endif + // find best layer mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - looking for suitable layer\n"); @@ -1184,6 +1205,19 @@ mpi->width=width; mpi->stride[0]=pitch; } + + // center image + + if (!frame) { + if(mpi->flags&MP_IMGFLAG_PLANAR){ + mpi->planes[0]= dst + yoffset * pitch + xoffset; + mpi->planes[1]+= (yoffset * pitch) >> 2 + xoffset >> 1; + mpi->planes[2]+= (yoffset * pitch) >> 2 + xoffset >> 1; + } else { + mpi->planes[0]=dst + yoffset * pitch + xoffset * (mpi->bpp >> 3); + } + } + mpi->flags|=MP_IMGFLAG_DIRECT; // if (verbose) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n"); return VO_TRUE; @@ -1201,6 +1235,8 @@ void *srcp; unsigned int p; +// if (verbose) printf("DirectFB: draw_slice entered\n"); + unlock(); if (frame) { @@ -1315,6 +1351,7 @@ memcpy(dst+i*pitch,src+i*mpi->stride[0],p); } + if (pixel_format == DSPF_YV12) { dst += pitch*height; @@ -1353,7 +1390,9 @@ unlock(); } else { +// I had to disable native directfb blit because it wasn't working under some conditions :-( +/* dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED; dsc.preallocated[0].data = mpi->planes[0]; dsc.preallocated[0].pitch = mpi->stride[0]; @@ -1374,6 +1413,23 @@ DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset)); }; tmp->Release(tmp); +*/ + + unsigned int pitch; + void *dst; + +// if (verbose) printf("DirectFB: Put_image - non planar branch\n"); + if (frame) { + DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); + framelocked = 1; + mem2agpcpy_pic(dst,mpi->planes[0] + mpi->y * mpi->stride[0] + mpi->x * (mpi->bpp >> 3) ,mpi->w * (mpi->bpp >> 3),mpi->h,pitch,mpi->stride[0]); + } else { + DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch)); + primarylocked = 1; + mem2agpcpy_pic(dst + yoffset * pitch + xoffset * (mpi->bpp >> 3),mpi->planes[0] + mpi->y * mpi->stride[0] + mpi->x * (mpi->bpp >> 3) ,mpi->w * (mpi->bpp >> 3),mpi->h,pitch,mpi->stride[0]); + }; + unlock(); + } return VO_TRUE; }