gralloc: Out of Memory using VFB

452 views
Skip to first unread message

onaips

unread,
Sep 5, 2010, 4:56:44 PM9/5/10
to android-porting
Hi, i compiled android kernel with virtual framebuffer support and
msm_fb disabled, so i can access the framebuffer only using a
framebuffer viewer (for example a VNC server).

However if i use a high resolution (800x600) gralloc returns me an Out
of Memory error...
If i use 320x480 its working fine.

Is there any constant limit i should raise?

Thanks
José Pereira


(logcat)
W/SurfaceFlinger( 124): mBuffers[0] is null (mWidth=480, mHeight=775)
E/gralloc ( 124): gralloc failed err=Out of memory
D/Sensors ( 124): sensors=00000000, real=00000000
W/ ( 124): alloc(480, 775, 1, 00000133, ...) failed -12 (Out
of memory)
D/ ( 124): Allocated buffers:
D/ ( 124): 0xed4d8: 32.70 KiB | 91 x 92 | 1 |
0x00000133
D/ ( 124): 0x12e388: 750.00 KiB | 480 x 800 | 4 |
0x00000130
D/ ( 124): 0x2095f8: 931.25 KiB | 320 x 745 | 1 |
0x00000133
D/ ( 124): 0x214c58: 46.88 KiB | 480 x 25 | 1 |
0x00000133
D/ ( 124): 0x276868: 0.94 KiB | 12 x 20 | 1 |
0x00000133
D/ ( 124): 0x280800: 750.00 KiB | 480 x 800 | 4 |
0x00000133
D/ ( 124): 0x29b6e8: 1453.12 KiB | 480 x 775 | 1 |
0x00000133
D/ ( 124): 0x2a4a18: 931.25 KiB | 320 x 745 | 1 |
0x00000133
D/ ( 124): 0x2d5628: 28.44 KiB | 91 x 80 | 1 |
0x00000133
D/ ( 124): 0x2d7a30: 1453.12 KiB | 480 x 775 | 1 |
0x00000133
D/ ( 124): 0x2fdb28: 46.88 KiB | 480 x 25 | 1 |
0x00000133
D/ ( 124): 0x3032e0: 750.00 KiB | 480 x 800 | 4 |
0x00000133
D/ ( 124): 0x35fcd8: 750.00 KiB | 480 x 800 | 4 |
0x00000133
D/ ( 124): Total allocated: 7924.58 KB
E/SurfaceFlinger( 124): Layer::requestBuffer(this=0xea950), index=0,
w=480, h=775 failed (Out of memory)
E/Surface ( 124): Surface (identity=2) requestBuffer(0, 00000033)
returneda buffer with a null handle
E/Surface ( 124): getBufferLocked(0, 00000033) failed (Out of memory)
E/Surface ( 124): dequeueBuffer failed (Out of memory)
E/ViewRoot( 124): OutOfResourcesException locking surface

Tung Dang

unread,
Sep 5, 2010, 11:47:45 PM9/5/10
to ona...@gmail.com, android-porting
Hi onaips,

I run your VNC server with VFB and the screen resolution is 800x520 is ok
Can u try with this resolution ?

logcat:

W/gralloc ( 1960): page flipping not supported (yres_virtual=520, requested=1040)
I/gralloc ( 1960): using (fd=22)
I/gralloc ( 1960): id           = Virtual FB
I/gralloc ( 1960): xres         = 800 px
I/gralloc ( 1960): yres         = 520 px
I/gralloc ( 1960): xres_virtual = 800 px
I/gralloc ( 1960): yres_virtual = 520 px
I/gralloc ( 1960): bpp          = 16
I/gralloc ( 1960): r            = 11:5
I/gralloc ( 1960): g            =  5:6
I/gralloc ( 1960): b            =  0:5
I/gralloc ( 1960): width        = 127 mm (160.000000 dpi)
I/gralloc ( 1960): height       = 83 mm (159.132523 dpi)
I/gralloc ( 1960): refresh rate = 27.20 Hz

Btw, try to run kernel with a generic build of system.img , dont use the HAL layer of msm

Cheers.
Tung


onaips

unread,
Sep 6, 2010, 9:01:07 AM9/6/10
to android-porting
Hi Tung, thanks for your answer,

You were right, i was using the msm7k gralloc and it was allocation
the memory on GPU, i simply changed the name of /system/libs/hw/
gralloc.msm7k.so lib to force HAL to search for the
gralloc.default.so, and now i can use any resolution.

Now i have another issue, the colors of the screen aren't right. I've
been looking in ./libhardware/modules/gralloc/framebuffer.cpp, and i
see i don't need to set colour information on VFB because it is set on
"int mapFrameBufferLocked(struct private_module_t* module)"

Something like:

/*
* Explicitly request 5/6/5
*/
info.bits_per_pixel = 16;
info.red.offset = 11;
info.red.length = 5;
info.green.offset = 5;
info.green.length = 6;
info.blue.offset = 0;
info.blue.length = 5;
info.transp.offset = 0;
info.transp.length = 0;

However using the VNC server (i'm guessing it isnt a VNC issue) the
colors are wrong... I've attached a pic so you can see what's wrong...

http://zeluispereira.no.sapo.pt/vfb.png

I/gralloc ( 123): using (fd=25)
I/gralloc ( 123): id = Virtual FB
I/gralloc ( 123): xres = 1024 px
I/gralloc ( 123): yres = 768 px
I/gralloc ( 123): xres_virtual = 1024 px
I/gralloc ( 123): yres_virtual = 1536 px
I/gralloc ( 123): bpp = 16
I/gralloc ( 123): r = 0:5
I/gralloc ( 123): g = 5:6
I/gralloc ( 123): b = 11:5
I/gralloc ( 123): width = 163 mm (159.568100 dpi)
I/gralloc ( 123): height = 122 mm (159.895081 dpi)
I/gralloc ( 123): refresh rate = 25.43 Hz

Thanks
> > --> unsubscribe:android-porti...@googlegroups.com<android-porting%2Bunsubscribe@ googlegroups.com>
> > website:http://groups.google.com/group/android-porting

Tung Dang

unread,
Sep 7, 2010, 3:05:52 AM9/7/10
to ona...@gmail.com, android-porting
Hi Onaip,

The color mapping between red and blue is swaped.
U edit your vfb.c to change the color offset for red and blue (in vfb_check_var, setting for RGB 565)

Cheers,
Tung


José Luis Pereira

unread,
Sep 30, 2010, 12:50:33 PM9/30/10
to Tung Dang, android-porting
I have some one question, i'd be glad if someone could answer this.

I know that Android doesnt support multiple framebuffer, but is it possible to support 2 displays, one active at a time, dynamically changing? Do i have to change the core of OS?

Thanks

Evan Wilson

unread,
Oct 3, 2014, 3:24:46 PM10/3/14
to android...@googlegroups.com, ona...@gmail.com
Hi, I am attempting to do something similar on a new board. How did you change the the video mode for VFB?
I have tried modifying the vfb_default screen info in vfb.c, and I use the boot param video=vfb: and the fb always comes up in 640x400 mode. I tried setting params on boot (for example: video=vfb:320x240-24@60), but still nothing changes the mode.
Reply all
Reply to author
Forward
0 new messages