X11 / Mesa3d(OpenGLES) / linux lima driver (sun4i-drm) [Allwinner A13]

Sergio Sota pikaslabs at gmail.com
Wed Dec 23 16:41:45 UTC 2020


Dear all,

we have created a Linux embedded system for an Allwinner A13 SOC. All
the linux kernel needed support is enabled, you can check in the following
kernel logs that the mali gpu is detected and Lima driver enabled, also the
sun4i-drm driver:

<<<===========================================================
...
[    0.881876] sun5i-pinctrl 1c20800.pinctrl: supply vcc-pd not found,
using dummy regulator
[    0.895920] lima 1c40000.gpu: gp - mali400 version major 1 minor 1
[    0.902267] lima 1c40000.gpu: pp0 - mali400 version major 1 minor 1
[    0.908568] lima 1c40000.gpu: l2 cache 32K, 4-way, 64byte cache
line, 64bit external bus
[    0.917322] lima 1c40000.gpu: bus rate = 300000000
[    0.922177] lima 1c40000.gpu: mod rate = 384000000[    0.927515]
[drm] Initialized lima 1.1.0 20191231 for 1c40000.gpu on minor 0*
[    0.935599] sun5i-pinctrl 1c20800.pinctrl: supply vcc-pc not found,
using dummy regulator
...
[    2.171465] Key type dns_resolver registered
[    2.175845] Registering SWP/SWPB emulation handler
[    2.191990] sun5i-pinctrl 1c20800.pinctrl: supply vcc-pd not found,
using dummy regulator
[    2.200843] sun4i-drm display-engine: bound
1e00000.display-frontend (ops 0xc084c328)
[    2.209107] sun4i-drm display-engine: bound 1e60000.display-backend
(ops 0xc084bb68)
[    2.217464] sun4i-drm display-engine: bound 1c0c000.lcd-controller
(ops 0xc084a6c8)
[    2.225311] sun4i-drm display-engine: bound 1c0a000.tv-encoder (ops
0xc084b428)*
[    2.233146] checking generic (4fda8000 258000) vs hw (0 ffffffff)
[    2.233154] fb0: switching to sun4i-drm-fb from simple*
[    2.238746] Console: switching to colour dummy device 80x30
[    2.245271] [drm] Initialized sun4i-drm 1.0.0 20150629 for
display-engine on minor 1
[    2.253402] [drm] kms: can't enable cloning when we probably wanted to.*
[    2.291290] mmc0: host does not support reading read-only switch,
assuming write-enable
...
===========================================================>>>

we have completed a drm driver test with the "modetest" tool and this
command: "*modetest -M sun4i-drm -s 49 at 47
<https://lists.freedesktop.org/mailman/listinfo/mesa-users>:1024x600-60*"
(only mode
supported on our panel) and the result is correct, we can see the color bars
on screen, the drm works!
we also have completed a kms driver test with "kmscube" tool and we can
see a 3dcube on screen with 60fps at only 10% cpu, the kms works! With a
video the test report 20fps at 42% cpu ("kmscube -V test.mpg")

But here is our problem, when we launch a test such as "glxgears" app we
only reach 15fps and almost 100% cpu. What's more, when a QT app such as
vlc is launched we get the following message:
"libEGL warning: DRI2: failed to authenticate"
We created correctly the mesa3d libs (check the following build info)

<<<===========================================================
...
Message: Configuration summary:

        prefix:          /usr
        libdir:          lib
        includedir:      include

        OpenGL:         * yes* (ES1: yes ES2: yes)
        OSMesa:          no

        DRI platform:    drm
        DRI drivers:     no
        DRI driver dir:  /usr/lib/dri

        GLX:             DRI-based

        EGL:             yes
        EGL drivers:     builtin:egl_dri2
        GBM:             yes
        EGL/Vulkan/VL platforms:   *x11 surfaceless drm*

        Vulkan drivers:  *no*

        llvm:            *no*

        Gallium drivers: *kmsro lima panfrost swrast*
        Gallium st:      mesa
        HUD lmsensors:   no

        Shared-glapi:    yes

Build targets in project: 121

Option buildtype is: release [default: debugoptimized]
...
===========================================================>>>

we finally found the problem: x11-server was compiled without glamor
driver. Before we enabled glamor we have only software rendering on x11,
but checking mesa3d documentation: to use OpenGL with Lima driver and x11
there is needed modesetting & glamor drivers (the last one where missed by
a libepoxy library dependency)

Then the message "libEGL warning: DRI2: failed to authenticate" no longer
appears... but now all OpenGL apps crash (with a "Segmentation fault")
We checked the /tmp/Xorg.0.log file and found only one error message:

...
(EE) AIGLX error: sun4i-drm does not export required DRI extension
(II) IGLX: Loaded and initialized swrast
...

The solution was found thanks to the following post, short story: the
xserver doesn't recognize drivers with hyphen in the name (sun4i-drm), we
use xorg version 1.20.9 and have found there is needed a patch (located
in the post link, by the way this patch is still not present in 1.20.10)

"https://forum.clockworkpi.com/t/apt-full-upgrade-getting-the-new-software-updates-from-debian/5664
"

Once we aplied the patch there are no more error messages on Xorg.0.log

...
(II) AIGLX: Loaded and initialized sun4i-drm
(II) GLX: Initialized DRI2 GL provider for screen 0
...

All seems to be fine, but OpenGL apps still crash. If we use kmscube test
(after killing xorg server to permit the access) the app works fine (60fps)

We will keep on searching for a solution. Any help or clue would be
greatly appreciated. Thanks for your help and time!

Best Regards,
Sergio Sota

Here are our xorg.conf and /tmp/Xorg.0.log

==============================================================================
# Monitors represent physical monitors.
Section "Monitor"
        Identifier      "LCD-0"
EndSection

# Devices represent video cards or similars.
#Section "Device"
        Identifier      "FBDEV-0"
#EndSection

# Screen sections connect Devices to Monitors.
Section "Screen"
        Identifier      "SCREEN-0"
        Device          "FBDEV-0"
        Monitor         "LCD-0"
EndSection

# InputClass to add some options to the detected TouchScreen
Section "InputClass"
        Identifier      "LCDTS-0"
        Driver          "evdev"
        MatchProduct    "Goodix"
#       Option          "TransformationMatrix" "0.587156 0 0 0 1 0 0 0 1"
EndSection

# OutputClass to add some options to the detected GPU
Section "OutputClass"
        Identifier      "LIMA-0"
        MatchDriver     "sun4i-drm"
        Driver          "modesetting"
#       Option          "PrimaryGPU" "true"
EndSection

# ServerFlags add some configurations to ServerLayout.
Section "ServerFlags"
        Option          "BlankTime" "0"
        Option          "StandbyTime" "0"
        Option          "SuspendTime" "0"
        Option          "OffTime" "0"
        Option          "AutoAddGPU" "off"
        Option          "Debug" "dmabuf_capable"
EndSection

# ServerLayout define input/output devices used for X server.
Section "ServerLayout"
        Identifier      "LAYOUT-0"
        Screen          0 "SCREEN-0"
EndSection
==============================================================================

==============================================================================
[     6.913]
X.Org X Server 1.20.9
X Protocol Version 11, Revision 0
[     6.913] Build Operating System: Linux 4.15.0-115-generic x86_64
[     6.913] Current Operating System: Linux fanamoel-tk10 5.9.11 #1 SMP
Mon Dec 21 15:09:42 CET 2020 armv7l
[     6.913] Kernel command line: console=ttyS0,115200 earlyprintk
root=/dev/mmcblk0p2 rootwait
[     6.913] Build Date: 21 December 2020  05:18:05PM
[     6.913]
[     6.913] Current version of pixman: 0.40.0
[     6.913]     Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[     6.913] Markers: (--) probed, (**) from config file, (==) default
setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[     6.913] (==) Log file: "/var/log/Xorg.0.0.log", Time: Thu Jan 1
00:00:06 1970
[     6.935] (==) Using config file: "/etc/X11/xorg.conf"
[     6.935] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[     6.939] (==) ServerLayout "LAYOUT-0"
[     6.939] (**) |-->Screen "SCREEN-0" (0)
[     6.939] (**) |   |-->Monitor "LCD-0"
[     6.946] (**) |   |-->Device "FBDEV-0"
[     6.946] (**) Option "BlankTime" "0"
[     6.946] (**) Option "StandbyTime" "0"
[     6.946] (**) Option "SuspendTime" "0"
[     6.946] (**) Option "OffTime" "0"
[     6.946] (**) Option "AutoAddGPU" "off"
[     6.946] (**) Option "Debug" "dmabuf_capable"
[     6.946] (==) Automatically adding devices
[     6.946] (==) Automatically enabling devices
[     6.946] (**) Not automatically adding GPU devices
[     6.946] (==) Max clients allowed: 256, resource mask: 0x1fffff
[     6.960] (WW) The directory "/usr/share/fonts/X11//TTF/" does not exist.
[     6.960]     Entry deleted from font path.
[     6.960] (WW) The directory "/usr/share/fonts/X11//OTF/" does not exist.
[     6.960]     Entry deleted from font path.
[     6.960] (WW) The directory "/usr/share/fonts/X11//Type1/" does not
exist.
[     6.960]     Entry deleted from font path.
[     6.961] (WW) `fonts.dir' not found (or not valid) in
"/usr/share/fonts/X11//100dpi/".
[     6.962]     Entry deleted from font path.
[     6.962]     (Run 'mkfontdir' on "/usr/share/fonts/X11//100dpi/").
[     6.963] (WW) `fonts.dir' not found (or not valid) in
"/usr/share/fonts/X11//75dpi/".
[     6.963]     Entry deleted from font path.
[     6.963]     (Run 'mkfontdir' on "/usr/share/fonts/X11//75dpi/").
[     6.963] (==) FontPath set to:
    /usr/share/fonts/X11//misc/
[     6.963] (==) ModulePath set to "/usr/lib/xorg/modules"
[     6.963] (II) The server relies on udev to provide the list of input
devices.
    If no devices become available, reconfigure udev or disable
AutoAddDevices.
[     6.963] (II) Loader magic: 0x1dde08
[     6.963] (II) Module ABI versions:
[     6.963]     X.Org ANSI C Emulation: 0.4
[     6.963]     X.Org Video Driver: 24.1
[     6.963]     X.Org XInput driver : 24.1
[     6.963]     X.Org Server Extension : 10.0
[     6.965] (II) xfree86: Adding drm device (/dev/dri/card1)
[     6.965] (II) Platform probe for
/sys/devices/platform/display-engine/drm/card1
[     6.982] (II) xfree86: Adding drm device (/dev/dri/card0)
[     6.982] (II) Platform probe for
/sys/devices/platform/soc/1c40000.gpu/drm/card0
[     6.983] (**) OutputClass "LIMA-0" setting /dev/dri/card1 as PrimaryGPU
[     6.983] (II) LoadModule: "glx"
[     6.998] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[     7.095] (II) Module glx: vendor="X.Org Foundation"
[     7.095]     compiled for 1.20.9, module version = 1.0.0
[     7.095]     ABI class: X.Org Server Extension, version 10.0
[     7.095] (II) Applying OutputClass "LIMA-0" to /dev/dri/card1
[     7.095]     loading driver: modesetting
[     7.095] (==) Matched modesetting as autoconfigured driver 0
[     7.095] (==) Matched fbdev as autoconfigured driver 1
[     7.095] (==) Assigned the driver to the xf86ConfigLayout
[     7.095] (II) LoadModule: "modesetting"
[     7.096] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[     7.102] (II) Module modesetting: vendor="X.Org Foundation"
[     7.102]     compiled for 1.20.9, module version = 1.20.9
[     7.102]     Module class: X.Org Video Driver
[     7.102]     ABI class: X.Org Video Driver, version 24.1
[     7.102] (II) LoadModule: "fbdev"
[     7.103] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
[     7.105] (II) Module fbdev: vendor="X.Org Foundation"
[     7.105]     compiled for 1.20.9, module version = 0.5.0
[     7.106]     Module class: X.Org Video Driver
[     7.106]     ABI class: X.Org Video Driver, version 24.1
[     7.106] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[     7.106] (II) FBDEV: driver for framebuffer: fbdev
[     7.106] (++) using VT number 1

[     7.106] (WW) xf86OpenConsole: setpgid failed: Operation not permitted
[     7.115] (II) modeset(0): using drv /dev/dri/card1
[     7.115] (WW) Falling back to old probe method for fbdev
[     7.115] (II) Loading sub module "fbdevhw"
[     7.115] (II) LoadModule: "fbdevhw"
[     7.116] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[     7.122] (II) Module fbdevhw: vendor="X.Org Foundation"
[     7.122]     compiled for 1.20.9, module version = 0.0.2
[     7.122]     ABI class: X.Org Video Driver, version 24.1
[     7.122] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card
support
[     7.123] (II) modeset(0): Creating default Display subsection in Screen
section
    "SCREEN-0" for depth/fbbpp 24/32
[     7.123] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[     7.123] (II) Applying OutputClass "LIMA-0" options to /dev/dri/card1
[     7.123] (==) modeset(0): RGB weight 888
[     7.123] (==) modeset(0): Default visual is TrueColor
[     7.123] (II) Loading sub module "glamoregl"
[     7.123] (II) LoadModule: "glamoregl"
[     7.124] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[     7.291] (II) Module glamoregl: vendor="X.Org Foundation"
[     7.291]     compiled for 1.20.9, module version = 1.0.1
[     7.291]     ABI class: X.Org ANSI C Emulation, version 0.4
[     8.083] (II) modeset(0): glamor X acceleration enabled on Mali400
[     8.083] (II) modeset(0): glamor initialized
[     8.084] (II) modeset(0): Output None-1 using monitor section LCD-0
[     8.084] (II) modeset(0): Output Composite-1 has no monitor section
[     8.085] (II) modeset(0): EDID for output None-1
[     8.085] (II) modeset(0): Printing probed modes for output None-1
[     8.085] (II) modeset(0): Modeline "1024x600"x60.0   45.00  1024 1040
1050 1200  600 602 604 625 (37.5 kHz eP)
[     8.085] (II) modeset(0): EDID for output Composite-1
[     8.085] (II) modeset(0): Printing probed modes for output Composite-1
[     8.085] (II) modeset(0): Modeline "PAL"x25.0   13.50  720 723 725 864
576 604 606 625 interlace (15.6 kHz e)
[     8.085] (II) modeset(0): Modeline "NTSC"x30.0   13.50  720 738 740
858  480 506 508 525 interlace (15.7 kHz e)
[     8.085] (II) modeset(0): Output None-1 connected
[     8.086] (II) modeset(0): Output Composite-1 connected
[     8.086] (II) modeset(0): Using sloppy heuristic for initial modes
[     8.086] (II) modeset(0): Output None-1 using initial mode 1024x600 +0+0
[     8.086] (II) modeset(0): Output Composite-1 using initial mode PAL +0+0
[     8.086] (==) modeset(0): Using gamma correction (1.0, 1.0, 1.0)
[     8.086] (==) modeset(0): DPI set to (96, 96)
[     8.086] (II) Loading sub module "fb"
[     8.086] (II) LoadModule: "fb"
[     8.086] (II) Loading /usr/lib/xorg/modules/libfb.so
[     8.108] (II) Module fb: vendor="X.Org Foundation"
[     8.109]     compiled for 1.20.9, module version = 1.0.0
[     8.109]     ABI class: X.Org ANSI C Emulation, version 0.4
[     8.109] (II) UnloadModule: "fbdev"
[     8.109] (II) Unloading fbdev
[     8.109] (II) UnloadSubModule: "fbdevhw"
[     8.109] (II) Unloading fbdevhw
[     8.606] (==) modeset(0): Backing store disabled
[     8.606] (==) modeset(0): Silken mouse enabled
[     8.632] (II) modeset(0): Initializing kms color map for depth 24, 8
bpc.
[     8.633] (==) modeset(0): DPMS enabled
[     8.633] (WW) modeset(0): Option "PrimaryGPU" is not used
[     8.633] (II) modeset(0): [DRI2] Setup complete
[     8.633] (II) modeset(0): [DRI2]   DRI driver: sun4i-drm
[     8.633] (II) modeset(0): [DRI2]   VDPAU driver: sun4i-drm
[     8.633] (II) Initializing extension Generic Event Extension
[     8.633] (II) Initializing extension SHAPE
[     8.634] (II) Initializing extension MIT-SHM
[     8.634] (II) Initializing extension XInputExtension
[     8.640] (II) Initializing extension XTEST
[     8.640] (II) Initializing extension BIG-REQUESTS
[     8.640] (II) Initializing extension SYNC
[     8.640] (II) Initializing extension XKEYBOARD
[     8.641] (II) Initializing extension XC-MISC
[     8.641] (II) Initializing extension XFIXES
[     8.641] (II) Initializing extension RENDER
[     8.641] (II) Initializing extension RANDR
[     8.641] (II) Initializing extension DAMAGE
[     8.641] (II) Initializing extension MIT-SCREEN-SAVER
[     8.641] (II) Initializing extension DOUBLE-BUFFER
[     8.641] (II) Initializing extension RECORD
[     8.641] (II) Initializing extension DPMS
[     8.641] (II) Initializing extension Present
[     8.641] (II) Initializing extension DRI3
[     8.641] (II) Initializing extension X-Resource
[     8.641] (II) Initializing extension XVideo
[     8.641] (II) Initializing extension XVideo-MotionCompensation
[     8.641] (II) Initializing extension GLX
[     8.784] (II) AIGLX: Loaded and initialized sun4i-drm
[     8.784] (II) GLX: Initialized DRI2 GL provider for screen 0
[     8.784] (II) Initializing extension XFree86-VidModeExtension
[     8.784] (II) Initializing extension XFree86-DGA
[     8.784] (II) Initializing extension XFree86-DRI
[     8.789] (II) Initializing extension DRI2
[     8.804] (II) modeset(0): Damage tracking initialized
[     8.804] (II) modeset(0): Setting screen physical size to 270 x 158
==============================================================================



Best Regards,
Sergio Sota
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20201223/dc407fa3/attachment-0001.htm>


More information about the xorg mailing list