Hi,

I wrote a patch to add support to BGR555 pixel format. There is only one thing 
which is not really good... The configuration is made at compilation time, not 
run time ! See fbdev.c in dfb_fbdev_set_mode function. I leave a /* FIXME */.

How could I fix it ?

If I do not do this, I have :
(*) FBDev/Mode: Switched to 240x320 (240x320) at 16 bit BGR555 (wanted RGB16).

instead of :
(*) FBDev/Mode: Switched to 240x320 (240x320) at 16 bit BGR555 (wanted BGR555).

and the colors are wrong !


You (Denis Oliver Kropp) can push this patch to git/cvs if you want.



Regards,

Guillaume




diff -purN DirectFB-1.1.1/include/directfb.h DirectFB-1.1.1_modifie/include/directfb.h
--- DirectFB-1.1.1/include/directfb.h	2007-12-15 13:30:28.000000000 +0100
+++ DirectFB-1.1.1_modifie/include/directfb.h	2008-04-08 14:49:52.000000000 +0200
@@ -1121,12 +1121,15 @@ typedef enum {
      DSPF_RGB444    = DFB_SURFACE_PIXELFORMAT( 26, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
 
      /* 16 bit   RGB (2 byte, nothing @15, red [EMAIL PROTECTED], green [EMAIL PROTECTED], blue [EMAIL PROTECTED]) */
-     DSPF_RGB555    = DFB_SURFACE_PIXELFORMAT( 27, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 )
+     DSPF_RGB555    = DFB_SURFACE_PIXELFORMAT( 27, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit   BGR (2 byte, nothing @15, blue [EMAIL PROTECTED], green [EMAIL PROTECTED], red [EMAIL PROTECTED]) */
+     DSPF_BGR555    = DFB_SURFACE_PIXELFORMAT( 28, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 )
 
 } DFBSurfacePixelFormat;
 
 /* Number of pixelformats defined */
-#define DFB_NUM_PIXELFORMATS            28
+#define DFB_NUM_PIXELFORMATS            29
 
 /* These macros extract information about the pixel format. */
 #define DFB_PIXELFORMAT_INDEX(fmt)      (((fmt) & 0x0000007F)      )
diff -purN DirectFB-1.1.1/src/core/surface_buffer.c DirectFB-1.1.1_modifie/src/core/surface_buffer.c
--- DirectFB-1.1.1/src/core/surface_buffer.c	2007-12-15 13:30:28.000000000 +0100
+++ DirectFB-1.1.1_modifie/src/core/surface_buffer.c	2008-04-17 09:26:30.000000000 +0200
@@ -625,9 +625,11 @@ dfb_surface_buffer_dump( CoreSurfaceBuff
           case DSPF_UYVY:
           case DSPF_RGB444:
           case DSPF_RGB555:
+          case DSPF_BGR555:
                rgb   = true;
                break;
 
+
           default:
                D_ERROR( "DirectFB/core/surfaces: surface dump for format "
                          "'%s' is not implemented!\n",
@@ -810,6 +812,14 @@ dfb_surface_buffer_dump( CoreSurfaceBuff
                     }
                     break;
 
+               case DSPF_BGR555:
+                    for (n=0, n3=0; n<surface->config.size.w; n++, n3+=3) {
+                         buf_p[n3+2] = (data16[n] & 0x7C00) >> 7;
+                         buf_p[n3+1] = (data16[n] & 0x03E0) >> 2;
+                         buf_p[n3+0] = (data16[n] & 0x001F) << 3;
+                    }
+                    break;
+
                case DSPF_ARGB2554:
                     for (n=0, n3=0; n<surface->config.size.w; n++, n3+=3) {
                          buf_p[n3+0] = (data16[n] & 0x3E00) >> 6;
diff -purN DirectFB-1.1.1/src/gfx/convert.c DirectFB-1.1.1_modifie/src/gfx/convert.c
--- DirectFB-1.1.1/src/gfx/convert.c	2007-08-14 18:59:50.000000000 +0200
+++ DirectFB-1.1.1_modifie/src/gfx/convert.c	2008-04-17 09:27:18.000000000 +0200
@@ -89,6 +89,9 @@ dfb_color_to_pixel( DFBSurfacePixelForma
           case DSPF_RGB555:
                pixel = PIXEL_RGB555( r, g, b );
                break;
+          case DSPF_BGR555:
+               pixel = PIXEL_BGR555( r, g, b );
+               break;
           case DSPF_ARGB2554:
                pixel = PIXEL_ARGB2554( 0, r, g, b );
                break;
@@ -158,6 +161,12 @@ dfb_pixel_to_color( DFBSurfacePixelForma
                ret_color->b = EXPAND_5to8( (pixel & 0x001f)       );
                break;
 
+          case DSPF_BGR555:
+               ret_color->r = EXPAND_5to8( (pixel & 0x001f)       );
+               ret_color->g = EXPAND_5to8( (pixel & 0x03e0) >>  5 );
+               ret_color->b = EXPAND_5to8( (pixel & 0x7c00) >> 10 );
+               break;
+
           case DSPF_ARGB2554:
                ret_color->a = EXPAND_2to8(  pixel >> 14 );
                ret_color->r = EXPAND_5to8( (pixel & 0x3e00) >>  9 );
@@ -215,6 +224,9 @@ dfb_pixelformat_name( DFBSurfacePixelFor
           case DSPF_RGB555:
                return "RGB555";
 
+          case DSPF_BGR555:
+               return "BGR555";
+
           case DSPF_RGB16:
                return "RGB16";
 
diff -purN DirectFB-1.1.1/src/gfx/convert.h DirectFB-1.1.1_modifie/src/gfx/convert.h
--- DirectFB-1.1.1/src/gfx/convert.h	2007-12-15 13:30:28.000000000 +0100
+++ DirectFB-1.1.1_modifie/src/gfx/convert.h	2008-04-17 09:42:14.000000000 +0200
@@ -50,6 +50,10 @@
                                  (((g)&0xF8) << 2) | \
                                  (((b)&0xF8) >> 3) )
 
+#define PIXEL_BGR555(r,g,b)  ( (((b)&0xF8) << 7) | \
+                                 (((g)&0xF8) << 2) | \
+                                 (((r)&0xF8) >> 3) )
+
 #define PIXEL_ARGB2554(a,r,g,b)( (((a)&0xC0) << 8) | \
                                  (((r)&0xF8) << 6) | \
                                  (((g)&0xF8) << 1) | \
@@ -200,6 +204,10 @@
                                     (((pixel) & 0x07C0) >> 1) | \
                                     (((pixel) & 0x001F)) )
 
+#define RGB16_TO_BGR555(pixel)  ( (((pixel) & 0xF800) >> 12) | \
+                                    (((pixel) & 0x07C0) >> 1) | \
+                                    (((pixel) & 0x001F) << 10 ) )
+
 #define RGB16_TO_RGB444(pixel)  ( (((pixel) & 0xF000) >> 4) | \
                                     (((pixel) & 0x0780) >> 3) | \
                                     (((pixel) & 0x001F) >> 1) )
@@ -244,6 +252,10 @@
                                     (((pixel) & 0x00F800) >> 6) | \
                                     (((pixel) & 0x0000F8) >> 3) )
 
+#define RGB32_TO_BGR555(pixel)  ( (((pixel) & 0xF80000) >> 19) | \
+                                    (((pixel) & 0x00F800) >> 6) | \
+                                    (((pixel) & 0x0000F8) << 7) )
+
 #define RGB32_TO_RGB444(pixel)  ( (((pixel) & 0xF00000) >> 12) | \
                                     (((pixel) & 0x00F000) >>  8) | \
                                     (((pixel) & 0x0000F0) >>  4) )
@@ -270,6 +282,10 @@
 #define ARGB_TO_RGB555(pixel)  ( (((pixel) & 0x00F80000) >>  9) | \
                                    (((pixel) & 0x0000F800) >>  6) | \
                                    (((pixel) & 0x000000F8) >>  3) )
+
+#define ARGB_TO_BGR555(pixel)  ( (((pixel) & 0x00F80000) >>  19) | \
+                                   (((pixel) & 0x0000F800) >>  6) | \
+                                   (((pixel) & 0x000000F8) <<  7) )
 /* RGB <-> YCbCr conversion */
 
 extern const u16 y_for_rgb[256];
@@ -478,6 +494,18 @@ dfb_convert_to_rgb16( DFBSurfacePixelFor
                }
                break;
 
+ 	  case DSPF_BGR555:
+               while (height--) {
+                    src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ((src16[x] & 0x7c00) >> 10) | ((src16[x] & 0x03e0) << 1) | ((src16[x] & 0x001f) << 11 );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
           case DSPF_RGB32:
           case DSPF_ARGB:
                while (height--) {
@@ -572,6 +600,20 @@ dfb_convert_to_rgb32( DFBSurfacePixelFor
                }
                break;
 
+          case DSPF_BGR555:
+               while (height--) {
+                    src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB32( ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2),
+                                               ((src16[x] & 0x03e0) >> 2) | ((src16[x] & 0x0380) >> 7),
+                                               ((src16[x] & 0x7c00) >> 7) | ((src16[x] & 0x7000) >> 12) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
           case DSPF_RGB16:
                while (height--) {
                     src16 = src;
diff -purN DirectFB-1.1.1/src/gfx/generic/generic.c DirectFB-1.1.1_modifie/src/gfx/generic/generic.c
--- DirectFB-1.1.1/src/gfx/generic/generic.c	2007-12-15 16:24:26.000000000 +0100
+++ DirectFB-1.1.1_modifie/src/gfx/generic/generic.c	2008-04-09 11:35:58.000000000 +0200
@@ -93,7 +93,7 @@ static void gInit_64bit();
 #define Bop_PFI_OP_Aop_PFI( op ) Bop_16_##op##_Aop
 #include "template_colorkey_16.h"
 
-/* ARGB1555 / RGB555*/
+/* ARGB1555 / RGB555 / BGR555 */
 #define RGB_MASK 0x7fff
 #define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_15
 #define Bop_PFI_OP_Aop_PFI( op ) Bop_15_##op##_Aop
@@ -171,6 +171,24 @@ static void gInit_64bit();
 #define B_MASK 0x001f
 #include "template_acc_16.h"
 
+/* BGR555 */
+#define EXPAND_Ato8( a ) 0xFF
+#define EXPAND_Rto8( r ) EXPAND_5to8( r )
+#define EXPAND_Gto8( g ) EXPAND_5to8( g )
+#define EXPAND_Bto8( b ) EXPAND_5to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_BGR555( r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_xbgr1555_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_xbgr1555
+#define A_SHIFT 0
+#define B_SHIFT 10
+#define G_SHIFT 5
+#define R_SHIFT 0
+#define A_MASK 0
+#define B_MASK 0x7c00
+#define G_MASK 0x03e0
+#define R_MASK 0x001f
+#include "template_acc_16.h"
+
 /* ARGB2554 */
 #define EXPAND_Ato8( a ) EXPAND_2to8( a )
 #define EXPAND_Rto8( r ) EXPAND_5to8( r )
@@ -449,6 +467,7 @@ static GenefxFunc Cop_to_Aop_PFI[DFB_NUM
      NULL,               /* DSPF_LUT2 */
      Cop_to_Aop_16,      /* DSPF_RGB444 */
      Cop_to_Aop_16,      /* DSPF_RGB555 */
+     Cop_to_Aop_16,      /* DSPF_BGR555 */
 };
 
 /********************************* Cop_toK_Aop_PFI ****************************/
@@ -587,6 +606,7 @@ static GenefxFunc Cop_toK_Aop_PFI[DFB_NU
      NULL,                    /* DSPF_LUT2 */
      Cop_toK_Aop_12,          /* DSPF_RGB444 */
      Cop_toK_Aop_15,          /* DSPF_RGB555 */
+     Cop_toK_Aop_15,          /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_to_Aop_PFI *************************/
@@ -661,6 +681,7 @@ static GenefxFunc Bop_PFI_to_Aop_PFI[DFB
      NULL,               /* DSPF_LUT2 */
      Bop_16_to_Aop,      /* DSPF_RGB444 */
      Bop_16_to_Aop,      /* DSPF_RGB555 */
+     Bop_16_to_Aop,      /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_Kto_Aop_PFI ************************/
@@ -872,6 +893,7 @@ static GenefxFunc Bop_PFI_Kto_Aop_PFI[DF
      NULL,                    /* DSPF_LUT2 */
      Bop_12_Kto_Aop,          /* DSPF_RGB444 */
      Bop_15_Kto_Aop,          /* DSPF_RGB555 */
+     Bop_15_Kto_Aop,          /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_toK_Aop_PFI ************************/
@@ -1009,6 +1031,7 @@ static GenefxFunc Bop_PFI_toK_Aop_PFI[DF
      NULL,                    /* DSPF_LUT2 */
      Bop_12_toK_Aop,          /* DSPF_RGB444 */
      Bop_15_toK_Aop,          /* DSPF_RGB555 */
+     Bop_15_toK_Aop,          /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_KtoK_Aop_PFI ***********************/
@@ -1042,6 +1065,7 @@ static GenefxFunc Bop_PFI_KtoK_Aop_PFI[D
      NULL,                    /* DSPF_LUT2 */
      Bop_12_KtoK_Aop,         /* DSPF_RGB444 */
      Bop_15_KtoK_Aop,         /* DSPF_RGB555 */
+     Bop_15_KtoK_Aop,         /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_Sto_Aop_PFI ************************/
@@ -1540,6 +1564,7 @@ static GenefxFunc Bop_PFI_SKto_Aop_PFI[D
      NULL,                    /* DSPF_LUT2 */
      Bop_12_SKto_Aop,         /* DSPF_RGB444 */
      Bop_15_SKto_Aop,         /* DSPF_RGB555 */
+     Bop_15_SKto_Aop,         /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_StoK_Aop_PFI ***********************/
@@ -1573,6 +1598,7 @@ static GenefxFunc Bop_PFI_StoK_Aop_PFI[D
      NULL,                    /* DSPF_LUT2 */
      Bop_12_StoK_Aop,         /* DSPF_RGB444 */
      Bop_15_StoK_Aop,         /* DSPF_RGB555 */
+     Bop_15_StoK_Aop,         /* DSPF_BGR555 */
 };
 
 /********************************* Bop_PFI_SKtoK_Aop_PFI **********************/
@@ -1606,6 +1632,7 @@ static GenefxFunc Bop_PFI_SKtoK_Aop_PFI[
      NULL,                    /* DSPF_LUT2 */
      Bop_12_SKtoK_Aop,        /* DSPF_RGB444 */
      Bop_15_SKtoK_Aop,        /* DSPF_RGB555 */
+     Bop_15_SKtoK_Aop,        /* DSPF_BGR555 */
 };
 
 /********************************* Sop_PFI_Sto_Dacc ***************************/
@@ -2000,6 +2027,7 @@ static GenefxFunc Sop_PFI_Sto_Dacc[DFB_N
      NULL,                         /* DSPF_LUT2 */
      Sop_xrgb4444_Sto_Dacc,        /* DSPF_RGB444 */
      Sop_xrgb1555_Sto_Dacc,        /* DSPF_RGB555 */
+     Sop_xbgr1555_Sto_Dacc,        /* DSPF_BGR555 */
 };
 
 /********************************* Sop_PFI_SKto_Dacc **************************/
@@ -2418,6 +2446,7 @@ static GenefxFunc Sop_PFI_SKto_Dacc[DFB_
      NULL,                         /* DSPF_LUT2 */
      Sop_xrgb4444_SKto_Dacc,       /* DSPF_RGB444 */
      Sop_xrgb1555_SKto_Dacc,       /* DSPF_RGB555 */
+     Sop_xbgr1555_SKto_Dacc,       /* DSPF_BGR555 */
 };
 
 /********************************* Sop_PFI_to_Dacc ****************************/
@@ -2784,6 +2813,7 @@ static GenefxFunc Sop_PFI_to_Dacc[DFB_NU
      NULL,                         /* DSPF_LUT2 */
      Sop_xrgb4444_to_Dacc,         /* DSPF_RGB444 */
      Sop_xrgb1555_to_Dacc,         /* DSPF_RGB555 */
+     Sop_xbgr1555_to_Dacc,         /* DSPF_BGR555 */
 };
 
 /********************************* Sop_PFI_Kto_Dacc ***************************/
@@ -3179,6 +3209,7 @@ static GenefxFunc Sop_PFI_Kto_Dacc[DFB_N
      NULL,                         /* DSPF_LUT2 */
      Sop_xrgb4444_Kto_Dacc,        /* DSPF_RGB444 */
      Sop_xrgb1555_Kto_Dacc,        /* DSPF_RGB555 */
+     Sop_xbgr1555_Kto_Dacc,        /* DSPF_BGR555 */
 };
 
 /********************************* Sacc_to_Aop_PFI ****************************/
@@ -3689,6 +3720,7 @@ static GenefxFunc Sacc_to_Aop_PFI[DFB_NU
      NULL,                         /* DSPF_LUT2 */
      Sacc_to_Aop_xrgb4444,         /* DSPF_RGB444 */
      Sacc_to_Aop_xrgb1555,         /* DSPF_RGB555 */
+     Sacc_to_Aop_xbgr1555,         /* DSPF_BGR555 */
 };
 
 /********************************* Sacc_Sto_Aop_PFI ***************************/
@@ -4245,6 +4277,7 @@ static GenefxFunc Sacc_Sto_Aop_PFI[DFB_N
      NULL,                         /* DSPF_LUT2 */
      Sacc_Sto_Aop_xrgb4444,        /* DSPF_RGB444 */
      Sacc_Sto_Aop_xrgb1555,        /* DSPF_RGB555 */
+     Sacc_Sto_Aop_xbgr1555,        /* DSPF_BGR555 */
 };
 
 /********************************* Sacc_toK_Aop_PFI ***************************/
@@ -4584,6 +4617,7 @@ static GenefxFunc Sacc_toK_Aop_PFI[DFB_N
      NULL,                         /* DSPF_LUT2 */
      Sacc_toK_Aop_xrgb4444,        /* DSPF_RGB444 */
      Sacc_toK_Aop_xrgb1555,        /* DSPF_RGB555 */
+     Sacc_toK_Aop_xbgr1555,        /* DSPF_BGR555 */
 };
 
 /********************************* Sacc_StoK_Aop_PFI **************************/
@@ -4617,6 +4651,7 @@ static GenefxFunc Sacc_StoK_Aop_PFI[DFB_
      NULL,                         /* DSPF_LUT2 */
      Sacc_StoK_Aop_xrgb4444,       /* DSPF_RGB444 */
      Sacc_StoK_Aop_xrgb1555,       /* DSPF_RGB555 */
+     Sacc_StoK_Aop_xbgr1555,       /* DSPF_BGR555 */
 };
 
 /************** Bop_a8_set_alphapixel_Aop_PFI *********************************/
@@ -5432,6 +5467,7 @@ static GenefxFunc Bop_a1_set_alphapixel_
      NULL,                                        /* DSPF_LUT2 */
      NULL,                                        /* DSPF_RGB444 */
      NULL,                                        /* DSPF_RGB555 */
+     NULL,                                        /* DSPF_BGR555 */
 };
 
 
@@ -6164,6 +6200,7 @@ static GenefxFunc Bop_argb_blend_alphach
      NULL,                                             /* DSPF_LUT2 */
      NULL,                                             /* DSPF_RGB444 */
      NULL,                                             /* DSPF_RGB555 */
+     NULL,                                             /* DSPF_BGR555 */
 };
 
 /* A8/A1 to YCbCr */
@@ -6773,6 +6810,9 @@ bool gAcquire( CardState *state, DFBAcce
           case DSPF_RGB555:
                gfxs->Cop = PIXEL_RGB555( color.r, color.g, color.b );
                break;
+          case DSPF_BGR555:
+               gfxs->Cop = PIXEL_BGR555( color.r, color.g, color.b );
+               break;
           default:
                D_ONCE("unsupported destination format");
                return false;
@@ -6798,6 +6838,7 @@ bool gAcquire( CardState *state, DFBAcce
                case DSPF_RGB332:
                case DSPF_RGB444:
                case DSPF_RGB555:
+               case DSPF_BGR555:
                     if (dst_ycbcr &&
                         state->blittingflags & (DSBLIT_COLORIZE |
                                                 DSBLIT_SRC_PREMULTCOLOR))
@@ -8253,6 +8294,7 @@ static const StretchFunctionTable *stret
      NULL,                    /* DSPF_LUT2 */
      NULL,                    /* DSPF_RGB444 */
      NULL,                    /* DSPF_RGB555 */
+     NULL,                    /* DSPF_BGR555 */
 };
 
 /**********************************************************************************************************************/
diff -purN DirectFB-1.1.1/src/idirectfb.c DirectFB-1.1.1_modifie/src/idirectfb.c
--- DirectFB-1.1.1/src/idirectfb.c	2007-12-15 13:30:28.000000000 +0100
+++ DirectFB-1.1.1_modifie/src/idirectfb.c	2008-04-08 13:41:12.000000000 +0200
@@ -503,6 +503,7 @@ IDirectFB_CreateSurface( IDirectFB      
           case DSPF_NV16:
           case DSPF_RGB444:
           case DSPF_RGB555:
+          case DSPF_BGR555:
                break;
 
           default:
diff -purN DirectFB-1.1.1/src/misc/conf.c DirectFB-1.1.1_modifie/src/misc/conf.c
--- DirectFB-1.1.1/src/misc/conf.c	2007-12-15 14:19:08.000000000 +0100
+++ DirectFB-1.1.1_modifie/src/misc/conf.c	2008-04-16 16:56:54.000000000 +0200
@@ -53,7 +53,6 @@
 
 #include <misc/conf.h>
 
-
 DFBConfig *dfb_config = NULL;
 
 static const char *config_usage =
@@ -204,6 +203,7 @@ static const FormatString format_strings
      { "RGB332",   DSPF_RGB332   },
      { "RGB444",   DSPF_RGB444   },
      { "RGB555",   DSPF_RGB555   },
+     { "BGR555",   DSPF_BGR555   },
      { "UYVY",     DSPF_UYVY     },
      { "YUY2",     DSPF_YUY2     },
      { "YV12",     DSPF_YV12     },
@@ -1072,6 +1072,7 @@ DFBResult dfb_config_set( const char *na
                argb >>= 8;
                conf->src_key.r = argb & 0xFF;
                argb >>= 8;
+
                conf->src_key.a = argb & 0xFF;
 
                conf->config.options |= DLOP_SRC_COLORKEY;
diff -purN DirectFB-1.1.1/src/misc/gfx_util.c DirectFB-1.1.1_modifie/src/misc/gfx_util.c
--- DirectFB-1.1.1/src/misc/gfx_util.c	2007-12-15 13:30:24.000000000 +0100
+++ DirectFB-1.1.1_modifie/src/misc/gfx_util.c	2008-04-08 14:00:20.000000000 +0200
@@ -439,6 +439,11 @@ static void write_argb_span (u32 *src, u
                     ((u16*)d)[i] = ARGB_TO_RGB555( src[i] );
                break;
 
+          case DSPF_BGR555:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_BGR555( src[i] );
+               break;
+
           case DSPF_RGB444:
                for (i = 0; i < len; i++)
                     ((u16*)d)[i] = ARGB_TO_RGB444( src[i] );
diff -purN DirectFB-1.1.1/systems/fbdev/fbdev.c DirectFB-1.1.1_modifie/systems/fbdev/fbdev.c
--- DirectFB-1.1.1/systems/fbdev/fbdev.c	2007-12-15 13:30:28.000000000 +0100
+++ DirectFB-1.1.1_modifie/systems/fbdev/fbdev.c	2008-04-17 09:36:13.000000000 +0200
@@ -1472,10 +1472,13 @@ static DFBSurfacePixelFormat dfb_fbdev_g
                if(dfb_fbdev_compatible_format( var, 1, 5, 5, 5, 15, 10, 5, 0 ))
                    return DSPF_ARGB1555;
 
+               if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 0, 5, 10 )){
+                    return DSPF_BGR555;
+		}
+
                break;
 
          case 16:
-
                if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 10, 5, 0 ))
                     return DSPF_RGB555;
 
@@ -1491,6 +1494,10 @@ static DFBSurfacePixelFormat dfb_fbdev_g
                if (dfb_fbdev_compatible_format( var, 0, 5, 6, 5, 0, 11, 5, 0 ))
                     return DSPF_RGB16;
 
+               if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 0, 5, 10 )){
+			return DSPF_BGR555;
+		}
+
                break;
 
           case 18:
@@ -1619,6 +1626,7 @@ dfb_fbdev_set_mode( CoreSurface         
                     VideoMode             *mode,
                     CoreLayerRegionConfig *config )
 {
+	
      unsigned int              vxres, vyres;
      struct fb_var_screeninfo  var;
      FBDevShared              *shared = dfb_fbdev->shared;
@@ -1672,7 +1680,11 @@ dfb_fbdev_set_mode( CoreSurface         
           var.bits_per_pixel = DFB_BYTES_PER_PIXEL(config->format) * 8;
 
           var.transp.length = var.transp.offset = 0;
-
+#define BGR555  
+#ifdef BGR555
+	  /* FIXME */
+ 	  config->format = DSPF_BGR555; 
+#endif
           switch (config->format) {
                case DSPF_ARGB1555:
                     var.transp.length = 1;
@@ -1694,6 +1706,15 @@ dfb_fbdev_set_mode( CoreSurface         
                     var.blue.offset   = 0;
                     break;
 
+               case DSPF_BGR555:
+                    var.red.length    = 5;
+                    var.green.length  = 5;
+                    var.blue.length   = 5;
+                    var.red.offset    = 0;
+                    var.green.offset  = 5;
+                    var.blue.offset   = 10;
+                    break;
+
                case DSPF_ARGB4444:
                     var.transp.length = 4;
                     var.red.length    = 4;
@@ -1874,15 +1895,17 @@ dfb_fbdev_set_mode( CoreSurface         
           FBDEV_IOCTL( FBIOGET_VSCREENINFO, &var );
 
           vxres = var.xres_virtual;
+
+	  var.yres_virtual = ( (var.yres_virtual > vyres) ? vyres : var.yres_virtual ); // For FB_S1D13XXX (on AT91RM9200-EK)
           switch (config->buffermode) {
           case DLBM_TRIPLE:
                vyres = var.yres_virtual / 3;
                break;
           case DLBM_BACKVIDEO:
-               vyres = var.yres_virtual / 2;
+ 		  vyres = var.yres_virtual / 2;
                break;
           default:
-               vyres = var.yres_virtual;
+		  vyres = var.yres_virtual;
                break;
           }
 
@@ -2066,6 +2089,7 @@ static DFBResult dfb_fbdev_set_gamma_ram
      switch (format) {
           case DSPF_ARGB1555:
           case DSPF_RGB555:
+	   case DSPF_BGR555:
                red_size   = 32;
                green_size = 32;
                blue_size  = 32;
diff -purN DirectFB-1.1.1/wm/default/default.c DirectFB-1.1.1_modifie/wm/default/default.c
--- DirectFB-1.1.1/wm/default/default.c	2007-12-15 13:30:28.000000000 +0100
+++ DirectFB-1.1.1_modifie/wm/default/default.c	2008-04-17 09:27:57.000000000 +0200
@@ -508,6 +508,7 @@ window_at_pointer( CoreWindowStack *stac
 
                                    case DSPF_ARGB1555:
                                    case DSPF_RGB555:
+                                   case DSPF_BGR555:
                                         pixel = *(u16*)(data + 2 * wx +
                                                         pitch * wy)
                                                 & 0x7fff;
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to