Copy 320X240 Buffer To 240X320 Screen


Exophase said:
KungPhoo said:
Tearing when waiting for vblank!!

AHHH! Now I'm waiting for the vblank to finish and then do the flip. However, the flip takes longer than the vblank, thus I get a tearing now on this position:
tnvblank.png
I'm using /dev/fb0 btw.

You have to start using double buffering, meaning you probably can't use /dev/fb0 anymore. Use or look at the code for libcastor.

Ah. Silly me.
Is there a tutorial how to swap the buffers?
 
Last edited by a moderator:
I don't think he can use that if it comes from gpSP as the comments suggest. KungPhoo sells his stuff, and gpSP is GPL.
 
Exophase said:
ikari said:
Exophase; Well, I'm not sure. But I'm also working about it. Currently I'm replacing "/dev/fb0" to "/dev/mem" for full hardware access.

Be sure to use mmuhack as well.

The new version from ikari and the source is in the archive now and is working very well:

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,23,271

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,272
 
Last edited by a moderator:
sbock said:
Exophase said:
ikari said:
Exophase; Well, I'm not sure. But I'm also working about it. Currently I'm replacing "/dev/fb0" to "/dev/mem" for full hardware access.

Be sure to use mmuhack as well.

The new version from ikari and the source is in the archive now and is working very well:

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,23,271

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,272

Hmmm This seems to cause major issues with GP2Xpectrum. The colours are all wrong.
I just copied libSDL-1.2.so.0 and warm_2.6.24.ko to the GP2Xpectrum directory and ran.
Any ideas why? Tearing on this emu was really bad and I'd like to see if this has fixed it.

Thanks
-(e)
 
Last edited by a moderator:
sweetlilmre said:
sbock said:
Exophase said:
ikari said:
Exophase; Well, I'm not sure. But I'm also working about it. Currently I'm replacing "/dev/fb0" to "/dev/mem" for full hardware access.

Be sure to use mmuhack as well.

The new version from ikari and the source is in the archive now and is working very well:

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,23,271

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,272

Hmmm This seems to cause major issues with GP2Xpectrum. The colours are all wrong.
I just copied libSDL-1.2.so.0 and warm_2.6.24.ko to the GP2Xpectrum directory and ran.
Any ideas why? Tearing on this emu was really bad and I'd like to see if this has fixed it.

Thanks
-(e)

I've uploaded bug fixed version that may help you.

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,23,271
 
Last edited by a moderator:
Nice. I can confirm that GP2Xpectrum now works flawlessly with the new library.
The performance is really amazing. Some games without RAM tweaks and MMU Hack out of the box now even run faster with this libs than without...
 
Not only spectrum emulator, Amstrad and Amiga emulators do not have diagonal tearing with this last SDL ;)

Thank you very much Ikari.
 
ikari said:
I've uploaded bug fixed version that may help you.

http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,23,271

Dude... you rock! :) works like an absolute charm. Sorry I didn't get back to you sooner, RL took over (thanks sbock for confirming)
-(e)
 
Last edited by a moderator:
Rivroner said:
Not only spectrum emulator, Amstrad and Amiga emulators do not have diagonal tearing with this last SDL ;)

Thank you very much Ikari.

Yes, many many many many thanks for fixing the Amiga emulator. That rotated with the last version of libSDL. Finally some tear free amiga emulation :D.
 
Last edited by a moderator:
Rivroner said:
Ikari, what features have the new version uploaded? :)

Many of changes are for developers. Such as OpenGL ES development and using 3D/YUV memory for alloc SDL_Surface on non OpenGL mode.
For more information, see README.gp2xwiz file on source tarball.(Sorry for my poor English..)
(http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,272)
Currently it has some compilation issues with OpenWIZ toolchain so I'll fix it later.

For end-user, I've separated it to "Fast version" and "Normal version"
"Normal version" is working same as previous version.
"Fast version" rotates screen without postprocessing. It has more tearing than "Normal" but it gains more performance.

February 24's update is not that necessary. Only modified VideoInit/Quit functions for more stability.
 
Last edited by a moderator:
Thank you for the answer :)

I have a question, if the screen is rotated why is still tearing in fast version? (I only have tested normal version)

Another question, there is no diagonal tearing (thank you very much) but in Neo Geo Logo for example you can see like vertical lines tearing the screen , there are like 4 vertical lines. You can see it in amiga emulator too. In Amstrad and Spectrum i don´t see the lines but maybe are there.

Is not posible to make desappear all the tear? This is much better than diagonal one but...

In Picodrive, Mame4All or GpSP emulators with the antitear option enabled you cannot see anything like this.
 
Hi ikari! Many thanks for your this great contribution and for the infos. Much appreciated.

I post your readme file here. I think it's very interesting for devs. It seems you're working on a lot of great stuff here:

[How to build]
make clean
./configure --prefix=(installdir) --host=(arm-linux) --enable-shared --enable-pthreads --enable-pthreads-sem --enable-threads --disable-video-fbcon --disable-video-directfb --disable-video-x11 --disable-arts --disable-esd --enable-video --enable-video-gp2xwiz (--enable-video-opengl --enable-gp2xwiz-experimentalmodes --enable-gp2xwiz-rotbuffer)
make
make install
(If you want to develop your own application with this library, you need to install this library on your toolchain.)

* Addition flags for GP2X Wiz
--enable-video-opengl : Enables OpenGL ES development (You have to copy gl.h and egl.h on your toolchain's include/GLES directory first.)
--enable-gp2xwiz-experimentalmodes : Enables 24, 32bit color setting (Disabled by default)
※ USE AT YOUR OWN RISK : 24, 32bit modes are very slow and may be unstable. Don't use this feature except you know what you're doing.
--enable-gp2xwiz-rotbuffer : Reduces screen tearing on 320x240 => 240x320 rotation, but it's slower than default. (Disabled by default)


[Additional SDL_SetVideoMode() flags for developers]
1. SDL_DOUBLEBUF : Enables Wait for VSYNC
If you wanna use this feature, add SDL_DOUBLEBUF flag on SDL_SetVideoMode() and use SDL_Flip() to refresh screen.
(SDL_UpdateRects() doesn't wait for VSYNC)

example)
SDL_SetVideoMode(320,240,16,SDL_SWSURFACE|SDL_DOUBLEBUF);
SDL_Flip(screen);

2. WIZ_240X320 : Enables 240x320 screen mode
If you wanna use this feature, set screen width to 240 or smaller,
set screen height to 320 or smaller, and add WIZ_240X320 flag on SDL_SetVideoMode().

example)
SDL_SetVideoMode(240,320,16,SDL_SWSURFACE|WIZ_240X320);

--------------------------------
|(0,0) |
| |
| |
| |
| (319,239)|
--------------------------------
(320x240 rotation mode)

--------------------------------
| (0,0)|
| |
| |
| |
|(239,319) |
--------------------------------
(240x320 mode)

3. WIZ_TEARING : Set screen mode to 320x240 "diagnoal tearing" mode. (Same as GP2X Wiz's built in SDL library)
example)
SDL_SetVideoMode(320,240,16,SDL_SWSURFACE|WIZ_TEARING);

4. WIZ_UPPERSURFACE : Use upper 16MiB(3D memory area) to alloc 2D SDL_Surface.
(It's for 2D graphics mode only. With SDL_OPENGL flag, it's automatically disabled.)
If you wanna use this feature, add WIZ_UPPERSURFACE flag on SDL_SetVideoMode(),
and add WIZ_UPPERSURFACE flag on each SDL_CreateRGBSurface() calls.
Or you can use SDL_DisplayFormat() function. It allocates converted surface on upper memory when WIZ_UPPERSURFACE enabled.
Note that this feature requires MMUHACK/wARM module. If you don't have .ko file on your SD's same directory with libSDL-1.2.so.0 and your .gpe file, this feature is automatically disabled.
example)
SDL_SetVideoMode(320,240,16,SDL_SWSURFACE|WIZ_UPPERSURFACE);
SDL_CreateRGBSurface(WIZ_UPPERSURFACE,...);

5. SDL_OPENGL : Enables OpenGL ES development for GP2X Wiz.
If you wanna use this feature, set SDL_OPENGL flag on SDL_SetVideoMode(),
And dynamic link GP2X Wiz's libopengles_lite.so and libwizGLES.so/libglport.so at compiling your apps.
You can use this flag with WIZ_240X320/WIZ_TEARING flags for set screen direction, but can't use this flag with WIZ_UPPERSURFACE/SDL_DOUBLEBUF.
(SDL_DOUBLEBUF and WIZ_UPPERSURFACE flags are automatically disabled when SDL_OPENGL flag enabled.)

usage for older(~firmware 1.1.0) libraries)
SDL_SetVideoMode(240,320,16,SDL_OPENGL|WIZ_240X320); - 240x320 mode to prevent diagnoal tearing.
SDL_SetVideoMode(320,240,16,SDL_OPENGL|WIZ_TEARING); - Default 320x240 mode. It's have diagnoal tearing.

arm-openwiz-linux-gnu-g++ (your options) -lSDL -lwizGLES -lopengles_lite

usage for newer(firmware 1.2.0) libraries)
SDL_SetVideoMode(320,240,16,SDL_OPENGL); - Newer libraries are eliminated diagnoal tearing and doesn't support 240x320 mode.

arm-openwiz-linux-gnu-g++ (your options) -lSDL -lglport -lopengles_lite

Note : Don't use SDL_OPENGLBLIT flag! It's veryvery slow.


[Modifications for SDL_GL_SetAttribute() function]
SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE, SDL_GL_SWAP_CONTROL flags are enabled for OpenGL ES Lite 1.1.
Other flags are disabled because they are not supported on OpenGL ES 1.1 or GP2X Wiz's OpenGL ES Lite.
Note : SDL_GL_ALPHA_SIZE is always be zero, and SDL_GL_SWAP_CONTROL flag has no effects currently.


Special thanks to : Notaz, Orkie, Pickle, hcf, Exophase, KungPhoo, Franxis, sbock, NK, SMgal and everybody!
And PLZ forgive my poor English................. ikari

BTW: I think your English is very good. At least I can understand you without problems, but I'm also not a native English speaker...
 
ikari said:
Rivroner said:
Ikari, what features have the new version uploaded? :)

Many of changes are for developers. Such as OpenGL ES development and using 3D/YUV memory for alloc SDL_Surface on non OpenGL mode.
For more information, see README.gp2xwiz file on source tarball.(Sorry for my poor English..)
(http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,272)
Currently it has some compilation issues with OpenWIZ toolchain so I'll fix it later.

For end-user, I've separated it to "Fast version" and "Normal version"
"Normal version" is working same as previous version.
"Fast version" rotates screen without postprocessing. It has more tearing than "Normal" but it gains more performance.

February 24's update is not that necessary. Only modified VideoInit/Quit functions for more stability.

How much faster is the fast version compared to the normal version? Any numbers on that? Is it faster than the libsdl in the wiz firmware?

Regards

André
 
Last edited by a moderator:
fettouhi said:
ikari said:
Rivroner said:
Ikari, what features have the new version uploaded? :)

Many of changes are for developers. Such as OpenGL ES development and using 3D/YUV memory for alloc SDL_Surface on non OpenGL mode.
For more information, see README.gp2xwiz file on source tarball.(Sorry for my poor English..)
(http://dl.openhandhelds.org/cgi-bin/wiz.cgi?0,0,0,0,46,272)
Currently it has some compilation issues with OpenWIZ toolchain so I'll fix it later.

For end-user, I've separated it to "Fast version" and "Normal version"
"Normal version" is working same as previous version.
"Fast version" rotates screen without postprocessing. It has more tearing than "Normal" but it gains more performance.

February 24's update is not that necessary. Only modified VideoInit/Quit functions for more stability.

How much faster is the fast version compared to the normal version? Any numbers on that? Is it faster than the libsdl in the wiz firmware?

Regards

André

It's faster than normal but slightly slower than firmware's SDL.
Belows are result of simple screen filling test for measure drawing performance.
(with mmuhack and ram timing tweak)

Normal ver : Max 280Frames per sec
Fast ver : Max 470Frames per sec
Firmware's SDL : Max 520Frames per sec

With GNGEO, Fast version gains average 10FPS than normal.(with 22khz sound)
 
Last edited by a moderator:
Rivroner said:
Thank you for the answer :)

I have a question, if the screen is rotated why is still tearing in fast version? (I only have tested normal version)

Another question, there is no diagonal tearing (thank you very much) but in Neo Geo Logo for example you can see like vertical lines tearing the screen , there are like 4 vertical lines. You can see it in amiga emulator too. In Amstrad and Spectrum i don´t see the lines but maybe are there.

Is not posible to make desappear all the tear? This is much better than diagonal one but...

In Picodrive, Mame4All or GpSP emulators with the antitear option enabled you cannot see anything like this.

There are two sorts of tearing, diagonal and vertical.
When you're using firmware's default 320x240 mode, you can see diagonal one,
and when you're using screen rotation, you can see vertical one.

When you're using "Fast" library, you can see more vertical lines than "Normal" library, and it looks more badly.

GNGEO's vertical tearing can be eliminated with hardware double buffering but it may be slower.
Anyway, I'll add that feature until next update.
(Other emulators are not tested yet.)
 
Last edited by a moderator:
In GneoGeo i have noticed the vertical tearing in normal version (like 3-4 vertical lines), but only in the Neo Geo Logo , this tearing is much better than diagonal one.

With fast version in GneoGeo i have noticed 3-4 lines but they are not vertical, they are diagonal but they are not visible at all, only in the logo.

Thnak you very much for the answer :)
 
I can't get the source from the filearchive to build. It fails with:
./src/video/SDL_video.c: In function 'SDL_RdEEPROM':
./src/video/SDL_video.c:439: error: storage size of 'i2c_msgs' isn't known
./src/video/SDL_video.c:455: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:455: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:456: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:456: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:457: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:457: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:458: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:458: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:471: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:471: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:472: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:472: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:472: error: 'I2C_M_RD' undeclared (first use in this function)
./src/video/SDL_video.c:472: error: (Each undeclared identifier is reported only once
./src/video/SDL_video.c:472: error: for each function it appears in.)
./src/video/SDL_video.c:473: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:473: error: dereferencing pointer to incomplete type
./src/video/SDL_video.c:474: error: invalid use of undefined type 'struct i2c_msg'
./src/video/SDL_video.c:474: error: dereferencing pointer to incomplete type
make: *** [build/SDL_video.lo] Fehler 1

Any ideas ?
 
Back
Top