Jump to content

BananaPro: lima driver problems


musicPi

Recommended Posts

Hello guys,

I've been playing around with the build-in lima drivers but didn't get it to work on BananaPro using Armbian_20.02.1_Bananapipro_buster_current_5.4.20_desktop image.
I installed drivers armsoc, modesetting, fbdev from debian buster repos but "Xorg -configure" fails.

 

/var/log/Xorg.0.log says:

 

Quote

[   624.247] (==) ServerLayout "X.org Configured"
[   624.247] (**) |-->Screen "Screen0" (0)
[   624.247] (**) |   |-->Monitor "Monitor0"
[   624.249] (**) |   |-->Device "Card0"
[   624.249] (**) |   |-->GPUDevice "Card0"
[   624.249] (**) |-->Input Device "Mouse0"
[   624.249] (**) |-->Input Device "Keyboard0"
[   624.249] (**) Option "BlankTime" "0"
[   624.249] (**) Option "StandbyTime" "0"
[   624.249] (**) Option "SuspendTime" "0"
[   624.250] (**) Option "OffTime" "0"

 

and

 

Quote

[   624.250] (**) ModulePath set to "/usr/lib/xorg/modules"
[   624.251] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[   624.251] (WW) Disabling Mouse0
[   624.251] (WW) Disabling Keyboard0
[   624.251] (WW) Falling back to old probe method for armsoc
[   624.251] (II) No BusID or DriverName specified - opening /dev/dri/card0
[   624.251] (II) Got BusID 1c40000.gpu
[   624.252] (II) Opened DRM
[   624.252] (II)    DeviceName is [/dev/dri/card0]
[   624.252] (II)    bus_id is [1c40000.gpu]
[   624.252] (II)    DriverName is [lima]
[   624.252] (II)    version is [1.0.0]
[   624.252] (II) Screen:1,  CRTC:0
[   624.252] (II) No BusID or DriverName specified - opening /dev/dri/card0
[   624.253] (II) Got BusID 1c40000.gpu
[   624.253] (II) Opened DRM
[   624.253] (II)    DeviceName is [/dev/dri/card0]
[   624.253] (II)    bus_id is [1c40000.gpu]
[   624.253] (II)    DriverName is [lima]
[   624.254] (II)    version is [1.0.0]
[   624.254] (II) Screen:2,  CRTC:1
[   624.254] Number of created screens does not match number of detected devices.
  Configuration failed.
[   624.254] (EE) Server terminated with error (2). Closing log file.

 

and generated xorg.conf:

 

 

Quote

Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        ModulePath   "/usr/lib/xorg/modules"
        FontPath     "/usr/share/fonts/X11/misc"
        FontPath     "/usr/share/fonts/X11/cyrillic"
        FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/Type1"
        FontPath     "/usr/share/fonts/X11/100dpi"
        FontPath     "/usr/share/fonts/X11/75dpi"
        FontPath     "built-ins"
EndSection

Section "Module"
        Load  "glx"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/input/mice"
        Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "Debug"                     # [<bool>]
        #Option     "NoFlip"                    # [<bool>]
        #Option     "DRICard"                   # <i>
        #Option     "BusID"                     # <str>
        #Option     "DriverName"                # <str>
        #Option     "DRI2MaxBuffers"            # <i>
        #Option     "InitFromFBDev"             # <str>
        #Option     "UMP_LOCK"                  # [<bool>]
        Identifier  "Card0"
        Driver      "armsoc"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                Viewport   0 0
                Depth     1
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     4
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     8
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     15
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     16
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection

 

Any suggestions what I am doing wrong?

 

regards

Edited by musicPi
Link to comment
Share on other sites

Thanks a lot for your replies!
I still have the problem lima does not work properly.
Module sun4i-drm, which is needed for lima, is avaliable via modprobe (at least ist gives no error message), but seems not to be loaded either. lsmod does not show it.

I don't exactly know what is wrong but it seems there is a problem with the compiled driver.
When I look into /lib/modules/5.4.44-sunxi/kernel/drivers/gpu/drm/sun4i/ there is just a file called sun6i_mipi_dsi.ko. What has sun6i todo with sun4i? The GPU is a different one (Power VR SGX 544 instead of Mali 400).

The only thing I've found on my system is /sys/bus/platforms/drivers/sun4i-drm.
There is no device bound to and no module connected.

So I've build an image for bananapro myself, but it looks the same.
For some reason I compiled an image for bananapi and surprisingly sun4i-drm has been loaded. I´m going to check if it works correctly...

I'm interested in the differences between those two configurations and of course it would be very nice to apply this configuration also to the bananapro image!

Edited by musicPi
Link to comment
Share on other sites

On the BananaPi image startx says:
 

Quote

gbm: failed to open any driver (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
gbm: Last dlopen error: /usr/lib/dri/sun4i-drm_dri.so: cannot open shared object file: No such file or directory
failed to load driver: sun4i-drm

Indeed /usr/lib/arm-linux-gnueabihf/dri/ contains various *_dri.so files but none called sun4i-drm.
Any suggestions what to do?

Link to comment
Share on other sites

Finally got it to work building mesa on my own on a recent BananaPi image  :beer:
But it would be very cool if the sun4i-drm driver was fixed in BananaPro images.
Can you please take care of that, Igor?
I'll help you as far as I can and will provide further information from my test machine.

Edited by musicPi
Link to comment
Share on other sites

1 hour ago, Werner said:

You could start by telling what you did to achieve make it work?

I just built the lastest armbian sources for BananaPi minimal, which is version Armbian_20.08.0-trunk_Bananapi_buster_current_5.4.44_minimal and startet ist on my BananaPro.
After that I got mesa running doing this:

Quote

 

apt build-dep mesa
apt install -y valgrind cmake libunwind-dev

git clone --branch mesa-19.3.2 https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa/
meson build/ --optimization s --buildtype release --prefix=/usr --libdir=lib/arm-linux-gnueabihf -Dgallium-drivers=lima,panfrost,kmsro,swrast -Dplatforms=x11,drm,surfaceless

ninja -C build/
ninja -C build/ install

 

... and kodi on X11 started properly. Got into Kodi->Systeminformation. There it says lima driver is used. This failed on various BananaPro images before.

 

The question is how to integrate that into a build script.


Furthermore there seem to be some differences between the image configuration of BananaPi and BananaPro although the only differences are integrated WIFI-Device (Pro) and 40-Pin GPIO (Pro). Therefore there should be no differences between processorelated functionality.
Differences known so far (each image tested on bananapro):
AHCI does work properly on Pro but fails on Pi,

sun4i-drm works on Pi but not on Pro

I`m going to try some reverse engineering to find the differences in configuration.


 

Edited by musicPi
Link to comment
Share on other sites

On 6/5/2020 at 3:28 PM, musicPi said:

sun4i-drm works on Pi but not on Pro

No, it doesn't. I have a Banana Pi M1 and I get the same errors about the missing sun4i-drm driver.  None of the builds with Linux kernels above 3.14 ever worked for me, they all fail to load the graphics drivers. Not only armbian, but other distributions as well.

Link to comment
Share on other sites

On 6/7/2020 at 7:53 AM, asdf2005 said:

No, it doesn't. I have a Banana Pi M1 and I get the same errors about the missing sun4i-drm driver.  None of the builds with Linux kernels above 3.14 ever worked for me, they all fail to load the graphics drivers. Not only armbian, but other distributions as well.

lsmod shows sun4idrm and as far as i can say all devices needed are where they should be. On that base Lima can be run with basic functionality. It does not work like a charm (not all GL-Drives do work) but lima is able to run kodi.
 

Link to comment
Share on other sites

I got lima working on BananaPro by adding following contents to build/cache/sources/u-boot/v20XX.XX/arch/arm/dts/sun7i-a20-bananapro.dts :

Enable HDMI:

Quote

/ {

 

    // right under chosen-tag:
    hdmi-connector {
            compatible = "hdmi-connector";
            type = "a";

            port {
                hdmi_con_in: endpoint {
                    remote-endpoint = <&hdmi_out_con>;
                };
            };
        };

};

 

Quote

// right under &gmac-tag:

 

&hdmi {
    status = "okay";
};

&hdmi_out {
    hdmi_out_con: endpoint {
        remote-endpoint = <&hdmi_con_in>;
    };
};

 

Enable display engine:

Quote

right under &codec-tag:

&de {
    status = "okay";
};

 

Change build/cache/sources/linux-mainline/orange-pi-5.XX/arch/arm/boot/dts/sun7i-a20-bananapro.dts accordingly.

 

Then compile the mesa driver like this:

 

nano /etc/apt/sources.list // uncomment #src
apt update

apt build-dep -y mesa
apt install -y git g++ build-essential pkg-config
apt install -y libx11-dev libgl1-mesa-dev
apt install -y valgrind cmake libunwind-dev
apt install -y libudev-dev

// if you get meson version errors
apt install -y python3-pip
pip3 install --upgrade meson

git clone https://gitlab.freedesktop.org/mesa/mesa.git

cd mesa/
/usr/local/bin/meson build/ --optimization s --buildtype release --libdir=/usr/lib/arm-linux-gnueabihf -Dgallium-drivers=lima,panfrost,kmsro,swrast -Dplatforms=x11,drm,surfaceless

ninja -C build/
ninja -C build/ install

 

Now it's working (at least to run Kodi, but there ist still a great difference in power between this lima driver version and the mali driver provided at sunxi.org)!

 

I don't know what changes are necessary to BananaPi but the Problems concerning SATA and AHCI seem to come from a different way of handling the PMIC. I saw similar dts-files with that specific PMIC axp209.dtsi-file. They got a AHCI-tag looking like this:

Quote

&ahci {
    target-supply = <&reg_ahci_5v>;
    status = "okay";
};

Maybe the target-supply-line will do the thing. I'll ty later.

Never the less i get problems when starting my original allwinner 5"-LCD using this tutorial:

https://forum.armbian.com/topic/7233-bananapi-pro-7-touchlcd-with-debian-buster-and-mainline-kernel-5xxxx/

I changed the parameters from 7"-LCD to 5"-LCD and itis working very well without displayengine enabled.
But when I enable it the screen freezes at boottime, right after saying "starting networkinterfaces".
Has anyone ever had the same problem and can help me with that?

 

Edited by musicPi
Link to comment
Share on other sites

@musicPi @ning Can you help? I can't enable hardware acceleration with lima on bananapro and latest armbian (switched to bullseye, kernel 5.13.12, mesa 20.3.5) 


Lima drivers initialized, but /dev/dri/card1 not present and no sun4i-drm in /lib/modules/5.13.12-sunxi/kernel/drivers/gpu/drm
I try xserver-xorg-video-fbdev (no accelerated) and xserver-xorg-video-armsoc-sun4i (doesn't work at all).

glxinfo | grep 'renderer string': OpenGL renderer string: llvmpipe (LLVM 11.0.1, 128 bits)

I try some custom configs, like this, but nothing helps. /etc/X11/xorg.conf.d/02-lima.conf

 

Section "ServerFlags"
        Option  "AutoAddGPU" "off"
        Option "Debug" "dmabuf_capable"
EndSection

Section "OutputClass"
        Identifier "Lima"
        MatchDriver "lima"
        Driver "modesetting"
        Option "PrimaryGPU" "true"
EndSection

 

 

armbianEnv.txt, dpkg -l, Xorg.0.log: https://paste.debian.net/1208449/
armbianmonitor -U: https://paste.debian.net/1208445/
 

Link to comment
Share on other sites

Quote

 

[ 37.446] xorg-server 2:1.20.11-1 (https://www.debian.org/support)

Quote

[ 37.932] (II) Initializing extension GLX [ 37.933] (II) AIGLX: Screen 0 is not DRI2 capable [ 40.453] (II) IGLX: Loaded and initialized swrast [ 40.454] (II) GLX: Initialized DRISWRAST GL provider for screen 0 [ 40.454] (II) Initializing extension XFree86-VidModeExtension

 

please update your Xserver to at least 1.20.13

Link to comment
Share on other sites

no need xserver-xorg-video-armsoc-sun4i,

 

Section "ServerFlags"
        Option  "AutoAddGPU" "off"
        Option "Debug" "dmabuf_capable"
EndSection

Section "OutputClass"
        Identifier "Lima"
        MatchDriver "sunxi-drm"
        Driver "modesetting"
        Option "PrimaryGPU" "true"
EndSection

 

Link to comment
Share on other sites

Xorg version up to 1.20.13 doesn't help 
xorg.0.log: https://paste.debian.net/1208887/ 

driverName argument in glxProbeDriver is always swrast, not sun4i-drm, problem before: AIGLX: Screen 0 is not DRI2 capable

[  4882.754] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[  4882.754] (II) FBDEV: driver for framebuffer: fbdev
[  4882.755] (WW) Falling back to old probe method for modesetting
[  4882.756] (WW) Falling back to old probe method for fbdev

Looks like modesetting probe method fails. It's a problem with kernel or glamor.

Can you provide your Xorg.0.log and lsmod?
 

Link to comment
Share on other sites

As newbie, not knowing what I'm talking about, reviewing your pastebin I saw these 4 lines:

[ 1476.203] (II) LoadModule: "fbdev"

[ 1476.204] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so

[ 1476.205] (II) Module fbdev: vendor="X.Org Foundation"

[ 1476.205] compiled for 1.20.8, module version = 0.5.0

 

all the other modules are compiled for 1.20.13

 

Link to comment
Share on other sites

I got it. But perfomance too poor: mc panel on/off in qterminal takes about 1-2 seconds (fbdev+swrast < 1 sec). glxgears looks laggy. Sluggish keyboard/mouse response (mesa 20.3.5).
@ning does mouse sluggish with sun4i-drm on your bananapi/pro?

modesetting+sun4i-drm:

$glxinfo|grep render
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: Mali400

$glxgears.
120 frames in 5.0 seconds = 23.970 FPS
121 frames in 5.0 seconds = 24.057 FPS

fbdev+swrast:

$glxinfo|grep render
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: llvmpipe (LLVM 11.0.1, 128 bits)

$glxgears
46 frames in 5.0 seconds =  9.124 FPS
56 frames in 5.1 seconds = 11.085 FPS

Xorg.0.log https://paste.debian.net/1208920/

Without compiling you can enable this in following steps:

1. Download arch xserver https://archlinuxarm.org/packages/armv7h/xorg-server, extract and replace /usr/lib/xorg/modules/extensions/libglx.so in armbian system
2. cd /usr/lib && ln -s arm-linux-gnueabihf/dri dri
3. In /boot/armbianEnv.txt change fdtfile=sun7i-a20-bananapro.dtb to fdtfile=sun7i-a20-bananapi.dtb (internal bananpro wifi will be disabled)
4. /etc/X11/xorg.conf.d/02-lima.conf

Section "ServerFlags"
  Option "AutoAddGPU" "off"
  Option "Debug" "dmabuf_capable"
EndSection

Section "OutputClass"
  Identifier "Lima"
  MatchDriver "sun4i-drm"
  Driver "modesetting"
  Option "PrimaryGPU" "true"
EndSection

5. Restart xorg and check Xorg.0.log for 
[  5920.805] (II) modeset(0): [DRI2]   DRI driver: sun4i-drm
[  5920.805] (II) modeset(0): [DRI2]   VDPAU driver: sun4i-drm
[  5921.330] (II) AIGLX: Loaded and initialized sun4i-drm

As musicPi says above, for bananapro need an patched dts version. I try to suggest patch for dts into armbian later. But i don't know how to suggest xorg-xserver patch (it is not an armbian package), just wait 1.20.13 in upstream or use arch.

Link to comment
Share on other sites

I suggest bananapro dts patches to armbian builder https://github.com/armbian/build/pull/3117 for enabling lima with wifi on bananapro.

Without compiling you can install armbian build, based on ubuntu hirsute (needed mesa>=21.0.1)
For testing use wayland + xwayland or xserver-xorg-core >= 1.20.13 (in hirsute 1.20.11, so compile or use binary from ubuntu impish - https://launchpad.net/ubuntu/+source/xorg-server)

Without lima glxgears shows 10 fps with lima - 20 fps (no lags and normal mouse / keyboard response). glxinfo | grep render shows Mali400.

But mpv --va=gpu plays 720p video with lags and hundreds frame drops (on 3 kernel with non-free mali driver mpv with hwdec vdpau plays 720p video without lags)
I think problem with hwdec (lima doesn't supports it, https://forum.armbian.com/topic/12696-mali-lima-driver-on-orange-pi-2e-missing-548-iamge/)

I found only old mesa issues about poor performance on sun7i A20: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3033. But it looks unrelated to mesa.

Can anybody play 720p video in mpv or vlc without framedrop with 5.x kernel on Allwinner A20?

This link describes, that no way to enable hwdec in X/wayland session at current moment.

a

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines