Thanks,

I have managed to get it all to work now, there were a couple of issues.

1 The case statement for LUT8 was missing in the colour selection routine of 
savage4.c so my test in 8 bit mode was using software fall back. I have fixed 
that.

2 There is a macro that waits for the GPU hardware to become ready, it was not 
yielding (it just loops while incrementing a counter!) so the CPU load was 
much, much higher than it should be, I have sorted that out now by adding a 
usleep call and it is now behaving much better. I have also added a non 
blocking function to call to test if the GPU is busy to help with multitasking. 
The CPU loading is now sub 0.1% for my program which was what I had expected.

Thanks tor your help, 

Tim



Freeman <freemanli...@foxmail.com> wrote:
>hi,tim
>
>Sorry, It's too late to replay you email.
>
>
>I just read the code about how the graphics initialized.
>
>
>In your log, the accelerator is worked!
>
>
>When I have time I will read your log again and If I found any thing usefull I 
>will email you!
>
>
>(-) [Main Thread       0.176] (  303) Core/Graphics:      
>dfb_graphics_core_initialize( 0x804d170, 0x8051048, 0x8051110 )
>
>(*) DirectFB/Genefx: MMX detected and enabled
>
>(-) [Main Thread       0.176] (  303) Direct/Modules:     
>direct_modules_explore_directory( 'gfxdrivers' )
>
>(-) [Main Thread       0.176] (  303) Direct/Mem:           +    44 bytes 
>[modules.c:232 in direct_modules_explore_directory()]
>
>(-) [Main Thread       0.176] (  303) Direct/Mem:           +    22 bytes 
>[modules.c:240 in direct_modules_explore_directory()] -> 0x8052838 "         
>libdirectfb_savage.so"
>
>(-) [Main Thread       0.176] (  303) Direct/Modules:     Loading 
>'/usr/local/lib/directfb-1.2-9/gfxdrivers/libdirectfb_savage.so'...
>
>(-) [Main Thread       0.177] (  303) Direct/Modules:     Registering 'savage' 
>('gfxdrivers')...
>
>(-) [Main Thread       0.177] (  303) Direct/Mem:           +     7 bytes 
>[modules.c:134 in direct_modules_register()] -> 0x8051b28 "                    
>    savage"
>
>(-) [Main Thread       0.177] (  303) Direct/Modules:     ...registered.
>
>savage4:savage4getinfo
>
>(-) [Main Thread       0.177] (  303) Direct/Mem:           +     8 bytes 
>[gfxcard.c:210 in dfb_graphics_core_initialize()]
>
>savage4:savage4initdriver
>
>savage4:savage4initdevice
>
>(*) DirectFB/Graphics: S3 Savage4 Series 0.3 (directfb.org)‍
>
>
>
>
>------------------ Original ------------------
>
>From:  "tim";<t...@gizzy.co.uk>;
>
>Date:  Mon, Mar 30, 2015 10:19 PM
>
>To:  "Freeman"<freemanli...@foxmail.com>; 
>
>Cc:  "directfb-users"<directfb-users@directfb.org>; 
>
>Subject:  Re: [directfb-users] Can't get any 
>hardwareaccelerationusingthesavage driver.
>
>
>
>Hi,
>
>
>I have attached a log file (dump.txt) for my application. I have had a look 
>through it and the only thing that really jumps out at me is:
>
>
>(!) [Main Thread       0.237] (  303) *** Assumption [core != NULL] failed *** 
>[colorhash.c:206 in dfb_colorhash_attach()]
>
>
>I also notice that calls to dfb_gfxcard_state_check() return accel = 
>0x00000000 which I assume means that no acceleration is available for the 
>function it is checking. What could cause that?
>
>
>Would you mind having a quick look and let me know your thoughts? It looks 
>like the savage driver is loading correctly but I don't really know where to 
>look from there.
>
>
>When I run with --dfb:software-warn
>
>
>I get messages for fill rectangle and drawline which fits with the log 
>
>
>my own debug code, returned that the call to dfb_gfxcard_get_accelerator( 
>device ) was returning FB_ACCEL_S3TWISTER_P    (0x8a)
>
>
>Regards
>
>
>
>Tim
>
>
>
>On March 27, 2015, Freeman <freemanli...@foxmail.com> wrote:
>
>Hi, 
>
>First, you can set the config for acceleration use these value.
>
>#define FB_ACCEL_SAVAGE4        0x80   /* S3 Savage4                   */
>
>#define FB_ACCEL_SAVAGE3D       0x81   /* S3 Savage3D                  */
>
>#define FB_ACCEL_SAVAGE3D_MV    0x82   /* S3 Savage3D-MV               */
>
>#define FB_ACCEL_SAVAGE2000     0x83   /* S3 Savage2000                */
>
>#define FB_ACCEL_SAVAGE_MX_MV   0x84   /* S3 Savage/MX-MV              */
>
>#define FB_ACCEL_SAVAGE_MX      0x85   /* S3 Savage/MX                 */
>
>#define FB_ACCEL_SAVAGE_IX_MV   0x86   /* S3 Savage/IX-MV              */
>
>#define FB_ACCEL_SAVAGE_IX      0x87   /* S3 Savage/IX                 */
>
>#define FB_ACCEL_PROSAVAGE_PM   0x88   /* S3 ProSavage PM133           */
>
>#define FB_ACCEL_PROSAVAGE_KM   0x89   /* S3 ProSavage KM133           */
>
>#define FB_ACCEL_S3TWISTER_P    0x8a   /* S3 Twister                   */
>
>#define FB_ACCEL_S3TWISTER_K    0x8b   /* S3 TwisterK                  */
>
>#define FB_ACCEL_SUPERSAVAGE    0x8c    /* S3 Supersavage               */
>
>#define FB_ACCEL_PROSAVAGE_DDR  0x8d   /* S3 ProSavage DDR             */
>
>#define FB_ACCEL_PROSAVAGE_DDRK 0x8e   /* S3 ProSavage DDR-K           */‍
>
>
>Second, add some log in savage, why it does not use this video card
>
>
>Good Luck!
>
>Try do something and give me some information, so I can help you more!
>
>
>------------------ Original ------------------
>
>From:  "tim";<t...@gizzy.co.uk>;
>
>Date:  Fri, Mar 27, 2015 11:41 PM
>
>To:  "directfb-users"<directfb-users@directfb.org>; 
>
>Subject:  Re: [directfb-users] Can't get any hardware 
>accelerationusingthesavage driver.
>
>
>Hi,
>
>
>Ok, I can give it a go, but how would I go about doing that? Could you give me 
>some pointers, such as were to look and how to get a log? The current build is 
>using the following, should I enable additional options to get more 
>information?
>
>
>./configure --disable-png --disable-jpeg --disable-freetype 
>--with-gfxdrivers=savage
>
>
>Thanks for your help, I am happy to do the work, I just need to a little help 
>about how to go about it and what to look for.
>
>
>
>Regards
>
>
>Tim
>
>On March 27, 2015, Freeman <freemanli...@foxmail.com> wrote:
>
>Hi,tim
>
>I just want to say you video card is so old.
>
>But It is support by DirectFB.
>
>Under the directory Gfxdrivers/Savage, you can find the drivers code. You can 
>debug and find why the video driver is not work!
>
>Or you can send me a log and I will try to find why it's no work!
>
>
>
>------------------ Original ------------------
>
>From:  "tim";<t...@gizzy.co.uk>;
>
>Date:  Fri, Mar 27, 2015 10:22 PM
>
>To:  "directfb-users"<directfb-users@directfb.org>; 
>
>Subject:  Re: [directfb-users] Can't get any hardware acceleration 
>usingthesavage driver.
>
>
>Hi,
>
>
>Yes that does work, I think that is the default option if you pass no 
>parameters isn't it?
>
>
>However, The program does not seem to be running with hardware acceleration. I 
>say that because it runs the same speed when I run it with --dfb:no-hardware! 
>It is also the same speed as if I run using the vesa frame buffer (/dev/fb1) 
>which does not support acceleration. I really wanted to get the GPU to do the 
>work.
>
> 
>
>
>Regards
>
>
>
>
>
>On March 27, 2015, Freeman <freemanli...@foxmail.com> wrote:
>
>hi, tim
>
>You can juse use this command
>
>-bash-3.1# ./test --dfb:hardware
>
>I think it will work.
>
>
>"  [no-]hardware                  Enable/disable hardware acceleration\n"‍
>
>
>option "no-software"  disable software fallbacks. 
>
>This is mainly for  debugging/profiling purpose. 
>
>It will print out a warning with the operation and flags each time a fallback 
>would occur.
>
>
>And I think it is just print some information.
>
>
> 
>
>
>
>------------------ Original ------------------
>
>From:  "Tim Nicholson";<t...@gizzy.co.uk>;
>
>Date:  Fri, Mar 27, 2015 08:21 PM
>
>To:  "directfb-users"<directfb-users@directfb.org>; 
>
>Subject:  [directfb-users] Can't get any hardware acceleration using thesavage 
>driver.
>
>
>Hi,
>
>
>I am trying to take advantage of the graphics accelerator on some embedded 
>linux hardware. I have sucessfully built directfb and I have written some test 
>code which runs fine but, it only appears to be using software drawing and I 
>am at a loss as to what I need to do to utilize the hardware acceleration. 
>Below are some details about my setup. Any help of advice would be much 
>appreciated.
>
>
>I have included the source code for my test program below, it simply rotates a 
>wire cube using multiple DrawLine functions , I am compiling it using the 
>following command line:
>
>
>-bash-3.1$ gcc -I /usr/local/include/directfb -lm -ldirectfb directfb_test.c 
>-o test
>
>
>I have included details of various outputs below in the hope they may be of 
>use:
>
>
>grub menu.lst entry
>
>
>kernel /boot/linux-2.6.16.46 root=/dev/hdc4 i8042.direct=1 atkbd.set=3 
>video=savagefb:mtrr,ywrap,pmipal,vga=0x301 ide=nodma quiet console=tty7 
>loglevel=0
>
>
>-bash-3.1# cat /proc/version 
>
>Linux version 2.6.16.46 (root@sentinel) (gcc version 4.0.3) #1 PREEMPT Sat Mar 
>10 13:17:45 EST 2012
>
>
>-bash-3.1# fbset -i
>
>
>mode "640x400-70"
>
>    # D: 25.176 MHz, H: 31.469 kHz, V: 69.932 Hz
>
>    geometry 640 400 640 4096 8
>
>    timings 39721 40 24 39 9 96 2
>
>    accel true
>
>    rgba 8/0,8/0,8/0,0/0
>
>endmode
>
>
>Frame buffer device information:
>
>    Name        : TwisterP
>
>    Address     : 0xe0000000
>
>    Size        : 33423360
>
>    Type        : PACKED PIXELS
>
>    Visual      : PSEUDOCOLOR
>
>    XPanStep    : 4
>
>    YPanStep    : 1
>
>    YWrapStep   : 0
>
>    LineLength  : 640
>
>    MMIO Address: 0xed000000
>
>    MMIO Size   : 524288
>
>    Accelerator : Unknown (138)
>
>
>-bash-3.1$ lspci
>
>00:00.0 Host bridge: VIA Technologies, Inc. VT8605 [ProSavage PM133]
>
>00:01.0 PCI bridge: VIA Technologies, Inc. VT8605 [PM133 AGP]
>
>00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 
>40)
>
>00:07.1 IDE interface: VIA Technologies, Inc. 
>VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
>
>00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 
>Controller (rev 1d)
>
>00:07.4 Bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40)
>
>00:07.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 
>Audio Controller (rev 50)
>
>00:0e.0 Ethernet controller: National Semiconductor Corporation DP83815 
>(MacPhyter) Ethernet Controller
>
>01:00.0 VGA compatible controller: S3 Inc. 86C380 [ProSavageDDR K4M266] (rev 
>02)
>
>
>-bash-3.1# ./test
>
>test application is starting
>
>
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.2.9 |~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>        (c) 2001-2008  The world wide DirectFB Open Source Community
>
>        (c) 2000-2004  Convergence (integrated media) GmbH
>
>      ----------------------------------------------------------------
>
>
>(*) DirectFB/Core: Single Application Core. (2015-03-23 14:57) 
>
>(*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER 0/0] 
><8388608>...
>
>(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: AT Raw Set 3 keyboard (1) 0.1 (directfb.org)
>
>(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: PC Speaker (2) 0.1 (directfb.org)
>
>(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: DELL DELL USB Keyboard (3) 0.1 (directfb.org)
>
>(*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
>
>(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
>
>(*) DirectFB/Genefx: MMX detected and enabled
>
>(*) DirectFB/Graphics: S3 Savage4 Series 0.3 (directfb.org)
>
>(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
>
>(*) FBDev/Surface: Allocated 640x400 8 bit LUT8 buffer (index 0) at offset 0 
>and pitch 640.
>
>(*) FBDev/Mode: Setting 640x400 LUT8
>
>(*) FBDev/Mode: Switched to 640x400 (virtual 640x800) at 8 bit (LUT8), pitch 
>640
>
>(*) FBDev/Surface: Allocated 640x400 8 bit LUT8 buffer (index 1) at offset 
>256000 and pitch 640.
>
>(*) FBDev/Mode: Setting 640x400 LUT8
>
>(*) FBDev/Mode: Switched to 640x400 (virtual 640x400) at 8 bit (LUT8), pitch 
>640
>
>(*) FBDev/Surface: Allocated 640x400 8 bit LUT8 buffer (index 0) at offset 0 
>and pitch 640.
>
>
>When I run the code specifying no-software, as follows, I just get a blank 
>screen, so I am assuming hardware acceleration is not working.
>
>
>-bash-3.1# ./test --dfb:no-software
>
>test application is starting
>
>
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.2.9 |~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>        (c) 2001-2008  The world wide DirectFB Open Source Community
>
>        (c) 2000-2004  Convergence (integrated media) GmbH
>
>      ----------------------------------------------------------------
>
>
>(*) DirectFB/Core: Single Application Core. (2015-03-23 14:57) 
>
>(*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER 0/0] 
><8388608>...
>
>(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: AT Raw Set 3 keyboard (1) 0.1 (directfb.org)
>
>(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: PC Speaker (2) 0.1 (directfb.org)
>
>(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: DELL DELL USB Keyboard (3) 0.1 (directfb.org)
>
>(*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
>
>(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] 
><8388608>...
>
>(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
>
>(*) DirectFB/Genefx: MMX detected and enabled
>
>(*) DirectFB/Graphics: S3 Savage4 Series 0.3 (directfb.org)
>
>(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
>
>(*) FBDev/Surface: Allocated 640x400 8 bit LUT8 buffer (index 0) at offset 0 
>and pitch 640.
>
>(*) FBDev/Mode: Setting 640x400 LUT8
>
>(*) FBDev/Mode: Switched to 640x400 (virtual 640x800) at 8 bit (LUT8), pitch 
>640
>
>(*) FBDev/Surface: Allocated 640x400 8 bit LUT8 buffer (index 1) at offset 
>256000 and pitch 640.
>
>(*) FBDev/Mode: Setting 640x400 LUT8
>
>(*) FBDev/Mode: Switched to 640x400 (virtual 640x400) at 8 bit (LUT8), pitch 
>640
>
>(*) FBDev/Surface: Allocated 640x400 8 bit LUT8 buffer (index 0) at offset 0 
>and pitch 640
>
>
>
>
>
>/****************************************************
>
>* Name:                directfb_test.c
>
>* Author:              Tim Nicholson
>
>* Purpose:             Just for test the DirectFB
>
>****************************************************/
>
>#include <stdio.h>
>
>#include <unistd.h>
>
>#include <directfb.h>
>
>#include <math.h>
>
>
>#define HEIGHT 480
>
>#define WIDTH 640
>
>#define WHOLE 150
>
>#define HALF (WHOLE/2.0)
>
>#define MIDX (WIDTH/2.0)
>
>#define MIDY (HEIGHT/2.0)
>
>
>static struct PointF
>
>{
>
>       double x;
>
>       double y;
>
>} c1,c2,c3,c4,p1,p2,p3,p4,p5,p6,p7,p8,mid1,mid2;
>
>
>static int x = 0;
>
>void calc (void);
>
>
>int main (int argc, char *argv[])
>
>{
>
>  IDirectFB             *dfb   = NULL;
>
>  IDirectFBDisplayLayer *layer = NULL;
>
>  IDirectFBSurface      *surface = NULL;
>
>
>  printf ("test application is starting\n");
>
>  DirectFBInit (&argc, &argv);
>
>  DirectFBCreate (&dfb);
>
>
>  dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
>
>  layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE);
>
>  layer->GetSurface (layer, &surface);
>
>
>  mid1.x = MIDX - HALF;
>
>  mid1.y = MIDY;
>
>  mid2.x = MIDX + HALF;
>
>  mid2.y = MIDY;
>
>
>  while (1)
>
>    {
>
>      calc();
>
>      surface->SetColor (surface, 0x00, 0x00, 0x00, 0xff);
>
>      surface->FillRectangle (surface, 0, 0, WIDTH, HEIGHT);
>
>      surface->SetColor (surface, 0xff, 0xff, 0xff, 0xff);
>
>      
>
>      surface->DrawLine (surface, p1.x, p1.y, p2.x, p2.y);
>
>      surface->DrawLine (surface, p2.x, p2.y, p3.x, p3.y);
>
>      surface->DrawLine (surface, p3.x, p3.y, p4.x, p4.y);
>
>      surface->DrawLine (surface, p4.x, p4.y, p1.x, p1.y);
>
>
>      surface->DrawLine (surface, p5.x, p5.y, p6.x, p6.y);
>
>      surface->DrawLine (surface, p6.x, p6.y, p7.x, p7.y);
>
>      surface->DrawLine (surface, p7.x, p7.y, p8.x, p8.y);
>
>      surface->DrawLine (surface, p8.x, p8.y, p5.x, p5.y);
>
>
>      surface->DrawLine (surface, p1.x, p1.y, p5.x, p5.y);
>
>      surface->DrawLine (surface, p2.x, p2.y, p6.x, p6.y);
>
>      surface->DrawLine (surface, p3.x, p3.y, p7.x, p7.y);
>
>      surface->DrawLine (surface, p4.x, p4.y, p8.x, p8.y);
>
>
>      dfb->WaitForSync(dfb);
>
>    }
>
>  surface->Release (surface);
>
>  layer->Release (layer);
>
>  dfb->Release (dfb);
>
>  return 0;
>
>}
>
>
>// 
>*********************************************************************************************
>
>// c a l c
>
>// 
>*********************************************************************************************
>
>void calc (void)
>
>{
>
>  int a,b,c,d;
>
>
>  x++;
>
>  a = x;
>
>  b = x + 90;
>
>  c = x + 180;
>
>  d = x + 270;
>
>
>  a %= 360;
>
>  b %= 360;
>
>  c %= 360;
>
>  d %= 360;
>
>
>  c1.x = (sin(M_PI / 180.0 * a) * WHOLE);
>
>  c1.y = (cos(M_PI / 180.0 * a) * WHOLE);
>
>  c2.x = (sin(M_PI / 180.0 * b) * WHOLE);
>
>  c2.y = (cos(M_PI / 180.0 * b) * WHOLE);
>
>  c3.x = (sin(M_PI / 180.0 * c) * WHOLE);
>
>  c3.y = (cos(M_PI / 180.0 * c) * WHOLE);
>
>  c4.x = (sin(M_PI / 180.0 * d) * WHOLE);
>
>  c4.y = (cos(M_PI / 180.0 * d) * WHOLE);
>
>
>  p1.x = mid1.x + c1.x;
>
>  p2.x = mid1.x + c2.x;
>
>  p3.x = mid1.x + c3.x;
>
>  p4.x = mid1.x + c4.x;
>
>
>  p5.x = mid2.x + c1.x;
>
>  p6.x = mid2.x + c2.x;
>
>  p7.x = mid2.x + c3.x;
>
>  p8.x = mid2.x + c4.x;
>
>
>  p1.y = mid1.y + c1.y;
>
>  p2.y = mid1.y + c2.y;
>
>  p3.y = mid1.y + c3.y;
>
>  p4.y = mid1.y + c4.y;
>
>
>  p5.y = mid2.y + c1.y;
>
>  p6.y = mid2.y + c2.y;
>
>  p7.y = mid2.y + c3.y;
>
>  p8.y = mid2.y + c4.y;
>
>}
>
>
>
>
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to