Hi,

I posted before on the possibility of the Overlay layer supporting a
backbuffer.  I was thinking of possibilities on how to implement
buffermode change in reallocate_surface(), and how to add support for
DLBM_BACKVIDEO in allocate_surface().  

For reallocate_surface(), how about just deallocating the old surface
and then allocate a new one with the new buffer format? And for
allocate_surface(), just pass a DSCAPS_FLIPPING to
dfb_surface_create()?  

As for the gfxdrivers' FlipBuffers() implementation, most will probably
just require a call to dfb_surface_flip_buffers() followed by an update
of the hardware buffer pointer registers.

I have implemented the changes using this line of thought, and they work
for me. Still, I'm not too sure if these changes will introduce
difficulties, or if a more elegant way exists for doing this.  Any
comments?

I've attached a diff of layers.c in DirectFB-0.9.10.

Tony



--- layers.c-orig       Fri Apr 19 17:36:46 2002
+++ layers.c    Sun May 26 00:36:50 2002
@@ -1237,7 +1237,8 @@
 allocate_surface( DisplayLayer *layer )
 {
      DisplayLayerShared *shared = layer->shared;
-     
+     DFBSurfaceCapabilities caps = DSCAPS_VIDEOONLY;
+
      DFB_ASSERT( shared->surface == NULL );
 
      if (layer->funcs->AllocateSurface)
@@ -1246,9 +1247,12 @@
                                                 &shared->config,
                                                 &shared->surface );
 
+     if (shared->config.buffermode & DLBM_BACKVIDEO) 
+       caps |= DSCAPS_FLIPPING;
+
      return dfb_surface_create( shared->config.width, shared->config.height,
                                 shared->config.pixelformat, CSP_VIDEOONLY,
-                                DSCAPS_VIDEOONLY, &shared->surface );
+                                caps, &shared->surface );
 }
 
 static DFBResult
@@ -1266,8 +1270,12 @@
 
      /* FIXME: implement buffer mode changes */
      if (shared->config.buffermode != config->buffermode) {
-          ONCE("Changing the buffermode of layers is unimplemented!");
+       shared->config.buffermode = config->buffermode;
+       deallocate_surface( layer);
+       allocate_surface ( layer );
+       /* ONCE("Changing the buffermode of layers is unimplemented!");
           return DFB_UNIMPLEMENTED;
+       */
      }
 
      /* FIXME: write surface management functions

Reply via email to