Last Comment Bug 777495 - Failing to allocate gralloc buffer with A8 format
: Failing to allocate gralloc buffer with A8 format
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget (show other bugs)
: unspecified
: ARM Gonk (Firefox OS)
: -- normal (vote)
: mozilla17
Assigned To: Kan-Ru Chen [:kanru] (UTC+8)
:
:
Mentors:
: 777197 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-25 13:50 PDT by Dale Harvey (:daleharvey)
Modified: 2012-07-31 13:58 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+


Attachments
Fallback to TexImage2D if unable to allocate gralloc buffer. (2.21 KB, patch)
2012-07-26 16:12 PDT, Kan-Ru Chen [:kanru] (UTC+8)
cjones.bugs: review+
Details | Diff | Splinter Review

Description Dale Harvey (:daleharvey) 2012-07-25 13:50:21 PDT
Open the UI Tests on the device, when you attempt to scroll down, gecko crashes. Relevant adb logs are:

I/IdleService( 2207): next timeout 1343249073499051 usec (1000 msec from now)
I/IdleService( 2207): SetTimerExpiryIfBefore: next timeout 1343249073499051 usec
I/IdleService( 2207): reset timer expiry from 0 usec to 1343249073509051 usec
I/IdleService( 2207): Reset idle timeout: tell observer baa838 user is back
D/memalloc( 2207): /dev/pmem: Allocated buffer base:0x49477000 size:614400 offset:614400 fd:93
D/memalloc( 2207): /dev/pmem: Allocated buffer base:0x49477000 size:532480 offset:1228800 fd:98
E/memalloc( 2207): unrecognized pixel format: 8
W/GraphicBufferAllocator( 2207): alloc(320, 396, 8, 00000133, ...) failed -22 (Invalid argument)
F/libc    ( 2207): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
I/DEBUG   ( 2205): debuggerd committing suicide to free the zombie!
I/DEBUG   ( 2293): debuggerd: Jul 25 2012 07:42:30
E/AudioHardwareMSM76XXA( 2294): failed to open AUDIO_NORMAL_FILTER /system/etc/AudioFilter.csv: No such file or directory (2).
E/AudioHardwareMSM76XXA( 2294): failed to open AUTO_VOLUME_CONTROL /system/etc/AutoVolumeControl.txt: No such file or directory (2)
E/QualcommCamera( 2294): Qint android::get_number_of_cameras(): E
I/QualcommCameraHardware( 2294): getCameraInfo: IN
I/QualcommCameraHardware( 2294): getCameraInfo: loading libqcamera at 0xb000ed10
V/QualcommCameraHardware( 2294):  Storing the current target type as 3 
I/QualcommCameraHardware( 2294): getCameraInfo: numOfCameras = 1
I/QualcommCameraHardware( 2294): Camera sensor 0 info:
I/QualcommCameraHardware( 2294): camera_id: 0
I/QualcommCameraHardware( 2294): modes_supported: 5
I/QualcommCameraHardware( 2294): position: 0
I/QualcommCameraHardware( 2294): sensor_mount_angle: 90
V/QualcommCameraHardware( 2294): getCameraInfo: dlclose(libqcamera)
I/QualcommCameraHardware( 2294): getCameraInfo: OUT
W/AudioFlinger( 2294): Thread AudioOut_1 cannot connect to the power manager service
W/AudioHardwareMSM76XXA( 2294): rpc_snd_set_device(6, 1, 1)
E/profiler( 2295): Registering start signal
I/Gonk    ( 2295): Socket open for RIL
I/VolumeManager( 2295): Connected to vold
I/VolumeManager( 2295): Volume sdcard: changing state from Init to Mounted (0 observers)
D/VoldCmdListener(  100): volume list
I/AutoMounter( 2295): UpdateState: umsAvail:1 umsEnabled:1 mode:0 usbCablePluggedIn:1 tryToShare:0
I/AutoMounter( 2295): UpdateState: Volume sdcard is Mounted and inserted
D/CALCFPS ( 2295): DEBUG_CALC_FPS: 0
Comment 1 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-07-25 13:56:05 PDT
Here's the relevant part

E/memalloc( 2207): unrecognized pixel format: 8
W/GraphicBufferAllocator( 2207): alloc(320, 396, 8, 00000133, ...) failed -22 (Invalid argument)
F/libc    ( 2207): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

If the pixel format reported there is derived from PixelFormat, then it appears we're asking for

    PIXEL_FORMAT_A_8

which is totally legit.  This is probably our accelerated masking code allocating, which uses an A8 mask.  Our YUV shaders also want to work on A8 surfaces/textures.

Any suggestions on what we should do, oh oracles? ;)
Comment 2 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-07-25 14:24:11 PDT
So we need to stick to the HAL pixel formats.

There are really two bugs here
 - we crash when we don't get A8, instead of falling back on sysmem+upload
 - we're not able to gralloc with A8

Definitely need to fix the first issue first.  If we're frequently regenerating masks for mask layers, we're just going to completely lose anyway, the optimization fails.  So sysmem+upload shouldn't be so bad.

We'll probably need some GL wizardry to allocate a non-A8 gralloc buffer and use it the right way in our shaders.
Comment 3 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-07-25 17:44:42 PDT
*** Bug 777197 has been marked as a duplicate of this bug. ***
Comment 4 Tony Chung [:tchung] 2012-07-25 18:12:16 PDT
noming for basecamp blocking.   bug 777197 is affected.
Comment 5 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-07-25 18:53:00 PDT
Kan-Ru are you taking this?
Comment 6 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-07-25 18:53:20 PDT
Re: comment 2, let's fix the fallback path first.
Comment 7 Kan-Ru Chen [:kanru] (UTC+8) 2012-07-26 16:12:19 PDT
Created attachment 646399 [details] [diff] [review]
Fallback to TexImage2D if unable to allocate gralloc buffer.

It turns out we already have fallback path but just not been used.
Comment 8 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-07-26 17:38:27 PDT
Comment on attachment 646399 [details] [diff] [review]
Fallback to TexImage2D if unable to allocate gralloc buffer.

This fixes the crash.

It took me a while to understand *why* it fixes the crash, but I understand now :).  Nice fix.
Comment 9 Kan-Ru Chen [:kanru] (UTC+8) 2012-07-26 17:48:12 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/4bfa8a24fe41

Note You need to log in before you can comment on or make changes to this bug.