static DFBResult
Test_Clipboard_Get( IDirectFB *dfb )
{
     DFBResult       ret;
     struct timeval  tv;
     char           *mime_type;
     void           *data;
     unsigned int    data_size;

     ret = dfb->GetClipboardTimeStamp( dfb, &tv );
     if (ret) {
          D_DERROR( ret, "DFBTest/Clipboard: IDirectFB::GetClipboardTimeStamp() failed!\n" );
          return ret;
     }

     ret = dfb->GetClipboardData( dfb, &mime_type, &data, &data_size );
     if (ret) {
          D_DERROR( ret, "DFBTest/Clipboard: IDirectFB::GetClipboardData() failed!\n" );
          return ret;
     }

     direct_log_printf( NULL, "Got clipboard data of mime type '%s' with data '%s'\n", mime_type, (const char*) data );
     direct_log_printf( NULL, "Got clipboard timestamp %ld.%06ld\n", tv.tv_sec, tv.tv_usec );

     return ret;
}
예제 #2
0
void
Entity::Dump() const
{
     direct_log_printf( NULL, "\n" );
     direct_log_printf( NULL, "Entity (TYPE %d)\n", GetType() );
     direct_log_printf( NULL, "  Buffer at        %p [%zu]\n", buf, length );
}
예제 #3
0
void
Glyph::Dump() const
{
     Entity::Dump();

     direct_log_printf( NULL, "  Unicode          0x%04x\n", unicode );
     direct_log_printf( NULL, "  Left             %d\n", left );
     direct_log_printf( NULL, "  Top              %d\n", top );
     direct_log_printf( NULL, "  Advance          %d\n", advance );
     direct_log_printf( NULL, "  File             '%s'\n", file.c_str() );
}
예제 #4
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;
}
예제 #5
0
DFBResult
pxa3xxEngineSync( void *drv, void *dev )
{
     DFBResult            ret    = DFB_OK;
     PXA3XXDriverData    *pdrv   = drv;
     PXA3XXGfxSharedArea *shared = pdrv->gfx_shared;

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

     DUMP_INFO();

     while (shared->hw_running && ioctl( pdrv->gfx_fd, PXA3XX_GCU_IOCTL_WAIT_IDLE ) < 0) {
          if (errno == EINTR)
               continue;

          ret = errno2result( errno );
          D_PERROR( "PXA3XX/BLT: PXA3XX_GCU_IOCTL_WAIT_IDLE failed!\n" );

          direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
                             pdrv->gfx_shared->hw_running ? "" : "not ",             \
                             pdrv->gfx_shared->hw_start,                             \
                             pdrv->gfx_shared->hw_end,                               \
                             pdrv->gfx_shared->next_start,                           \
                             pdrv->gfx_shared->next_end,                             \
                             pdrv->gfx_shared->next_valid ? "" : "not " );

          break;
     }

     if (ret == DFB_OK) {
          D_ASSERT( !shared->hw_running );
     }

     return ret;
}
예제 #6
0
void
direct_print_memleaks( void )
{
     unsigned long total = 0;

     /* Debug only. */
     direct_mutex_lock( &alloc_lock );

     if (alloc_hash.count) {
          direct_log_printf( NULL, "Local memory allocations remaining (%d): \n", alloc_hash.count );

          direct_hash_iterate( &alloc_hash, local_alloc_hash_iterator, &total );
     }

     direct_mutex_unlock( &alloc_lock );

     if (total)
          direct_log_printf( NULL, "%7lu bytes in total\n", total );
}
예제 #7
0
static void
AVTunerOnStationFoundDispatchCallback( void               *ctx,
                                       ComaNotificationID  notification,
                                       void               *arg )
{
//     OnStationData *data = arg;

    direct_log_printf( NULL, "AV/Tuner: %s( %p, %lu, %p ) called!\n",
                       __FUNCTION__, ctx, notification, arg );

//     coma->Deallocate( coma, data );
}
예제 #8
0
파일: perf.c 프로젝트: Distrotech/DirectFB
void
direct_perf_dump_all()
{
     direct_mutex_lock( &counter_lock );

     if (direct_hash_count( &counter_hash )) {
          direct_log_printf( NULL, "Performance Counters                                               Total count    rate           start        end\n" );

          direct_hash_iterate( &counter_hash, perf_iterate, NULL );
     }

     direct_mutex_unlock( &counter_lock );
}
예제 #9
0
static void
ComaTestMethodFunc( void         *ctx,
                    ComaMethodID  method,
                    void         *arg,
                    unsigned int  serial )
{
    ComaTestInstance *instance = ctx;

    calls++;

    if (calls % 1000 == 0)
        direct_log_printf( NULL, "\rReceived %u calls", calls );

    DecoupleCall( instance, method, arg, serial );
}
예제 #10
0
static void
ShowMessage( unsigned int ms, const char *name, const char *prefix, const char *format, ... )
{
    char buf[512];

    va_list ap;

    va_start( ap, format );

    vsnprintf( buf, sizeof(buf), format, ap );

    va_end( ap );

    direct_log_printf( NULL, "%s [[ %-30s ]]  %s\n", prefix, name, buf );

    direct_thread_sleep( ms * 1000 );
}
예제 #11
0
void
Face::Dump() const
{
     Entity::Dump();

     direct_log_printf( NULL, "  Size             %u\n", size );
     direct_log_printf( NULL, "  Height           %u\n", height );
     direct_log_printf( NULL, "  Ascender         %d\n", ascender );
     direct_log_printf( NULL, "  Descender        %d\n", descender );
     direct_log_printf( NULL, "  MaxAdvance       %d\n", maxadvance );
     direct_log_printf( NULL, "  BlittingFlags    0x%08x\n", blittingflags );
}
예제 #12
0
static bool
local_alloc_hash_iterator( DirectHash    *hash,
                           unsigned long  key,
                           void          *value,
                           void          *ctx )
{
     MemDesc       *desc  = value;
     unsigned long *total = ctx;

     direct_log_printf( NULL, ""_ZUn(7)" bytes at %p allocated in %s (%s: %u)\n",
                        desc->bytes, desc->mem, desc->func, desc->file, desc->line );

     if (desc->trace)
          direct_trace_print_stack( desc->trace );

     *total += desc->bytes;

     return true;
}
예제 #13
0
static int
SetGains( AVTuner *tuner, AVTunerSetGainsCtx *gains )
{
    void           *ptr;
    OnStationData  *data;
    IComaComponent *component = tuner->component;

    direct_log_printf( NULL, "AV/Tuner: %s( %p, %d [%d...] ) called!\n", __FUNCTION__,
                       gains, gains->num, gains->gains[0] );

    coma->Allocate( coma, sizeof(OnStationData), &ptr );

    data = ptr;
    data->frequency = tuner->frequency;
    data->snr       = 30;

    component->Notify( component, AV_TUNER_ONSTATIONLOST, data );

    return DR_OK;
}
static DFBResult
Test_Clipboard_Set( IDirectFB  *dfb,
                    const char *mime_type,
                    const char *data )
{
     DFBResult      ret;
     struct timeval tv;

     gettimeofday( &tv, NULL );

     direct_log_printf( NULL, "Setting clipboard data to mime type '%s' with data '%s' and timestamp %ld.%06ld\n",
                        mime_type, data, tv.tv_sec, tv.tv_usec );

     ret = dfb->SetClipboardData( dfb, mime_type, data, strlen(data) + 1, &tv );
     if (ret) {
          D_DERROR( ret, "DFBTest/Clipboard: IDirectFB::SetClipboardData() failed!\n" );
          return ret;
     }

     return ret;
}
예제 #15
0
static int
SetFrequency( AVTuner *tuner, int *frequency )
{
    void           *ptr;
    OnStationData  *data;
    IComaComponent *component = tuner->component;

    direct_log_printf( NULL, "AV/Tuner: %s( %d ) called!\n", __FUNCTION__, *frequency );

    tuner->frequency = *frequency * 1000;


    coma->Allocate( coma, sizeof(OnStationData), &ptr );

    data = ptr;
    data->frequency = tuner->frequency;
    data->snr       = 80;

    component->Notify( component, AV_TUNER_ONSTATIONFOUND, data );

    return DR_OK;
}
예제 #16
0
파일: perf.c 프로젝트: Distrotech/DirectFB
static bool
perf_iterate( DirectHash    *hash,
              unsigned long  key,
              void          *value,
              void          *ctx )
{
     DirectPerfCounter *counter = value;

     counter->stop = direct_clock_get_time( DIRECT_CLOCK_SESSION );

     if (counter->count > 0)
          direct_log_printf( NULL, "  %-60s  %12lu  (%7.3f/sec)  %9lld -%9lld\n", counter->name,
                             counter->count, counter->count * 1000000.0 / (double)(counter->stop - counter->start),
                             counter->start, counter->stop );

     if (counter->reset_on_dump) {
          counter->count = 0;
          counter->start = 0;
     }

     return true;
}
예제 #17
0
static void
OnStationLost( void *ctx, void *arg )
{
     direct_log_printf( NULL, "AV/TuningMonitor: %s( %d ) called!\n", __FUNCTION__, * (int*) arg );
}
예제 #18
0
static DFBResult
flush_prepared( PXA3XXDriverData *pdrv )
{
     PXA3XXGfxSharedArea *shared  = pdrv->gfx_shared;

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

     DUMP_INFO();

     D_ASSERT( pdrv->prep_num < PXA3XX_GCU_BUFFER_WORDS );
     D_ASSERT( pdrv->prep_num <= D_ARRAY_SIZE(pdrv->prep_buf) );

     /* Something prepared? */
     while (pdrv->prep_num) {
          int timeout = 2;
          int next_end;

          /* Mark shared information as invalid. From this point on the interrupt handler
           * will not continue with the next block, and we'll start the hardware ourself. */
          shared->next_valid = false;

          mb();

          /* Check if there's enough space at the end.
           * Wait until hardware has started next block before it gets too big. */
          if (shared->next_end + pdrv->prep_num >= PXA3XX_GCU_BUFFER_WORDS ||
              shared->next_end - shared->next_start >= PXA3XX_GCU_BUFFER_WORDS/4)
          {
               /* If there's no next block waiting, start at the beginning. */
               if (shared->next_start == shared->next_end)
                    shared->next_start = shared->next_end = 0;
               else {
                    D_ASSERT( shared->buffer[shared->hw_end] == 0x08000000 );

                    /* Mark area as valid again. */
                    shared->next_valid = true;

                    mb();

                    /* Start in case it got idle while doing the checks. */
                    if (start_hardware( pdrv )) {
                         /*
                          * Hardware has not been started (still running).
                          * Check for timeout. */
                         if (!timeout--) {
                              D_ERROR( "PXA3XX/Blt: Timeout waiting for processing!\n" );
                              direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
                                                 pdrv->gfx_shared->hw_running ? "" : "not ",             \
                                                 pdrv->gfx_shared->hw_start,                             \
                                                 pdrv->gfx_shared->hw_end,                               \
                                                 pdrv->gfx_shared->next_start,                           \
                                                 pdrv->gfx_shared->next_end,                             \
                                                 pdrv->gfx_shared->next_valid ? "" : "not " );
                              D_ASSERT( shared->buffer[shared->hw_end] == 0x08000000 );
//                              pxa3xxEngineReset( pdrv, pdrv->dev );

                              return DFB_TIMEOUT;
                         }

                         /* Wait til next block is started. */
                         ioctl( pdrv->gfx_fd, PXA3XX_GCU_IOCTL_WAIT_NEXT );
                    }

                    /* Start over with the checks. */
                    continue;
               }
          }

          /* We are appending in case there was already a next block. */
          next_end = shared->next_end + pdrv->prep_num;

          /* Reset the timeout counter. */
          timeout = 20;

          /* While the hardware is running... */
          while (shared->hw_running) {
               D_ASSERT( shared->buffer[shared->hw_end] == 0x08000000 );

               /* ...make sure we don't over lap with its current buffer, otherwise wait. */
               if (shared->hw_start > next_end || shared->hw_end < shared->next_start)
                    break;

               /* Check for timeout. */
               if (!timeout--) {
                    D_ERROR( "PXA3XX/Blt: Timeout waiting for space!\n" );
                    direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
                                       pdrv->gfx_shared->hw_running ? "" : "not ",             \
                                       pdrv->gfx_shared->hw_start,                             \
                                       pdrv->gfx_shared->hw_end,                               \
                                       pdrv->gfx_shared->next_start,                           \
                                       pdrv->gfx_shared->next_end,                             \
                                       pdrv->gfx_shared->next_valid ? "" : "not " );
                    D_ASSERT( shared->buffer[shared->hw_end] == 0x08000000 );
//                    pxa3xxEngineReset( pdrv, pdrv->dev );

                    return DFB_TIMEOUT;
               }

               /* Wait til next block is started. */
               ioctl( pdrv->gfx_fd, PXA3XX_GCU_IOCTL_WAIT_NEXT );
          }

          /* Copy from local to shared buffer. */
          direct_memcpy( (void*) &shared->buffer[shared->next_end], &pdrv->prep_buf[0], pdrv->prep_num * sizeof(u32) );

          /* Terminate the block. */
          shared->buffer[next_end] = 0x08000000;

          /* Update next block information and mark valid. */
          shared->next_end   = next_end;

          mb();

          shared->next_valid = true;

          /* Reset local counter. */
          pdrv->prep_num = 0;

          /* Start in case it is idle. */
          return start_hardware( pdrv );
     }

     return DFB_OK;
}
예제 #19
0
/*
 * Programs have to call this to get the super interface
 * which is needed to access other functions
 */
DFBResult
DirectFBCreate( IDirectFB **interface )
{
     DFBResult  ret;
     IDirectFB *dfb;
     CoreDFB   *core_dfb;

     if (!dfb_config) {
          /*  don't use D_ERROR() here, it uses dfb_config  */
          direct_log_printf( NULL, "(!) DirectFBCreate: DirectFBInit "
                             "has to be called before DirectFBCreate!\n" );
          return DFB_INIT;
     }

     if (!interface)
          return DFB_INVARG;

     if (idirectfb_singleton) {
          idirectfb_singleton->AddRef( idirectfb_singleton );
          *interface = idirectfb_singleton;
          return DFB_OK;
     }

     direct_initialize();

     if ( !(direct_config->quiet & DMT_BANNER) && dfb_config->banner) {
          direct_log_printf( NULL,
                             "\n"
                             "   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB " DIRECTFB_VERSION " |~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                             "        (c) 2001-2009  The world wide DirectFB Open Source Community\n"
                             "        (c) 2000-2004  Convergence (integrated media) GmbH\n"
                             "      ----------------------------------------------------------------\n"
                             "\n" );
     }

     if (dfb_config->remote.host)
          return CreateRemote( dfb_config->remote.host, dfb_config->remote.session, interface );

     ret = dfb_core_create( &core_dfb );
     if (ret)
          return ret;

     DIRECT_ALLOCATE_INTERFACE( dfb, IDirectFB );

     ret = IDirectFB_Construct( dfb, core_dfb );
     if (ret) {
          dfb_core_destroy( core_dfb, false );
          return ret;
     }

     if (dfb_core_is_master( core_dfb )) {
          /* not fatal */
          ret = dfb_wm_post_init( core_dfb );
          if (ret)
               D_DERROR( ret, "DirectFBCreate: Post initialization of WM failed!\n" );

          dfb_core_activate( core_dfb );
     }

     *interface = idirectfb_singleton = dfb;

     return DFB_OK;
}