[Gta04-owner] Fighting DRM
Josua Mayer
josua.mayer97 at gmail.com
Sun Jun 24 17:42:47 CEST 2018
By updating drm_hwcomposer to the last version that did *not* use the
Composer API version 2, thus requiring an update at least to
libhardware, and by cherry-picking two commits I have gotten rid of the
error message about not getting the connector.
Turns out that a really small, and hidden change made the difference:
drm_hwcomposer was siltering all connectors by their type for internal
or external. This worked by listing specific types as internal, and all
others are regarded external.
Because the connector is of type uknown for omapdss->dispc, it was
skipped by drm_hwcomposer.
But after solving this problem, yet another one appears.
First, a promising log:
06-24 15:18:01.580 1953 1953 D libEGL : Emulator without GPU support
detected. Fallback to software renderer.
06-24 15:18:01.587 1953 1953 D libEGL : loaded
/system/lib/egl/libGLES_android.so
06-24 15:18:01.779 1953 1953 E gralloc : failed to put fb info
06-24 15:18:01.779 1953 1953 W gralloc : page flipping not supported
(yres_virtual=640, requested=1280)
06-24 15:18:01.779 1953 1953 I gralloc : using (fd=12)
06-24 15:18:01.779 1953 1953 I gralloc : id = omapdrm
06-24 15:18:01.779 1953 1953 I gralloc : xres = 480 px
06-24 15:18:01.779 1953 1953 I gralloc : yres = 640 px
06-24 15:18:01.779 1953 1953 I gralloc : r = 16:8
06-24 15:18:01.779 1953 1953 I gralloc : g = 8:8
06-24 15:18:01.779 1953 1953 I gralloc : b = 0:8
06-24 15:18:01.779 1953 1953 I gralloc : width = 76 mm
(160.421051 dpi)
06-24 15:18:01.779 1953 1953 I gralloc : height = 102 mm
(159.372543 dpi)
06-24 15:18:01.779 1953 1953 I gralloc : refresh rate = 60.00 Hz
06-24 15:18:01.788 1953 1953 E hwc-drm-plane: Could not get rotation
property
06-24 15:18:01.789 1953 1953 I hwc-drm-plane: Could not get alpha property
06-24 15:18:01.791 1953 1953 E hwc-drm-plane: Could not get rotation
property
06-24 15:18:01.791 1953 1953 I hwc-drm-plane: Could not get alpha property
06-24 15:18:01.793 1953 1953 E hwc-drm-plane: Could not get rotation
property
06-24 15:18:01.793 1953 1953 I hwc-drm-plane: Could not get alpha property
06-24 15:18:01.796 1953 1953 F libc : Fatal signal 11 (SIGSEGV),
code 1, fault addr 0xc in tid 1953 (surfaceflinger)
06-24 15:18:01.799 1953 1987 E cutils-trace: Error opening trace file:
Permission denied (13)
06-24 15:18:01.799 1953 1987 W hwc-gl-worker:
EGL_ANDROID_native_fence_sync extension not supported
06-24 15:18:01.800 1953 1987 E libEGL : eglMakeCurrent:813 error 3009
(EGL_BAD_MATCH)
06-24 15:18:01.800 1953 1987 E hwc-gl-worker: Failed to make the
OpenGL ES Context current: EGL_BAD_MATCH
06-24 15:18:01.800 1953 1987 E hwc-drm-display-compositor: Failed to
initialize OpenGL compositor 1
06-24 15:18:01.800 1953 1987 E hwc-drm-compositor-worker: Failed to
composite! 1
06-24 15:18:01.898 1550 1550 F DEBUG : *** *** *** *** *** *** ***
*** *** *** *** *** *** *** *** ***
06-24 15:18:01.899 1550 1550 F DEBUG : Replicant Version:
'replicant-6.0'
06-24 15:18:01.899 1550 1550 F DEBUG : Build fingerprint:
'replicant_gta04:6.0.1/MOI10E/eng.root.20180623.123530:eng/debug,test-keys'
06-24 15:18:01.899 1550 1550 F DEBUG : Revision: '0'
06-24 15:18:01.899 1550 1550 F DEBUG : ABI: 'arm'
06-24 15:18:01.899 1550 1550 F DEBUG : pid: 1953, tid: 1953, name:
surfaceflinger >>> /system/bin/surfaceflinger <<<
06-24 15:18:01.899 1550 1550 F DEBUG : signal 11 (SIGSEGV), code 1
(SEGV_MAPERR), fault addr 0xc
06-24 15:18:01.905 1550 1550 F DEBUG : r0 b6648518 r1 bec49810
r2 00000000 r3 b6b060a8
06-24 15:18:01.905 1550 1550 F DEBUG : r4 b6648518 r5 b6b0e268
r6 b6648200 r7 bec49810
06-24 15:18:01.905 1550 1550 F DEBUG : r8 b6648210 r9 bec49810
sl bec4980c fp 00000000
06-24 15:18:01.905 1550 1550 F DEBUG : ip b6314984 sp bec497d8
lr b62ff66b pc b63046f0 cpsr 60070030
06-24 15:18:01.937 1550 1550 F DEBUG :
06-24 15:18:01.937 1550 1550 F DEBUG : backtrace:
06-24 15:18:01.937 1550 1550 F DEBUG : #00 pc 000166f0
/system/lib/hw/hwcomposer.drm.so
(_ZN7android20DrmDisplayCompositor16QueueCompositionENSt3__110unique_ptrINS_21DrmDisplayCompositionENS1_14default_deleteIS3_EEEE+7)
06-24 15:18:01.937 1550 1550 F DEBUG : #01 pc 00011667
/system/lib/hw/hwcomposer.drm.so
(_ZN7android13DrmCompositor16QueueCompositionENSt3__110unique_ptrINS_14DrmCompositionENS1_14default_deleteIS3_EEEE+114)
06-24 15:18:01.937 1550 1550 F DEBUG : #02 pc 0001089b
/system/lib/hw/hwcomposer.drm.so
(_ZN7android12DrmResources20SetDisplayActiveModeEiRKNS_7DrmModeE+110)
06-24 15:18:01.937 1550 1550 F DEBUG : #03 pc 0001b161
/system/lib/hw/hwcomposer.drm.so
(_ZN7androidL21hwc_set_active_configEP21hwc_composer_device_1ii+276)
06-24 15:18:01.938 1550 1550 F DEBUG : #04 pc 0001c303
/system/lib/hw/hwcomposer.drm.so
(_ZN7androidL15hwc_device_openEPK11hw_module_tPKcPP11hw_device_t+366)
06-24 15:18:01.938 1550 1550 F DEBUG : #05 pc 00027941
/system/lib/libsurfaceflinger.so
(_ZN7android10HWComposer13loadHwcModuleEv+64)
06-24 15:18:01.938 1550 1550 F DEBUG : #06 pc 0002763d
/system/lib/libsurfaceflinger.so
(_ZN7android10HWComposerC1ERKNS_2spINS_14SurfaceFlingerEEERNS0_12EventHandlerE+228)
06-24 15:18:01.938 1550 1550 F DEBUG : #07 pc 0001bc29
/system/lib/libsurfaceflinger.so (_ZN7android14SurfaceFlinger4initEv+208)
06-24 15:18:01.938 1550 1550 F DEBUG : #08 pc 00000ed5
/system/bin/surfaceflinger
06-24 15:18:01.938 1550 1550 F DEBUG : #09 pc 000173d9
/system/lib/libc.so (__libc_init+44)
06-24 15:18:01.938 1550 1550 F DEBUG : #10 pc 00000d90
/system/bin/surfaceflinger
So now we arrived at the core of drm_hwcompositor. It wants to use
OpenGL, and can't!
I do not believe investigating this any further is useful, read this
patch description:
https://patchwork.kernel.org/patch/10381461/
"... was only ever well tested on closed stacks. It also only supports
GLES3.x ..."
I don't know what is required to have maybe llvmpipe based OpenGL
available. If it is easy to get, we can try enabling this feature.
In the meantime we should fall back to the framebuffer based default.
For reference: I picked drm_hwcomposer commit
9a15678ca61c9707ff7b3955225d65ddd2fa031a,
and cherry-picked:
commit 2bb1ec63b8e460f2e559241c37e43c8da585e08a (HEAD ->
replicant-6.0-gta04)
Author: Robert Foss <robert.foss at collabora.com>
Date: Wed Nov 1 12:50:04 2017 -0500
drm_hwcomposer: Add HDMI connector as a valid type
Accept DRM_MODE_CONNECTOR_HDMIA connector type.
Look for primary DrmConnector amongst external connectors
after looking for primary amongst internal ones first.
Signed-off-by: Robert Foss <robert.foss at collabora.com>
Signed-off-by: Rob Herring <robh at kernel.org>
commit dc2326fefa128f37ac64d76361eaa7d25bde36be
Author: Rob Herring <robh at kernel.org>
Date: Wed Nov 1 11:21:48 2017 -0500
drm_hwcomposer: correct handling of DRM_MODE_ROTATE_0
If the rotation property is supported for a plane, then the rotation
value must be non-zero. For the case of 0 degree rotation,
DRM_MODE_ROTATE_0 needs to be set.
Signed-off-by: Rob Herring <robh at kernel.org>
commit a68d9dab1ad89fdc12a4977a5f4bc4fcc2abe118
Author: Rob Herring <robh at kernel.org>
Date: Fri Oct 6 16:46:48 2017 -0500
drm_hwcomposer: use upstream DRM_MODE_{ROTATE, REFLECT} defines
The DRM_REFLECT_* and DRM_ROTATE_* defines were not upstream, but now
they are. Convert to using the upstream version which are defined as a
bit mask rather than a bit position.
Signed-off-by: Rob Herring <robh at kernel.org>
Reviewed-by: Robert Foss <robert.foss at collabora.com>
Am 24.06.2018 um 14:58 schrieb Josua Mayer:
> I have found that the problem is (luckily) not in the kernel. The
> modeprint test application inside libdrm lists a connector for each
> display, on both replicant and debian:
> Starting test
> Resources
>
> count_connectors : 2
> count_encoders : 2
> count_crtcs : 2
> count_fbs : 0
>
> Connector: 17-1
> id : 30
> encoder id : 29
> conn : connected
> size : 0x0 (mm)
> count_modes : 1
> count_props : 4
> props : 1 2 5 6
> count_encoders : 1
> encoders : 29
> Mode: "480x640" 480x640 66
> Connector: SVIDEO-1
> id : 35
> encoder id : 0
> conn : unknown
> size : 0x0 (mm)
> count_modes : 1
> count_props : 4
> props : 1 2 5 6
> count_encoders : 1
> encoders : 34
> Mode: "720x574i" 720x574 50
> ...
>
>
> This output comes fomr a statically linked version of that test-case,
> meaning it does *not* match the version of libdrm used by replicant.
> So maybe that one is too old? The latest commit in external/libdrm is
> from September 2015. I will try updating that component.
>
>
> Am 23.06.2018 um 23:45 schrieb Josua Mayer:
>> Greetings once again,
>>
>> I have made some progress with drm_hwcomposer and finally debugged a
>> crazy crash in surfaceflinger. The crash is related to a DRM connector
>> that probably does not exist in kernel for the main display of the gta04.
>>
>> So lets start with a log, and some inline comments:
>> 01-01 09:11:24.354 2122 2122 I SurfaceFlinger: SurfaceFlinger is starting
>> 01-01 09:11:24.359 2122 2122 I SurfaceFlinger: SurfaceFlinger's main
>> thread ready to run. Initializing graphics H/W...
>> 01-01 09:11:24.379 2122 2122 D libEGL : Emulator without GPU support
>> detected. Fallback to software renderer.
>> 01-01 09:11:24.449 2122 2122 D libEGL : loaded
>> /system/lib/egl/libGLES_android.so
>> 01-01 09:11:24.680 2122 2122 E gralloc : failed to put fb info
>> This is harmless, gralloc tried to set the framebuffer to 480x1280 to
>> allow for flipping, and failed.
>>
>> 01-01 09:11:24.682 2122 2122 W gralloc : page flipping not supported
>> (yres_virtual=640, requested=1280)
>> 01-01 09:11:24.683 2122 2122 I gralloc : using (fd=12)
>> 01-01 09:11:24.683 2122 2122 I gralloc : id = omapdrm
>> 01-01 09:11:24.683 2122 2122 I gralloc : xres = 480 px
>> 01-01 09:11:24.683 2122 2122 I gralloc : yres = 640 px
>> 01-01 09:11:24.683 2122 2122 I gralloc : xres_virtual = 480 px
>> 01-01 09:11:24.683 2122 2122 I gralloc : yres_virtual = 640 px
>> 01-01 09:11:24.683 2122 2122 I gralloc : bpp = 32
>> 01-01 09:11:24.683 2122 2122 I gralloc : r = 16:8
>> 01-01 09:11:24.683 2122 2122 I gralloc : g = 8:8
>> 01-01 09:11:24.683 2122 2122 I gralloc : b = 0:8
>> 01-01 09:11:24.683 2122 2122 I gralloc : width = 76 mm
>> (160.421051 dpi)
>> 01-01 09:11:24.683 2122 2122 I gralloc : height = 102 mm
>> (159.372543 dpi)
>> 01-01 09:11:24.683 2122 2122 I gralloc : refresh rate = 60.00 Hz
>> 01-01 09:11:24.899 2122 2122 E hwc-drm-plane: Could not get rotation
>> property
>> 01-01 09:11:24.910 2122 2122 I hwc-drm-plane: Could not get alpha property
>> 01-01 09:11:25.021 2122 2122 E hwc-drm-plane: Could not get rotation
>> property
>> 01-01 09:11:25.030 2122 2122 I hwc-drm-plane: Could not get alpha property
>> 01-01 09:11:25.152 2122 2122 E hwc-drm-plane: Could not get rotation
>> property
>> 01-01 09:11:25.160 2122 2122 I hwc-drm-plane: Could not get alpha property
>> these are harmless too, no rotation or alpha are assumed.
>>
>> 01-01 09:11:25.207 2122 2140 E cutils-trace: Error opening trace file:
>> Permission denied (13)
>> 01-01 09:11:25.207 2122 2140 W hwc-gl-worker:
>> EGL_ANDROID_native_fence_sync extension not supported
>> 01-01 09:11:25.207 2122 2140 E libEGL : eglMakeCurrent:813 error 3009
>> (EGL_BAD_MATCH)
>> 01-01 09:11:25.207 2122 2140 E hwc-gl-worker: Failed to make the
>> OpenGL ES Context current: EGL_BAD_MATCH
>> 01-01 09:11:25.207 2122 2140 E hwc-drm-display-compositor: Failed to
>> initialize OpenGL compositor 1
>> 01-01 09:11:25.207 2122 2140 E hwc-drm-compositor-worker: Failed to
>> composite! 1
>> 01-01 09:11:25.212 2122 2142 W hwc-gl-worker:
>> EGL_ANDROID_native_fence_sync extension not supported
>> 01-01 09:11:25.212 2122 2142 E libEGL : eglMakeCurrent:813 error 3009
>> (EGL_BAD_MATCH)
>> 01-01 09:11:25.212 2122 2142 E hwc-gl-worker: Failed to make the
>> OpenGL ES Context current: EGL_BAD_MATCH
>> 01-01 09:11:25.212 2122 2142 E hwc-drm-display-compositor: Failed to
>> initialize OpenGL compositor 1
>> 01-01 09:11:25.212 2122 2142 E hwc-drm-compositor-worker: Failed to
>> composite! 1
>> 01-01 09:11:25.214 2122 2122 I SurfaceFlinger: Using composer version 1.4
>> 01-01 09:11:25.215 2122 2122 E hwcomposer-drm: Failed to get connector
>> for display 0
>> Does this hint at a problem?
>>
>> 01-01 09:11:25.216 2122 2122 E SurfaceFlinger: queryDisplayProperties:
>> Invalid display config! -1
>> This may be another one
>>
>> 01-01 09:11:25.219 2122 2122 W SurfaceFlinger: no suitable EGLConfig
>> found, trying a simpler query
>> 01-01 09:11:25.229 2122 2122 W SurfaceFlinger: EGL_SLOW_CONFIG selected!
>> 01-01 09:11:25.239 2122 2122 I SurfaceFlinger: EGL information:
>> 01-01 09:11:25.239 2122 2122 I SurfaceFlinger: vendor : Android
>> 01-01 09:11:25.240 2122 2122 I SurfaceFlinger: version : 1.4 Android
>> META-EGL
>> 01-01 09:11:25.240 2122 2122 I SurfaceFlinger: extensions:
>> EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time
>> EGL_KHR_swap_buffers_with_damage EGL_KHR_image_base EGL_KHR_fence_sync
>> EGL_ANDROID_image_native_buffer
>> 01-01 09:11:25.249 2122 2122 I SurfaceFlinger: Client API: OpenGL_ES
>> 01-01 09:11:25.249 2122 2122 I SurfaceFlinger: EGLSurface: 8-8-8-8,
>> config=0x4
>> 01-01 09:11:25.252 2122 2122 I SurfaceFlinger: OpenGL ES informations:
>> 01-01 09:11:25.252 2122 2122 I SurfaceFlinger: vendor : Android
>> 01-01 09:11:25.253 2122 2122 I SurfaceFlinger: renderer : Android
>> PixelFlinger 1.4
>> 01-01 09:11:25.253 2122 2122 I SurfaceFlinger: version : OpenGL
>> ES-CM 1.0
>> 01-01 09:11:25.254 2122 2122 I SurfaceFlinger: extensions:
>> GL_EXT_debug_marker GL_OES_byte_coordinates GL_OES_fixed_point
>> GL_OES_single_precision GL_OES_read_format
>> GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_matrix_get
>> GL_OES_query_matrix GL_OES_EGL_image GL_OES_EGL_sync
>> GL_OES_compressed_ETC1_RGB8_texture GL_ARB_texture_compression
>> GL_ARB_texture_non_power_of_two GL_ANDROID_user_clip_plane
>> GL_ANDROID_vertex_buffer_object GL_ANDROID_generate_mipmap
>> 01-01 09:11:25.254 2122 2122 I SurfaceFlinger: GL_MAX_TEXTURE_SIZE = 4096
>> 01-01 09:11:25.254 2122 2122 I SurfaceFlinger: GL_MAX_VIEWPORT_DIMS = 4096
>> 01-01 09:11:25.255 2122 2122 I SurfaceFlinger: Going to initialize
>> connected, and primary displays.
>> 01-01 09:11:25.255 2122 2122 I SurfaceFlinger: Initializing connected
>> or primary display 0.
>> I inserted these two log messages in SurfaceFlinger.cpp:init(), and then
>> many markers (redacted in this log)
>> 01-01 09:11:25.268 2122 2122 I SurfaceFlinger: MARKER 202
>> And this is the last thing that happens before the crash. This marker is
>> in HWComposer.cpp: getWidth(). The only thing that can go wrong here is
>> accessing a pointer at index currentConfig, which is initialized to 0,
>> and it does :(
>> The call stack as follows:
>> SurfaceFlinger.cpp: new FramebufferSurface(*mHwc, i, consumer);
>> FramebufferSurface.cpp:
>> mConsumer->setDefaultBufferSize(mHwc.getWidth(disp), mHwc.getHeight(disp));
>> HWComposer.cpp: return mDisplayData[disp].configs[currentConfig].width;
>>
>> 01-01 09:11:25.275 2122 2122 F libc : Fatal signal 11 (SIGSEGV),
>> code 1, fault addr 0x0 in tid 2122 (surfaceflinger)
>>
>>
>> So HWComposer assumes that mDisplayData[disp].configs exists and has at
>> least 1 entry. But for some reason, in this very case it is a
>> null-pointer. How can this be? The list of configurations is filled in
>> HWComposer.cpp: queryDisplayProperties.
>> We have already received a hint that something might have gone wrong,
>> however there is still a chance to find a configuration now by asking
>> the drm_hwcomposer with a call to mHwc->getDisplayAttributes. This call
>> is done in a for loop, but *only* if we get past a call to
>> mHwc->getDisplayConfigs.
>> This one translates to hwc_get_display_configs in drm_hwcomposer>
>> hwcomposer.cpp.
>> And there we find a familiar message in the code:
>> ALOGE("Failed to get connector for display %d", display);
>>
>> So, we found the culprit! For some reason
>> ctx->drm.GetConnectorForDisplay(display) has failed.
>> Why? Well, I'd think the answer is in the DRM subsystem of the kernel. I
>> did a little googling, but couldn't come to any conclusions.
>> The only related thing I noticed is that every connector has a type, but
>> it is Unknown for dispc displays in omapdss.
>> However I was not able to confirm if that would prevent it from being
>> returned as a connector.
>> Or maybe there just is no such thing called a connector in this setup?
>>
>> Anyhow this is where I can't continue.
>>
>> Nikolaus, you hinted that some xorg drivers have problems too. With a
>> little luck the modesetting driver is one of those, and just maybe it
>> suffers from teh same issue? I think this is worth investigating at some
>> point.
>> I will now see if I can hack the hwcomposer library to grab display
>> properties from the framebuffer device instead. There is already code to
>> do that, but ggated by an if-clause to prefer calls to drm_hwcomposer.
>>
>> br
>> Josua Mayer
>>
More information about the Gta04-owner
mailing list