Beispiel #1
0
static DFBResult
Test_RenderElement( IWater *water, IDirectFBSurface *surface )
{
     int i;

     /*
      * Render elements
      */
     for (i=0; i<D_ARRAY_SIZE(m_test_elements); i++) {
          unsigned int index = WATER_ELEMENT_TYPE_INDEX( m_test_elements[i].header.type  );

          D_ASSERT( index < D_ARRAY_SIZE(m_element_types) );

          surface->Clear( surface, 0xc0, 0xb0, 0x90, 0xff );

          D_INFO( "Tests/Water: Testing RenderElement( %s )...\n", m_element_types[index].name );

          /*
           * Render element
           */
          _T( water->RenderElements( water, surface,
                                     &m_test_elements[i],
                                     1 ) );

          surface->Flip( surface, NULL, DSFLIP_NONE );
          sleep( 2 );
     }

     return DFB_OK;
}
Beispiel #2
0
/*
 * Translates a Linux input keycode into a DirectFB keycode.
 */
static int
translate_key( unsigned short code )
{
     if (code < D_ARRAY_SIZE( basic_keycodes ))
          return basic_keycodes[code];

     if (code >= KEY_OK)
          if (code - KEY_OK < D_ARRAY_SIZE( ext_keycodes ))
               return ext_keycodes[code-KEY_OK];

     return DIKI_UNKNOWN;
}
Beispiel #3
0
static DFBResult
Test_RenderElements( IWater *water, IDirectFBSurface *surface )
{
     D_INFO( "Tests/Water: Testing RenderElements( %d )...\n", D_ARRAY_SIZE(m_test_elements) );

     /*
      * Render elements
      */
     _T( water->RenderElements( water, surface, m_test_elements, D_ARRAY_SIZE(m_test_elements) ) );

     return DFB_OK;
}
static void
dump_encoder_config( const DFBScreenEncoderConfig *config )
{
     int i;

     printf( "\n" );

     if (config->flags & DSECONF_TV_STANDARD) {
          printf( "TV Standard:   " );

          for (i=0; i<D_ARRAY_SIZE(tv_standard_names); i++) {
               if (config->tv_standard & tv_standard_names[i].standard)
                    printf( "%s ", tv_standard_names[i].name );
          }

          printf( "\n" );
     }

     if (config->flags & DSECONF_TEST_PICTURE)
          printf( "Test Picture:  %s\n", test_picture_name( config->test_picture ) );

     if (config->flags & DSECONF_MIXER)
          printf( "Mixer:         %d\n", config->mixer );

     if (config->flags & DSECONF_OUT_SIGNALS) {
          printf( "Signals:       " );

          for (i=0; i<D_ARRAY_SIZE(signal_names); i++) {
               if (config->out_signals & signal_names[i].signal)
                    printf( "%s ", signal_names[i].name );
          }

          printf( "\n" );
     }

     if (config->flags & DSECONF_RESOLUTION)
          printf( "Resolution:    %s\n", resolution_name( config->resolution ) );

     if (config->flags & DSECONF_SCANMODE)
          printf( "Scan Mode:     %s\n", scan_mode_name( config->scanmode ) );

     if (config->flags & DSECONF_FREQUENCY)
          printf( "Frequency:     %s\n", frequency_name( config->frequency ) );

     if (config->flags & DSECONF_FRAMING)
          printf( "Framing:       %s\n", framing_name( config->framing ) );

     printf( "\n" );
}
Beispiel #5
0
static DFBResult
primarySetOutputConfig( CoreScreen                  *screen,
                        void                        *driver_data,
                        void                        *screen_data,
                        int                          output,
                        const DFBScreenOutputConfig *config )
{
     DFBX11       *x11    = driver_data;
     DFBX11Shared *shared = x11->shared;

     int hor[] = { 640,720,720,800,1024,1152,1280,1280,1280,1280,1400,1600,1920 };
     int ver[] = { 480,480,576,600, 768, 864, 720, 768, 960,1024,1050,1200,1080 };

     int res;

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

     (void)output; /* all outputs are active */

     /* we support screen resizing only */
     if (config->flags != DSOCONF_RESOLUTION)
          return DFB_INVARG;

     res = D_BITn32(config->resolution);
     if ( (res == -1) || (res >= D_ARRAY_SIZE(hor)) )
          return DFB_INVARG;

     shared->screen_size.w = hor[res];
     shared->screen_size.h = ver[res];

     // FIXME: recreate window/target etc.

     return DFB_OK;
}
Beispiel #6
0
DFBResult
SurfacePeer::updateBuffers()
{
     D_DEBUG_AT( DirectFB_Graphics, "Graphics::SurfacePeer::%s( %p ) <- surface %p\n", __FUNCTION__, this, surface );

     if (direct_serial_update( &surface_serial, &surface->config_serial )) {
          DFBResult ret;

          surface_config = surface->config;

          ret = ::CoreSurface_GetBuffers( surface, &buffer_ids[0], D_ARRAY_SIZE(buffer_ids), &buffer_num );
          if (ret) {
               D_DERROR( ret, "Graphics/SurfacePeer: CoreSurface::GetBuffers() failed!\n" );
               return ret;
          }

          for (size_t i=0; i<buffer_num; i++)
               buffer_objects[i] = NULL;
     }

     if (surface_config.caps & DSCAPS_STEREO) {
          D_ASSERT( buffer_num > 1 );

          index = (flips % (buffer_num/2)) * 2;
     }
     else {
          D_ASSERT( buffer_num > 0 );

          index = flips % buffer_num;
     }

     return DFB_OK;
}
Beispiel #7
0
static DFBResult
dfb_core_initialize( CoreDFB *core )
{
     int            i;
     DFBResult      ret;
     CoreDFBShared *shared;

     D_MAGIC_ASSERT( core, CoreDFB );

     shared = core->shared;

     D_MAGIC_ASSERT( shared, CoreDFBShared );

     ret = fusion_shm_pool_create( core->world, "DirectFB Data Pool", 0x1000000,
                                   fusion_config->debugshm, &shared->shmpool_data );
     if (ret)
          return ret;

     shared->layer_context_pool = dfb_layer_context_pool_create( core->world );
     shared->layer_region_pool  = dfb_layer_region_pool_create( core->world );
     shared->palette_pool       = dfb_palette_pool_create( core->world );
     shared->surface_pool       = dfb_surface_pool_create( core->world );
     shared->window_pool        = dfb_window_pool_create( core->world );

     for (i=0; i<D_ARRAY_SIZE(core_parts); i++) {
          DFBResult ret;

          if ((ret = dfb_core_part_initialize( core, core_parts[i] ))) {
               dfb_core_shutdown( core, true );
               return ret;
          }
     }

     return DFB_OK;
}
Beispiel #8
0
static DFBResult
flush_prepared( PXA3XXDriverData *pdrv )
{
     int result;

     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? */
     if (pdrv->prep_num) {
          result = write( pdrv->gfx_fd, pdrv->prep_buf, pdrv->prep_num * 4 );
          if (result < 0) {
               D_PERROR( "PXA3XX/BLT: write() failed!\n" );
               return DFB_IO;
          }

          pdrv->prep_num = 0;
     }

     return DFB_OK;
}
Beispiel #9
0
void
sawman_dispatch_tier_update( SaWMan             *sawman,
                             SaWManTier         *tier,
                             bool                right_eye,
                             const DFBRegion    *updates,
                             unsigned int        num_updates )
{
     SaWManListenerCallData data;

     data.call        = SWMLC_TIER_UPDATE;
     data.stereo_eye  = right_eye ? DSSE_RIGHT : DSSE_LEFT;
     data.layer_id    = tier->layer_id;
     data.num_updates = num_updates;

     D_ASSERT( num_updates <= D_ARRAY_SIZE(data.updates) );

     direct_memcpy( data.updates, updates, num_updates * sizeof(DFBRegion) );

     fusion_reactor_dispatch( sawman->reactor, &data, true, NULL );

     if (!right_eye) {
          unsigned int i;

          for (i=0; i<num_updates; i++)
               tier->performance.pixels += (updates[i].x2 - updates[i].x1 + 1) * (updates[i].y2 - updates[i].y1 + 1);

          tier->performance.updates++;
     }
}
Beispiel #10
0
static DFBResult
Test_WarpCursor( IDirectFBDisplayLayer *layer, void *arg )
{
    int      i;
    DFBPoint pos;

    /*
     * Warp the cursor
     */
    _T( layer->SetCooperativeLevel( layer, DLSCL_ADMINISTRATIVE ) );
    _T( layer->GetCursorPosition( layer, &pos.x, &pos.y ) );

    {
        DFBPoint poss[] = { { pos.x - 40, pos.y - 40 },
            { pos.x + 40, pos.y - 40 },
            { pos.x + 40, pos.y + 40 },
            { pos.x - 40, pos.y + 40 },
            { pos.x     , pos.y      }
        };

        for (i=0; i<D_ARRAY_SIZE(poss); i++) {
            SHOW_TEST( "WarpCursor( %4d,%4d - [%02d] )...", poss[i].x, poss[i].y, i );

            _T( layer->WarpCursor( layer, poss[i].x, poss[i].y ) );

            SHOW_RESULT( "...WarpCursor( %4d,%4d - [%02d] ) done.", poss[i].x, poss[i].y, i );
        }
    }

    return DFB_OK;
}
Beispiel #11
0
void
__Fusion_init_all()
{
     size_t i;

     for (i=0; i<D_ARRAY_SIZE(init_funcs); i++)
          init_funcs[i]();
}
Beispiel #12
0
void
__Voodoo_deinit_all()
{
     size_t i;

     for (i=0; i<D_ARRAY_SIZE(deinit_funcs); i++)
          deinit_funcs[i]();
}
Beispiel #13
0
void
__D_deinit_all()
{
     size_t i;

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

     for (i=0; i<D_ARRAY_SIZE(deinit_funcs); i++)
          deinit_funcs[i]();
}
Beispiel #14
0
static const char *
tree_name( DFBScreenMixerTree tree )
{
     int i;

     for (i=0; i<D_ARRAY_SIZE(tree_names); i++) {
          if (tree_names[i].tree == tree)
               return tree_names[i].name;
     }

     return "<invalid>";
}
Beispiel #15
0
static const char *
scan_mode_name( DFBScreenEncoderScanMode scan_mode )
{
     int i;

     for (i=0; i<D_ARRAY_SIZE(scan_mode_names); i++) {
          if (scan_mode_names[i].scan_mode == scan_mode)
               return scan_mode_names[i].name;
     }

     return "<invalid>";
}
Beispiel #16
0
static const char *
resolution_name( DFBScreenOutputResolution resolution )
{
     int i;

     for (i=0; i<D_ARRAY_SIZE(resolution_names); i++) {
          if (resolution_names[i].resolution == resolution)
               return resolution_names[i].name;
     }

     return "<invalid>";
}
Beispiel #17
0
static const char *
framing_name( DFBScreenEncoderPictureFraming framing )
{
     int i;

     for (i=0; i<D_ARRAY_SIZE(framing_names); i++) {
          if (framing_names[i].framing == framing)
               return framing_names[i].name;
     }

     return "<invalid>";
}
Beispiel #18
0
static const char *
frequency_name( DFBScreenEncoderFrequency frequency )
{
     int i;

     for (i=0; i<D_ARRAY_SIZE(frequency_names); i++) {
          if (frequency_names[i].frequency == frequency)
               return frequency_names[i].name;
     }

     return "<invalid>";
}
Beispiel #19
0
static const char *
test_picture_name( DFBScreenEncoderTestPicture test_picture )
{
     int i;

     for (i=0; i<D_ARRAY_SIZE(test_picture_names); i++) {
          if (test_picture_names[i].test_picture == test_picture)
               return test_picture_names[i].name;
     }

     return "<invalid>";
}
Beispiel #20
0
static FSSampleFormat
parse_sampleformat( const char *format )
{
     int i;
     
     for (i = 0; i < D_ARRAY_SIZE(format_strings); i++) {
          if (!strcmp( format, format_strings[i].string ))
               return format_strings[i].format;
     }

     return FSSF_UNKNOWN;
}
Beispiel #21
0
static void
parse_flags( const char *arg, DFBSurfaceBlittingFlags *ret_flags )
{
     int i;

     *ret_flags = DSBLIT_NOFX;

     for (i=0; i<D_ARRAY_SIZE(m_bflags); i++) {
          if (strcasestr( arg, m_bflags[i].name ))
               *ret_flags = (DFBSurfaceBlittingFlags)(*ret_flags | m_bflags[i].flag);
     }
}
Beispiel #22
0
static int
dfb_core_leave( CoreDFB *core, bool emergency )
{
     int i;

     D_MAGIC_ASSERT( core, CoreDFB );

     for (i=D_ARRAY_SIZE(core_parts)-1; i>=0; i--)
          dfb_core_part_leave( core, core_parts[i], emergency );

     return DFB_OK;
}
Beispiel #23
0
static FSChannelMode
parse_modestring( const char *mode )
{
     int i;
     
     for (i = 0; i < D_ARRAY_SIZE(mode_strings); i++) {
          if (!strcmp( mode, mode_strings[i].string ))
               return mode_strings[i].mode;
     }

     return FSCM_UNKNOWN;
}
Beispiel #24
0
static DFBResult
Test_DstGeometry( IDirectFBDisplayLayer *layer, void *arg )
{
    int                i;
    IDirectFBWindow   *window;
    DFBWindowGeometry  geometry;
    DFBDimension       size;

    D_ASSERT( m_toplevel_id != 0 );

    /*
     * Get the top level window
     */
    _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );

    window->GetSize( window, &size.w, &size.h );

    /*
     * Change destination geometry
     */
    {
        DFBRectangle rects[] = { {          0,          0, size.w / 2, size.h / 2 },
            { size.w / 2,          0, size.w / 2, size.h / 2 },
            { size.w / 2, size.h / 2, size.w / 2, size.h / 2 },
            {          0, size.h / 2, size.w / 2, size.h / 2 }
        };

        for (i=0; i<D_ARRAY_SIZE(rects); i++) {
            SHOW_TEST( "SetDstGeometry( %4d,%4d-%4dx%4d - [%02d] )...", DFB_RECTANGLE_VALS(&rects[i]), i );

            geometry.mode      = DWGM_RECTANGLE;
            geometry.rectangle = rects[i];

            _T( window->SetDstGeometry( window, &geometry ) );

            SHOW_RESULT( "...SetDstGeometry( %4d,%4d-%4dx%4d - [%02d] ) done.", DFB_RECTANGLE_VALS(&rects[i]), i );
        }
    }


    SHOW_TEST( "SetDstGeometry( DEFAULT )..." );

    geometry.mode = DWGM_DEFAULT;

    _T( window->SetDstGeometry( window, &geometry ) );

    SHOW_RESULT( "...SetDstGeometry( DEFAULT ) done." );


    window->Release( window );

    return DFB_OK;
}
Beispiel #25
0
static DFBResult
Test_ScaleWindow( IDirectFBDisplayLayer *layer, void *arg )
{
    int              i;
    IDirectFBWindow *window;
    DFBWindowOptions opts;
    DFBDimension     size;

    D_ASSERT( m_toplevel_id != 0 );

    /*
     * Get the top level window
     */
    _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );

    window->GetSize( window, &size.w, &size.h );

    /*
     * Enable scaling
     */
    _T( window->GetOptions( window, &opts ) );
    _T( window->SetOptions( window, opts | DWOP_SCALE ) );

    /*
     * Scale the window
     */
    {
        DFBDimension sizes[] = { { size.w + 40, size.h      },
            { size.w + 40, size.h + 40 },
            { size.w,      size.h + 40 },
            { size.w + 40, size.h - 40 },
            { size.w - 40, size.h + 40 },
            { size.w,      size.h      }
        };

        for (i=0; i<D_ARRAY_SIZE(sizes); i++) {
            SHOW_TEST( "Resize( %4d,%4d - [%02d] )...", sizes[i].w, sizes[i].h, i );

            _T( window->Resize( window, sizes[i].w, sizes[i].h ) );

            SHOW_RESULT( "...Resize( %4d,%4d - [%02d] ) done.", sizes[i].w, sizes[i].h, i );
        }
    }

    /*
     * Restore options
     */
    _T( window->SetOptions( window, opts ) );

    window->Release( window );

    return DFB_OK;
}
Beispiel #26
0
static void
dump_encoder_config( const DFBScreenEncoderConfig *config )
{
     int i;

     printf( "\n" );

     if (config->flags & DSECONF_TV_STANDARD) {
          printf( "TV Standard:   " );

          for (i=0; i<D_ARRAY_SIZE(tv_standard_names); i++) {
               if (config->tv_standard & tv_standard_names[i].standard)
                    printf( "%s ", tv_standard_names[i].name );
          }

          printf( "\n" );
     }

     if (config->flags & DSECONF_TEST_PICTURE)
          printf( "Test Picture:  %s\n", test_picture_name( config->test_picture ) );

     if (config->flags & DSECONF_MIXER)
          printf( "Mixer:         %d\n", config->mixer );

     if (config->flags & DSECONF_OUT_SIGNALS) {
          printf( "Signals:       " );

          for (i=0; i<D_ARRAY_SIZE(signal_names); i++) {
               if (config->out_signals & signal_names[i].signal)
                    printf( "%s ", signal_names[i].name );
          }

          printf( "\n" );
     }

     if (config->flags & DSECONF_SCANMODE)
          printf( "Scan Mode:     %s\n", scan_mode_name( config->scanmode ) );

     printf( "\n" );
}
Beispiel #27
0
static const char *
symbol_name( DFBInputDeviceKeySymbol symbol )
{
     int i;
     static char buf[64];

     for (i=0; i<D_ARRAY_SIZE(symbol_names); i++) {
          if (symbol_names[i].symbol == symbol)
               return symbol_names[i].name;
     }

     snprintf( buf, sizeof(buf), "<0x%08x>", symbol );

     return buf;
}
Beispiel #28
0
/*
 * Translates a Linux input keycode into an XBMC keycode.
 */
XBMCKey CLinuxInputDevice::TranslateKey(unsigned short code)
{
  if (code < D_ARRAY_SIZE(basic_keycodes))
    return basic_keycodes[code];

/*
  In the future we may want it...

  if (code >= KEY_OK)
    if (code - KEY_OK < D_ARRAY_SIZE(ext_keycodes))
      return ext_keycodes[code - KEY_OK];
*/

  return XBMCK_UNKNOWN;
}
Beispiel #29
0
static inline u32*
r100_init_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev, u32 type, u32 count, u32 size )
{
    u32 *vb;

    if ((rdev->vb_size && rdev->vb_type != type) ||
            rdev->vb_size+size > D_ARRAY_SIZE(rdev->vb))
        r100_flush_vb( rdrv, rdev );

    vb = &rdev->vb[rdev->vb_size];
    rdev->vb_type   = type;
    rdev->vb_size  += size;
    rdev->vb_count += count;

    return vb;
}
Beispiel #30
0
static bool
parse_command_line( int argc, char *argv[] )
{
     int i, n;

     for (n = 1; n < argc; n++) {
          bool        ok  = false;
          const char *arg = argv[n];

          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
               print_usage (argv[0]);
               return false;
          }

          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
               fprintf (stderr, "dfbscreen version %s\n", DIRECTFB_VERSION);
               return false;
          }

          for (i=0; i<D_ARRAY_SIZE(options); i++) {
               const AnyOption *opt = &options[i];

               if (!strcmp (arg, opt->short_name) || !strcmp (arg, opt->long_name)) {
                    if (++n == argc) {
                         print_usage (argv[0]);
                         return false;
                    }

                    if (!parse_option( opt, argv[n] ))
                         return false;

                    ok = true;

                    break;
               }
          }

          if (!ok) {
               print_usage (argv[0]);
               return false;
          }
     }

     return true;
}