comparison libvo/vo_dfbmga.c @ 27591:5ab1614e3f0a

Rename some variables and change some strings to make the CRTC1 code clearer.
author syrjala
date Mon, 15 Sep 2008 20:41:08 +0000
parents 4c4389f2aba2
children 6398d845ae76
comparison
equal deleted inserted replaced
27590:4c4389f2aba2 27591:5ab1614e3f0a
56 /* 56 /*
57 * (Globals) 57 * (Globals)
58 */ 58 */
59 static IDirectFB *dfb; 59 static IDirectFB *dfb;
60 60
61 static IDirectFBDisplayLayer *primary; 61 static IDirectFBDisplayLayer *crtc1;
62 static IDirectFBDisplayLayer *bes; 62 static IDirectFBDisplayLayer *bes;
63 static IDirectFBDisplayLayer *crtc2; 63 static IDirectFBDisplayLayer *crtc2;
64 static IDirectFBDisplayLayer *spic; 64 static IDirectFBDisplayLayer *spic;
65 65
66 static int num_bufs; 66 static int num_bufs;
88 static IDirectFBInputDevice *remote; 88 static IDirectFBInputDevice *remote;
89 static IDirectFBEventBuffer *buffer; 89 static IDirectFBEventBuffer *buffer;
90 90
91 static int blit_done; 91 static int blit_done;
92 static int c1stretch; 92 static int c1stretch;
93 static int stretch; 93 static int c2stretch;
94 94
95 static int use_bes; 95 static int use_bes;
96 static int use_crtc1; 96 static int use_crtc1;
97 static int use_crtc2; 97 static int use_crtc2;
98 static int use_spic; 98 static int use_spic;
434 } 434 }
435 435
436 if (use_crtc1 || use_bes) { 436 if (use_crtc1 || use_bes) {
437 struct layer_enum l = { 437 struct layer_enum l = {
438 "FBDev Primary Layer", 438 "FBDev Primary Layer",
439 &primary, 439 &crtc1,
440 DFB_UNSUPPORTED 440 DFB_UNSUPPORTED
441 }; 441 };
442 dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l ); 442 dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
443 if (l.res != DFB_OK) { 443 if (l.res != DFB_OK) {
444 mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get primary layer - %s\n", 444 mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get CRTC1 layer - %s\n",
445 DirectFBErrorString( l.res ) ); 445 DirectFBErrorString( l.res ) );
446 uninit(); 446 uninit();
447 return -1; 447 return -1;
448 } 448 }
449 if ((res = primary->SetCooperativeLevel( primary, DLSCL_EXCLUSIVE )) != DFB_OK) { 449 if ((res = crtc1->SetCooperativeLevel( crtc1, DLSCL_EXCLUSIVE )) != DFB_OK) {
450 mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to primary layer - %s\n", 450 mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to CRTC1 layer - %s\n",
451 DirectFBErrorString( res ) ); 451 DirectFBErrorString( res ) );
452 uninit(); 452 uninit();
453 return -1; 453 return -1;
454 } 454 }
455 use_input = 1; 455 use_input = 1;
706 */ 706 */
707 if (use_crtc1) { 707 if (use_crtc1) {
708 dlc.flags = DLCONF_BUFFERMODE; 708 dlc.flags = DLCONF_BUFFERMODE;
709 dlc.buffermode = buffermode; 709 dlc.buffermode = buffermode;
710 710
711 if ((res = primary->TestConfiguration( primary, &dlc, &failed )) != DFB_OK) { 711 if ((res = crtc1->TestConfiguration( crtc1, &dlc, &failed )) != DFB_OK) {
712 mp_msg( MSGT_VO, MSGL_ERR, 712 mp_msg( MSGT_VO, MSGL_ERR,
713 "vo_dfbmga: Invalid CRTC1 configuration - %s!\n", 713 "vo_dfbmga: Invalid CRTC1 configuration - %s!\n",
714 DirectFBErrorString( res ) ); 714 DirectFBErrorString( res ) );
715 return -1; 715 return -1;
716 } 716 }
717 if ((res = primary->SetConfiguration( primary, &dlc )) != DFB_OK) { 717 if ((res = crtc1->SetConfiguration( crtc1, &dlc )) != DFB_OK) {
718 mp_msg( MSGT_VO, MSGL_ERR, 718 mp_msg( MSGT_VO, MSGL_ERR,
719 "vo_dfbmga: CRTC1 configuration failed - %s!\n", 719 "vo_dfbmga: CRTC1 configuration failed - %s!\n",
720 DirectFBErrorString( res ) ); 720 DirectFBErrorString( res ) );
721 return -1; 721 return -1;
722 } 722 }
723 if ((res = primary->GetConfiguration( primary, &dlc )) != DFB_OK) { 723 if ((res = crtc1->GetConfiguration( crtc1, &dlc )) != DFB_OK) {
724 mp_msg( MSGT_VO, MSGL_ERR, 724 mp_msg( MSGT_VO, MSGL_ERR,
725 "vo_dfbmga: Getting CRTC1 configuration failed - %s!\n", 725 "vo_dfbmga: Getting CRTC1 configuration failed - %s!\n",
726 DirectFBErrorString( res ) ); 726 DirectFBErrorString( res ) );
727 return -1; 727 return -1;
728 } 728 }
729 729
730 primary->GetSurface( primary, &c1frame ); 730 crtc1->GetSurface( crtc1, &c1frame );
731 c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX ); 731 c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX );
732 c1frame->SetColor( c1frame, 0, 0, 0, 0xff ); 732 c1frame->SetColor( c1frame, 0, 0, 0, 0xff );
733 733
734 c1frame->GetSize( c1frame, &screen_width, &screen_height ); 734 c1frame->GetSize( c1frame, &screen_width, &screen_height );
735 735
840 aspect_save_screenres( out_width, out_height ); 840 aspect_save_screenres( out_width, out_height );
841 aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM ); 841 aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM );
842 842
843 if (in_width != out_width || 843 if (in_width != out_width ||
844 in_height != out_height) 844 in_height != out_height)
845 stretch = 1; 845 c2stretch = 1;
846 else 846 else
847 stretch = 0; 847 c2stretch = 0;
848 848
849 c2rect.x = (screen_width - out_width) / 2; 849 c2rect.x = (screen_width - out_width) / 2;
850 c2rect.y = (screen_height - out_height) / 2; 850 c2rect.y = (screen_height - out_height) / 2;
851 c2rect.w = out_width; 851 c2rect.w = out_width;
852 c2rect.h = out_height; 852 c2rect.h = out_height;
1183 } 1183 }
1184 1184
1185 if (use_crtc1) { 1185 if (use_crtc1) {
1186 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) 1186 #if DIRECTFBVERSION > DFB_VERSION(0,9,15)
1187 if (vo_vsync && !flipping) 1187 if (vo_vsync && !flipping)
1188 primary->WaitForSync( primary ); 1188 crtc1->WaitForSync( crtc1 );
1189 #endif 1189 #endif
1190 1190
1191 if (c1stretch) 1191 if (c1stretch)
1192 c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect ); 1192 c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect );
1193 else 1193 else
1198 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) 1198 #if DIRECTFBVERSION > DFB_VERSION(0,9,15)
1199 if (vo_vsync && !flipping) 1199 if (vo_vsync && !flipping)
1200 crtc2->WaitForSync( crtc2 ); 1200 crtc2->WaitForSync( crtc2 );
1201 #endif 1201 #endif
1202 1202
1203 if (stretch) 1203 if (c2stretch)
1204 c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect ); 1204 c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect );
1205 else 1205 else
1206 c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y ); 1206 c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y );
1207 } 1207 }
1208 } 1208 }
1288 keyboard->Release( keyboard ); 1288 keyboard->Release( keyboard );
1289 if (crtc2) 1289 if (crtc2)
1290 crtc2->Release( crtc2 ); 1290 crtc2->Release( crtc2 );
1291 if (bes) 1291 if (bes)
1292 bes->Release( bes ); 1292 bes->Release( bes );
1293 if (primary) 1293 if (crtc1)
1294 primary->Release( primary ); 1294 crtc1->Release( crtc1 );
1295 if (dfb) 1295 if (dfb)
1296 dfb->Release( dfb ); 1296 dfb->Release( dfb );
1297 1297
1298 buffer = NULL; 1298 buffer = NULL;
1299 remote = NULL; 1299 remote = NULL;
1300 keyboard = NULL; 1300 keyboard = NULL;
1301 crtc2 = NULL; 1301 crtc2 = NULL;
1302 bes = NULL; 1302 bes = NULL;
1303 primary = NULL; 1303 crtc1 = NULL;
1304 dfb = NULL; 1304 dfb = NULL;
1305 } 1305 }
1306 1306
1307 static uint32_t 1307 static uint32_t
1308 get_image( mp_image_t *mpi ) 1308 get_image( mp_image_t *mpi )
1433 1433
1434 /* Prefer CRTC2 over BES */ 1434 /* Prefer CRTC2 over BES */
1435 if (use_crtc2) 1435 if (use_crtc2)
1436 res = crtc2->SetColorAdjustment( crtc2, &ca ); 1436 res = crtc2->SetColorAdjustment( crtc2, &ca );
1437 else if (use_crtc1) 1437 else if (use_crtc1)
1438 res = primary->SetColorAdjustment( primary, &ca ); 1438 res = crtc1->SetColorAdjustment( crtc1, &ca );
1439 else 1439 else
1440 res = bes->SetColorAdjustment( bes, &ca ); 1440 res = bes->SetColorAdjustment( bes, &ca );
1441 1441
1442 if (res != DFB_OK) 1442 if (res != DFB_OK)
1443 return VO_FALSE; 1443 return VO_FALSE;
1454 1454
1455 /* Prefer CRTC2 over BES */ 1455 /* Prefer CRTC2 over BES */
1456 if (use_crtc2) 1456 if (use_crtc2)
1457 res = crtc2->GetColorAdjustment( crtc2, &ca ); 1457 res = crtc2->GetColorAdjustment( crtc2, &ca );
1458 else if (use_crtc1) 1458 else if (use_crtc1)
1459 res = primary->GetColorAdjustment( primary, &ca ); 1459 res = crtc1->GetColorAdjustment( crtc1, &ca );
1460 else 1460 else
1461 res = bes->GetColorAdjustment( bes, &ca ); 1461 res = bes->GetColorAdjustment( bes, &ca );
1462 1462
1463 if (res != DFB_OK) 1463 if (res != DFB_OK)
1464 return VO_FALSE; 1464 return VO_FALSE;