LinuxFB + DirectFB at same time?

3.6k views Asked by At

I have an embedded plarform which has 2 graphic layers (/dev/fb0 and /dev/fb1).

I want to use 2 separate processes: One using /dev/fb0 directly (raw mode, no video libs). The other using /dev/fb1 through directfb.

I can start the first one and it is working well (i'm using the linux open function to open /dev/fb0 and write to that directly).

When I try to start the second one, it gets stuck in the directfb initialization.

I can't understand why directFb is locking on /dev/fb0 if I'm trying to use the /dev/fb1.

As requested by @shodanex, here is the strace output for the second process:

[pid  1483] open("/etc/directfbrc", O_RDONLY) = 7
[pid  1483] fstat64(7, {st_mode=S_IFREG|0755, st_size=472, ...}) = 0
[pid  1483] old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2f375000
[pid  1483] read(7, "system=fbdev\n#no-vt\n#no-vt-switc"..., 4096) = 472
[pid  1483] write(2, "(!) DirectFB/Config \'depth\': OK!"..., 39(!) DirectFB/Config 'depth': OK!!!! 32
) = 39
[pid  1483] read(7, "", 4096)           = 0
[pid  1483] close(7)                    = 0
[pid  1483] munmap(0x2f375000, 4096)    = 0
[pid  1483] open("/root/.directfbrc", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] write(2, "\n     =======================|  "..., 270
 =======================|  DirectFB 1.0.1  |=======================
      (c) 2001-2007  The DirectFB Organization (directfb.org)
      (c) 2000-2004  Convergence (integrated media) GmbH
    ------------------------------------------------------------

) = 270
[pid  1483] gettid()                    = 1483
[pid  1483] rt_sigaction(SIGHUP, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGINT, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGTERM, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGABRT, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGFPE, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {0x29d6f860, [], 0}, 8) = 0
[pid  1483] rt_sigaction(SIGILL, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {0x29d6f860, [], 0}, 8) = 0
[pid  1483] rt_sigaction(SIGQUIT, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGSEGV, {0x2a323fc0, [], SA_SIGINFO}, {0x29d6f860, [], 0}, 8) = 0
[pid  1483] rt_sigaction(SIGTRAP, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGBUS, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {0x29d6f860, [], 0}, 8) = 0
[pid  1483] rt_sigaction(SIGXCPU, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] rt_sigaction(SIGXFSZ, {0x2a323fc0, [], SA_NOMASK|SA_SIGINFO}, {SIG_DFL}, 8) = 0
[pid  1483] write(2, "(*) DirectFB/Core: Single Applic"..., 64(*) DirectFB/Core: Single Application Core. (2010-03-25 20:40) 
) = 64
[pid  1483] open("/usr/lib/libdirectfb-1.0.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/lib/directfb-1.0-0/systems", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 7
[pid  1483] fstat64(7, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid  1483] fcntl64(7, F_SETFD, FD_CLOEXEC) = 0
[pid  1483] getdents(7, /* 10 entries */, 4096) = 288
[pid  1483] open("/usr/lib/directfb-1.0-0/systems/libdirectfb_fbdev.so", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\200&\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=59543, ...}) = 0
[pid  1483] old_mmap(NULL, 115640, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f378000
[pid  1483] mprotect(0x2f384000, 65536, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f394000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0xc000) = 0x2f394000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/lib/directfb-1.0-0/systems/libdirectfb_x11.so", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\200\35\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=25273, ...}) = 0
[pid  1483] old_mmap(NULL, 83288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f398000
[pid  1483] mprotect(0x2f39d000, 61440, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f3ac000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x4000) = 0x2f3ac000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/local/lib/mylibs/libX11.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/local/lib/libX11.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/lib/libX11.so.6", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\340\205\1\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=953468, ...}) = 0
[pid  1483] old_mmap(NULL, 895116, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f3b0000
[pid  1483] mprotect(0x2f477000, 65536, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f487000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0xc7000) = 0x2f487000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/local/lib/mylibs/libXext.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/local/lib/libXext.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/lib/libXext.so.6", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\340)\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=61440, ...}) = 0
[pid  1483] old_mmap(NULL, 114084, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f48c000
[pid  1483] mprotect(0x2f498000, 61440, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f4a7000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0xb000) = 0x2f4a7000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/local/lib/mylibs/libxcb-xlib.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/local/lib/libxcb-xlib.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/lib/libxcb-xlib.so.0", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\300\5\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=5786, ...}) = 0
[pid  1483] old_mmap(NULL, 68112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f4a8000
[pid  1483] mprotect(0x2f4a9000, 61440, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f4b8000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0) = 0x2f4b8000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/local/lib/mylibs/libxcb.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/local/lib/libxcb.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  1483] open("/usr/lib/libxcb.so.1", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\300u\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=112671, ...}) = 0
[pid  1483] old_mmap(NULL, 144212, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f4bc000
[pid  1483] mprotect(0x2f4cf000, 65536, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f4df000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x13000) = 0x2f4df000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/lib/libXau.so.6", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\240\n\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=10880, ...}) = 0
[pid  1483] old_mmap(NULL, 71644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f4e0000
[pid  1483] mprotect(0x2f4e2000, 61440, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f4f1000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x1000) = 0x2f4f1000
[pid  1483] close(8)                    = 0
[pid  1483] open("/usr/lib/libXdmcp.so.6", O_RDONLY) = 8
[pid  1483] read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\0\20\0\0004\0\0\0"..., 512) = 512
[pid  1483] fstat64(8, {st_mode=S_IFREG|0755, st_size=23841, ...}) = 0
[pid  1483] old_mmap(NULL, 80376, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0x2f4f4000
[pid  1483] mprotect(0x2f4f8000, 61440, PROT_NONE) = 0
[pid  1483] old_mmap(0x2f507000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x3000) = 0x2f507000
[pid  1483] close(8)                    = 0
[pid  1483] getdents(7, /* 0 entries */, 4096) = 0
[pid  1483] close(7)                    = 0
[pid  1483] munmap(0x2f398000, 83288)   = 0
[pid  1483] munmap(0x2f48c000, 114084)  = 0
[pid  1483] munmap(0x2f3b0000, 895116)  = 0
[pid  1483] munmap(0x2f4a8000, 68112)   = 0
[pid  1483] munmap(0x2f4bc000, 144212)  = 0
[pid  1483] munmap(0x2f4e0000, 71644)   = 0
[pid  1483] munmap(0x2f4f4000, 80376)   = 0
[pid  1483] open("/dev/fb1", O_RDWR)    = 7
[pid  1483] fcntl64(7, F_SETFD, FD_CLOEXEC) = 0
[pid  1483] setsid()                    = 1483
[pid  1483] open("/dev/tty0", O_RDONLY|O_NOCTTY) = 8
[pid  1483] ioctl(8, 0x5603, 0x7bbc1d2a) = 0
[pid  1483] ioctl(8, 0x5600, 0x497658)  = 0
[pid  1483] ioctl(7, 0x460f, 0x7bbc1d18) = 0
[pid  1483] fstat64(7, {st_mode=S_IFCHR|0600, st_rdev=makedev(29, 1), ...}) = 0
[pid  1483] ioctl(7, 0x4610, 0x7bbc1c28) = 0
[pid  1483] ioctl(8, 0x5606, 0x2)       = 0

Note that the directfb reads the /etc/directfbrc file (check its content ahead). Nothing will be printed after that.

system=fbdev
fbdev=/dev/fb1
primary-layer=1
no-cursor
bg-color=00000000
disable-module=lirc
disable-module=keyboard
disable-module=ps2mouse
mode=1280x720-60
pixelformat=ARGB
depth=32
hardware
desktop-buffer-mode=backvideo

Have any idea? Thaks very much again.

2

There are 2 answers

0
Marcus On

I discovered that it is necessary to instruct the application not to switch graphics mode. I managed to make both applications run together just doing this. No locking situations anymore.

Now I'm trying to run my actual program, however QT is killing me because it is ignoring the nographicsmodeswitch argument. I'm working on that and I'm sure it's going to work sooner or later.

If someone here is a QT expert, I'd appreciate any help.

Thanks shodanex, your strace advice was very useful.

1
shodanex On

Could you provide more info :

  • Does direct FB works when the first process is not launched ?
  • How do you know directfb is locking on /dev/fb0 ?

Linux FB is a kernel driver, you can use any userspace program you want to use /dev/fb<x> such as directFB

DirectFB is a userspace library, it works with the Linux Frame Buffer.

So the answer is definitely yes, you can use you own program on /dev/fb0, and a DirectFB program on /dev/fb1. Maybe you should strace your directfb program to understand why it is stuck.