comparison libvo/vo_directfb2.c @ 10840:10f45897d653

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.
author zdar
date Sun, 07 Sep 2003 19:42:35 +0000
parents 7901f7d6e0eb
children 6e35326c742f
comparison
equal deleted inserted replaced
10839:0f2182b3261f 10840:10f45897d653
235 opt_no = 0; 235 opt_no = 0;
236 } else if (!strncmp(vo_subdevice, "help", 4)) { 236 } else if (!strncmp(vo_subdevice, "help", 4)) {
237 show_help = 1; 237 show_help = 1;
238 vo_subdevice += 4; 238 vo_subdevice += 4;
239 break; 239 break;
240 } 240 } else {
241 } 241 vo_subdevice++;
242 }
243 }
242 244
243 if (show_help) { 245 if (show_help) {
244 mp_msg( MSGT_VO, MSGL_ERR, 246 mp_msg( MSGT_VO, MSGL_ERR,
245 "\nvo_dfbmga command line help:\n" 247 "\nvo_dfbmga command line help:\n"
246 "Example: mplayer -vo directfb:layer=1:buffermode=single\n" 248 "Example: mplayer -vo directfb:layer=1:buffermode=single\n"
609 } 611 }
610 } 612 }
611 } 613 }
612 } 614 }
613 } // vm end 615 } // vm end
616
617 // just for sure clear primary layer
618 #if DIRECTFBVERSION > 913
619 ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer);
620 if (ret==DFB_OK) {
621 ret = layer->GetSurface(layer,&primary);
622 if (ret==DFB_OK) {
623 primary->Clear(primary,0,0,0,0xff);
624 ret = primary->Flip(primary,NULL,0);
625 if (ret==DFB_OK) {
626 primary->Clear(primary,0,0,0,0xff);
627 }
628 primary->Release(primary);
629 }
630 primary=NULL;
631 layer->Release(layer);
632 }
633 layer=NULL;
634 #endif
614 635
615 // find best layer 636 // find best layer
616 637
617 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - looking for suitable layer\n"); 638 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - looking for suitable layer\n");
618 params.format=format; 639 params.format=format;
1182 //YUY2 and RGB formats 1203 //YUY2 and RGB formats
1183 mpi->planes[0]=dst; 1204 mpi->planes[0]=dst;
1184 mpi->width=width; 1205 mpi->width=width;
1185 mpi->stride[0]=pitch; 1206 mpi->stride[0]=pitch;
1186 } 1207 }
1208
1209 // center image
1210
1211 if (!frame) {
1212 if(mpi->flags&MP_IMGFLAG_PLANAR){
1213 mpi->planes[0]= dst + yoffset * pitch + xoffset;
1214 mpi->planes[1]+= (yoffset * pitch) >> 2 + xoffset >> 1;
1215 mpi->planes[2]+= (yoffset * pitch) >> 2 + xoffset >> 1;
1216 } else {
1217 mpi->planes[0]=dst + yoffset * pitch + xoffset * (mpi->bpp >> 3);
1218 }
1219 }
1220
1187 mpi->flags|=MP_IMGFLAG_DIRECT; 1221 mpi->flags|=MP_IMGFLAG_DIRECT;
1188 // if (verbose) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n"); 1222 // if (verbose) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
1189 return VO_TRUE; 1223 return VO_TRUE;
1190 1224
1191 } 1225 }
1198 unsigned int pitch; 1232 unsigned int pitch;
1199 void *dst; 1233 void *dst;
1200 void *dst2; 1234 void *dst2;
1201 void *srcp; 1235 void *srcp;
1202 unsigned int p; 1236 unsigned int p;
1237
1238 // if (verbose) printf("DirectFB: draw_slice entered\n");
1203 1239
1204 unlock(); 1240 unlock();
1205 1241
1206 if (frame) { 1242 if (frame) {
1207 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch)); 1243 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch));
1313 1349
1314 for (i=0;i<mpi->h;i++) { 1350 for (i=0;i<mpi->h;i++) {
1315 memcpy(dst+i*pitch,src+i*mpi->stride[0],p); 1351 memcpy(dst+i*pitch,src+i*mpi->stride[0],p);
1316 } 1352 }
1317 1353
1354
1318 if (pixel_format == DSPF_YV12) { 1355 if (pixel_format == DSPF_YV12) {
1319 1356
1320 dst += pitch*height; 1357 dst += pitch*height;
1321 p = p/2; 1358 p = p/2;
1322 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2; 1359 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2;
1351 1388
1352 } 1389 }
1353 unlock(); 1390 unlock();
1354 1391
1355 } else { 1392 } else {
1356 1393 // I had to disable native directfb blit because it wasn't working under some conditions :-(
1394
1395 /*
1357 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED; 1396 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED;
1358 dsc.preallocated[0].data = mpi->planes[0]; 1397 dsc.preallocated[0].data = mpi->planes[0];
1359 dsc.preallocated[0].pitch = mpi->stride[0]; 1398 dsc.preallocated[0].pitch = mpi->stride[0];
1360 dsc.width = mpi->width; 1399 dsc.width = mpi->width;
1361 dsc.height = mpi->height; 1400 dsc.height = mpi->height;
1372 DFBCHECK (tmp->Blit(tmp,frame,&rect,0,0)); 1411 DFBCHECK (tmp->Blit(tmp,frame,&rect,0,0));
1373 } else { 1412 } else {
1374 DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset)); 1413 DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset));
1375 }; 1414 };
1376 tmp->Release(tmp); 1415 tmp->Release(tmp);
1416 */
1417
1418 unsigned int pitch;
1419 void *dst;
1420
1421 // if (verbose) printf("DirectFB: Put_image - non planar branch\n");
1422 if (frame) {
1423 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
1424 framelocked = 1;
1425 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]);
1426 } else {
1427 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
1428 primarylocked = 1;
1429 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]);
1430 };
1431 unlock();
1432
1377 } 1433 }
1378 return VO_TRUE; 1434 return VO_TRUE;
1379 } 1435 }
1380 1436
1381 1437