Пример #1
0
bool
Surface::createDFBSubSurfaceStereo(const Rectangle& geometry, IDirectFBSurface* parent, int zIndex)
{
    release();
    DFBRectangle r = geometry.dfbRect();
    _parentSurface = parent;

    r.x += zIndex;
    DFBResult ret = _parentSurface->GetSubSurface(_parentSurface, &r, &_dfbSurface);
    if (ret)
    {
        ILOG_ERROR( ILX_SURFACE, "Cannot get sub-surface left: %s", DirectFBErrorString(ret));
        return false;
    }
    ret = _dfbSurface->SetBlittingFlags(_dfbSurface, DSBLIT_BLEND_ALPHACHANNEL);
    _dfbSurface->SetStereoEye(_dfbSurface, DSSE_LEFT);

    r.x -= zIndex + zIndex;
    ret = _parentSurface->GetSubSurface(_parentSurface, &r, &_rightSurface);
    if (ret)
    {
        ILOG_ERROR( ILX_SURFACE, "Cannot get sub-surface right: %s", DirectFBErrorString(ret));
        return false;
    }
    ret = _rightSurface->SetBlittingFlags(_rightSurface, DSBLIT_BLEND_ALPHACHANNEL);
    _rightSurface->SetStereoEye(_rightSurface, DSSE_RIGHT);

    return true;
}
Пример #2
0
static DFBResult
server_run()
{
    DFBResult     ret;
    VoodooServer *server;

    ret = voodoo_server_create( &server );
    if (ret) {
        D_ERROR( "Voodoo/Proxy: Could not create the server (%s)!\n", DirectFBErrorString(ret) );
        return ret;
    }

    ret = voodoo_server_register( server, "IDirectFB", ConstructDispatcher, NULL );
    if (ret) {
        D_ERROR( "Voodoo/Proxy: Could not register super interface 'IDirectFB'!\n" );
        voodoo_server_destroy( server );
        return ret;
    }

    ret = voodoo_server_run( server );
    if (ret)
        D_ERROR( "Voodoo/Proxy: Server exiting with error (%s)!\n", DirectFBErrorString(ret) );

    voodoo_server_destroy( server );

    return DFB_OK;
}
Пример #3
0
DFBResult
DirectFBError( const char *msg, DFBResult error )
{
     if (msg)
          direct_log_printf( NULL, "(#) DirectFBError [%s]: %s\n", msg,
                             DirectFBErrorString( error ) );
     else
          direct_log_printf( NULL, "(#) DirectFBError: %s\n",
                             DirectFBErrorString( error ) );

     return error;
}
Пример #4
0
DFBResult
dfb_core_part_leave( CoreDFB  *core,
                     CorePart *core_part,
                     bool      emergency )
{
     DFBResult ret;

     if (!core_part->initialized)
          return DFB_OK;

     D_DEBUG_AT( Core_Parts, "Going to leave '%s' core...\n", core_part->name );

     ret = core_part->Leave( core_part->data_local, emergency );
     if (ret)
          D_ERROR( "DirectFB/Core: Could not leave '%s' core!\n"
                    "    --> %s\n", core_part->name,
                    DirectFBErrorString( ret ) );

     if (core_part->data_local)
          D_FREE( core_part->data_local );

     core_part->data_local  = NULL;
     core_part->data_shared = NULL;
     core_part->initialized = false;

     return DFB_OK;
}
Пример #5
0
DFBResult
dfb_core_part_shutdown( CoreDFB  *core,
                        CorePart *core_part,
                        bool      emergency )
{
     DFBResult            ret;
     FusionSHMPoolShared *pool;

     pool = dfb_core_shmpool( core );

     if (!core_part->initialized)
          return DFB_OK;

     D_DEBUG_AT( Core_Parts, "Going to shutdown '%s' core...\n", core_part->name );

     ret = core_part->Shutdown( core_part->data_local, emergency );
     if (ret)
          D_ERROR( "DirectFB/Core: Could not shutdown '%s' core!\n"
                    "    --> %s\n", core_part->name,
                    DirectFBErrorString( ret ) );

     if (core_part->data_shared)
          SHFREE( pool, core_part->data_shared );

     if (core_part->data_local)
          D_FREE( core_part->data_local );

     core_part->data_local  = NULL;
     core_part->data_shared = NULL;
     core_part->initialized = false;

     return DFB_OK;
}
static IDirectFBSurface* 
_create_surface(IDirectFB* dfb, guint width, guint height)
{
    g_assert(dfb != NULL);
    g_assert(width > 0);
    g_assert(height > 0);

    DFBResult err;

    IDirectFBSurface *ret = NULL;
    
    DFBSurfaceDescription sdesc;

    sdesc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
    sdesc.width = width;
    sdesc.height = height;
    sdesc.pixelformat = DSPF_RGB32;

    err = dfb->CreateSurface(dfb, &sdesc, &ret);

    if (err != DFB_OK) {
        DEBUG_WARN("DirectFB::CreateSurface failed:%s", DirectFBErrorString(err));
        return NULL;
    }

    return ret;

}
Пример #7
0
static DFBResult
fbdevTestConfig( CoreSurfacePool         *pool,
                 void                    *pool_data,
                 void                    *pool_local,
                 CoreSurfaceBuffer       *buffer,
                 const CoreSurfaceConfig *config )
{
     DFBResult           ret;
     CoreSurface        *surface;
     FBDevPoolData      *data  = pool_data;
     FBDevPoolLocalData *local = pool_local;

     D_DEBUG_AT( FBDev_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );

     D_MAGIC_ASSERT( pool, CoreSurfacePool );
     D_MAGIC_ASSERT( data, FBDevPoolData );
     D_MAGIC_ASSERT( local, FBDevPoolLocalData );
     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );

     surface = buffer->surface;
     D_MAGIC_ASSERT( surface, CoreSurface );

     if (surface->type & CSTF_LAYER)
          return DFB_OK;

     ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, NULL, NULL );

     D_DEBUG_AT( FBDev_Surfaces, "  -> %s\n", DirectFBErrorString(ret) );

     return ret;
}
Пример #8
0
bool
Surface::createDFBSurface(int width, int height, DFBSurfaceCapabilities caps)
{
    ILOG_TRACE(ILX_SURFACE);
    release();
    DFBSurfaceDescription desc;
    desc.flags = (DFBSurfaceDescriptionFlags) (DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS);
    desc.width = width;
    desc.height = height;
    desc.pixelformat = PlatformManager::instance().forcedPixelFormat();
    if(_flags & ForceSingleSurface)
        desc.caps = caps;
    else
        desc.caps = (DFBSurfaceCapabilities) (caps | PlatformManager::instance().getWindowSurfaceCaps());
    desc.hints = DSHF_FONT;
    DFBResult ret = PlatformManager::instance().getDFB()->CreateSurface(PlatformManager::instance().getDFB(), &desc, &_dfbSurface);
    if (ret)
    {
        ILOG_ERROR(ILX_SURFACE, "Cannot create surface: %s\n", DirectFBErrorString(ret));
        return false;
    }
    _dfbSurface->SetBlittingFlags(_dfbSurface, DSBLIT_BLEND_ALPHACHANNEL);
    ILOG_DEBUG(ILX_SURFACE, "[%p] %s(width %d, height %d)\n", this, __FUNCTION__, width, height);
    ILOG_DEBUG(ILX_SURFACE, "  -> Created dfb surface %p\n", _dfbSurface);
    return true;
}
Пример #9
0
static void
_dfb_blit_accel_caps_print(IDirectFBSurface *dst, IDirectFBSurface *src)
{
#ifdef DFB_DEBUG_ACCELERATION
   DFBAccelerationMask mask;
   DFBResult r;

   r = dst->GetAccelerationMask(dst, src, &mask);
   if (r != DFB_OK)
     {
	ERR("Could not retrieve acceleration mask: %s",
		DirectFBErrorString(r));
	return;
     }

   DBG("Acceleration: ");

#define O(m) if (mask & m) DBG(#m " ")
   O(DFXL_FILLRECTANGLE);
   O(DFXL_DRAWRECTANGLE);
   O(DFXL_DRAWLINE);
   O(DFXL_FILLTRIANGLE);
   O(DFXL_BLIT);
   O(DFXL_STRETCHBLIT);
   O(DFXL_TEXTRIANGLES);
   O(DFXL_DRAWSTRING);
#undef O

   if (mask == DFXL_NONE) DBG("<NONE>");
#endif /* DFB_DEBUG_ACCELERATION */
}
Пример #10
0
void
Surface::flip()
{
    ILOG_TRACE(ILX_SURFACE);
    DFBResult ret;
    switch (PlatformManager::instance().getLayerFlipMode(_owner->_rootWindow->layerName()))
    {
    case FlipNone:
        ILOG_DEBUG(ILX_SURFACE, " -> Flip using DSFLIP_NONE\n");
        ret = _dfbSurface->Flip(_dfbSurface, NULL, DSFLIP_NONE);
        break;
    case FlipOnSync:
        ILOG_DEBUG(ILX_SURFACE, " -> Flip using DSFLIP_ONSYNC\n");
        ret = _dfbSurface->Flip(_dfbSurface, NULL, DSFLIP_ONSYNC);
        break;
    case FlipWaitForSync:
        ILOG_DEBUG(ILX_SURFACE, " -> Flip using DSFLIP_WAITFORSYNC\n");
        ret = _dfbSurface->Flip(_dfbSurface, NULL, DSFLIP_WAITFORSYNC);
        break;
    case FlipNew:
        ILOG_DEBUG(ILX_SURFACE, " -> Flip using DSFLIP_ONSYNC\n");
        ret = _dfbSurface->Flip(_dfbSurface, NULL, DSFLIP_ONSYNC);
        break;

    default:
        ILOG_DEBUG(ILX_SURFACE, " -> Flip using DSFLIP_NONE\n");
        ret = _dfbSurface->Flip(_dfbSurface, NULL, DSFLIP_NONE);
        break;
    }

    if (ret)
        ILOG_ERROR(ILX_SURFACE, " -> Flip error: %s\n", DirectFBErrorString(ret));
}
Пример #11
0
static DFBResult
stmfbdevTestConfig (CoreSurfacePool         *pool,
                    void                    *pool_data,
                    void                    *pool_local,
                    CoreSurfaceBuffer       *buffer,
                    const CoreSurfaceConfig *config)
{
  CoreSurface           *surface;
  STMfbdevPoolData      * const data  = pool_data;
  STMfbdevPoolLocalData * const local = pool_local;
  DFBResult              ret;

  D_DEBUG_AT (STMfbdev_Surfaces, "%s (%p)\n", __FUNCTION__, buffer);

  D_MAGIC_ASSERT (pool, CoreSurfacePool);
  D_MAGIC_ASSERT (data, STMfbdevPoolData);
  D_MAGIC_ASSERT (local, STMfbdevPoolLocalData);
  D_MAGIC_ASSERT (buffer, CoreSurfaceBuffer);
  D_ASSERT (config != NULL);

  surface = buffer->surface;
  D_MAGIC_ASSERT (surface, CoreSurface);

  D_DEBUG_AT (STMfbdev_Surfaces, "  -> buffer/type/id %p/0x%x/%lu\n",
              buffer, surface->type, surface->resource_id);

  ret = dfb_surfacemanager_allocate (local->core, data->manager,
                                     buffer, NULL, NULL);

  D_DEBUG_AT (STMfbdev_Surfaces, "  -> %s\n", DirectFBErrorString (ret));

  return ret;
}
Пример #12
0
static IDirectFBSurface *
_dfb_surface_from_data(IDirectFB *dfb, int w, int h, void *data)
{
   IDirectFBSurface *s;
   DFBSurfaceDescription desc;
   DFBResult r;

   desc.flags = (DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT |
		 DSDESC_PIXELFORMAT | DSDESC_PREALLOCATED);
   desc.caps = DSCAPS_PREMULTIPLIED;
   desc.width = w;
   desc.height = h;
   desc.preallocated[0].data = data;
   desc.preallocated[0].pitch = w * 4;
   desc.preallocated[1].data = NULL;
   desc.preallocated[1].pitch = 0;
   desc.pixelformat = DSPF_ARGB;
   r = dfb->CreateSurface(dfb, &desc, &s);
   if (r != DFB_OK)
     {
	ERR("Cannot create DirectFB surface: %s",
		     DirectFBErrorString(r));
	return NULL;
     }

   s->SetPorterDuff(s, DSPD_SRC_OVER);

   return s;
}
Пример #13
0
/*
 * Wait for the blitter to be idle.
 *
 * This function is called before memory that has been written to by the hardware is about to be
 * accessed by the CPU (software driver) or another hardware entity like video encoder (by Flip()).
 * It can also be called by applications explicitly, e.g. at the end of a benchmark loop to include
 * execution time of queued commands in the measurement.
 */
DFBResult
davinciEngineSync( void *drv, void *dev )
{
     DFBResult          ret;
     DavinciDriverData *ddrv = drv;
     DavinciDeviceData *ddev = dev;

     D_DEBUG_AT( Davinci_2D, "%s()\n", __FUNCTION__ );

     if (!ddev->synced) {
          D_DEBUG_AT( Davinci_2D, "  -> syncing...\n" );

          ret = davinci_c64x_wait_low( &ddrv->c64x );
          if (ret) {
               D_DEBUG_AT( Davinci_2D, "  -> ERROR (%s)\n", DirectFBErrorString(ret) );
               return ret;
          }

          D_DEBUG_AT( Davinci_2D, "  => syncing done.\n" );

          ddev->synced = true;
     }
     else
          D_DEBUG_AT( Davinci_2D, "  => already synced!\n" );

     return DFB_OK;
}
Пример #14
0
int
main( int argc, char *argv[] )
{
     DFBResult       ret;
     int             i;
     VoodooPlayInfo  info;
     VoodooPlayer   *player = NULL;

     /* Initialize DirectFB including command line parsing. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          DirectFBError( "DirectFBInit() failed", ret );
          return -1;
     }

     /* Parse the command line. */
     if (!parse_command_line( argc, argv ))
          return -2;

     if (m_name) {
          direct_snputs( info.name, m_name, VOODOO_PLAYER_NAME_LENGTH );
     }

     ret = voodoo_player_create( m_name ? &info : NULL, &player );
     if (ret) {
          D_ERROR( "Voodoo/Play: Could not create the player (%s)!\n", DirectFBErrorString(ret) );
          goto out;
     }


     do {
          voodoo_player_broadcast( player );

          direct_thread_sleep( 100000 );

          voodoo_player_enumerate( player, player_callback, NULL );

          if (m_lookup) {
               for (i=1; i<argc; i++) {
                    char buf[100];

                    if (voodoo_player_lookup( player, (const u8 *)argv[i], NULL, buf, sizeof(buf) )) {
                         D_ERROR( "Voodoo/Play: No '%s' found!\n", argv[i] );
                         continue;
                    }

                    D_INFO( "Voodoo/Play: Found '%s' with address %s\n", argv[i], buf );
               }
          }

          direct_thread_sleep( 2000000 );
     } while (m_run);


out:
     if (player)
          voodoo_player_destroy( player );

     return ret;
}
Пример #15
0
IDirectFBSurface *load_image(const char *filename, IDirectFB *dfb, float x_ratio, float y_ratio)
{
	IDirectFBImageProvider *provider;
	IDirectFBSurface *image = NULL;
	DFBSurfaceDescription dsc;
	DFBResult err;

	if (access(filename, R_OK))
	{
		WRITELOG(ERROR, "Cannot load image: file '%s' does not exist!\n", filename);
		return NULL;
	}

	err = dfb->CreateImageProvider (dfb, filename, &provider);
	if (err != DFB_OK)
	{
		WRITELOG(ERROR, "Couldn't load image from file '%s': %s\n", filename, DirectFBErrorString (err));
		return NULL;
	}

	provider->GetSurfaceDescription (provider, &dsc);
	dsc.flags       = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
	dsc.pixelformat = DSPF_ARGB;
	dsc.width       = (float)dsc.width  * (float)x_ratio;
	dsc.height      = (float)dsc.height * (float)y_ratio;
	if (dfb->CreateSurface (dfb, &dsc, &image) == DFB_OK) provider->RenderTo (provider, image, NULL);

	return image;
}
Пример #16
0
void
Surface::setStereoGeometry(int x, int y, int width, int height, int zIndex)
{
    DFBRectangle r = { x, y, width, height };
    if (_parentSurface)
    {
        r.x += zIndex;
        DFBResult ret = _dfbSurface->MakeSubSurface(_dfbSurface, _parentSurface, &r);
        if (ret)
            ILOG_ERROR( ILX_SURFACE, "Cannot set left geometry: %s\n", DirectFBErrorString(ret));

        r.x -= zIndex + zIndex;
        ret = _rightSurface->MakeSubSurface(_rightSurface, _parentSurface, &r);
        if (ret)
            ILOG_ERROR( ILX_SURFACE, "Cannot set right geometry: %s\n", DirectFBErrorString(ret));
    } else
        ILOG_ERROR(ILX_SURFACE, "No Parent Surface, need to create surface again!\n");
}
Пример #17
0
void
Surface::clear()
{
    ILOG_TRACE(ILX_SURFACE);
    DFBResult ret = _dfbSurface->Clear(_dfbSurface, 0, 0, 0, 0);
    if (ret)
        ILOG_ERROR(ILX_SURFACE, "Clear error: %s\n", DirectFBErrorString(ret));
    else
        ILOG_DEBUG(ILX_SURFACE, " -> Cleared surface.\n");
}
Пример #18
0
void
Surface::flipStereo(const Rectangle& left, const Rectangle& right)
{
    DFBRegion l = left.dfbRegion();
    DFBRegion r = right.dfbRegion();
    ILOG_DEBUG(ILX_SURFACE, "[%p] %s Left(%d,%d,%d,%d) Right(%d,%d,%d,%d)\n", this, __FUNCTION__, left.x(), left.y(), left.width(), left.height(), right.x(), right.y(), right.width(), right.height());
    DFBResult ret = _dfbSurface->FlipStereo(_dfbSurface, &l, &r, DSFLIP_WAITFORSYNC);
    if (ret)
        ILOG_ERROR(ILX_SURFACE, "Flip error: %s\n", DirectFBErrorString(ret));
}
Пример #19
0
static int
_dfb_surface_set_blit_params(DirectFB_Engine_Image_Entry *d, DirectFB_Engine_Image_Entry *s, RGBA_Draw_Context *dc)
{
   IDirectFBSurface *surface;
   DFBSurfaceBlittingFlags blit_flags = DSBLIT_NOFX;
   DFBResult res;
   int r, g, b, a;

   _context_get_color(dc, &r, &g, &b, &a);
   if (a == 0)
     return 0;

   if (a != 255)
     blit_flags = DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR;

   if ((r != a) || (g != a) || (b != a))
     {
	blit_flags |= DSBLIT_COLORIZE;

	r = 0xff * r / a;
	g = 0xff * g / a;
	b = 0xff * b / a;
   }

   if (s->cache_entry.src->flags.alpha)
     blit_flags |= DSBLIT_BLEND_ALPHACHANNEL;

   surface = d->surface;

   if (blit_flags &
       (DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR | DSBLIT_COLORIZE))
     {
	res = surface->SetColor(surface, r, g, b, a);
	if (res != DFB_OK)
	  goto error;
     }

   res = surface->SetBlittingFlags(surface, blit_flags);
   if (res != DFB_OK)
     goto error;

#ifdef DFB_DEBUG_FLAGS
   DBG("sfunc=%s, dfunc=%s, color=%d %d %d %d, blit=%s, draw=%s",
	  _dfb_blend_func_str(src_func), _dfb_blend_func_str(dst_func),
	  r, g, b, a,
	  _dfb_blit_flags_str(blit_flags), _dfb_draw_flags_str(draw_flags));
#endif /* DFB_DEBUG_FLAGS */

   return 1;

 error:
   ERR("Could not set blit params: %s",
	 DirectFBErrorString(res));
   return 0;
}
Пример #20
0
DFBResult
dfb_core_part_initialize( CoreDFB  *core,
                          CorePart *core_part )
{
     DFBResult            ret;
     void                *local  = NULL;
     void                *shared = NULL;
     FusionSHMPoolShared *pool;

     pool = dfb_core_shmpool( core );

     if (core_part->initialized) {
          D_BUG( "%s already initialized", core_part->name );
          return DFB_BUG;
     }

     D_DEBUG_AT( Core_Parts, "Going to initialize '%s' core...\n", core_part->name );

     if (core_part->size_local)
          local = D_CALLOC( 1, core_part->size_local );

     if (core_part->size_shared)
          shared = SHCALLOC( pool, 1, core_part->size_shared );
      
     D_INFO("Going to initialize '%s' core...\n", core_part->name );
     ret = core_part->Initialize( core, local, shared );
     D_INFO("Core '%s' initialized ...\n", core_part->name );

     if (ret) {
          D_ERROR( "DirectFB/Core: Could not initialize '%s' core!\n"
                    "    --> %s\n", core_part->name,
                    DirectFBErrorString( ret ) );

          if (shared)
               SHFREE( pool, shared );

          if (local)
               D_FREE( local );

          return ret;
     }

     if (shared)
          fusion_arena_add_shared_field( dfb_core_arena( core ),
                                         core_part->name, shared );

     core_part->data_local  = local;
     core_part->data_shared = shared;
     core_part->initialized = true;
     
     return DFB_OK;
}
Пример #21
0
void
Surface::setGeometry(int x, int y, int width, int height)
{
    ILOG_TRACE(ILX_SURFACE);
    DFBRectangle r = { x, y, width, height };
    if (_parentSurface)
    {
        DFBResult ret = _dfbSurface->MakeSubSurface(_dfbSurface, _parentSurface, &r);
        if (ret)
            ILOG_ERROR(ILX_SURFACE, "Cannot set geometry: %s\n", DirectFBErrorString(ret));
    } else
        ILOG_ERROR(ILX_SURFACE, "Cannot set geometry without a parent surface!\n");
}
Пример #22
0
string MMSFB_ErrorString(const int rc, const string msg) {
    if (rc)
    {
#ifdef  __HAVE_DIRECTFB__
        string s1 = msg;
        string s2 = DirectFBErrorString((DFBResult)rc);
        return s1 + " [" + s2 + "]";
#else
        return msg;
#endif
    }
    else
        return msg;
}
Пример #23
0
bool
Surface::createDFBSubSurface(const Rectangle& geometry, IDirectFBSurface* parent)
{
    ILOG_TRACE(ILX_SURFACE);
    release();
    DFBRectangle r = geometry.dfbRect();
    _parentSurface = parent;
    DFBResult ret = _parentSurface->GetSubSurface(_parentSurface, &r, &_dfbSurface);
    if (ret)
    {
        ILOG_ERROR(ILX_SURFACE, "Cannot get sub-surface: %s", DirectFBErrorString(ret));
        return false;
    }
    ret = _dfbSurface->SetBlittingFlags(_dfbSurface, DSBLIT_BLEND_ALPHACHANNEL);
    if (ret)
    {
        ILOG_ERROR(ILX_SURFACE, "Cannot set blitting flags of sub-surface: %s", DirectFBErrorString(ret));
        return false;
    }
    ILOG_DEBUG(ILX_SURFACE, "[%p] %s(x %d, y %d, w %d, h %d, parent %p)\n", this, __FUNCTION__, geometry.x(), geometry.y(), geometry.width(), geometry.height(), parent);
    ILOG_DEBUG(ILX_SURFACE, "  -> Created dfb surface %p\n", _dfbSurface);
    return true;
}
Пример #24
0
static void
_dfb_surface_update(IDirectFBSurface *surface, int x, int y, int w, int h)
{
   DFBRegion cr;
   DFBResult r;

   cr.x1 = x;
   cr.y1 = y;
   cr.x2 = x + w - 1;
   cr.y2 = y + h - 1;
   r = surface->Flip(surface, &cr, DSFLIP_NONE);
   if (r != DFB_OK)
     WRN("Could not update surface: %s",
	   DirectFBErrorString(r));
}
Пример #25
0
int
main( int argc, char *argv[] )
{
     DFBResult       ret;
     VoodooPlayInfo  info;
     VoodooPlayer   *player = NULL;

     /* Initialize DirectFB including command line parsing. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          DirectFBError( "DirectFBInit() failed", ret );
          return -1;
     }

     /* Parse the command line. */
     if (!parse_command_line( argc, argv ))
          return -2;

     if (m_name) {
          direct_snputs( info.name, m_name, VOODOO_PLAYER_NAME_LENGTH );
     }

     ret = voodoo_player_create( m_name ? &info : NULL, &player );
     if (ret) {
          D_ERROR( "Voodoo/Play: Could not create the player (%s)!\n", DirectFBErrorString(ret) );
          goto out;
     }


     voodoo_player_broadcast( player );

     sleep( 1 );

     voodoo_player_enumerate( player, player_callback, NULL );


out:
     if (player)
          voodoo_player_destroy( player );

     return ret;
}
Пример #26
0
void
Surface::blit(IDirectFBSurface* source, int x, int y)
{
    if (source && _dfbSurface)
    {
        DFBResult ret;
#ifdef ILIXI_STEREO_OUTPUT
        if (_eye == PaintEvent::LeftEye)
#endif
            ret = _dfbSurface->Blit(_dfbSurface, source, NULL, x, y);
#ifdef ILIXI_STEREO_OUTPUT
        else
            ret = _rightSurface->Blit(_rightSurface, source, NULL, x, y);
#endif
        if (ret)
            ILOG_ERROR(ILX_SURFACE, "Blit error: %s\n", DirectFBErrorString(ret));
        else
            ILOG_DEBUG(ILX_SURFACE, "[%p] %s P(%d, %d)\n", this, __FUNCTION__, x, y);
    }
}
Пример #27
0
DFBResult
dfb_core_part_join( CoreDFB  *core,
                    CorePart *core_part )
{
     DFBResult  ret;
     void      *local  = NULL;
     void      *shared = NULL;

     if (core_part->initialized) {
          D_BUG( "%s already joined", core_part->name );
          return DFB_BUG;
     }

     D_DEBUG_AT( Core_Parts, "Going to join '%s' core...\n", core_part->name );

     if (core_part->size_shared &&
         fusion_arena_get_shared_field( dfb_core_arena( core ),
                                        core_part->name, &shared ))
          return DFB_FUSION;

     if (core_part->size_local)
          local = D_CALLOC( 1, core_part->size_local );

     ret = core_part->Join( core, local, shared );
     if (ret) {
          D_ERROR( "DirectFB/Core: Could not join '%s' core!\n"
                    "    --> %s\n", core_part->name,
                    DirectFBErrorString( ret ) );

          if (local)
               D_FREE( local );

          return ret;
     }

     core_part->data_local  = local;
     core_part->data_shared = shared;
     core_part->initialized = true;

     return DFB_OK;
}
Пример #28
0
static void
_image_autoset_alpha(DirectFB_Engine_Image_Entry *image)
{
   DFBResult r;
   DFBSurfacePixelFormat fmt;
   IDirectFBSurface *surface;
   RGBA_Image *im;
   int has_alpha;

   surface = image->surface;
   r = surface->GetPixelFormat(surface, &fmt);
   if (r != DFB_OK)
     {
       ERR("Could not get pixel format: %s",
		DirectFBErrorString(r));
	return;
     }

   /* XXX: check this in more depth in future, if other PF are supported */
   image->cache_entry.src->flags.alpha = (fmt == DSPF_ARGB);
}
Пример #29
0
void
Surface::blit(IDirectFBSurface* source, const Rectangle& crop, int x, int y)
{
    if (source && _dfbSurface)
    {
        DFBRectangle r = crop.dfbRect();
        DFBResult ret;
#ifdef ILIXI_STEREO_OUTPUT
        if (_eye == PaintEvent::LeftEye)
#endif
            ret = _dfbSurface->Blit(_dfbSurface, source, &r, x, y);
#ifdef ILIXI_STEREO_OUTPUT
        else
            ret = _rightSurface->Blit(_rightSurface, source, &r, x, y);
#endif
        if (ret)
            ILOG_ERROR(ILX_SURFACE, " -> Blit error: %s - Rect(%d, %d, %d, %d)\n", DirectFBErrorString(ret), crop.x(), crop.y(), crop.width(), crop.height());
        else
            ILOG_DEBUG(ILX_SURFACE, "[%p] %s Rect(%d, %d, %d, %d) P(%d, %d)\n", this, __FUNCTION__, crop.x(), crop.y(), crop.width(), crop.height(), x, y);
    }
}
Пример #30
0
static IDirectFBSurface *
load_image (const char *filename)
{
     IDirectFBImageProvider *provider;
     IDirectFBSurface       *tmp     = NULL;
     IDirectFBSurface       *surface = NULL;
     DFBSurfaceDescription   dsc;
     DFBResult               err;

     err = dfb->CreateImageProvider( dfb, filename, &provider );
     if (err != DFB_OK) {
          fprintf( stderr, "Couldn't load image from file '%s': %s\n",
                   filename, DirectFBErrorString( err ));
          return NULL;
     }

     provider->GetSurfaceDescription( provider, &dsc );
     dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
     dsc.pixelformat = DSPF_ARGB;
     if (dfb->CreateSurface( dfb, &dsc, &tmp ) == DFB_OK)
          provider->RenderTo( provider, tmp, NULL );

     provider->Release( provider );

     if (tmp) {
          primary->GetPixelFormat( primary, &dsc.pixelformat );
          if (dfb->CreateSurface( dfb, &dsc, &surface ) == DFB_OK) {
               surface->Clear( surface, 0, 0, 0, 0xFF );
               surface->SetBlittingFlags( surface, DSBLIT_BLEND_ALPHACHANNEL );
               surface->Blit( surface, tmp, NULL, 0, 0 );
          }
          tmp->Release( tmp );
     }

     return surface;
}