Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBTFT doesn't work by default on the Beaglebone Black #55

Closed
notro opened this issue Dec 1, 2013 · 2 comments

Comments

Projects
None yet
1 participant
@notro
Copy link
Owner

commented Dec 1, 2013

A workaround is to use DMA allocated buffers:

modprobe fbtft dma

On the BBB (drivers/spi/spi-omap2-mcspi.c), non-DMA SPI transfers above 160 bytes uses DMA mapping on the transfer buffer. This fails with FBTFT because it uses vmalloc to allocate the transfer buffer. vmalloc doesn't give physically contiguous memory.

The solution is to use kmalloc/kzalloc instead of vmalloc/vzalloc in fbtft-core.c

Crossref: #22

@ghost ghost assigned notro Dec 1, 2013

@notro

This comment has been minimized.

Copy link
Owner Author

commented Dec 1, 2013

I tried to use kzalloc on the display memory allocation as well, but that failed. Maybe deferred io only works on vmalloc'ed memory?

mmap memory usage

root@beaglebone:~# mplayer -nolirc -vo fbdev2:/dev/fb0 -vf scale=128:-3 ~/test.mp
MPlayer2 2.0-379-ge3f5043 (C) 2000-2011 MPlayer Team
162 audio & 361 video codecs

Playing /home/root/test.mpg.
Detected file format: raw MPEG video (libavformat)
[mpegvideo @ 0xb6003780]max_analyze_duration reached
[mpegvideo @ 0xb6003780]Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: video (mpeg1video), -vid 0
VIDEO:  [mpg1]  320x240  0bpp  25.000 fps  6553.2 kbps (800.0 kbyte/s)
Load subtitles in /home/root/
Opening video filter: [scale]
[ass] auto-open
Opening video filter: [scale w=128 h=-3]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg1] vfm: ffmpeg (FFmpeg MPEG-1)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
[swscaler @ 0xb5f27578]BICUBIC scaler, from yuv420p to yuv420p using C
[swscaler @ 0xb5f27578]No accelerated colorspace conversion found from yuv420p to rgb565le.
VO: [fbdev2] 128x96 => 128x96 BGR 16-bit
V:   0.0   0/  0 ??% ??% ??,?% 0 0 $<3>
Fontconfig failed to select a font. Trying without fontconfig...
New_Face failed. Maybe the font path is wrong.
Please supply [  235.273232] Unable to handle kernel paging request at virtual address bfae6040
[  235.281130] pgd = ddb7c000
[  235.283950] [bfae6040] *pgd=00000000
[  235.287685] Internal error: Oops: 5 [#2] SMP THUMB2
[  235.292773] Modules linked in: fb_st7735r fbtft_device fbtft ipv6 autofs4
[  235.299884] CPU: 0    Tainted: G      D       (3.8.13-00722-ge139c80-dirty #3)
[  235.307429] PC is at fb_deferred_io_fault+0x1e/0x70
[  235.312526] LR is at fb_deferred_io_fault+0x19/0x70
[  235.317610] pc : [<c01b974a>]    lr : [<c01b9745>]    psr: a8000133
[  235.317610] sp : ddb73da8  ip : 18091809  fp : 00000001
[  235.329583] r10: 00000029  r9 : 00000000  r8 : 00002000
[  235.335032] r7 : 00000029  r6 : bfae6040  r5 : df66ba70  r4 : ddb73dd0
[  235.341838] r3 : c0ae6000  r2 : e0800000  r1 : 00002000  r0 : bfae6040
[  235.348644] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment user
[  235.356262] Control: 50c5387d  Table: 9db7c019  DAC: 00000015
[  235.362254] Process mplayer (pid: 292, stack limit = 0xddb72240)
[  235.368522] Stack: (0xddb73da8 to 0xddb74000)
[  235.373067] 3da0:                   df66ba70 00000000 df7d9ac0 c00825f7 000002a7 00000000
[  235.381596] 3dc0: 00000000 b56b1000 ddb7ed58 00000000 00000029 00000002 b56b1000 00000000
[  235.390124] 3de0: c752c602 00000000 000000b1 df66ba70 df79d2c4 00002000 00000000 00000029
[  235.398659] 3e00: ddb7ed58 c0084387 00000002 00000029 00000000 ab6bab6a 00020200 00000001
[  235.407188] 3e20: c0efa808 c06bb784 00000000 c0efa80c df048c00 c0090bbb df048c00 b56b1000
[  235.415726] 3e40: 000000b1 000005ab df7d9ac0 ddb7ed58 df66ba70 00000029 bededc14 c008474b
[  235.424262] 3e60: ddb7ed58 00000029 df66ba70 ddb73fb0 b56b1000 df198040 df7d9ac0 00000817
[  235.432793] 3e80: 00000029 c001344d 00000002 df049c00 df48b008 c0076d95 df7d9b08 c06bac40
[  235.441331] 3ea0: 00000001 c0078d07 df66b9f4 00000000 c0ecf160 c0ecf180 00000000 00000001
[  235.449870] 3ec0: 00000001 c0076005 c0ecf160 c0ecf160 00000000 df6906a8 df66b9c0 c0076b77
[  235.458396] 3ee0: 00000000 df66b860 df6906a8 00000817 c06538b4 b56b1000 ddb73fb0 18281808
[  235.466925] 3f00: bedeb400 003953d0 bededc14 c00083e5 00000000 00000000 ffffffff c06f9740
[  235.475462] 3f20: c06f9740 05530552 008b4000 c06f9740 ffffffff 68000013 00618000 df7d9b08
[  235.483990] 3f40: 0068d000 00618000 df7d9b0c 00000000 00000005 c038aafb df7d9b08 c019677d
[  235.492519] 3f60: 00000000 ddb73f90 bedeb2c8 bedeb2c8 0034bb18 0000004e c000c5a4 bedeb2c8
[  235.501058] 3f80: 00000008 00000000 00000000 c002f8dd 386fd0a6 000bcd1e 002a97b0 b5b3b760
[  235.509592] 3fa0: 280f0010 ffffffff 18091809 c000c143 b56b1000 00594748 00005f60 18081808
[  235.518117] 3fc0: 20092009 20092009 200a200a 18091809 18281808 bedeb400 003953d0 bededc14
[  235.526645] 3fe0: 18091809 bedeb2a4 18091809 b5b3b760 280f0010 ffffffff 00000000 00000000
[  235.535207] [<c01b974a>] (fb_deferred_io_fault+0x1e/0x70) from [<c00825f7>] (__do_fault+0x75/0x2de)
[  235.544660] [<c00825f7>] (__do_fault+0x75/0x2de) from [<c0084387>] (handle_pte_fault+0x1e1/0x526)
[  235.553919] [<c0084387>] (handle_pte_fault+0x1e1/0x526) from [<c008474b>] (handle_mm_fault+0x7f/0x98)
[  235.563551] [<c008474b>] (handle_mm_fault+0x7f/0x98) from [<c001344d>] (do_page_fault+0xad/0x210)
[  235.572805] [<c001344d>] (do_page_fault+0xad/0x210) from [<c00083e5>] (do_DataAbort+0x25/0x60)
[  235.581800] [<c00083e5>] (do_DataAbort+0x25/0x60) from [<c000c143>] (__dabt_usr+0x43/0x60)
[  235.590420] Exception stack(0xddb73fb0 to 0xddb73ff8)
[  235.595686] 3fa0:                                     b56b1000 00594748 00005f60 18081808
[  235.604212] 3fc0: 20092009 20092009 200a200a 18091809 18281808 bedeb400 003953d0 bededc14
[  235.612751] 3fe0: 18091809 bedeb2a4 18091809 b5b3b760 280f0010 ffffffff
[  235.619655] Code: ff4e 4606 2800 d023 (6803) 0419
[  235.624653] ---[ end trace 471d8a8c2625a9c5 ]---
the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Fontconfig failed to select a font. Trying without fontconfig...
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Segmentation fault

Unloading

root@beaglebone:~# rmmod fbtft_device
[ 8594.812167] fb_st7735r spi1.0: fbtft_remove_common()
[ 8594.818040] fb_st7735r spi1.0: fbtft_free_gpios()
[ 8594.823203] fb_st7735r spi1.0: fbtft_free_gpios(): gpio_free('reset'=48)
[ 8594.831308] fb_st7735r spi1.0: fbtft_free_gpios(): gpio_free('dc'=49)
[ 8594.839434] Console: switching to colour dummy device 80x30
[ 8594.851103] Unable to handle kernel paging request at virtual address bfae6004
[ 8594.858739] pgd = df518000
[ 8594.861604] [bfae6004] *pgd=00000000
[ 8594.865404] Internal error: Oops: 805 [#1] SMP THUMB2
[ 8594.870733] Modules linked in: fb_st7735r fbtft_device(-) fbtft ipv6 autofs4 [last unloaded: fbtft]
[ 8594.880378] CPU: 0    Not tainted  (3.8.13-00722-ge139c80-dirty #3)
[ 8594.887011] PC is at fb_deferred_io_cleanup+0x26/0x42
[ 8594.892348] LR is at fb_deferred_io_cleanup+0x23/0x42
[ 8594.897689] pc : [<c01b981e>]    lr : [<c01b981b>]    psr: 00000033
[ 8594.897689] sp : df75bea8  ip : 00000000  fp : 00021008
[ 8594.909789] r10: 00000000  r9 : df75a000  r8 : c000c5a4
[ 8594.915306] r7 : 00000000  r6 : df463d40  r5 : 00001000  r4 : df4ed800
[ 8594.922193] r3 : c0ae6000  r2 : e0800000  r1 : 00000000  r0 : bfae6000
[ 8594.929083] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment user
[ 8594.936793] Control: 50c5387d  Table: 9f518019  DAC: 00000015
[ 8594.942858] Process rmmod (pid: 347, stack limit = 0xdf75a240)
[ 8594.949013] Stack: (0xdf75bea8 to 0xdf75c000)
[ 8594.953630] bea0:                   c059974b df4ed800 df4edb84 c069ff08 00000081 bf874691
[ 8594.962270] bec0: df4ed800 00000000 00000000 df4ed800 df4edb84 c069ff08 00000081 bf87472d
[ 8594.970911] bee0: bf88b017 df4cbc00 bf88b44c bf88b027 df4cbc00 c02317e3 c02317d7 c01f4243
[ 8594.979551] bf00: dd25e040 df4cbc34 df4cbc00 c01f4285 00000000 df4cbc00 df0af03c c01f3f83
[ 8594.988191] bf20: df4cbc00 df78c400 00021d50 c01f2a9f bf883760 00000000 00021d50 bf880203
[ 8594.996831] bf40: bf883610 c005a665 00002710 66746266 65645f74 65636976 00000000 dd25e040
[ 8595.005469] bf60: dd25e42c 00000000 df017c90 dd25e040 dd25e42c 00000000 c06dfc04 c003af45
[ 8595.014107] bf80: 00000000 000e000e bf883610 00000800 df75bf94 00000000 00021d20 00000800
[ 8595.022746] bfa0: 00021d20 c000c401 00021d20 00000800 00021d50 00000800 be9ffb88 ffffeffc
[ 8595.031384] bfc0: 00021d20 00000800 00021d20 00000081 00000001 be9ffbb8 be9ffdc8 00021008
[ 8595.040021] bfe0: b6ea2780 be9ffb74 b6f35610 b6ea278c 60000010 00021d50 00000000 00000000
[ 8595.048744] [<c01b981e>] (fb_deferred_io_cleanup+0x26/0x42) from [<bf874691>] (fbtft_framebuffer_release+0xc/0x70 [fbtft])
[ 8595.060471] [<bf874691>] (fbtft_framebuffer_release+0xc/0x70 [fbtft]) from [<bf87472d>] (fbtft_remove_common+0x38/0x4c [fbtft])
[ 8595.072627] [<bf87472d>] (fbtft_remove_common+0x38/0x4c [fbtft]) from [<bf88b027>] (fbtft_driver_remove_spi+0x10/0x12 [fb_st7735r])
[ 8595.085140] [<bf88b027>] (fbtft_driver_remove_spi+0x10/0x12 [fb_st7735r]) from [<c02317e3>] (spi_drv_remove+0xd/0xe)
[ 8595.096269] [<c02317e3>] (spi_drv_remove+0xd/0xe) from [<c01f4243>] (__device_release_driver+0x3f/0x6c)
[ 8595.106198] [<c01f4243>] (__device_release_driver+0x3f/0x6c) from [<c01f4285>] (device_release_driver+0x15/0x1e)
[ 8595.116944] [<c01f4285>] (device_release_driver+0x15/0x1e) from [<c01f3f83>] (bus_remove_device+0x77/0x88)
[ 8595.127140] [<c01f3f83>] (bus_remove_device+0x77/0x88) from [<c01f2a9f>] (device_del+0xa5/0xea)
[ 8595.136362] [<c01f2a9f>] (device_del+0xa5/0xea) from [<bf880203>] (fbtft_device_exit+0xe/0x27 [fbtft_device])
[ 8595.146870] [<bf880203>] (fbtft_device_exit+0xe/0x27 [fbtft_device]) from [<c005a665>] (sys_delete_module+0x101/0x168)
[ 8595.158182] [<c005a665>] (sys_delete_module+0x101/0x168) from [<c000c401>] (ret_fast_syscall+0x1/0x46)
[ 8595.168010] Code: f7ff fee3 f505 5580 (6047) f8d4
[ 8595.173078] ---[ end trace dc3d12f4a50909c6 ]---
Segmentation fault

@notro

This comment has been minimized.

Copy link
Owner Author

commented Dec 2, 2013

Fixed: 6395de9

@notro notro closed this Dec 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.