Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drmModeGetResources failed on 11.0.0 Preview 2 #9178

Closed
Coloryr opened this issue Oct 14, 2022 · 19 comments
Closed

drmModeGetResources failed on 11.0.0 Preview 2 #9178

Coloryr opened this issue Oct 14, 2022 · 19 comments
Labels
bug help-wanted A contribution from the community would be most welcome. os-linux

Comments

@Coloryr
Copy link
Contributor

Coloryr commented Oct 14, 2022

Describe the bug
drmModeGetResources failed when start, it error in 11.0.0 Preview 2, but work in 0.10.18

To Reproduce

public static void Main(string[] args) => BuildAvaloniaApp()
            .StartLinuxDrm(args, scaling: 1);

Expected behavior

root@orangepizero2:~/Avalonia# dotnet Demo.dll
Unhandled exception. System.ComponentModel.Win32Exception (95): drmModeGetResources failed
   at Avalonia.LinuxFramebuffer.Output.DrmResources..ctor(Int32 fd, Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 91
   at Avalonia.LinuxFramebuffer.Output.DrmCard.GetResources(Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 171
   at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String path, Boolean connectorsForceProbe, DrmOutputOptions options) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 47
   at LinuxFramebufferPlatformExtensions.StartLinuxDrm[T](T builder, String[] args, String card, Double scaling, IInputBackend inputBackend) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 151

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • Version 11.0.0 Preview 2

Additional context

@Coloryr
Copy link
Contributor Author

Coloryr commented Feb 7, 2023

11.0.0 Preview 5 is same

Unhandled exception. System.ComponentModel.Win32Exception (95): drmModeGetResources failed
   at Avalonia.LinuxFramebuffer.Output.DrmResources..ctor(Int32 fd, Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 91
   at Avalonia.LinuxFramebuffer.Output.DrmCard.GetResources(Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 171
   at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String path, Boolean connectorsForceProbe, DrmOutputOptions options) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 59
   at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder builder, String[] args, String card, Boolean connectorsForceProbe, DrmOutputOptions options, IInputBackend inputBackend) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 150
   at SmartBox.Top.Program.Main(String[] args) in E:\code\project19\top\ConsoleApp1\AvaloniaApplication1\Program.cs:line 28
Aborted

@maxkatz6 maxkatz6 added the help-wanted A contribution from the community would be most welcome. label Feb 7, 2023
@AndreSteenbergen
Copy link

AndreSteenbergen commented Mar 4, 2023

I am getting this same issue as well

System: Radxa model rock 3
Mali g52

Operating system: Debian bullseye

Kmscube is running fine

@AndreSteenbergen
Copy link

IMG_20230304_235008
Maybe this helps. This is the output from kmscube

@AndreSteenbergen
Copy link

Could this be a problem for us as well?
ardera/flutter-pi#13

when I look into /dev/dri/* I see card0, card1, renderD128 and renderD129

@AndreSteenbergen
Copy link

I get a different error now when I specify the card to use. I don't have an ssh connection to the SBC. But when specifying /dev/dri/card0 I get a EGL_BAD_MATCH error.

at CreateWindowSurface. Maybe that helps

@AndreSteenbergen
Copy link

IMG_20230305_003106
Is a picture of my screen

@kekekeks
Copy link
Member

kekekeks commented Mar 4, 2023

The card search order got changed by #7749

I think it is now somewhat random since it enumerates cards in filesystem order.

We should probably rewrite our code to scan cards in numeric order and to pick the first one that actually works instead of the first one we can get a file descriptor for.

As a workaround, pass the correct card to the card parameter of StartLinuxDrm

@AndreSteenbergen
Copy link

I did I get the above error now: EGL_BAD_MATCH now. I am debugging why I am getting that particular error

@AndreSteenbergen
Copy link

        using (var x = new DrmCard(Card))
        {
            try
            {
                var y = x.GetResources(true);
                y.Dump();
            }
            catch 
            {
            }
        }

Now gives:

    Connector
        DSI-1
            Id: 154
            Size: 217, 136 mm
            Encode id: 153
            Modes
                800x480

@Coloryr
Copy link
Contributor Author

Coloryr commented Apr 18, 2023

work in 11.0.999-cibuild0033386-beta when set card0

@Coloryr Coloryr closed this as completed Apr 18, 2023
@Coloryr
Copy link
Contributor Author

Coloryr commented Apr 18, 2023

I2%ATE)$8KO)$0J{136LH@H

@Coloryr
Copy link
Contributor Author

Coloryr commented Apr 18, 2023

I'm use Lubancat 2, RK3568

@mghcool
Copy link

mghcool commented Mar 22, 2024

I have the same problem

@mghcool
Copy link

mghcool commented Mar 22, 2024

我使用的是 Lubancat 2、RK3568

你目前解决这个问题了吗?能不能说明一下我也用的鲁班猫2

@Coloryr
Copy link
Contributor Author

Coloryr commented Mar 22, 2024

这边建议你换板子,鲁班猫2的固件bug很多
然后渲染不用GPU的,巨卡
你去dev/dri看看card有那些
我去年看只有card0是工作的

@rabbitism
Copy link
Contributor

这边建议你换板子,鲁班猫2的固件bug很多
然后渲染不用GPU的,巨卡
你去dev/dri看看card有那些
我去年看只有card0是工作的

那rk3568用drm效果如何?

@Coloryr
Copy link
Contributor Author

Coloryr commented Mar 23, 2024

这边建议你换板子,鲁班猫2的固件bug很多
然后渲染不用GPU的,巨卡
你去dev/dri看看card有那些
我去年看只有card0是工作的

那rk3568用drm效果如何?

走GPU的话就很好

@mghcool
Copy link

mghcool commented Mar 23, 2024

我找到问题了,是因为使用gbm_surface_create是输入的图像格式不对,应该从XR24改为AR24


Avalonia.LinuxFramebuffer.Output.LibDrm.GbmColorFormats.GBM_FORMAT_XRGB8888 { get; } = FourCC('X', 'R', '2', '4');
改为
Avalonia.LinuxFramebuffer.Output.LibDrm.GbmColorFormats.GBM_FORMAT_XRGB8888 { get; } = FourCC('A', 'R', '2', '4');

这样就可以正常运行。
我使用ildasm将Avalonia.LinuxFramebuffer.dll反编译成il文件,修改上述位置后再用ilasm将修改的il打包成dll文件,将原来程序的替换掉就可以正常运行了

@Coloryr
Copy link
Contributor Author

Coloryr commented Mar 23, 2024

我用rk3566的orangepi 3B没这问题,估计还是lubancat的驱动问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted A contribution from the community would be most welcome. os-linux
Projects
None yet
Development

No branches or pull requests

6 participants