Hi,

We are using STi7109 from ST Microelectronics with the STAPI M6 DirectFB driver.
According to their documentation, the 2d blitter should be able to blit at
200MPixels/sec. We enable hardware acceleration and have some performance issue.
We have a small test program that shows the time taken by several functions and
it appears that Blit is particularly slow, taking a bit more than 3 seconds for
a 2MPixels image (1920*1080), which is roughly 300 times slower than expected.
We also tried with hardware acceleration disabled and it takes nearly half the
time it takes with acceleration enabled (alright, it is faster without
hardware acceleration than with it).
Enclosed are the source code for our tests and the output with results, with and
without acceleration.
As you can see, the other functions do not seem as slow as Blit.
Could you please enlighten us on this matter?

Greetings

-- 
Alexandre Franke
// sh4-linux-gcc -I /opt/STM/STLinux-2.2/devkit/sh4/target/usr/include/directfb/ -L /opt/STM/STLinux-2.2/devkit/sh4/target/usr/lib/ -l directfb -o benchmark dfb_benchmark.c
#include <directfb.h>
#include <stdio.h>
#include <time.h>

#define TIME( x... ) \
{ \
    struct timeval before, after; \
    gettimeofday(&before, NULL); \
    x; \
    gettimeofday(&after, NULL); \
    printf("\n%s\nBefore operation:%ld.%ld\t\tAfter operation:%ld.%ld\n", #x, before.tv_sec, before.tv_usec, after.tv_sec, after.tv_usec); \
}

int main(int argc, char **argv)
{
    system("insmod /home/modules/modules26/stapi/stgfb_core.ko mod_init=\"YES\" layer_name=\"LAYER_GDP1\" g_tvOutMode=\"1920x1080-50i\"");
    IDirectFB *dfb = NULL;
    IDirectFBSurface *primary = NULL, *background = NULL;
    DFBSurfaceDescription primary_desc, background_desc;

    DirectFBInit(0, NULL);
    DirectFBCreate(&dfb);
    dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
    primary_desc.flags = DSDESC_CAPS;
    primary_desc.caps = DSCAPS_PRIMARY|DSCAPS_FLIPPING;
    dfb->CreateSurface(dfb, &primary_desc, &primary);
    TIME( primary->Clear(primary, 0, 0, 0, 0) );

    background_desc.flags = DSDESC_CAPS;
    background_desc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
    IDirectFBImageProvider *background_provider;

    dfb->CreateImageProvider(dfb, "pics/background.png", &background_provider);
    background_provider->GetSurfaceDescription(background_provider, &background_desc);
    primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL);
    TIME( dfb->CreateSurface(dfb, &background_desc, &background) );
    TIME( background_provider->RenderTo(background_provider, background, NULL) );
    background_provider->Release(background_provider);
    TIME( primary->Blit( primary, background, NULL, 0, 0 ) );

    primary->SetColor(primary, 0x80, 0x80, 0xFF, 0xFF);
    TIME( primary->FillRectangle( primary, 100, 100, 500, 400 ) );

    TIME( primary->Flip(primary, NULL, DSFLIP_WAITFORSYNC) );

    background->Release(background);
    primary->Release(primary);
    dfb->Release(dfb);
    system("rmmod stgfb_core");
}
     =======================|  DirectFB 1.0.0-rc1  |=======================
          (c) 2001-2006  United Cultures of Earth - go for outer space!
          (c) 2000-2004  Convergence (integrated media) GmbH
        ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2006-10-15 11:13) 
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 1596)...
(!) DirectFB/FBDev: Could not retrieve palette for backup!
    --> Invalid argument
(*) Direct/Modules: suppress module 'lirc'
(*) Direct/Modules: suppress module 'ps2mouse'
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 1606)...
(*) DirectFB/Input: Keyboard 0.9 (convergence integrated media GmbH)
(!) DirectFB/gfxdrivers/stgfx: FB file descriptor = 3
(*) DirectFB/Graphics: ST Microelectronics Gamma 0.1 (ST Microelectronics)
(*) DirectFB/Core/WM: Default 0.2 (Convergence GmbH)
(!) DirectFB/DirectFBCreate: Setting desktop resolution to 1920x1080 failed!
     -> Using default resolution.
(!) DirectFB/DirectFBCreate: Setting desktop format failed!
     -> Using default format.
(!) DirectFB/DirectFBCreate: Setting desktop buffer mode failed!
     -> No virtual resolution support or not enough memory?
        Falling back to system back buffer.

primary->Clear(primary, 0, 0, 0, 0)
Before operation:1143198703.404345              After 
operation:1143198703.453027
(*) Direct/Interface: Loaded 'PNG' implementation of 'IDirectFBImageProvider'.

dfb->CreateSurface(dfb, &background_desc, &background)
Before operation:1143198703.528842              After 
operation:1143198703.529028

background_provider->RenderTo(background_provider, background, NULL)
Before operation:1143198703.531661              After 
operation:1143198705.504325

primary->Blit( primary, background, NULL, 0, 0 )
Before operation:1143198705.526134              After 
operation:1143198707.355721

primary->FillRectangle( primary, 100, 100, 500, 400 )
Before operation:1143198707.358799              After 
operation:1143198707.363731

primary->Flip(primary, NULL, DSFLIP_WAITFORSYNC)
Before operation:1143198707.366773              After 
operation:1143198707.423761

     =======================|  DirectFB 1.0.0-rc1  |=======================
          (c) 2001-2006  United Cultures of Earth - go for outer space!
          (c) 2000-2004  Convergence (integrated media) GmbH
        ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2006-10-15 11:13) 
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 1601)...
(!) DirectFB/FBDev: Could not retrieve palette for backup!
    --> Invalid argument
(*) Direct/Modules: suppress module 'lirc'
(*) Direct/Modules: suppress module 'ps2mouse'
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 1602)...
(*) DirectFB/Input: Keyboard 0.9 (convergence integrated media GmbH)
(!) DirectFB/gfxdrivers/stgfx: FB file descriptor = 3
(*) DirectFB/Graphics: ST Microelectronics Gamma 0.1 (ST Microelectronics)
(*) DirectFB/Graphics: Acceleration disabled (by 'no-hardware')
(*) DirectFB/Core/WM: Default 0.2 (Convergence GmbH)

primary->Clear(primary, 0, 0, 0, 0)
Before operation:1143198799.916382              After 
operation:1143198799.965183
(*) Direct/Interface: Loaded 'PNG' implementation of 'IDirectFBImageProvider'.

dfb->CreateSurface(dfb, &background_desc, &background)
Before operation:1143198800.41270               After operation:1143198800.41457

background_provider->RenderTo(background_provider, background, NULL)
Before operation:1143198800.44520               After operation:1143198802.18153

primary->Blit( primary, background, NULL, 0, 0 )
Before operation:1143198802.39980               After 
operation:1143198803.873042

primary->FillRectangle( primary, 100, 100, 500, 400 )
Before operation:1143198803.876059              After 
operation:1143198803.880931

primary->Flip(primary, NULL, DSFLIP_WAITFORSYNC)
Before operation:1143198803.883961              After 
operation:1143198803.941028
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to