[Gta04-owner] Fighting DRM

Josua Mayer josua.mayer97 at gmail.com
Sun Jun 24 14:58:15 CEST 2018


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