So now that we have the first version fo harware decode support
in softdevice cvs, it would be nice to have the required patch for 
directfb in DirectFB's cvs too. The original author of the patches 
should give his OK for doing this (for coyright reasons).

For reviewing I'll attach them now.

A more efficient way could be done when the final blit from the 
decoded data to videolayer could be dropped. But this will require
another change to DirectFB: A surface with N backbuffers
(3 back + 1 front) in this case and flipping to a dedicated 
backbuffer [0 .. 3].

-- 
Stefan Lucke
Index: include/directfb.h
===================================================================
RCS file: /cvs/directfb/DirectFB/include/directfb.h,v
retrieving revision 1.285
diff -u -r1.285 directfb.h
--- include/directfb.h	6 Apr 2006 12:00:34 -0000	1.285
+++ include/directfb.h	1 May 2006 19:18:36 -0000
@@ -2923,6 +2923,15 @@
      );
 
      /*
+      * Returns the framebuffer offset of a locked surface.
+      * The surface must exist in video memory.
+      */
+     DFBResult (*GetFramebufferOffset) (
+          IDirectFBSurface *thiz,
+          int              *offset
+     );
+
+     /*
       * Unlock the surface after direct access.
       */
      DFBResult (*Unlock) (
Index: src/display/idirectfbsurface.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/display/idirectfbsurface.c,v
retrieving revision 1.112
diff -u -r1.112 idirectfbsurface.c
--- src/display/idirectfbsurface.c	2 Apr 2006 12:40:53 -0000	1.112
+++ src/display/idirectfbsurface.c	1 May 2006 19:18:37 -0000
@@ -388,6 +388,44 @@
 }
 
 static DFBResult
+IDirectFBSurface_GetFramebufferOffset( IDirectFBSurface *thiz,
+                                       int *offset )
+{
+     int front;
+     DFBResult ret;
+     SurfaceBuffer *buffer;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!offset)
+          return DFB_INVARG;
+
+     if (!data->locked)
+          return DFB_ACCESSDENIED;
+
+     front = data->locked - 1; /* As set by Lock(). */
+
+     if (front)
+          buffer = data->surface->front_buffer;
+     else
+          buffer = data->surface->back_buffer;
+
+     if (!buffer)
+          return DFB_BUG;
+
+     if (!buffer->video.locked) {
+          /* The surface is probably in a system buffer if video is unlocked. */
+          return DFB_UNSUPPORTED;
+     }
+
+     *offset = buffer->video.offset;
+     return DFB_OK;
+}
+
+static DFBResult
 IDirectFBSurface_Unlock( IDirectFBSurface *thiz )
 {
      DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
@@ -1986,6 +2024,7 @@
      thiz->SetAlphaRamp = IDirectFBSurface_SetAlphaRamp;
 
      thiz->Lock = IDirectFBSurface_Lock;
+     thiz->GetFramebufferOffset = IDirectFBSurface_GetFramebufferOffset;
      thiz->Unlock = IDirectFBSurface_Unlock;
      thiz->Flip = IDirectFBSurface_Flip;
      thiz->SetField = IDirectFBSurface_SetField;
Index: dfb++/idirectfbsurface.cpp
===================================================================
RCS file: /cvs/directfb/DFB++/dfb++/idirectfbsurface.cpp,v
retrieving revision 1.21
diff -u -r1.21 idirectfbsurface.cpp
--- dfb++/idirectfbsurface.cpp	15 Jan 2006 12:24:33 -0000	1.21
+++ dfb++/idirectfbsurface.cpp	1 May 2006 18:30:43 -0000
@@ -116,6 +116,11 @@
      DFBCHECK( iface->Lock (iface, flags, ptr, pitch) );
 }
 
+void IDirectFBSurface::GetFramebufferOffset (int *offset)
+{
+     DFBCHECK( iface->GetFramebufferOffset(iface, offset) ); 
+}
+
 void IDirectFBSurface::Unlock()
 {
      DFBCHECK( iface->Unlock (iface) );
Index: include/idirectfbsurface.h
===================================================================
RCS file: /cvs/directfb/DFB++/include/idirectfbsurface.h,v
retrieving revision 1.23
diff -u -r1.23 idirectfbsurface.h
--- include/idirectfbsurface.h	15 Jan 2006 12:24:33 -0000	1.23
+++ include/idirectfbsurface.h	1 May 2006 18:30:43 -0000
@@ -62,6 +62,7 @@
      void                   Lock                (DFBSurfaceLockFlags       flags,
                                                  void                    **ptr,
                                                  int                      *pitch);
+     void                   GetFramebufferOffset(int                      *offset);
      void                   Unlock              ();
      void                   Flip                (DFBRegion                *region = NULL,
                                                  DFBSurfaceFlipFlags       flags = (DFBSurfaceFlipFlags)0);
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to