summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsyrjala <syrjala@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-10-08 22:16:38 +0000
committersyrjala <syrjala@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-10-08 22:16:38 +0000
commit8db718fbf80845fa0fee3fe547d93f3394944743 (patch)
tree455035ad1e2103acc2bb31ae480f147f61a70ebc
parent348ea88925e18cb0de79d52107e56fa98c481ca2 (diff)
downloadmpv-8db718fbf80845fa0fee3fe547d93f3394944743.tar.bz2
mpv-8db718fbf80845fa0fee3fe547d93f3394944743.tar.xz
Fix DirectFB version check. The old code simply concatenated the
digits, so 1.0.0 was considered older than 0.9.XY. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20118 b3059339-0415-0410-9bf9-f77b7e298cf2
-rwxr-xr-xconfigure20
-rw-r--r--libvo/vo_dfbmga.c32
-rw-r--r--libvo/vo_directfb2.c24
3 files changed, 44 insertions, 32 deletions
diff --git a/configure b/configure
index ea91762043..e52028790a 100755
--- a/configure
+++ b/configure
@@ -3759,17 +3759,25 @@ EOF
fi
fi
+dfb_version() {
+ expr $1 \* 65536 + $2 \* 256 + $3
+}
+
if test "$_directfb" = yes; then
cat > $TMPC << EOF
#include <directfb_version.h>
int
-dfb_ver = DIRECTFB_MAJOR_VERSION DIRECTFB_MINOR_VERSION DIRECTFB_MICRO_VERSION
+dfb_ver = DIRECTFB_MAJOR_VERSION.DIRECTFB_MINOR_VERSION.DIRECTFB_MICRO_VERSION
;
EOF
if $_cc -E $TMPC $_inc_extra > "$TMPO"; then
- _directfb_version=`sed -n 's/^dfb_ver[^1-9]*\(.*\)/\1/p' "$TMPO" | tr -d '() '`
- _def_directfb_version="#define DIRECTFBVERSION $_directfb_version"
- if test "$_directfb_version" -ge 913; then
+ _directfb_version=`sed -n 's/^dfb_ver[^0-9]*\(.*\)/\1/p' "$TMPO" | 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"
else
_def_directfb_version='#undef DIRECTFBVERSION'
@@ -3785,13 +3793,13 @@ echores "$_directfb"
if test "$_directfb" = yes ; then
_def_directfb='#define HAVE_DIRECTFB 1'
- if test "$_directfb_version" -ge 913; then
+ if test "$_dfb_version" -ge $(dfb_version 0 9 13); then
_vosrc="$_vosrc vo_directfb2.c"
_vomodules="directfb $_vomodules"
_ld_directfb='-ldirectfb'
fi
- if test "$_directfb_version" -ge 915; then
+ if test "$_dfb_version" -ge $(dfb_version 0 9 15); then
_vosrc="$_vosrc vo_dfbmga.c"
_vomodules="dfbmga $_vomodules"
fi
diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c
index e339bda564..1c8f1fa76e 100644
--- a/libvo/vo_dfbmga.c
+++ b/libvo/vo_dfbmga.c
@@ -25,6 +25,8 @@
/* directfb includes */
#include <directfb.h>
+#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
+
/* other things */
#include <stdio.h>
#include <stdlib.h>
@@ -108,13 +110,13 @@ static int is_g200;
* vo_dfbmga *
******************************/
-#if DIRECTFBVERSION < 918
+#if DIRECTFBVERSION < DFB_VERSION(0,9,18)
#define DSPF_ALUT44 DSPF_LUT8
#define DLBM_TRIPLE ~0
#define DSFLIP_ONSYNC 0
#endif
-#if DIRECTFBVERSION < 916
+#if DIRECTFBVERSION < DFB_VERSION(0,9,16)
#define DSPF_ARGB1555 DSPF_RGB15
#endif
@@ -149,7 +151,7 @@ pixelformat_name( DFBSurfacePixelFormat format )
return "I420";
case DSPF_ALUT44:
return "ALUT44";
-#if DIRECTFBVERSION > 921
+#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
return "NV12";
case DSPF_NV21:
@@ -181,7 +183,7 @@ imgfmt_to_pixelformat( uint32_t format )
case IMGFMT_I420:
case IMGFMT_IYUV:
return DSPF_I420;
-#if DIRECTFBVERSION > 921
+#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case IMGFMT_NV12:
return DSPF_NV12;
case IMGFMT_NV21:
@@ -206,7 +208,7 @@ get_layer_by_name( DFBDisplayLayerID id,
{
struct layer_enum *l = (struct layer_enum *) data;
-#if DIRECTFBVERSION > 915
+#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)
@@ -237,7 +239,7 @@ preinit( const char *arg )
use_crtc2 = 1;
use_spic = 1;
field_parity = -1;
-#if DIRECTFBVERSION > 917
+#if DIRECTFBVERSION > DFB_VERSION(0,9,17)
buffermode = DLBM_TRIPLE;
osd_max = 4;
#else
@@ -479,7 +481,7 @@ preinit( const char *arg )
if (use_crtc2) {
struct layer_enum l = {
-#if DIRECTFBVERSION > 920
+#if DIRECTFBVERSION > DFB_VERSION(0,9,20)
"Matrox CRTC2 Layer",
#else
"Matrox CRTC2",
@@ -694,7 +696,7 @@ config( uint32_t width, uint32_t height,
dlc.buffermode = buffermode;
dlc.options = DLOP_NONE;
-#if DIRECTFBVERSION > 916
+#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
if (field_parity != -1) {
dlc.options |= DLOP_FIELD_PARITY;
}
@@ -742,7 +744,7 @@ config( uint32_t width, uint32_t height,
return -1;
}
-#if DIRECTFBVERSION > 916
+#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
if (field_parity != -1)
crtc2->SetFieldParity( crtc2, field_parity );
#endif
@@ -822,7 +824,7 @@ config( uint32_t width, uint32_t height,
dlc.pixelformat = DSPF_ALUT44;
dlc.buffermode = buffermode;
-#if DIRECTFBVERSION > 916
+#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
dlc.flags |= DLCONF_OPTIONS;
dlc.options = DLOP_ALPHACHANNEL;
#endif
@@ -903,7 +905,7 @@ query_format( uint32_t format )
return 0;
case IMGFMT_YUY2:
break;
-#if DIRECTFBVERSION > 921
+#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case IMGFMT_NV12:
case IMGFMT_NV21:
if (!use_bes || use_crtc2)
@@ -1012,7 +1014,7 @@ draw_alpha( int x0, int y0,
((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1,
pitch );
break;
-#if DIRECTFBVERSION > 921
+#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
case DSPF_NV21:
#endif
@@ -1050,7 +1052,7 @@ draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y )
y /= 2;
h /= 2;
-#if DIRECTFBVERSION > 921
+#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] );
@@ -1090,7 +1092,7 @@ blit_to_screen( void )
DFBRectangle *srect = NULL;
if (use_bes) {
-#if DIRECTFBVERSION > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
if (vo_vsync && !flipping && !use_crtc2)
bes->WaitForSync( bes );
#endif
@@ -1101,7 +1103,7 @@ blit_to_screen( void )
}
if (use_crtc2) {
-#if DIRECTFBVERSION > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
if (vo_vsync && !flipping)
crtc2->WaitForSync( crtc2 );
#endif
diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c
index e1130c5ccb..7be855a58d 100644
--- a/libvo/vo_directfb2.c
+++ b/libvo/vo_directfb2.c
@@ -25,6 +25,8 @@
#include <directfb.h>
+#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
+
// other things
#include <stdio.h>
@@ -50,7 +52,7 @@
#define min(x,y) (((x)<(y))?(x):(y))
#endif
-#if DIRECTFBVERSION > 917
+#if DIRECTFBVERSION > DFB_VERSION(0,9,17)
// triple buffering
#define TRIPLE 1
#endif
@@ -273,7 +275,7 @@ static int preinit(const char *arg)
DFBCHECK (DirectFBCreate (&dfb));
-#if DIRECTFBVERSION < 917
+#if DIRECTFBVERSION < DFB_VERSION(0,9,17)
if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot swith to fullscreen mode");
};
@@ -318,7 +320,7 @@ 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 > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
case IMGFMT_RGB15: return DSPF_ARGB1555; break;
case IMGFMT_BGR15: return DSPF_ARGB1555; break;
#else
@@ -568,7 +570,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width,
} // vm end
// just for sure clear primary layer
-#if DIRECTFBVERSION > 913
+#if DIRECTFBVERSION > DFB_VERSION(0,9,13)
ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer);
if (ret==DFB_OK) {
ret = layer->GetSurface(layer,&primary);
@@ -609,7 +611,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width,
DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer));
-#if DIRECTFBVERSION > 916
+#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - switching layer to exclusive mode\n");
ret = layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE);
@@ -667,7 +669,7 @@ 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 > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
case DSPF_ARGB1555: bpp=15;break;
#else
case DSPF_RGB15: bpp=15;break;
@@ -680,7 +682,7 @@ 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 > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
case DSPF_ARGB1555:
#else
case DSPF_RGB15:
@@ -751,7 +753,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width,
}
#endif
-#if DIRECTFBVERSION > 916
+#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
if (field_parity != -1) {
dlc.flags = DLCONF_OPTIONS;
ret = layer->GetConfiguration( layer, &dlc );
@@ -790,7 +792,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 > 913
+#if DIRECTFBVERSION > DFB_VERSION(0,9,13)
primary->Clear(primary,0,0,0,0xff);
#endif
flipping = 0;
@@ -802,7 +804,7 @@ 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 > 913
+#if DIRECTFBVERSION > DFB_VERSION(0,9,13)
primary->Clear(primary,0,0,0,0xff);
#ifdef TRIPLE
// if we have 3 buffers clean once more
@@ -1487,7 +1489,7 @@ 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 > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
case DSPF_ARGB1555:
#else
case DSPF_RGB15: