GP2X Hw Accelerated Sdl

Discussion in 'General Discussions' started by paeryn, Dec 28, 2005.

  1. DJWillis

    DJWillis Random GP32/GP2X/Wiz & Pandora Moocher

    Joined:
    Jul 20, 2003
    Messages:
    1,467
    Location:
    Bath, Somerset, UK
     
    Last edited by a moderator: Dec 18, 2015
  2. Pickle

    Pickle Mega GP Mania

    Joined:
    May 30, 2006
    Messages:
    5,398
    Location:
    Detroit, Michigan
    Problem solved, with help from DJwillis all that was needed was to add --enable-video-directfb=no to the makefile to keep directfb on my local system from being enabled. I am using opensuse 10.3.
     
    Last edited by a moderator: Dec 20, 2015
  3. DJWillis

    DJWillis Random GP32/GP2X/Wiz & Pandora Moocher

    Joined:
    Jul 20, 2003
    Messages:
    1,467
    Location:
    Bath, Somerset, UK
    And I have fixed it in SVN (well updated the SDL 1.2.11 build rule in makefile.o2x anyway) ;).
     
    Last edited by a moderator: Dec 20, 2015
  4. Hitnrun

    Hitnrun Member

    Joined:
    Mar 1, 2008
    Messages:
    427
    I am trying to build the lib pack from the SVN (running the script without parameters), and I am getting:


    CODE

    make[1]: Leaving directory `/home/rangel/prog/src/gp2x/open2x/libs/SDL-1.2.11'
    make[1]: Entering directory `/home/rangel/prog/src/gp2x/open2x/libs/SDL-1.2.11'
    /bin/bash ./libtool --mode=compile /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -DARM -D_ARM_ASSEM_ -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/libxml2 -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -I/usr/include -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -c ./src/SDL_error.c -o build/SDL_error.lo
    /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -DARM -D_ARM_ASSEM_ -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/libxml2 -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -I/usr/include -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -c ./src/SDL_error.c -fPIC -DPIC -o build/.libs/SDL_error.o
    ./src/SDL_error.c: In function 'SDL_SetError':
    ./src/SDL_error.c:52: error: 'va_list' undeclared (first use in this function)
    ./src/SDL_error.c:52: error: (Each undeclared identifier is reported only once
    ./src/SDL_error.c:52: error: for each function it appears in.)
    ./src/SDL_error.c:52: error: expected ';' before 'ap'
    ./src/SDL_error.c:60: error: 'ap' undeclared (first use in this function)
    ./src/SDL_error.c:79: error: expected expression before 'int'
    ./src/SDL_error.c:83: error: expected expression before 'double'
    ./src/SDL_error.c:87: error: expected expression before 'void'
    ./src/SDL_error.c:87: warning: assignment makes pointer from integer without a cast
    ./src/SDL_error.c:92: error: expected expression before 'const'
    ./src/SDL_error.c:92: warning: initialization makes pointer from integer without a cast
    make[1]: *** [build/SDL_error.lo] Error 1
    make[1]: Leaving directory `/home/rangel/prog/src/gp2x/open2x/libs/SDL-1.2.11'
    make: *** [/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a] Error 2
    Done - Please check build logs.



    va_list undeclared? Should be a simple thing, but I can't figure out what the problem is...
     
  5. senquack

    senquack I feel a great disturbance in the source

    Joined:
    Nov 1, 2006
    Messages:
    1,168
    Location:
    USA
    [quote name='Hitnrun' date='Mar 28 2008, 04:35 PM'
    va_list undeclared? Should be a simple thing, but I can't figure out what the problem is...
    [/quote]

    Try adding this line:
    #include <stdarg.h>

    to the top of SDL_error.c


    I've had various problems compiling from SVN source. Honestly, I gave up and just use the precompiled package. Sometimes I'll compile a custom version of this or that library but it's always a fight to compile SDL itself. Wait until it starts complaining about keyboard identifiers and you have to hack in sections of identifiers you find in old copies of SVGAlib. FUN!
     
  6. Hitnrun

    Hitnrun Member

    Joined:
    Mar 1, 2008
    Messages:
    427
    Now getting a different error:

    CODE

    make[1]: Entering directory `/home/rangel/prog/src/gp2x/open2x/libs/SDL_image-1.2.4'
    /bin/bash ./libtool --mode=link /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -DARM -D_ARM_ASSEM_ -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/libxml2 -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -D_REENTRANT -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLOAD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -o libSDL_image.la -rpath /opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -no-undefined -release 1.2 -version-info 1:3:1 IMG.lo IMG_bmp.lo IMG_gif.lo IMG_jpg.lo IMG_lbm.lo IMG_pcx.lo IMG_png.lo IMG_pnm.lo IMG_tga.lo IMG_tif.lo IMG_xcf.lo IMG_xpm.lo -ljpeg -lpng -lz -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -Wl,-rpath,/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -lSDL -lpthread
    grep: /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux/lib/libstdc++.la: No such file or directory
    /bin/sed: can't read /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux/lib/libstdc++.la: No such file or directory
    libtool: link: `/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux/lib/libstdc++.la' is not a valid libtool archive
    make[1]: *** [libSDL_image.la] Error 1
    make[1]: Leaving directory `/home/rangel/prog/src/gp2x/open2x/libs/SDL_image-1.2.4'
    make: *** [/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL_image.a] Error 2



    Looks like it is adding the open2x directory 2 times (for grep and sed) but it does not looks like it appears on the libtool line.

    I think I found a bug (in the stable 1.2.9 SDL): when I set the video mode with x = 320, and y < 240, for example, 320x200, the screen is not stretched as with other videomodes, the screen stays with a black margin at bottom, on this example 40 pixels.

    But if I use a different width, like 300x200, the screen is scaled fullscreen like all other modes.

    The other problem with this is, the touchscreen still accepts clicking on the black margin, and returns positions as if the screen was stretched, so it returns positions that are all of the right position.
     
  7. Hitnrun

    Hitnrun Member

    Joined:
    Mar 1, 2008
    Messages:
    427
    UPDATE: looks like there is something strange with the open2x compiler:

    CODE

    # ./arm-open2x-linux-gcc -v
    Using built-in specs.
    Target: arm-open2x-linux
    Configured with: /storage/file-store/Projects/GP2X/crosstool-0.43/build/arm-open2x-linux/gcc-4.1.1-glibc-2.3.6/gcc-4.1.1/configure --target=arm-open2x-linux --host=i686-host_pc-linux-gnu --prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux --with-float=soft --with-cpu=arm920t --enable-cxx-flags=-mcpu=arm920t --with-headers=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux/include --with-local-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
    Thread model: posix
    gcc version 4.1.1



    I created a symlink for this second arm-open2x-linux, and it seems to have worked. Anyone knows why is that?
     
  8. M-.-n

    M-.-n Member

    Joined:
    May 28, 2005
    Messages:
    160
    Location:
    Brussels, Belgium
    Did anyone succeed to use 1bpp surfaces ?
    I'm trying to speed up the drawing of my fonts using them combined with SDL_GP2X_SetMonoColours

    My font is 8x8 so for each char I do:

    CODE

    fonts = SDL_CreateRGBSurface(SDL_HWSURFACE, 8, 8, 1,
    0, 0, 0, 0);
    if (fonts==NULL) {
    Trace::Debug("Failed to create font surface %d",i);
    } else {
    SDL_LockSurface(fonts);
    int pixelSize=fonts->format->BytesPerPixel;

    const unsigned char *src=font+i*8;
    unsigned char *dest=(unsigned char *)fonts->pixels;
    for (int y = 0; y < 8; y++) {
    unsigned char pixel=0;
    for (int x = 0; x < 8; x++) {
    pixel<<=1;
    pixel+=(*src);
    src++;
    }
    if (y<7) src+=FONT_WIDTH-8;
    *dest=pixel;
    dest+=fonts->pitch-8*pixelSize;
    }
    SDL_UnlockSurface(fonts);
    };



    then, when drawing the font, I simply call SDL_GP2X_SetMonoColours() and blit on the HW surface. The code that does the same using 16bpp was fine, so I know the app is ok. Result is garbage coloured squares. Good thing is that is indeed goes a lot faster so it'd be nice if it actually worked :)

    Any tips ?
     
  9. M-.-n

    M-.-n Member

    Joined:
    May 28, 2005
    Messages:
    160
    Location:
    Brussels, Belgium
    looking that the source code, I realised 1bpp seems to need 1byte per pixel. However, it still doesn't work
     
  10. paeryn

    paeryn Reclusive maniac

    Joined:
    Nov 28, 2005
    Messages:
    432
    Location:
    Sheffield, England
    I remember having a problem with this in that SDL doesn't call the HW blit routines if the source and destination surfaces have different bit-depths. I was reluctant to alter the core SDL code to allow it, and I never got around to putting a hack in to make 1bpp surfaces appear as the same bit-depth as the screen.

    The only way to do it at the moment is to use SWSURFACEs for 1bpp.

    I'm going away in the morning for a few days but I'll have a go at implementing it in the week.
     
    Last edited by a moderator: Dec 18, 2015
  11. M-.-n

    M-.-n Member

    Joined:
    May 28, 2005
    Messages:
    160
    Location:
    Brussels, Belgium
    yo paeryn,

    since I've upgrade with the touchscreen enabled version of SDL, touching the F200 screen crashes lgpt although I don't even process mouse events.

    Any idea from where it could come ?

    Cheers
    Marc

    EDIT: fuck GPH for killing the usb network !
     
  12. senquack

    senquack I feel a great disturbance in the source

    Joined:
    Nov 1, 2006
    Messages:
    1,168
    Location:
    USA
    I recently spent a few days working out how to improve the touchscreen support in Paeryn's SDL, and I think I've hopefully fixed a few of the problems people have been having:

    LINK: http://www.mediafire.com/?xjn0myjazwy

    I'd like some feedback if you find it helps. I think it's really improved the accuracy of both tapping and dragging the cursor with the pen, reduced CPU load, and seems to make needing INIT_EVENTTHREAD a thing of the past.

    The code I've modified is from the latest SVN pull of open2x SDL 1.2.9 (paeryn's)

    -Dan Silsby aka Senor Quack
    dansilsby <AT> gmail <dot> com

    Changes made:
    * Ignore any samples with pressures less than 35,000 in value. This
    is a conservative lower bound, as all samples normally fall above
    45,000. This completely fixes the common problem of the cursor
    jumping after tapping and releasing.

    * Limit reading of touchscreen device to once every 5ms at most. It never
    provides more than 100 samples a second anyways. Helps reduce CPU load
    a bit.

    * Only read one sample at a time at most, then continue with other SDL tasks.
    This and the other change make it unnecessary to use INIT_EVENTTHREAD. In
    fact, it seems to only hurt responsiveness and cpu loading now that
    things are done differently.

    * Disabled standard tslib dejitter module, as it isn't effective enough for
    the F200's level of noise. Completely replaced it with a new algorithm
    that averages the past 15 samples using a pyramid-weighting (i.e., the
    sample from 8 samples ago is the highest weighting in the average).
    Jitter is significantly improved but still cannot be removed completely.

    * Altered tslib variance module (another noise reduction filter) so that it
    will tell the new averaging module to flush its sample history at
    appropriate times, like fast movements, to reduce lag. Also fixed a
    bad pointer dereference.

    * Altered tslib ucb touchscreen reading module, as it was trying to read
    12 bytes of data into a structure and only ever got 8 bytes from the
    device. Removed unnecessary timeval parts of event structure.

    * Optimized various parts of tslib, inlined all functions.
     
  13. Pickle

    Pickle Mega GP Mania

    Joined:
    May 30, 2006
    Messages:
    5,398
    Location:
    Detroit, Michigan
    Thanks for doing this, the feedback im getting for dosbox is positive so far.
     
    Last edited by a moderator: Dec 18, 2015
  14. paeryn

    paeryn Reclusive maniac

    Joined:
    Nov 28, 2005
    Messages:
    432
    Location:
    Sheffield, England
    I've updated both SVN and the lib on my website with Senor Quack's modifications.
     
  15. Hitnrun

    Hitnrun Member

    Joined:
    Mar 1, 2008
    Messages:
    427
    I tested Pickles's dosbox with this change, and I can really see the improvements. Clicking and holding does not halt the application anymore, and the cursor doesn't "dance" when clicking.

    Also dragging seems better, altough the mouse cursor doesn't move together when dragging, but the dragging seems to be working besides of that.
     
  16. Orkie

    Orkie Super Duper Mega GP Mania

    Joined:
    Mar 22, 2006
    Messages:
    2,350
    Location:
    UK
    Ignore.
     
  17. pcklee123

    pcklee123 Member

    Joined:
    Nov 14, 2003
    Messages:
    403
  18. senquack

    senquack I feel a great disturbance in the source

    Joined:
    Nov 1, 2006
    Messages:
    1,168
    Location:
    USA
     
    Last edited by a moderator: Dec 17, 2015
  19. pcklee123

    pcklee123 Member

    Joined:
    Nov 14, 2003
    Messages:
    403
    Thanks. No wonder I was having so much trouble. I think I was mixing 1.2.9(from Paeryn's website) with 1.2.11 (3rd July 2007 Test release from open2x).
    Also I've been looking forward to open2x release. Does that mean there will be open2x release for f200 as well?

    OK just tried with libs from here http://wiki.open2x.org/open2x/wiki/index.p...ibrary_Packages http://www.open2x.org/open2x/toolchains/op...3.6.tar.bz2.zip
    overwrite with http://www.mediafire.com/?zyylyyx51qn

    Keyboard works but mouse not working anymore on f100(firmware 2.1.1) & f200 (firmware 4.1.1). (with SDL 1.2.11 from http://www.open2x.org/open2x/toolchains/op...glibc-2.3.6.zip mouse works but keyboard doesn't)

    testing with gp2x_touch-1.0:
    url=http://www.open2x.org/open2x/toolchains/open2x-libpack-20071903-gcc-4.1.1-glibc-2.3.6.tar.bz2.zip -mouse works touchscreen not working(expected?)
    overwrite with files from http://www.mediafire.com/?zyylyyx51qn
    neither mouse nor touchscreen works.
    What am I missing here? I needed to install HomebrewEnabler - now touchscreen works -but then fcalc stops working- looks like software compiled with open2x needs homebrewenabler but the it interferes with touchscreen on software compiled with GPH SDK?
     
  20. senquack

    senquack I feel a great disturbance in the source

    Joined:
    Nov 1, 2006
    Messages:
    1,168
    Location:
    USA
    Yep, there will be separate, simultaneous releases for both F100 and F200. I am just finishing adding kernel-level system-wide volume scaling and muting and it works great. Now onto fix more bugs and add more features..
     
    Last edited by a moderator: Dec 18, 2015

Share This Page

Loading...