Closed rsglobal closed 1 year ago
After some investigation, I've found that call to EGLConfigChooser::chooseConfig at GLSurfaceView.java:1054 returns null instead of valid config. GdxEglConfigChooser from libgdx is used as an implementation for config chooser for Pixel Wheels.
Seems like libgdx expects there to be config which would support RGB565 for a fallback option while trying to find better one. For Orange Pi 3 it fails, since for some reason there is no exact match for desired config, neither available RGB565 config, so it returns null and causes further errors for context creation.
Replacing GdxEglConfigChooser with default SimpleEGLConfigChooser by simply removing implementation of setEGLConfigChooser kinda fixes the issue, SimpleEGLConfigChooser picks first available config and game launches properly, I don't observe any issues, but it couldn't be used as a proper solution to this issue, of course.
Unfortunately, I wasn't able to check which config libgdx expects in best case, since it's third-party library that comes outside of AOSP, so I think it's better to further investigate onto why there's no EGL config for RGB565 and if it's possible to add such config in one way or another.
As for now, first call to eglChooseConfig returns 8 configs, each of them has red, green and blue components size equals 8.
Thanks for digging into it. Just by grepping mesa3d sources I can find presence of RGB565 in lima formats, which should be exposed via EGL configs. Can you share list of those 8 configs?
Based on logs from mesa, droid_add_configs_for_visuals
fails to create configs for HAL_PIXEL_FORMAT_RGB_565
and HAL_PIXEL_FORMAT_BGRA_8888
, though latter, as explained in the comment below, is created only if there's no other rgba format available. Configs for HAL_PIXEL_FORMAT_RGBA_8888
and HAL_PIXEL_FORMAT_RGBX_8888
is created successfully.
Seems like dri2_add_config
fails to create config for HAL_PIXEL_FORMAT_RGB_565
because of rgba_shifts mismatch, for this format it expects shifts to be { 11, 5, 0, -1 }
, but it reads only { 0, 8, 16, -1 }
or { 16, 8, 0, -1 }
. I haven't found yet how does those shifts are filled and why there's no correct shift.
@rsglobal
Thanks for digging into it. Just by grepping mesa3d sources I can find presence of RGB565 in lima formats, which should be exposed via EGL configs. Can you share list of those 8 configs?
Here's my debug logs with rgba, depth and stencil components printed:
##> [ComponentSizeChooser::chooseConfig]: choosing between 8 configs
##> [chooseConfig]: configs[0]:
##> depth size = 24
##> stencil size = 0
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 0
##> [chooseConfig]: configs[1]:
##> depth size = 24
##> stencil size = 8
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 0
##> [chooseConfig]: configs[2]:
##> depth size = 24
##> stencil size = 0
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 0
##> [chooseConfig]: configs[3]:
##> depth size = 24
##> stencil size = 8
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 0
##> [chooseConfig]: configs[4]:
##> depth size = 24
##> stencil size = 0
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 8
##> [chooseConfig]: configs[5]:
##> depth size = 24
##> stencil size = 8
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 8
##> [chooseConfig]: configs[6]:
##> depth size = 24
##> stencil size = 0
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 8
##> [chooseConfig]: configs[7]:
##> depth size = 24
##> stencil size = 8
##> red size = 8
##> green size = 8
##> blue size = 8
##> alpha size = 8
Sorry for not printing exact pixel formats, I'll check which formats exactly are available now via EGL configs.
HAL_PIXEL_FORMAT_RGB_565 added successfully on lima, HAL_PIXEL_FORMAT_BGRA_8888 is skipped due to https://gitlab.freedesktop.org/mesa/mesa/-/blob/faaba0d6afe0c5f6985345c7c6226435658d196a/src/egl/drivers/dri2/platform_android.c#L1240
Even with both formats pixelwheels still fail.
@roman-kovalivskyi , unassigned due to long inactivity. Please re-assign if you are still working on it.
The game works on recent builds for some reason.
pixelwheels works on rpi4, but doesn't work on opi3, pinephone.
logcat crash:
Crashed at: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/com_google_android_gles_jni_EGLImpl.cpp;l=223;drc=master