changeset 20112:5deee6e61057

Fix DirectFB version check. The old code simply concatenated the digits, so 1.0.0 was considered older than 0.9.XY.
author syrjala
date Sun, 08 Oct 2006 22:16:38 +0000
parents b6042b4c91ce
children a3959dc972eb
files configure libvo/vo_dfbmga.c libvo/vo_directfb2.c
diffstat 3 files changed, 44 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sun Oct 08 17:19:20 2006 +0000
+++ b/configure	Sun Oct 08 22:16:38 2006 +0000
@@ -3759,17 +3759,25 @@
   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 @@
 
 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
--- a/libvo/vo_dfbmga.c	Sun Oct 08 17:19:20 2006 +0000
+++ b/libvo/vo_dfbmga.c	Sun Oct 08 22:16:38 2006 +0000
@@ -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 @@
 *	    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 @@
 	  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 @@
      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 @@
 {
      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 @@
      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 @@
 
      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 @@
           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 @@
                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 @@
           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 @@
                     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 @@
 			      ((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 @@
      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 @@
      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 @@
      }
 
      if (use_crtc2) {
-#if DIRECTFBVERSION > 915
+#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
           if (vo_vsync && !flipping)
                crtc2->WaitForSync( crtc2 );
 #endif
--- a/libvo/vo_directfb2.c	Sun Oct 08 17:19:20 2006 +0000
+++ b/libvo/vo_directfb2.c	Sun Oct 08 22:16:38 2006 +0000
@@ -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 @@
 
         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 @@
 	    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 @@
 	} // 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 @@
 
         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 @@
 		    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 @@
 		    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 @@
 	}
 #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 @@
 
 // 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 @@
 	    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 @@
                 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: