robherring / gbm_gralloc Goto Github PK
View Code? Open in Web Editor NEWAndroid gralloc module using libgbm API from Mesa
Android gralloc module using libgbm API from Mesa
Hello,
This one is really tricky for my limited hobbyst knowledge,
I'm opening in order to triage, as this is the last issue preventing the use of gbm_gralloc as default gralloc in android-x86 with Android R - NOTE: Android R requires hwbinder [email protected] and gbm_gralloc needs to become the default gralloc
I'm opening a ticket for a problem happening only with gbm_gralloc and logged on r600 (AMD TURKS)
but it is happening also with radeonsi and nouveau.
As a comparison the problem does not happen with minigbm with the same GPUs and mesa version
0x76d2d8fe6ba0: 9328.00 KiB | 2006 (2048) x 1166 | 1 | 1 | 0x933 | android/com.android.internal.app.ResolverActivity#0
0x76d2d8fe8d10: 9328.00 KiB | 2006 (2048) x 1166 | 1 | 1 | 0x933 | android/com.android.internal.app.ResolverActivity#0
0x76d2d8fea250: 9328.00 KiB | 2006 (2048) x 1166 | 1 | 1 | 0x933 | android/com.android.internal.app.ResolverActivity#0
0x933 flags correspond to
GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN
Android R android-11.0.0_r17 mesa 21.0.1
I'm adding logs in the attachments: tombstone
, addr2line
, modetest
and dumpsys SurfaceFlinger
tombstone_00_gbm_gralloc_glitch.txt
addr2line_gbm_gralloc_glitch.txt
modetest_gbm_gralloc_glitch.txt
dumpsys_gbm_gralloc_glitch.txt
Chicken Invaders 3 is also affected as explained below, there is a top pane that should show Ads
Dispite this project is old, the philosophy that was implemented here makes it attractable to use in modern Android.
But there are several issues that can't be fixes by few lines of code, which forced me to search for alternatives:
From the other hand minigbm is constantly maintained by Chromium OS guys, all moderns APIs available, but it has different philosophy which require copy part of mesa3d and paste inside minigbm to make it work. Any new device require this copy-paste-test iterations.
Here is my second attempt to port gbm_gralloc as minigbm backend: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3024265 (first was DRI DSO-based)
At this moment it successfully tested with sun4i_drm + lima, v3d+vc4, sun4i_drm+panfrost.
does this require the AOSP source code in order to be compiled? or can this be built using the NDK and SDK
Just noticed a potential error in gbm_mod_free_gpu0
I suggested that we should use native_handle_delete rather than delete handle.
Because handle is allocated by malloc rather than "new"
static int gbm_mod_free_gpu0(alloc_device_t *dev, buffer_handle_t handle)
{
struct gbm_module_t *dmod = (struct gbm_module_t *) dev->common.module;
pthread_mutex_lock(&dmod->mutex);
gbm_free(handle);
native_handle_close(handle);
//delete handle;
native_handle_delete(handle);
On Android R (android-11.0.0_r35) with mesa-21.1.0, gbm_gralloc and drm_hwcomposer, opening the webcam in a WebView (Chrome/89) crashes the app at this line: https://github.com/robherring/gbm_gralloc/blob/master/gralloc_gbm.cpp#L386
The format requested is HAL_PIXEL_FORMAT_YCbCr_420_888
(35), which is not supported by gralloc_gbm_get_bpp
. It returns 0 and leads to SIGFPE.
hi,Herring:
when close the gralloc by gbm_mod_close_gpu0 function, do not need to clean up the gbm_bo_handle_map ?
gralloc_gbm_get_bpp() can return 0 for unsupported HAL pixel formats and this is causing segfaults with Android CTS 13 dEQP-EGL test runs due to division by zero
Checking bpp value before proceeding in gralloc_gbm_get_bpp() routines fixes the following segfaults observed with HAL Pixel Formats 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x38
Hi @rsglobal
After testing the build of gbm_gralloc starting from Android 9 to Android 12
I found that Android 10 is the only version affected by the following building error:
FAILED:
build/make/core/base_rules.mk:526: error: overriding commands for target `out/target/product/x86_64/system/vendor/etc/vintf/manifest/gbm_gralloc_manifest.xml', previously defined at build/make/core/base_rules.mk:526
20:37:32 ckati failed with: exit status 1
#### failed to build some targets (02:00 (mm:ss)) ####
As a proposal, is it acceptable for everyone to use LOCAL_VINTF_FRAGMENTS := gbm_gralloc_manifest.xml
for Android 11 and later?
Hello,
gbm_gralloc is the only gralloc0 implementation not passing gralloc_order test,
the test case is described in the comment
gralloctest.c has not changed much, here is a recent version
@line 394
/*
* Duplicate the buffer handle to simulate an additional reference
* in same process.
*/
native_handle_t *native_handle = duplicate_buffer_handle(info.handle);
duplicate.handle = native_handle;
CHECK(unregister_buffer(ctx->module, &duplicate) == 0);
CHECK(register_buffer(ctx->module, &duplicate)); /* @line 402 here is the CHECK that is failing only with gbm_gralloc */
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.