OESF Portal | OESF Forum | OESF Wiki | LinuxPDA | #planetgemini chat on matrix.org | #gemini-pda chat on Freenode | #zaurus and #alarmz chat on Freenode | ELSI (coming soon) | Ibiblio

IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Sdl With Directfb Packages, directfb-enabled SDL for ALARMZ
danboid
post Nov 8 2015, 03:54 PM
Post #1





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



There are two main reasons you may need to use SDL's directfb output. You may want to run an SDL2 program from the console or you may wish to run an SDL program such as an emulator or a game at QVGA resolution from the console. SDL1 supports fbcon output but fbcon output has been dropped from SDL2 where directfb is your only real option for displaying graphics outside of X. QVGA fbcon output doesn't seem to work for SDL1 under recent kernels. To make matters more complicated, both the SDL1 and SDL2 packages in the ALARM repositories don't include directfb support and even if you do build SDL yourself with directfb enabled (without using the patched PKGBUILD below) it still won't work properly because the display isn't aligned for the Zaurus' display and your pointers orientation will be skewed using the directfb version currently in the ALARM repos, directfb 1.7.7.

Thankfully forum member daalnroti patched the directfb code of SDL 1.2.14 so that we can use directfb and see the full screen and he also patched directfb so that you can use a pointer device correctly up/down will be up/down instead of left/right. I have built ALARM packages and PKGBUILD tarballs that integrate these patches to simplify the install process.

So far we only have the previous stable release of SDL1 (1.2.14) patched so that the directfb display works properly and an older directfb with the pointer patch applied. SDL2 apps will suffer from a misaligned display until we have a similar patch for SDL2. daal's original directfb patch was for directfb 1.4.11 but it still applied cleanly to 1.4.16 which was the oldest version I could get to build under Arch. I have not yet looked into if this patch works under the latest directfb but its a very small patch so it should be trivial to update it if required.

The SDL package here was built against the directfb 1.4.16 package below.

Installing sdl and directfb

To install the attached packages you will first need to uncompress their tarballs to get the Arch .tar.xz package as well as uninstall your existing SDL and everything that depends on SDL (if you've already installed SDL1 from the ALARM repo) like so:

CODE
pacman -Rcn sdl


After installing the attached sdl and directfb packages, you will need to add both 'sdl' and 'directfb' to your IgnorePkg statement in /etc/pacman.conf. Don't forget to uncomment the IgnorePkg line as it's commented out by default!

Configuring sdl and directfb

If you wanted directfb to default to QVGA, you would create an /etc/directfbrc file like this:

CODE
fbdev=/dev/fb0
mode=240x320
force-windowed
layer-rotate=270
no-vt-switch


You can also temporarily switch DFB settings by exporting them in a comma separated list to DFBARGS by running a command like this:
CODE
export DFBARGS="force-windowed,layer-rotate=270,mode=240x320,no-vt-switch"


Note that layer-rotate is required to use directfb in landscape display mode and it doesn't work without the force-windowed option.

You need to export your choice of video driver othewise SDL1 defaults to fbcon output:

CODE
export SDL_VIDEODRIVER=directfb


Finally you also need to export one of the following EVs to correct the displays offset:

CODE
export SDL_VIDEO_DIRECTFB_POS=qvga
export SDL_VIDEO_DIRECTFB_POS=vga
export SDL_VIDEO_DIRECTFB_POS=topleft


If you want any of these exported automatically on boot, add them to /etc/profile .
Attached File(s)
Attached File  sdl_1.2.14_directfb_PKGBUILD.tar.gz ( 20.9K ) Number of downloads: 130
Attached File  directfb_1.4.16_ALARMZ_PKGBUILD.tar.gz ( 1.04K ) Number of downloads: 123
Attached File  sdl_1.2.14_directfb_ALARMZ.tar.gz ( 320.66K ) Number of downloads: 128
Attached File  directfb_1.4.16_ALARMZ.tar.gz ( 568.67K ) Number of downloads: 137
 
Go to the top of the page
 
+Quote Post
greguu
post Nov 8 2015, 08:04 PM
Post #2





Group: Moderators
Posts: 373
Joined: 14-November 05
From: New Zealand
Member No.: 8,535



QUOTE(danboid @ Nov 9 2015, 12:54 AM) *
There are two main reasons you may want to use SDL's directfb output - you may want to run an SDL2 program from the console or you may wish to run an SDL program such as an emulator or a game at QVGA resolution from the console. SDL1 supports fbcon output but fbcon output has been dropped from SDL2 where directfb is your only real option for displaying graphics outside of X and QVGA fbcon output doesn't seem to work for SDL1 under recent kernels. To make matters more complicated, both the SDL1 and SDL2 packages in the ALARM repositories don't include directfb support and even if you do build SDL yourself with directfb enabled it still won't work properly because the display isn't aligned properly for the Zaurus' display!

Thankfully daalnroti has patched the directfb code of SDL 1.2.14 so that we can use directfb properly - well we almost can! I have created and built an ALARM package and PKGBUILD tarball to simplify the install process (both of which are attached) although as it stands, despite having spent hours today trying various directfb input options, I have not been able to get the keyboard to work under MAME4ALL when using directfb so far but at least it has proved to me that QVGA directfb output does work with daal's patch.

So far we only have the previous stable release of SDL1 (1.2.14) patched so that the directfb display works properly. I'll update this post when keyboard input works and/or any progress is made on supporting newer versions of SDL.

Installing sdl-directfb

To install the attached SDL package you will first need to uncompress the tarball to get the Arch .tar.xz package as well as uninstall your existing SDL and everything that depends on SDL (if you've already installed SDL1 from the ALARM repo) like so:

CODE
pacman -Rcn sdl


After installing the attached package, you will need to add 'sdl' to your IgnorePkg statement in /etc/pacman.conf. Don't forget to uncomment the IgnorePkg line as it's commented out by default!

Configuring sdl-directfb

If you wanted directfb to default to QVGA, you would create an /etc/directfbrc file like this:

CODE
fbdev=/dev/fb0
mode=240x320
force-windowed
layer-rotate=270


You can also temporarily switch DFB settings by exporting them in a comma separated list to DFBARGS by running a command like this:
CODE
export DFBARGS="force-windowed,layer-rotate=270,mode=240x320"


Note that layer-rotate is required to use directfb in landscape display mode and it doesn't work without the force-windowed option.

You need to export your choice of video driver othewise SDL1 defaults to fbcon output:

CODE
export SDL_VIDEODRIVER=directfb


Finally you also need to export one of the following EVs to correct the displays offset:

CODE
export SDL_VIDEO_DIRECTFB_POS=qvga
export SDL_VIDEO_DIRECTFB_POS=vga
export SDL_VIDEO_DIRECTFB_POS=topleft


If you want any of these exported automatically on boot, add them to /etc/profile .


Great work for writing this how-to.

In regards to the keyboard not working under MAME4ALL :

Does it work for other SDL applications using DirectFB as the back-end ?

If not, you may need a custom DirectFB build to support the Z keyboard. Back on Debian there were no DirectFB packages and I always compiled my own.
Test with a USB keyboard if that works, too.

My configure parameters for DirectFB 1.4.11 were :

CODE
/configure --prefix=/opt/dfb/ --enable-fbdev --with-gfxdrivers=none --disable-osx --disable-x11 --disable-network --disable-voodoo --disable-vnc --disable-sysfs --enable-multi --enable-zlib --with-inputdrivers="keyboard,linuxinput,ps2mouse,tslib" --disable-debug-support --disable-sdl --disable-unique --disable-video4linux --with-dither-rgb16=none --with-dither=none
make


(keep in mind for --enable-multi and tslib (touchscreen) will require extra packages to be build before DirectFB.)
Go to the top of the page
 
+Quote Post
danboid
post Nov 9 2015, 08:34 AM
Post #3





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



Hi daal!

I've tried directfb with chocolate-doom from the repos and it behaves the same as MAME. Using a USB keyboard made no difference - I get the same probs as using the integrated keyboard which is that either directfb spawns a terminal under the window I want to use (which is semi-transparent by default) and that captures keyboard input instead of MAME/DOOM or the keyboard doesn't work at all, depending on what options I feed to DFB.

I've just tried recompiling directfb 1.7.7 using most of the same options you used, most notably using the same input options (minus tslib whch I'm not bothering with yet) but unlike you I didn't disable SDL. Why did you disable SDL when you built directfb?

I built dfb today against the patched SDL package I've posted in the SDL thread as I suspected my probs could've been down to me running a directfb that was compiled against a slightly newer SDL (the one in the repos) but my new dfb package doesn't work any better than the one from the repos despite being built with SDL enabled and only the patched 1.2.14 version of SDL being installed, no SDL2.

If I run `dfbinfo` it shows dfb recognises the Z's keyboard and mouse (the touchscreen). If I run `dfbinput` I get logged out and it opens a new QVGA VT. It's definitely got issues somewhere!
Go to the top of the page
 
+Quote Post
danboid
post Nov 9 2015, 09:26 AM
Post #4





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



I've updated the OP with my experimental PKGBUILD for directfb for anyone who wants to help try get it to work.

The resultant package from using this PKGBUILD doesnt work any better or worse than the directfb in the repos so don't expect it to fix anything in its current state.
Go to the top of the page
 
+Quote Post
greguu
post Nov 9 2015, 09:38 PM
Post #5





Group: Moderators
Posts: 373
Joined: 14-November 05
From: New Zealand
Member No.: 8,535



QUOTE(danboid @ Nov 9 2015, 05:34 PM) *
Hi daal!

I've tried directfb with chocolate-doom from the repos and it behaves the same as MAME. Using a USB keyboard made no difference - I get the same probs as using the integrated keyboard which is that either directfb spawns a terminal under the window I want to use (which is semi-transparent by default) and that captures keyboard input instead of MAME/DOOM or the keyboard doesn't work at all, depending on what options I feed to DFB.

I've just tried recompiling directfb 1.7.7 using most of the same options you used, most notably using the same input options (minus tslib whch I'm not bothering with yet) but unlike you I didn't disable SDL. Why did you disable SDL when you built directfb?

I built dfb today against the patched SDL package I've posted in the SDL thread as I suspected my probs could've been down to me running a directfb that was compiled against a slightly newer SDL (the one in the repos) but my new dfb package doesn't work any better than the one from the repos despite being built with SDL enabled and only the patched 1.2.14 version of SDL being installed, no SDL2.

If I run `dfbinfo` it shows dfb recognises the Z's keyboard and mouse (the touchscreen). If I run `dfbinput` I get logged out and it opens a new QVGA VT. It's definitely got issues somewhere!


When compiling DirectFB there is no need to include SDL.

The SDL backend on DirectFB makes DirectFB apps run via SDL (mostly used for developing and not what you want).

In theory you could run SDL apps on DirectFB using SDL again and causing a indefinite loop smile.gif

You only need DirectFB support in SDL to make things work for your purpose.( run SDL apps on DirectFB using FBDEV)

No need for SDL support in DirectFB (hope this makes sense)

So to clarify, SDL is build against DirectFB as a back-end, in your case, not the other way around. Its a bit confusing I know.

I would suggest to build the older DirectFB source I included in the post, then after that, build my SDL source using that DirectFB library and try again.

I did not have these issues back then, and things may have changed with DirectFB newer versions.
Go to the top of the page
 
+Quote Post
danboid
post Nov 10 2015, 05:33 AM
Post #6





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



Here's the error I got when trying to build DFB 1.4.11 for ALARM:

CODE
gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -I../include -I../include -I../lib -I../src -DDATADIR=\"/usr/share/directfb-1.4.11\" -D_REENTRANT -D_FORTIFY_SOURCE=2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libpng16 -O3 -ffast-math -pipe -march=armv5te -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_GNU_SOURCE  -std=gnu99 -Werror-implicit-function-declaration -MT directfb-csource.o -MD -MP -MF .deps/directfb-csource.Tpo -c -o directfb-csource.o directfb-csource.c
In file included from /usr/include/libpng16/pngconf.h:50:0,
                 from /usr/include/libpng16/png.h:489,
                 from directfb-csource.c:43:
directfb-csource.c: In function 'load_image':
directfb-csource.c:341:25: error: dereferencing pointer to incomplete type 'png_struct {aka struct png_struct_def}'
      if (setjmp (png_ptr->jmpbuf)) {
                         ^
directfb-csource.c:409:28: error: dereferencing pointer to incomplete type 'png_info {aka struct png_info_def}'
                if (info_ptr->num_palette) {
                            ^
directfb-csource.c: In function 'main':
directfb-csource.c:223:21: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result]
                     fread(data, statbuf.st_size, 1, f);
                     ^
Makefile:640: recipe for target 'directfb-csource.o' failed
make[2]: *** [directfb-csource.o] Error 1
make[2]: Leaving directory '/root/src/directfb-1.4.11-ALARMZ-PKGBUILD/src/DirectFB-1.4.11/tools'
Makefile:504: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/src/directfb-1.4.11-ALARMZ-PKGBUILD/src/DirectFB-1.4.11'
Makefile:371: recipe for target 'all' failed
make: *** [all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
Go to the top of the page
 
+Quote Post
danboid
post Nov 10 2015, 09:02 AM
Post #7





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



IT'S FIXED!

I can now run MAME4ALL at QVGA fullscreen with working Zaurus keybord input! 11 years I've waited for this! biggrin.gif

I've updated the OP with the required packages, PKGBUILD tarballs and instructions!

Thank's again to daal for the orignal patches!

biggrin.gif biggrin.gif biggrin.gif
Go to the top of the page
 
+Quote Post
danboid
post Nov 10 2015, 11:11 AM
Post #8





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



NO ITS NOT! sad.gif

it looks like I celebrated too soon and I'm back to not knowing what is causing the keyboard not to work under directfb because its broke again even though I'm still running the same kernel, sdl and directfb 1.4.16 I was running an hour ago when it was working. Yes, I did remember to add sdl and directfb to the IgnorePkg line before you ask! smile.gif

Whilst I had my network adapter and cable connected up to my Z, I thought I'd download a few packages. Something I installed today or one of its deps causes keyboard issues with directfb so I may not have needed to rebuild directfb to get the keyboard to work after all although it did still need to be patched anyway to fix the pointer orientation.

Getting really close now at least!
Go to the top of the page
 
+Quote Post
danboid
post Nov 10 2015, 12:49 PM
Post #9





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



OH YES IT IS WORKING! biggrin.gif

It's getting a bit pantomime this now isn't it? smile.gif

I've fixed my keyboard problem - I 'just' had to add:

CODE
no-vt-switch


To my /etc/directfbrc so I've updated the SDL guide appropriately.

I don't know why that option became auto-enabled the first few times I ran directfb 1.4.16? blink.gif
Go to the top of the page
 
+Quote Post
greguu
post Nov 10 2015, 07:46 PM
Post #10





Group: Moderators
Posts: 373
Joined: 14-November 05
From: New Zealand
Member No.: 8,535



QUOTE(danboid @ Nov 10 2015, 06:02 PM) *
IT'S FIXED!

I can now run MAME4ALL at QVGA fullscreen with working Zaurus keybord input! 11 years I've waited for this! biggrin.gif

I've updated the OP with the required packages, PKGBUILD tarballs and instructions!

Thank's again to daal for the orignal patches!

biggrin.gif biggrin.gif biggrin.gif


Hi Dan,

good news.

How is performance ? Sound smooth ? Upload some new video ?

Cheers!
Go to the top of the page
 
+Quote Post
danboid
post Nov 11 2015, 02:18 AM
Post #11





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



Whilst MAME does tend to intermittently experience brief slow downs on some 16 bit games, everything I've tried runs full speed and full screen with sound. Finally - usable MAME and SSH in my pocket! biggrin.gif

In almost 20 years as a Linux user, I have never had to put so much effort into getting a program to run properly (and that includes all sorts of servers and server transitions) so damn right I'm going to do a video to let everyone know what I had to go through to get here!

I'll be back soon to post one...
Go to the top of the page
 
+Quote Post
danboid
post Nov 12 2015, 07:37 AM
Post #12





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



I've just added some extra info to the intro and cleaned the guide up a bit.
Go to the top of the page
 
+Quote Post
greguu
post Dec 8 2015, 01:23 AM
Post #13





Group: Moderators
Posts: 373
Joined: 14-November 05
From: New Zealand
Member No.: 8,535



QUOTE(danboid @ Nov 12 2015, 04:37 PM) *
I've just added some extra info to the intro and cleaned the guide up a bit.


Hi danboid,

I was afk, and also currently changed my build machine.

Once I am back up and running and find some time I will continue with a DirectFB/SDL upgrade and get more apps build that use these.

Cheers,
Go to the top of the page
 
+Quote Post
greguu
post Jan 19 2016, 11:25 PM
Post #14





Group: Moderators
Posts: 373
Joined: 14-November 05
From: New Zealand
Member No.: 8,535



Hi Dan,

not sure you still follow this thread but I have started with a new build of DirectFB and SDL.
The latest kernel 4.4.0 v0.5 does include a linux-fusion module. This allows multiple DirectFB apps to run at the same time.
Once I got more I will open a new thread. Hope you are interested. Join the chat or PM me if you like.

Cheers!
Go to the top of the page
 
+Quote Post
danboid
post Jan 24 2016, 01:07 PM
Post #15





Group: Members
Posts: 881
Joined: 26-December 05
From: England
Member No.: 8,789



Good news daal!

Do you need fusion to have DFB on one VT and a regular console on another?

What do you want to use DFB Fusion for exactly? The the Z even got enough RAM to run more than one interesting DFB app at once?

If I don't do it tonight I'll try the latest kernel out in the next few days.
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 13th November 2019 - 01:17 PM