sony / flutter-elinux

Flutter tools for embedded Linux (eLinux)
BSD 3-Clause "New" or "Revised" License
429 stars 43 forks source link

Add support for multiple potential dri cards. #143

Closed callumhopkinsdev closed 1 year ago

callumhopkinsdev commented 1 year ago

Currently using the DRM backend you can only select a single card via FLUTTER_DRM_DEVICE. However, on the Raspberry Pi 4 the vc4 driver can randomly select either /dev/dri/card0 or /dev/dri/card1 at boot time.

Most other DRM based applications iterate through all of the devices in the /dev/dri/ directory and attempt to open each one until they are successful.

It would be great if either the FLUTTER_DRM_DEVICE variable allowed for a comma seperated list of devices to attempt to open, or if by default the DRM backend would attempt to open every device until one is successful.

HidenoriMatsubayashi commented 1 year ago

Thanks for creating the issue.

However, on the Raspberry Pi 4 the vc4 driver can randomly select either /dev/dri/card0 or /dev/dri/card1 at boot time.

Really? Where can I find that information?

callumhopkinsdev commented 1 year ago

On this thread, a few posts down you can find a quote directly from one of the engineers.

https://forums.raspberrypi.com/viewtopic.php?t=307392&sid=0519efbedbfc3f01ff2dbf41547ff41e

Moreover, I've experienced this behaviour personally when working on a C# GUI toolkit (Avalonia)

HidenoriMatsubayashi commented 1 year ago

Thanks for the information. I'll implement this feature.

HidenoriMatsubayashi commented 1 year ago

I created https://github.com/sony/flutter-embedded-linux/pull/295

HidenoriMatsubayashi commented 1 year ago

@callumhopkinsdev The change will be included in a next release (flutter 3.3.6?). If you want to add more improvements, please create a PR. Thanks.

callumhopkinsdev commented 1 year ago

Awesome, thanks @HidenoriMatsubayashi!