Beispiel #1
0
VoodooConnectionLink::VoodooConnectionLink( VoodooLink *link )
     :
     VoodooConnection( link )
{
     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p )\n", __func__, this );

     input.start   = 0;
     input.last    = 0;
     input.end     = 0;
     input.max     = 0;

     output.packets = NULL;
     output.sending = NULL;

     /* Initialize all locks. */
     direct_mutex_init( &output.lock );

     /* Initialize all wait conditions. */
     direct_waitqueue_init( &output.wait );

     /* Set default buffer limit. */
     input.max = VOODOO_CONNECTION_LINK_INPUT_BUF_MAX;

     /* Allocate buffers. */
     size_t input_buffer_size = VOODOO_CONNECTION_LINK_INPUT_BUF_MAX + VOODOO_PACKET_MAX + sizeof(VoodooPacketHeader);

     input.buffer = (u8*) D_MALLOC( input_buffer_size );

     D_INFO( "VoodooConnection/Link: Allocated "_ZU" kB input buffer at %p\n", input_buffer_size/1024, input.buffer );

     direct_tls_register( &output.tls, OutputTLS_Destructor );
}
Beispiel #2
0
int
main( int argc, char *argv[] )
{
    DirectResult ret;

    if (parse_cmdline( argc, argv ))
        return -1;

    direct_mutex_init( &lock );
    direct_waitqueue_init( &queue );

    ret = One_Initialize();
    if (ret)
        return ret;

    ret = OneThread_Create( "OneTest", &thread );
    if (ret)
        return ret;

    ret = OneQueue_New( ONE_QUEUE_NO_FLAGS, queue_id, &queue_id );
    if (ret)
        return ret;

    D_INFO( "Queue ID %u\n", queue_id );

    TestWakeUp();

    direct_mutex_deinit( &lock );
    direct_waitqueue_deinit( &queue );

    return 0;
}
Beispiel #3
0
DFBResult
CoreInputHubClient_Create( u32                                 remote_qid,
                           const CoreInputHubClientCallbacks  *callbacks,
                           void                               *ctx,
                           CoreInputHubClient                **ret_client )
{
     DFBResult           ret;
     CoreInputHubClient *client;

     D_DEBUG_AT( Core_InputHub, "%s( QID 0x%08x )\n", __FUNCTION__, remote_qid );

     D_ASSERT( callbacks != NULL );
     D_ASSERT( ret_client != NULL );

     One_Initialize();

     client = D_CALLOC( 1, sizeof(CoreInputHubClient) );
     if (!client)
          return D_OOM();

     client->remote_qid = remote_qid;
     client->callbacks  = *callbacks;
     client->ctx        = ctx;

     ret = OneQueue_New( ONE_QUEUE_NO_FLAGS, ONE_QID_NONE, &client->listen_qid );
     if (ret)
          goto error;

     OneQueue_SetName( client->listen_qid, "InputHub/Listener" );

     ret = OneThread_Create( "Input Hub Client", &client->thread );
     if (ret)
          goto error;

     ret = OneThread_AddQueue( client->thread, client->listen_qid, CoreInputHubClient_Dispatch, client );
     if (ret)
          goto error;

     direct_mutex_init( &client->lock );
     direct_waitqueue_init( &client->wq );

     *ret_client = client;

     return DFB_OK;


error:
     if (client->thread)
          OneThread_Destroy( client->thread );

     if (client->listen_qid)
          OneQueue_Destroy( client->listen_qid );

     D_FREE( client );

     return ret;
}
Beispiel #4
0
static DFBResult
mesaInitLayer( CoreLayer                  *layer,
               void                       *driver_data,
               void                       *layer_data,
               DFBDisplayLayerDescription *description,
               DFBDisplayLayerConfig      *config,
               DFBColorAdjustment         *adjustment )
{
     MesaData *mesa = driver_data;


     mesa->drmeventcontext.version = DRM_EVENT_CONTEXT_VERSION;
     mesa->drmeventcontext.vblank_handler = NULL;
     mesa->drmeventcontext.page_flip_handler = page_flip_handler;

     description->type             = DLTF_GRAPHICS;
     description->caps             = DLCAPS_SURFACE;
     description->surface_caps     = DSCAPS_NONE;
     description->surface_accessor = CSAID_LAYER0;

     direct_snputs( description->name, "Mesa Layer", DFB_DISPLAY_LAYER_DESC_NAME_LENGTH );


     config->flags       = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
     config->width       = dfb_config->mode.width  ?: mesa->mode.hdisplay;
     config->height      = dfb_config->mode.height ?: mesa->mode.vdisplay;
     config->pixelformat = dfb_config->mode.format ?: DSPF_ARGB;
     config->buffermode  = DLBM_FRONTONLY;


     direct_mutex_init( &mesa->lock );
     direct_waitqueue_init( &mesa->wq_event );
     direct_waitqueue_init( &mesa->wq_flip );

     mesa->thread = direct_thread_create( DTT_CRITICAL, Mesa_BufferThread_Main, mesa, "Mesa/Buffer" );

     return DFB_OK;
}
Beispiel #5
0
DirectResult
direct_processor_init( DirectProcessor            *processor,
                       const char                 *name,
                       const DirectProcessorFuncs *funcs,
                       unsigned int                data_size,
                       void                       *context,
                       int                         idle_ms )
{
     D_ASSERT( processor != NULL );
     D_ASSERT( name != NULL );
     D_ASSERT( funcs != NULL );
     D_ASSERT( funcs->Process != NULL );
     D_ASSERT( data_size > 0 );

     D_DEBUG_AT( Direct_Processor, "%s( %p, %p, %p, %u, %p )\n", __FUNCTION__,
                 processor, name, funcs, data_size, context );

     processor->name = D_STRDUP( name );
     if (!processor->name)
          return D_OOM();

     processor->funcs        = funcs;
     processor->data_size    = data_size;
     processor->context      = context;
     processor->idle_ms      = idle_ms;
     processor->max_recycled = (8000 / data_size) + 1;

     direct_fifo_init( &processor->commands );
     direct_fifo_init( &processor->recycled );

#if 0
     direct_waitqueue_init( &processor->lock_cond, NULL );
     direct_mutex_init( &processor->lock_mutex, NULL );
#endif

     D_MAGIC_SET( processor, DirectProcessor );

     processor->thread = direct_thread_create( DTT_DEFAULT, processor_thread, processor, name );
     if (!processor->thread) {
          D_MAGIC_CLEAR( processor );
          direct_fifo_destroy( &processor->commands );
          direct_fifo_destroy( &processor->recycled );
          D_FREE( processor->name );
          return DR_INIT;
     }

     return DR_OK;
}
Beispiel #6
0
DirectResult
fusion_ref_init (FusionRef         *ref,
                 const char        *name,
                 const FusionWorld *world)
{
     D_ASSERT( ref != NULL );
     D_ASSERT( name != NULL );

     direct_recursive_mutex_init( &ref->single.lock );
     direct_waitqueue_init( &ref->single.cond );

     ref->single.refs      = 0;
     ref->single.destroyed = false;
     ref->single.locked    = 0;

     return DR_OK;
}
Beispiel #7
0
VoodooDispatcher::VoodooDispatcher( VoodooManager *manager )
     :
     magic(0),
     manager(manager),
     packets(NULL)
{
     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p )\n", __func__, this );

     /* Initialize lock. */
     direct_mutex_init( &lock );

     /* Initialize wait queue. */
     direct_waitqueue_init( &queue );

     D_MAGIC_SET( this, VoodooDispatcher );


     dispatch_loop = direct_thread_create( DTT_MESSAGING, DispatchLoopMain, this, "Voodoo Dispatch" );
}
Beispiel #8
0
static DFBResult
drmkmsInitLayer( CoreLayer                  *layer,
                 void                       *driver_data,
                 void                       *layer_data,
                 DFBDisplayLayerDescription *description,
                 DFBDisplayLayerConfig      *config,
                 DFBColorAdjustment         *adjustment )
{
     DRMKMSData       *drmkms = driver_data;
     DRMKMSDataShared *shared = drmkms->shared;
     DRMKMSLayerData  *data   = layer_data;

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


     data->index       = shared->layerplane_index_count++;
     data->layer_index = shared->layer_index_count++;
     data->level       = 0;

     description->type             = DLTF_GRAPHICS;
     description->caps             = DLCAPS_SURFACE;
     description->surface_caps     = DSCAPS_NONE;
     description->surface_accessor = CSAID_LAYER0;

     direct_snputs( description->name, "DRMKMS Layer", DFB_DISPLAY_LAYER_DESC_NAME_LENGTH );


     config->flags       = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
     config->width       = dfb_config->mode.width  ?: shared->mode[data->layer_index].hdisplay;
     config->height      = dfb_config->mode.height ?: shared->mode[data->layer_index].vdisplay;

     config->pixelformat = dfb_config->mode.format ?: DSPF_ARGB;
     config->buffermode  = DLBM_FRONTONLY;

     direct_mutex_init( &data->lock );

     direct_waitqueue_init( &data->wq_event );

     return DFB_OK;
}
Beispiel #9
0
int
main( int argc, char *argv[] )
{
    DirectResult  ret;
    IFusionDale  *dale;
    int           i;

    //dfb_config_init( &argc, &argv );

    ret = FusionDaleInit( &argc, &argv );
    if (ret) {
        D_DERROR( ret, "FusionDaleInit() failed!\n" );
        return -1;
    }

    ret = FusionDaleCreate( &dale );
    if (ret) {
        D_DERROR( ret, "FusionDaleCreate() failed!\n" );
        return -2;
    }

    ret = dale->EnterComa( dale, "Coma Test", &coma );
    if (ret) {
        D_DERROR( ret, "IFusionDale::EnterComa('Coma Test') failed!\n" );
        return -3;
    }

    direct_mutex_init( &decoupled_calls_lock );
    direct_waitqueue_init( &decoupled_calls_wq );

    for (i=1; i<argc; i++) {
        if (strncmp( argv[i], "create", 6 ) == 0) {
            int n, num;
            int threads = 1;

            if (sscanf( argv[i]+6, "%d,%d", &num, &threads ) >= 1) {
                for (n=0; n<num; n++) {
                    RUN_create( n );
                }

                for (n=0; n<threads; n++) {
                    direct_thread_create( DTT_DEFAULT, DecoupledCall_thread_main, NULL, "Process" );
                }

                pause();
            }
            else
                fprintf( stderr, "Wrong number '%s'!\n", argv[i]+6 );
        }
        else if (strncmp( argv[i], "call", 4 ) == 0) {
            int index, threads = 1;

            if (sscanf( argv[i]+4, "%d,%d", &index, &threads ) >= 1) {
                RUN_call_threaded( index, threads );
            }
            else
                fprintf( stderr, "Wrong number '%s'!\n", argv[i]+4 );
        }
    }

    direct_waitqueue_deinit( &decoupled_calls_wq );
    direct_mutex_deinit( &decoupled_calls_lock );

    coma->Release( coma );

    dale->Release( dale );

    return 0;
}