On Sat, Feb 13, 2010 at 07:49:37PM +0100, Lionel Landwerlin wrote:
> The null system avoids dependency on a particular system (like fbdev, devmem, 
> etc...)
> when you're writing a gfxdriver for relaying on proprietary interfaces, which 
> can't be
> exposed in an opensource project.
> The behavior of this system is to answer "no" to any memory allocation 
> request, so the
> requests are redirected to the gfxdriver which implements its own allocation 
> system.
> 
> Signed-off-by: Lionel Landwerlin <llandwer...@gmail.com>
> ---
>  configure.in                     |   68 +++++++-----
>  src/core/system.h                |    7 +-
>  src/misc/conf.c                  |   12 +-
>  systems/Makefile.am              |   10 ++-
>  systems/null/Makefile.am         |   38 +++++++
>  systems/null/null.c              |  187 +++++++++++++++++++++++++++++++++
>  systems/null/null.h              |   14 +++
>  systems/null/null_surface_pool.c |  211 
> ++++++++++++++++++++++++++++++++++++++

Why exactly do you need this dummy pool when it does nothing?

>  systems/null/surfacemanager.c    |   97 +++++++++++++++++
>  systems/null/surfacemanager.h    |   52 +++++++++

Nothing from these files is actually used so they should not exist at all.

>  10 files changed, 656 insertions(+), 40 deletions(-)
>  create mode 100644 systems/null/Makefile.am
>  create mode 100644 systems/null/null.c
>  create mode 100644 systems/null/null.h
>  create mode 100644 systems/null/null_surface_pool.c
>  create mode 100644 systems/null/surfacemanager.c
>  create mode 100644 systems/null/surfacemanager.h
> 
> diff --git a/configure.in b/configure.in
> index 9c5877b..a0d1255 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -565,6 +565,14 @@ fi
> 
>  AM_CONDITIONAL(BUILDMMX, test "$enable_mmx" = "yes")
> 
> +dnl Test for Null system
> +AC_ARG_ENABLE(null,
> +  [  --enable-null             build with generic null support 
> [[default=yes]]],,
> +  enable_null=yes)
> +
> +AM_CONDITIONAL(NULL_CORE, test "$enable_null" = "yes")
> +
> +
> 
>  dnl Test for DevMem system
>  AC_ARG_ENABLE(devmem,
> @@ -1610,6 +1618,7 @@ src/windows/Makefile
>  systems/Makefile
>  systems/devmem/Makefile
>  systems/fbdev/Makefile
> +systems/null/Makefile
>  systems/x11/Makefile
>  systems/osx/Makefile
>  systems/sdl/Makefile
> @@ -1729,6 +1738,7 @@ Building Tools              $with_tools
>  Building System Modules:
>    Linux FBDev support       $enable_fbdev
>    Generic /dev/mem support  $enable_devmem
> +  Generic null support      $enable_null
>    X11 support               $enable_x11                 $X11_CFLAGS    
> $X11_LIBS
>    OSX support               $enable_osx                 $OSX_CFLAGS    
> $OSX_LIBS
>    SDL support               $enable_sdl                 $SDL_CFLAGS    
> $SDL_LIBS
> diff --git a/src/core/system.h b/src/core/system.h
> index f6d4df1..fe5e02f 100644
> --- a/src/core/system.h
> +++ b/src/core/system.h
> @@ -45,5 +45,6 @@ typedef enum {
>       CORE_SDL,
>       CORE_VNC,
>       CORE_DEVMEM,
> -     CORE_TI_CMEM
> +     CORE_TI_CMEM,
> +     CORE_NULL
>  } CoreSystemType;
> 
>  typedef enum {
> diff --git a/src/misc/conf.c b/src/misc/conf.c
> index 2c882a9..987a808 100644
> --- a/src/misc/conf.c
> +++ b/src/misc/conf.c
> @@ -140,7 +140,7 @@ static const char *config_usage =
>       "  video-length=<bytes>           Length of video memory (devmem 
> system)\n"
>       "  mmio-phys=<hexaddress>         Physical start of MMIO area (devmem 
> system)\n"
>       "  mmio-length=<bytes>            Length of MMIO area (devmem system)\n"
> -     "  accelerator=<id>               Accelerator ID selecting graphics 
> driver (devmem system)\n"
> +     "  accelerator=<id>               Accelerator ID selecting graphics 
> driver (devmem/null system)\n"
>       "\n"
>       "  [no-]matrox-sgram              Use Matrox SGRAM features\n"
>       "  [no-]matrox-crtc2              Experimental Matrox CRTC2 support\n"
> diff --git a/systems/Makefile.am b/systems/Makefile.am
> index 4137b44..b853ed9 100644
> --- a/systems/Makefile.am
> +++ b/systems/Makefile.am
> @@ -36,5 +36,11 @@ else
>  VNC_DIR =
>  endif
>    
> +if NULL_CORE
> +NULL_DIR = null
> +else
> +NULL_DIR =
> +endif
> +
> +SUBDIRS = $(DEVMEM_DIR) $(FBDEV_DIR) $(X11_DIR) $(SDL_DIR) $(OSX_DIR) 
> $(VNC_DIR) $(NULL_DIR)
>  
> -SUBDIRS = $(DEVMEM_DIR) $(FBDEV_DIR) $(X11_DIR) $(SDL_DIR) $(OSX_DIR) 
> $(VNC_DIR)
> diff --git a/systems/null/Makefile.am b/systems/null/Makefile.am
> new file mode 100644
> index 0000000..a72a5b1
> --- /dev/null
> +++ b/systems/null/Makefile.am
> @@ -0,0 +1,38 @@
> +## Makefile.am for DirectFB/systems/null
> +
> +INCLUDES = \
> +     -I$(top_srcdir)/include         \
> +     -I$(top_builddir)/include       \
> +     -I$(top_builddir)/lib           \
> +     -I$(top_srcdir)/lib             \
> +     -I$(top_srcdir)/src
> +
> +
> +internalincludedir = $(INTERNALINCLUDEDIR)/null
> +
> +internalinclude_HEADERS = \
> +     surfacemanager.h
> +
> +
> +systemsdir = $(MODULEDIR)/systems
> +
> +if BUILD_STATIC
> +systems_DATA = libdirectfb_null.o
> +endif
> +systems_LTLIBRARIES = libdirectfb_null.la
> +
> +libdirectfb_null_la_LDFLAGS = \
> +     -avoid-version  \
> +     -module
> +
> +libdirectfb_null_la_SOURCES = \
> +     null.c \
> +     surfacemanager.c \
> +     null_surface_pool.c
> +
> +libdirectfb_null_la_LIBADD = \
> +     $(top_builddir)/lib/direct/libdirect.la \
> +     $(top_builddir)/src/libdirectfb.la
> +
> +
> +include $(top_srcdir)/rules/libobject.make
> diff --git a/systems/null/null.c b/systems/null/null.c
> new file mode 100644
> index 0000000..3b7e7c5
> --- /dev/null
> +++ b/systems/null/null.c
> @@ -0,0 +1,187 @@
> +/*
> +   (c) Copyright 2009  The world wide DirectFB Open Source Community 
> (directfb.org)
> +
> +   All rights reserved.
> +
> +   Written by Lionel Landwerlin <llandwer...@gmail.com>.
> +
> +   This library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2 of the License, or (at your option) any later version.
> +
> +   This library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with this library; if not, write to the
> +   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.
> +*/
> +
> +#include <config.h>
> +
> +#include <fcntl.h>
> +#include <sys/mman.h>

Unused header files.

> +
> +#include <directfb.h>
> +
> +#include <direct/mem.h>

direct/mem.h also seems unused.

> +
> +#include <fusion/arena.h>
> +#include <fusion/shmalloc.h>

These too.

> +
> +#include <core/core.h>
> +#include <core/surface_pool.h>

And core/surface_pool.h in case you really don't need to dummy pool.

> +
> +#include <misc/conf.h>
> +
> +#include <core/core_system.h>
> +
> +#include "null.h"
> +
> +DFB_CORE_SYSTEM( null )
> +
> +static void
> +system_get_info( CoreSystemInfo *info )
> +{
> +     info->type = CORE_NULL;
> +     info->caps = CSCAPS_ACCELERATION;
> +
> +     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "Null" );
> +}
> +
> +static DFBResult
> +system_initialize( CoreDFB *core, void **ret_data )
> +{
> +     dfb_surface_pool_initialize( core, &nullSurfacePoolFuncs, ret_data );
> +
> +     return DFB_OK;
> +}
> +
> +static DFBResult
> +system_join( CoreDFB *core, void **ret_data )
> +{
> +     dfb_surface_pool_join( core, *ret_data, &nullSurfacePoolFuncs );
> +
> +     return DFB_OK;
> +}
> +
> +static DFBResult
> +system_shutdown( bool emergency )
> +{

Surface pool handling missing (same for system_leave()) but if the pool
can be eliminated all the better.

> +     return DFB_OK;
> +}
> +
> +static DFBResult
> +system_leave( bool emergency )
> +{


> +     return DFB_OK;
> +}
<snip>
> diff --git a/systems/null/null.h b/systems/null/null.h
> new file mode 100644
> index 0000000..b32154b
> --- /dev/null
> +++ b/systems/null/null.h
> @@ -0,0 +1,14 @@
> +#ifndef __NULL_H__
> +#define __NULL_H__
> +
> +#include <core/surface_pool.h>
> +
> +typedef struct {
> +     void                *mem;
> +     volatile void       *reg;
> +} NullData;

This structure is not used anywhere.

> +
> +
> +extern const SurfacePoolFuncs nullSurfacePoolFuncs;

And this will go away if the pool goes away. In that case this whole
header file can go.

> +
> +#endif /* __NULL_H__ */

-- 
Ville Syrjälä
syrj...@sci.fi
http://www.sci.fi/~syrjala/
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to