[omapfbplay] mmap() fails

142 views
Skip to first unread message

Selso LIBERADO

unread,
Mar 13, 2009, 5:27:42 AM3/13/09
to beagl...@googlegroups.com
Hi all !

I am experiencing troubles with omapfbplay. When I launch it fails with trace "mmap() invalid argument". It does seems to be due to ioctl() calls.

Here are some infos :
hardware : beagleboard BB-MB-000 Rev B7
Uboot : 2009.01-00013-g52eddcd (Feb 032009 - 22:25:11)
Software : BeagleBoard demo @ angstrom 2.6.28-omap1

uboot bootargs : setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rootdelay=2 rootfstype=ext2 ro omap-dss.def_disp=dvi omapfb.video_mode=800x600MR-24@60 omapfb.vram=2M,4M,4M omapfb.debug=y'

Checking init :

OMAPFB: omapfb_init
OMAPFB: omapfb_probe
fbcvt: 800x600@60: CVT Name - .480M3-R
OMAPFB: create 3 framebuffers
OMAPFB: fb_infos allocated
param '2M'
param '4M'
param '4M'
OMAPFB: allocating 2097152 bytes for fb 0
OMAPFB: allocated VRAM paddr 80661000, vaddr c9000000
OMAPFB: allocating 4194304 bytes for fb 1
OMAPFB: allocated VRAM paddr 80861000, vaddr c9200000
OMAPFB: allocating 4194304 bytes for fb 2
OMAPFB: allocated VRAM paddr 80c61000, vaddr c9600000
OMAPFB: region0 phys 80661000 virt c9000000 size=2097152
OMAPFB: region1 phys 80861000 virt c9200000 size=4194304
OMAPFB: region2 phys 80c61000 virt c9600000 size=4194304
....
OMAPFB: fbmems allocated



FBSET :
mode "800x600-60"
   # D: 35.500 MHz, H: 36.979 kHz, V: 59.837 Hz
   geometry 800 600 800 600 32
   timings 28169 80 48 3 11 32 4
   rgba 8/16,8/8,8/0,0/0
endmode

RUNNING STRACE with omapfbplay :
....
write(2, "Using 137 frame buffers, frame_s"..., 43Using 137 frame buffers, frame_size=487296
) = 43
mmap2(NULL, 66760704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40d9b000
brk(0x9f000)                            = 0x9f000
open("/dev/fb0", O_RDWR)                = 4
ioctl(4, FBIOGET_VSCREENINFO, 0x13a74)  = 0
close(4)                                = 0
open("/dev/fb1", O_RDWR)                = 4
ioctl(4, FBIOGET_VSCREENINFO, 0x13b14)  = 0
ioctl(4, 0x40444f35, 0x13bbc)           = 0
ioctl(4, 0x40084f38, 0x13bb4)           = 0 !!!! ===> THIS CALL IS THE PB : xioctl(fb, OMAPFB_QUERY_MEM, &minfo);
mmap2(NULL, 0, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = -1 EINVAL (Invalid argument)
write(2, "mmap: Invalid argument\n", 23mmap: Invalid argument
) = 23
io_submit(0x1, 0x1, 0xfbad2088 <unfinished ... exit status 1>
Process 2159 detached

I don't understand why the ioctl() calls fail, any idea ?

Selso.



Måns Rullgård

unread,
Mar 13, 2009, 6:37:33 AM3/13/09
to beagl...@googlegroups.com
Selso LIBERADO <selso.l...@gmail.com> writes:

The ioctl() call is not failing, the following mmap() call is. This
is because the OMAPFB_QUERY_MEM ioctl is returning a size of zero. I
don't know why it would do that.

--
Måns Rullgård
ma...@mansr.com

bizulk

unread,
Mar 13, 2009, 7:07:39 AM3/13/09
to Beagle Board

Hi Måns !
I did see the think in that way :) (but my english can be confusing).
What might help is to tell on which version of "u-boot & kernel & omap
version" you got omap working ?
Best regards !
Selso.

Måns Rullgård

unread,
Mar 13, 2009, 7:30:02 AM3/13/09
to beagl...@googlegroups.com
bizulk <selso.l...@gmail.com> writes:

> Hi Måns !
> I did see the think in that way :) (but my english can be confusing).
> What might help is to tell on which version of "u-boot & kernel & omap
> version" you got omap working ?

It should work with whatever Angstrom uses. Bug Koen if it doesn't.

--
Måns Rullgård
ma...@mansr.com

bizulk

unread,
Mar 13, 2009, 1:24:09 PM3/13/09
to Beagle Board
I'd like to resume what does omapfbplay :
> It's using libavcodec (software codec from ffmpeg) to decode video.
> It's using omapfb overlays (fb0/fb1) and use double-buffering
> It's not using the omap hardware codec.
> omap maps memory on /dev/fb1 (and makes a test on fb0).

On which condition ioctl(OMAPFB_QUERY_MEM) can return zero, if I
allocated 4M to fb1 ?

One more info with "cat /sys/devices/platform/omapfb/overlays" :
gfx t:lcd x:0 y:0 iw:640 ih:480 w:640 h:480 e:1
vid1 t:lcd ..... e:0
vid2 t:lcd ..... e:0
14-ov1 t:14 ... e:0
e:1 e:0 says if overlay is enabled/disabled. Shall the overlays be
also enabled on vid1 & vid2 ?

One more info with "cat /sys/devices/platform/omapfb/framebuffers" :
0 p:8065d000 v:c9000000 size:2097152 t:gfx
1 p:00000000 v:00000000 size:0 t:vid1
2 p:80c5d000 v:c9600000 size:4194304 t:vid2

Well I think the second line shows the problem, size is zero on vid1
but why ? I did put 4M to fb1 (see uboot args)


On Mar 13, 12:30 pm, Måns Rullgård <m...@mansr.com> wrote:
> m...@mansr.com

bizulk

unread,
Mar 13, 2009, 2:17:51 PM3/13/09
to Beagle Board
Hi Måns Rullgård !
You are the author of omapfbplay, aren't you ? Is it possible to
modify omapfbplay to add a new argument that let chose the framebuffer
to use (ex fb1/2).

I made this dirty test : switch fb1 & fb2 filenames and call
omapfbplay : it works !
So I think that "cat /sys/devices/platform/omapfb/framebuffers" point
out the problem, but there is a incoherence as kernel init trace tells
that vram allocated memory for fb1.

How can we resolve it ?

Best regards,
Selso.

Måns Rullgård

unread,
Mar 13, 2009, 2:45:27 PM3/13/09
to beagl...@googlegroups.com
bizulk <selso.l...@gmail.com> writes:

> Hi Måns Rullgård !
> You are the author of omapfbplay, aren't you ? Is it possible to
> modify omapfbplay to add a new argument that let chose the framebuffer
> to use (ex fb1/2).

Of course it's possible.

> I made this dirty test : switch fb1 & fb2 filenames and call
> omapfbplay : it works !
> So I think that "cat /sys/devices/platform/omapfb/framebuffers" point
> out the problem, but there is a incoherence as kernel init trace tells
> that vram allocated memory for fb1.
>
> How can we resolve it ?

I don't know what is messing with your configuration. Are you running
X?

--
Måns Rullgård
ma...@mansr.com

bizulk

unread,
Mar 13, 2009, 5:16:27 PM3/13/09
to Beagle Board
In fact the Angstrom demo include X and launches it at init, but
before making any test I do the following :
+ Open console on serial as root
+ Stop X with /etc/init.d/gpe-dm stop
+ Then I check that All X instance are killed with ps xaf.
+ I launch omapfbplay from root console.


On Mar 13, 7:45 pm, Måns Rullgård <m...@mansr.com> wrote:
> m...@mansr.com

Koen Kooi

unread,
Mar 13, 2009, 5:18:16 PM3/13/09
to beagl...@googlegroups.com

Op 13 mrt 2009, om 18:16 heeft bizulk het volgende geschreven:

>
> In fact the Angstrom demo include X and launches it at init, but
> before making any test I do the following :
> + Open console on serial as root
> + Stop X with /etc/init.d/gpe-dm stop
> + Then I check that All X instance are killed with ps xaf.
> + I launch omapfbplay from root console.

If X has already launched you have already lost, use update-rc.d to
disable gpe-dm and reboot.

regards,

Koen

sli

unread,
Mar 12, 2009, 1:26:10 PM3/12/09
to beagl...@googlegroups.com
Hi all !

I am experiencing trouble with omap fbplay. When I launch it fails with

Checking init :

RUNNING STRACE :


write(2, "Using 137 frame buffers, frame_s"..., 43Using 137 frame
buffers, frame_size=487296
) = 43
mmap2(NULL, 66760704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x40d9b000
brk(0x9f000) = 0x9f000
open("/dev/fb0", O_RDWR) = 4
ioctl(4, FBIOGET_VSCREENINFO, 0x13a74) = 0
close(4) = 0
open("/dev/fb1", O_RDWR) = 4
ioctl(4, FBIOGET_VSCREENINFO, 0x13b14) = 0
ioctl(4, 0x40444f35, 0x13bbc) = 0

ioctl(4, 0x40084f38, 0x13bb4) = 0 ===> THIS CALL IS THE PB :

xioctl(fb, OMAPFB_QUERY_MEM, &minfo);
mmap2(NULL, 0, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = -1 EINVAL
(Invalid argument)
write(2, "mmap: Invalid argument\n", 23mmap: Invalid argument
) = 23
io_submit(0x1, 0x1, 0xfbad2088 <unfinished ... exit status 1>
Process 2159 detached

I don't understand why the ioctl() calls fails, any idea ?

Selso.

bizulk

unread,
Mar 16, 2009, 9:44:45 AM3/16/09
to Beagle Board
So Instead of desinstalling gpe-dm launch I disabled it (chmod a-x)
and restart.
Now "cat /sys/devices/platform/omapfb/framebuffers" returns :
0 p:80661000 v:c9000000 size:2097152 t:gfx
1 p:80861000 v:c9200000 size:4194304 t:vid1
2 p:80c61000 v:c9600000 size:4194304 t:vid2

And omapfbplay runs correctly with fb1. I can understand that X
reserves some video memory when exiting but why ressource is not freed
when I stop X ?

Best regards.

bizulk

unread,
Mar 17, 2009, 7:01:14 AM3/17/09
to Beagle Board
Hi !
I just want to make a feedback of omapfbplay. I have compared
omapfbplay to mplayer (with -nosound as omapfbplay just play video)
with many video codec/format/bkps and I'd say that omapfbplay just
handle a bit better high resolution.
For example while 1280x720/mpeg2/60fps/18000kbps video "mplayer -
nosound -vo fbdev" loses frames, omapfbplay play this video "slowly".

Best regards.

Måns Rullgård

unread,
Mar 17, 2009, 7:26:24 AM3/17/09
to beagl...@googlegroups.com
bizulk <selso.l...@gmail.com> writes:

> Hi !
> I just want to make a feedback of omapfbplay. I have compared
> omapfbplay to mplayer (with -nosound as omapfbplay just play video)
> with many video codec/format/bkps and I'd say that omapfbplay just
> handle a bit better high resolution.
> For example while 1280x720/mpeg2/60fps/18000kbps video "mplayer -
> nosound -vo fbdev" loses frames, omapfbplay play this video "slowly".

I wrote omapfbplay specifically to show off the video playback. It
doesn't play sound, so it can get away with slowing down the video
while still playing it smoothly. MPlayer can't do that. Also,
omapfbplay pre-buffers decoded frames, which MPlayer doesn't. This
lets it play at full speed even if a few frames take longer to decode.

--
Måns Rullgård
ma...@mansr.com

bizulk

unread,
Mar 17, 2009, 10:07:58 AM3/17/09
to Beagle Board

> I wrote omapfbplay specifically to show off the video playback.  It
> doesn't play sound, so it can get away with slowing down the video
> while still playing it smoothly.  
==> I guessed it, I am making no reproach. I did just want to compare
the video players in the same conditions.

> MPlayer can't do that.  Also,
> omapfbplay pre-buffers decoded frames, which MPlayer doesn't.  This
> lets it play at full speed even if a few frames take longer to decode.
>
==> I know it (I read the code).

But the result is that omapfbplay is "slightly" better that mplayer
for the price of a higher memory load (for 1280x1024 resolution). I
can give my video samples.
If mplayer is losing a few frames, omapfbplay plays it correctly
If mplayer plays the video 'slowly', omapfbplay plays it correctly
(with some lost frames),
If mplayer doesn't play video, omapfbplay plays it 'slowly'.

We won't make miracles with double buffers if the CPU is at his limits.
Reply all
Reply to author
Forward
0 new messages