From 868fb5d278485f707cf8921ea137094fa8a7fdf5 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 15 Sep 2010 15:58:48 +0000 Subject: build: update DirectFB requirements, reduce #ifdefs Require DirectFB version 0.9.15 instead of 0.9.13. This simplifies the build system at the cost of requiring a library version that was released at the end rather than the middle of 2002. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32251 b3059339-0415-0410-9bf9-f77b7e298cf2 Simplify DirectFB check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32252 b3059339-0415-0410-9bf9-f77b7e298cf2 Require DirectFB version 0.9.22. This allows getting rid of a lot of library version check #ifdeffery. Release 0.9.22 is from February 2005, so the requirement is reasonable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32253 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/xml/en/install.xml | 4 ++-- Makefile | 3 +-- configure | 59 ++++++++++----------------------------------- libvo/video_out.c | 2 +- libvo/vo_dfbmga.c | 63 +++---------------------------------------------- libvo/vo_directfb2.c | 57 +++----------------------------------------- 6 files changed, 22 insertions(+), 166 deletions(-) diff --git a/DOCS/xml/en/install.xml b/DOCS/xml/en/install.xml index fbbe0d2299..f10f766313 100644 --- a/DOCS/xml/en/install.xml +++ b/DOCS/xml/en/install.xml @@ -66,8 +66,8 @@ answers. required for the optional PNG video output driver - directfb - optional, 0.9.13 or later - required for the directfb video output driver + directfb - optional, 0.9.22 or later + required for the directfb/dfbmga video output drivers lame - 3.90 or later is recommended, diff --git a/Makefile b/Makefile index e880661ba7..123421e0ea 100644 --- a/Makefile +++ b/Makefile @@ -526,10 +526,9 @@ SRCS_MPLAYER-$(CACA) += libvo/vo_caca.c SRCS_MPLAYER-$(COREAUDIO) += libao2/ao_coreaudio.c SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_corevideo.m libvo/osx_common.c SRCS_MPLAYER-$(DART) += libao2/ao_dart.c -SRCS_MPLAYER-$(DFBMGA) += libvo/vo_dfbmga.c SRCS_MPLAYER-$(DGA) += libvo/vo_dga.c SRCS_MPLAYER-$(DIRECT3D) += libvo/vo_direct3d.c libvo/w32_common.c -SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c +SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c SRCS_MPLAYER-$(DIRECTX) += libao2/ao_dsound.c libvo/vo_directx.c SRCS_MPLAYER-$(DXR2) += libao2/ao_dxr2.c libvo/vo_dxr2.c SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c diff --git a/configure b/configure index 0fc4f3ce45..b7185e4962 100755 --- a/configure +++ b/configure @@ -3974,60 +3974,28 @@ echores "$_bl" echocheck "DirectFB" if test "$_directfb" = auto ; then _directfb=no - for _inc_tmp in "" -I/usr/local/include/directfb -I/usr/include/directfb -I/usr/local/include; do - function_check directfb.h 'DirectFBInit(0, 0)' $_inc_tmp -ldirectfb && - _directfb=yes && extra_cflags="$extra_cflags $_inc_tmp" && break - done -fi - -dfb_version() { - expr $1 \* 65536 + $2 \* 256 + $3 -} - -if test "$_directfb" = yes; then cat > $TMPC << EOF +#include #include -int -dfb_ver = DIRECTFB_MAJOR_VERSION.DIRECTFB_MINOR_VERSION.DIRECTFB_MICRO_VERSION -; +#if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 22) +#error "DirectFB version too old." +#endif +int main(void) { DirectFBInit(0, 0); return 0; } EOF - if $_cc -E $TMPC $extra_cflags > "$TMPEXE"; then - _directfb_version=$(sed -n 's/^dfb_ver[^0-9]*\(.*\)/\1/p' "$TMPEXE" | tr -d '()') - _dfb_major=$(echo $_directfb_version | cut -d . -f 1) - _dfb_minor=$(echo $_directfb_version | cut -d . -f 2) - _dfb_micro=$(echo $_directfb_version | cut -d . -f 3) - _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro) - if test "$_dfb_version" -ge $(dfb_version 0 9 13); then - def_directfb_version="#define DIRECTFBVERSION $_dfb_version" - res_comment="$_directfb_version" - test "$_dfb_version" -ge $(dfb_version 0 9 15) && _dfbmga=yes - else - def_directfb_version='#undef DIRECTFBVERSION' - _directfb=no - res_comment="version >=0.9.13 required" - fi - else - _directfb=no - res_comment="failed to get version" - fi + for _inc_tmp in "" -I/usr/local/include/directfb -I/usr/include/directfb -I/usr/local/include; do + cc_check $_inc_tmp -ldirectfb && + _directfb=yes && extra_cflags="$extra_cflags $_inc_tmp" && break + done fi -echores "$_directfb" - if test "$_directfb" = yes ; then def_directfb='#define CONFIG_DIRECTFB 1' - vomodules="directfb $vomodules" + vomodules="directfb dfbmga $vomodules" libs_mplayer="$libs_mplayer -ldirectfb" else def_directfb='#undef CONFIG_DIRECTFB' - novomodules="directfb $novomodules" -fi -if test "$_dfbmga" = yes; then - vomodules="dfbmga $vomodules" - def_dfbmga='#define CONFIG_DFBMGA 1' -else - novomodules="dfbmga $novomodules" - def_dfbmga='#undef CONFIG_DFBMGA' + novomodules="directfb dfbmga $novomodules" fi +echores "$_directfb" echocheck "X11 headers presence" @@ -7554,7 +7522,6 @@ CDDB = $_cddb COREAUDIO = $_coreaudio COREVIDEO = $_corevideo DART = $_dart -DFBMGA = $_dfbmga DGA = $_dga DIRECT3D = $_direct3d DIRECTFB = $_directfb @@ -8035,13 +8002,11 @@ $def_aa $def_bl $def_caca $def_corevideo -$def_dfbmga $def_dga $def_dga1 $def_dga2 $def_direct3d $def_directfb -$def_directfb_version $def_directx $def_dvb $def_dvbin diff --git a/libvo/video_out.c b/libvo/video_out.c index e960a813d7..e223830e1e 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -236,7 +236,7 @@ const struct vo_driver *video_out_drivers[] = #ifdef CONFIG_VESA &video_out_vesa, #endif -#ifdef CONFIG_DFBMGA +#ifdef CONFIG_DIRECTFB &video_out_dfbmga, #endif #ifdef CONFIG_VIDIX diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c index 457a481c7a..a0a9d07760 100644 --- a/libvo/vo_dfbmga.c +++ b/libvo/vo_dfbmga.c @@ -21,12 +21,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* directfb includes */ #include - -#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) - -/* other things */ +#include #include #include #include @@ -103,16 +99,6 @@ static int osd_max; static int is_g200; -#if DIRECTFBVERSION < DFB_VERSION(0,9,18) - #define DSPF_ALUT44 DSPF_LUT8 - #define DLBM_TRIPLE ~0 - #define DSFLIP_ONSYNC 0 -#endif - -#if DIRECTFBVERSION < DFB_VERSION(0,9,16) - #define DSPF_ARGB1555 DSPF_RGB15 -#endif - static uint32_t in_width; static uint32_t in_height; static uint32_t buf_height; @@ -143,12 +129,10 @@ pixelformat_name( DFBSurfacePixelFormat format ) return "I420"; case DSPF_ALUT44: return "ALUT44"; -#if DIRECTFBVERSION > DFB_VERSION(0,9,21) case DSPF_NV12: return "NV12"; case DSPF_NV21: return "NV21"; -#endif default: return "Unknown pixel format"; } @@ -173,12 +157,10 @@ imgfmt_to_pixelformat( uint32_t format ) case IMGFMT_I420: case IMGFMT_IYUV: return DSPF_I420; -#if DIRECTFBVERSION > DFB_VERSION(0,9,21) case IMGFMT_NV12: return DSPF_NV12; case IMGFMT_NV21: return DSPF_NV21; -#endif default: return DSPF_UNKNOWN; } @@ -198,20 +180,9 @@ get_layer_by_name( DFBDisplayLayerID id, { struct layer_enum *l = (struct layer_enum *) data; -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) - /* We have desc.name so use it */ if (!strcmp( l->name, desc.name )) if ((l->res = dfb->GetDisplayLayer( dfb, id, l->layer )) == DFB_OK) return DFENUM_CANCEL; -#else - /* Fake it according to id */ - if ((id == 0 && !strcmp( l->name, "FBDev Primary Layer" )) || - (id == 1 && !strcmp( l->name, "Matrox Backend Scaler" )) || - (id == 2 && !strcmp( l->name, "Matrox CRTC2" )) || - (id == 3 && !strcmp( l->name, "Matrox CRTC2 Sub-Picture" ))) - if ((l->res = dfb->GetDisplayLayer( dfb, id, l->layer )) == DFB_OK) - return DFENUM_CANCEL; -#endif return DFENUM_OK; } @@ -228,13 +199,8 @@ preinit( const char *arg ) use_crtc2 = 1; use_spic = 1; field_parity = -1; -#if DIRECTFBVERSION > DFB_VERSION(0,9,17) buffermode = DLBM_TRIPLE; osd_max = 4; -#else - buffermode = DLBM_BACKVIDEO; - osd_max = 2; -#endif flipping = 1; tvnorm = -1; @@ -479,11 +445,7 @@ preinit( const char *arg ) if (use_crtc2) { struct layer_enum l = { -#if DIRECTFBVERSION > DFB_VERSION(0,9,20) "Matrox CRTC2 Layer", -#else - "Matrox CRTC2", -#endif &crtc2, DFB_UNSUPPORTED }; @@ -751,11 +713,9 @@ config( uint32_t width, uint32_t height, dlc.buffermode = buffermode; dlc.options = DLOP_NONE; -#if DIRECTFBVERSION > DFB_VERSION(0,9,16) if (field_parity != -1) { dlc.options |= DLOP_FIELD_PARITY; } -#endif mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Field parity set to: "); switch (field_parity) { case -1: @@ -799,10 +759,8 @@ config( uint32_t width, uint32_t height, return -1; } -#if DIRECTFBVERSION > DFB_VERSION(0,9,16) if (field_parity != -1) crtc2->SetFieldParity( crtc2, field_parity ); -#endif crtc2->GetSurface( crtc2, &c2frame ); c2frame->SetBlittingFlags( c2frame, DSBLIT_NOFX ); @@ -878,11 +836,9 @@ config( uint32_t width, uint32_t height, dlc.flags = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE; dlc.pixelformat = DSPF_ALUT44; dlc.buffermode = buffermode; - -#if DIRECTFBVERSION > DFB_VERSION(0,9,16) dlc.flags |= DLCONF_OPTIONS; dlc.options = DLOP_ALPHACHANNEL; -#endif + if ((res = spic->TestConfiguration( spic, &dlc, &failed )) != DFB_OK) { mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Invalid sub-picture configuration - %s!\n", @@ -971,13 +927,11 @@ query_format( uint32_t format ) break; case IMGFMT_YUY2: break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,21) case IMGFMT_NV12: case IMGFMT_NV21: if (use_crtc1 || use_crtc2) return 0; break; -#endif default: return 0; } @@ -1077,10 +1031,8 @@ draw_alpha( int x0, int y0, dst + pitch * y0 + 2 * x0 + 1, pitch ); break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,21) case DSPF_NV12: case DSPF_NV21: -#endif case DSPF_I420: case DSPF_YV12: vo_draw_alpha_yv12( w, h, src, srca, stride, @@ -1117,13 +1069,10 @@ draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y ) y /= 2; h /= 2; -#if DIRECTFBVERSION > DFB_VERSION(0,9,21) if (frame_format == DSPF_NV12 || frame_format == DSPF_NV21) { memcpy_pic( dst + pitch * y + x, src[1], w, h, pitch, stride[1] ); - } else -#endif - { + } else { x /= 2; w /= 2; pitch /= 2; @@ -1157,10 +1106,8 @@ blit_to_screen( void ) DFBRectangle *srect = NULL; if (use_bes) { -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) if (vo_vsync && !flipping) bes->WaitForSync( bes ); -#endif besframe->Blit( besframe, blitsrc, NULL, besrect.x, besrect.y ); blitsrc = besframe; @@ -1168,10 +1115,8 @@ blit_to_screen( void ) } if (use_crtc1) { -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) if (vo_vsync && !flipping) crtc1->WaitForSync( crtc1 ); -#endif if (c1stretch) c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect ); @@ -1180,10 +1125,8 @@ blit_to_screen( void ) } if (use_crtc2) { -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) if (vo_vsync && !flipping) crtc2->WaitForSync( crtc2 ); -#endif if (c2stretch) c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect ); diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c index 0c2fb9b423..3771f3d6a9 100644 --- a/libvo/vo_directfb2.c +++ b/libvo/vo_directfb2.c @@ -22,14 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -// directfb includes - #include - -#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) - -// other things - +#include #include #include #include @@ -48,16 +42,14 @@ #define min(x,y) (((x)<(y))?(x):(y)) #endif -#if DIRECTFBVERSION > DFB_VERSION(0,9,17) // triple buffering #define TRIPLE 1 -#endif static const vo_info_t info = { "Direct Framebuffer Device", "directfb", "Jiri Svoboda Jiri.Svoboda@seznam.cz", - "v 2.0 (for DirectFB version >=0.9.13)" + "v 2.0 (for DirectFB version >=0.9.22)" }; const LIBVO_EXTERN(directfb) @@ -241,7 +233,7 @@ static int preinit(const char *arg) if (((directfb_major_version <= 0) && (directfb_minor_version <= 9) && - (directfb_micro_version < 13))) + (directfb_micro_version < 15))) { mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: Unsupported DirectFB version\n"); return 1; @@ -269,12 +261,6 @@ static int preinit(const char *arg) DFBCHECK (DirectFBCreate (&dfb)); -#if DIRECTFBVERSION < DFB_VERSION(0,9,17) - if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) { - mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot switch to fullscreen mode"); - }; -#endif - /* * (Get keyboard) */ @@ -314,17 +300,10 @@ DFBSurfacePixelFormat convformat(uint32_t format) case IMGFMT_BGR24: return DSPF_RGB24; break; case IMGFMT_RGB16: return DSPF_RGB16; break; case IMGFMT_BGR16: return DSPF_RGB16; break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) case IMGFMT_RGB15: return DSPF_ARGB1555; break; case IMGFMT_BGR15: return DSPF_ARGB1555; break; case IMGFMT_RGB12: return DSPF_ARGB4444; break; case IMGFMT_BGR12: return DSPF_ARGB4444; break; -#else - case IMGFMT_RGB15: return DSPF_RGB15; break; - case IMGFMT_BGR15: return DSPF_RGB15; break; - case IMGFMT_RGB12: return DSPF_RGB12; break; - case IMGFMT_BGR12: return DSPF_RGB12; break; -#endif case IMGFMT_YUY2: return DSPF_YUY2; break; case IMGFMT_UYVY: return DSPF_UYVY; break; case IMGFMT_YV12: return DSPF_YV12; break; @@ -568,7 +547,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, } // vm end // just to be sure clear primary layer -#if DIRECTFBVERSION > DFB_VERSION(0,9,13) ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer); if (ret==DFB_OK) { ret = layer->GetSurface(layer,&primary); @@ -584,7 +562,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, layer->Release(layer); } layer=NULL; -#endif // find best layer @@ -609,7 +586,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer)); -#if DIRECTFBVERSION > DFB_VERSION(0,9,16) mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - switching layer to exclusive mode\n"); ret = layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE); @@ -617,7 +593,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot switch layer to exclusive mode. This could cause\nproblems. You may need to select correct pixel format manually!\n"); DirectFBError("MPlayer - Switch layer to exlusive mode.",ret); }; -#endif if (params.scale) { mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - changing layer configuration (size)\n"); dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT; @@ -667,13 +642,8 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, case DSPF_RGB32: bpp=32;break; case DSPF_RGB24: bpp=24;break; case DSPF_RGB16: bpp=16;break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) case DSPF_ARGB1555: bpp=15;break; case DSPF_ARGB4444: bpp=12; break; -#else - case DSPF_RGB15: bpp=15;break; - case DSPF_RGB12: bpp=12; break; -#endif case DSPF_RGB332 : bpp=8;break; } @@ -682,13 +652,8 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, case DSPF_RGB32: case DSPF_RGB24: case DSPF_RGB16: -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) case DSPF_ARGB1555: case DSPF_ARGB4444: -#else - case DSPF_RGB15: - case DSPF_RGB12: -#endif case DSPF_RGB332: mp_msg(MSGT_VO, MSGL_V,"DirectFB: Trying to recover via videomode change (VM).\n"); // get size @@ -755,7 +720,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, } #endif -#if DIRECTFBVERSION > DFB_VERSION(0,9,16) if (field_parity != -1) { dlc.flags = DLCONF_OPTIONS; ret = layer->GetConfiguration( layer, &dlc ); @@ -780,9 +744,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, break; } -#endif - - // get layer surface ret = layer->GetSurface(layer,&primary); @@ -794,9 +755,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, // test surface for flipping DFBCHECK(primary->GetCapabilities(primary,&caps)); -#if DIRECTFBVERSION > DFB_VERSION(0,9,13) primary->Clear(primary,0,0,0,0xff); -#endif flipping = 0; if (caps & (DSCAPS_FLIPPING #ifdef TRIPLE @@ -806,7 +765,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, ret = primary->Flip(primary,NULL,0); if (ret==DFB_OK) { flipping = 1; -#if DIRECTFBVERSION > DFB_VERSION(0,9,13) primary->Clear(primary,0,0,0,0xff); #ifdef TRIPLE // if we have 3 buffers clean once more @@ -815,7 +773,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, primary->Clear(primary,0,0,0,0xff); flipping = 2; } -#endif #endif } }; @@ -1476,18 +1433,10 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, case DSPF_RGB16: vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) case DSPF_ARGB1555: -#else - case DSPF_RGB15: -#endif vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); break; -#if DIRECTFBVERSION > DFB_VERSION(0,9,15) case DSPF_ARGB4444: -#else - case DSPF_RGB12: -#endif vo_draw_alpha_rgb12(w, h, src, srca, stride, ((uint8_t *) dst) + pitch * y0 + 2 * x0, pitch); -- cgit v1.2.3