GP2X Hw Accelerated Sdl


Pickle said:
DJWillis said:
Pickle,

If your getting compile errors like that your not building SDL correctly ;) .

Do you want to catch me on IRC (#gp2xdev) sometime and I'll give you a hand to build a set of libs (or build them for you).
To tell you the truth ive never used IRC. I really like to know what im doing wrong in order to learn from it.
Im using the script from the open2x svn, all i did was remove all the other targets from the make file since I only need SDL for touchscreen support.
I have my toolchain in /opt just like the script expects, im using the open2x gcc 4.1.1 toolchain.
Am i mssing something?


Pass, that sounds reasonable enough.

Care to e-mail me the full output from the script? (and why did you just not call "./open2x-libs.sh SDL" rather then hacking the script up).

Happy to help but I find it easier to quickly suggest things on IRC rather then keep replying to threads.

EDIT: It sounds like your not cross compiling, that it your LOCAL copy of DirectFB it is picking up. What is your full configure line? Anything odd, are you on a standard PC, Mac, Sun, *BSD?
 
Last edited by a moderator:
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:
Pickle said:
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.
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:
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...
 
[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!
 
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.
 
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?
 
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 ?
 
M-.-n said:
looking that the source code, I realised 1bpp seems to need 1byte per pixel. However, it still doesn't work
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:
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 !
 
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.
 
Senor Quack said:
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:
Thanks for doing this, the feedback im getting for dosbox is positive so far.
 
Last edited by a moderator:
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.
 
pcklee123 said:
Are the latest touchscreen patches already in the open2x svn? Which is the best method of getting a complete open2x toolchain & libs? Is it using buildroot-new or downloading the precompiled lib http://wiki.open2x.org/open2x/wiki/index.p...Testing_Package



The SVN SDL 1.2.9 code has been updated, but not the 1.2.11. 1.2.11 is about to get a major overhaul for the coming Open2X release.

If you like, you can download the Open2x precompiled 4.1.1 toolchain + libs and then download this archive. Inside the second archive, you'll find my latest precompiled version of libSDL.a, which also adds USB keyboard support on top of the touchscreen improvements.
 
Last edited by a moderator:
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?
 
pcklee123 said:
Also I've been looking forward to open2x release. Does that mean there will be open2x release for f200 as well?
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:
Back
Top