sony / flutter-embedded-linux

Embedded Linux embedding for Flutter
BSD 3-Clause "New" or "Revised" License
1.16k stars 122 forks source link

Enhancements to initialization code in drm backend #344

Closed t123yh closed 1 year ago

t123yh commented 1 year ago

In RK3399 board running latest mainline kernel, when the system just booted up, there's no encoder attached to connector, and no crtc attached to encoder. In this case flutter-embedded will fail to start with error message Couldn't find any encoders. In this case, modetest will report the following:

Encoders:
id      crtc    type    possible crtcs  possible clones
38      0       DSI     0x00000001      0x00000001

Connectors:
id      encoder status          name            size (mm)       modes   encoders
39      0       connected       DSI-1           95x53           1       38

After the user run something like glmark2-es2-drm, they will get initialized, and flutter apps will work now:

Encoders:
id      crtc    type    possible crtcs  possible clones
38      37      DSI     0x00000001      0x00000001

Connectors:
id      encoder status          name            size (mm)       modes   encoders
39      38      connected       DSI-1           95x53           1       38

This PR adds code to find suitable encoder and crtc from drm resources structure when they are absent. After this is applied, flutter apps can run on boot, even without crtcs and encoders assigned to connector.

As an extra protection measure, this adds guard code against SIGSEGV in gbm backend, in case no crtc is initialized.

HidenoriMatsubayashi commented 1 year ago

Thank you for sending this PR. Could you please update AUTHORS too?

t123yh commented 1 year ago

@HidenoriMatsubayashi Done.