mripard / sunxi-mali

GNU General Public License v2.0
100 stars 54 forks source link

blobs for aarch64 #33

Closed sergey-suloev closed 6 years ago

sergey-suloev commented 6 years ago

Hi Maxime

do we have any chance to get aarch64 blob ?

sergey-suloev commented 6 years ago

Maxime, I know that source code is closed, but I am curious how you were able to get the 32bit blob and if it is possible to get 64bit blob ?

shadeslayer commented 6 years ago

This please ^^

net147 commented 6 years ago

http://wiki.pine64.org/index.php/Mali_Driver

sergey-suloev commented 6 years ago

@net147 thank you! Did you try the kernel module in this repository? Will it work on A64 ?

net147 commented 6 years ago

@sergey-suloev I haven't tested the Pine64 binaries. Icenowy in the linux-sunxi IRC channel may have some experience in that area. I only have A20.

sergey-suloev commented 6 years ago

@net147 I looked at the link you have provided and unfortunately there's no fbdev mali blob.

net147 commented 6 years ago

@sergey-suloev On that page there is Wayland and X11 Mali blob. You shouldn't need to use fbdev as it is deprecated in favor of DRM and there is already sun4i-drm driver. The Wayland blob supports both Wayland and GBM - you can use GBM with it. For Qt 5, that would be using the eglfs-kms integration (QT_QPA_PLATFORM=eglfs QT_QPA_EGLFS_INTEGRATION=eglfs_kms ./myapp).

sergey-suloev commented 6 years ago

@net147 I tried blob from Wayland archive and compiled Qt5.11 but it said it can't find find mali blob. It seems like blob incompatible.

net147 commented 6 years ago

@sergey-suloev It shouldn't be looking for Mali blob at all. GBM is a generic interface. It should be looking for libgbm which is provided by Mali blob but not the Mali blob directly.

sergey-suloev commented 6 years ago

@net147 no, wait.. I am compiling qt5 with custom mkspec, where I am pointing to mali blob location. Of course, it is required. Usually it works for 32bit arm, but this one sucks. And I am using EGLFS_DEVICE_INTEGRATION = eglfs_mali

net147 commented 6 years ago

@sergey-suloev GBM is a generic interface that is implemented by the drivers of more than one graphics vendor, so Qt should not be using or looking for anything Mali specific. Qt has specific Mali integration code for fbdev but there is no specific Mali code in Qt for using GBM, it is a generic GBM implementation that works for more than one graphics vendor (including Mali when using GBM or Wayland blob).

For Intel graphics, libgbm.so is provided by Mesa. For Mali, libgbm.so is provided by the Mali blob.

sergey-suloev commented 6 years ago

@net147 ok , here is what I am using now

qmake configuration for the Allwinner A64 SoC

include(../common/linux_device_pre.conf)

QT_QPA_DEFAULT_PLATFORM = eglfs

MALI_LIB_PATH = /opt/mali/lib MALI_INC_PATH = =/opt/mali/include MALI_LINK = -L=$${MALI_LIB_PATH}

QMAKE_LIBDIR_OPENGL_ES2 = =$${MALI_LIB_PATH} QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2

QMAKE_INCDIR_EGL = $${MALI_INC_PATH} QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}

QMAKE_LIBS_OPENGL_ES2 = -Wl,-rpath,$${MALI_LIB_PATH} $${MALI_LINK} -lGLESv2 QMAKE_LIBS_EGL = -Wl,-rpath,$${MALI_LIB_PATH} $${MALI_LINK} -lEGL -lGLESv2

COMPILER_FLAGS += -march=armv8-a -mtune=cortex-a53 QMAKE_LIBS += -lrt -lpthread -ldl -lz

DISTRO_OPTS += deb-multi-arch DISTRO_OPTS += aarch64

EGLFS_DEVICE_INTEGRATION = eglfs_mali

include(../common/linux_arm_device_post.conf)

load(qt_config)


Should I simply change to eglfs_kms ?

net147 commented 6 years ago

EGLFS_DEVICE_INTEGRATION = eglfs_mali indicates you are using the fbdev Mali integration. This is not compatible with GBM used by the Wayland blob.

net147 commented 6 years ago

@sergey-suloev The Qt 5 configure output should display something like: QPA backends: [...] EGLFS ................ yes [...] EGLFS GBM .......... yes <-- this is for use with GBM or Wayland Mali blob EGLFS Mali ......... no <-- this is for use with fbdev Mali blob [...]

If it doesn't, you need to investigate why the detection is failing.

sergey-suloev commented 6 years ago

@net147 I can't proceed because of configuration error. I have mali blob on path, but Qt can't accept it.

ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.

ERROR: The OpenGL functionality tests failed! You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2], QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.

sergey-suloev commented 6 years ago

/home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_buffer_interface' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_proxy_set_queue' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_proxy_marshal_constructor' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_display_disconnect' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_resource_instance_of' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_proxy_destroy' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_resource_set_user_data' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_proxy_add_listener' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_resource_post_error' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_global_destroy' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_resource_get_user_data' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_display_flush' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_callback_interface' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_display_connect' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_event_queue_destroy' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_resource_create' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_display_interface' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_resource_set_implementation' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_registry_interface' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_resource_post_event' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_display_create_queue' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_resource_destroy' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_display_dispatch_queue' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_global_create' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference to wl_proxy_marshal_constructor_versioned' /home/sergey/Projects/orpaltech/boards/nanopia64/sysroot/opt/mali/lib/libGLESv2.so: undefined reference towl_proxy_marshal'

net147 commented 6 years ago

@sergey-suloev Do you have the Wayland libraries installed that libMali.so depends on? $ objdump -x libMali.so | grep NEEDED | grep wayland NEEDED libwayland-client.so.0 NEEDED libwayland-server.so.0

sergey-suloev commented 6 years ago

@net147 Yes, I installed weston and those dependencies were fixed. Then I copied blob with all symbolic links into /usr/lib and Qt5 still can't detect GBM. Any idea? I also tried to install libgbm-dev from debian repo, and after this Qt5 is able to detect GBM, but this is not the GBM we need, correct ?

net147 commented 6 years ago

@sergey-suloev The configure output will tell you if the compile test code for GBM fails to compile and run including what the errors were. Usually that is enough to work out why. You need only the GBM header gbm.h installed in /usr/include. libMali.so provides libgbm.so. Make sure that installing libgbm-dev doesn't install conflicting libgbm.so from Mesa. Probably safest to remove libgbm-dev and install gbm.h to /usr/include manually so it doesn't install conflicting libraries.

sergey-suloev commented 6 years ago

@net147 I think i should install libgbm-dev first, and overwrite the *.so after. Is this fine ?

net147 commented 6 years ago

@sergey-suloev Your distribution may change it back when updating packages if you do that.

net147 commented 6 years ago

@sergey-suloev Maybe you can use something like dpkg-divert to redirect the libgbm.so installed by libgbm to a different path?

sergey-suloev commented 6 years ago

I can see a picture now, below is my log. But I don't understand what role wayland is playing in this architecture?

Remote debugging from host 10.0.0.1 Process /opt/antenna-analyzer/bin/antenna-analyzer created; pid = 2669 QML debugging is enabled. Only use this in a safe environment. QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_emu", "eglfs_kms_egldevice", "eglfs_kms", "eglfs_x11") qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_kms", "eglfs_emu", "eglfs_kms_egldevice", "eglfs_x11") qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_kms"

qt.qpa.eglfs.kms: New DRM/KMS via GBM integration created qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_kms" qt.qpa.eglfs.kms: platformInit: Opening DRM device qt.qpa.input: udev device discovery for type QFlags(Device_DRM|Device_VideoMask)

qt.qpa.input: Found matching devices ("/dev/dri/card0") qt.qpa.eglfs.kms: Found the following video devices: ("/dev/dri/card0") qt.qpa.eglfs.kms: Using "/dev/dri/card0" qt.qpa.eglfs.kms: Using backend-provided DRM device /dev/dri/card0 qt.qpa.eglfs.kms: Creating GBM device for file descriptor 7 obtained from "/dev/dri/card0"

qt.qpa.eglfs.kms: Querying EGLDisplay qt.qpa.eglfs.kms: Found 2 planes qt.qpa.eglfs.kms: plane 0: id = 28 countFormats = 32 possibleCrtcs = 0x1 supported formats = AB15 AB12 AR15 AR12 BG16 BG24 BA15 BA12 BX24 RG16 RG24 RA12 RA15 RX24 XB24 XR24 NV16 NV12 NV21 NV61 UYVY VYUY YUYV YVYU YU11 YU12 YU16 YU24 YV11 YV12 YV16 YV24 qt.qpa.eglfs.kms: property 0: id = 7 name = 'type' qt.qpa.eglfs.kms: type is ENUM, value is 0, possible values are: qt.qpa.eglfs.kms: enum 0: Overlay - 0 qt.qpa.eglfs.kms: enum 1: Primary - 1 qt.qpa.eglfs.kms: enum 2: Cursor - 2 qt.qpa.eglfs.kms: property 1: id = 29 name = 'zpos' qt.qpa.eglfs.kms: type is RANGE, value is 0, possible values are: qt.qpa.eglfs.kms: 0 qt.qpa.eglfs.kms: 0 qt.qpa.eglfs.kms: plane 1: id = 30 countFormats = 20 possibleCrtcs = 0x1 supported formats = AB15 AB12 AB24 AR15 AR12 AR24 BG16 BG24 BA15 BA12 BA24 BX24 RG16 RG24 RA12 RA15 RA24 RX24 XB24 XR24 qt.qpa.eglfs.kms: property 0: id = 7 name = 'type' qt.qpa.eglfs.kms: type is ENUM, value is 1, possible values are: qt.qpa.eglfs.kms: enum 0: Overlay - 0 qt.qpa.eglfs.kms: enum 1: Primary - 1 qt.qpa.eglfs.kms: enum 2: Cursor - 2 qt.qpa.eglfs.kms: property 1: id = 31 name = 'zpos' qt.qpa.eglfs.kms: type is RANGE, value is 1, possible values are: qt.qpa.eglfs.kms: 1 qt.qpa.eglfs.kms: 1

qt.qpa.eglfs.kms: "HDMI1" mode count: 16 crtc index: 0 crtc id: 32 qt.qpa.eglfs.kms: mode 0 1280 x 1024 @ 60 hz qt.qpa.eglfs.kms: mode 1 1920 x 1080 @ 60 hz qt.qpa.eglfs.kms: mode 2 1920 x 1080 @ 60 hz qt.qpa.eglfs.kms: mode 3 1280 x 1024 @ 75 hz qt.qpa.eglfs.kms: mode 4 1280 x 720 @ 60 hz qt.qpa.eglfs.kms: mode 5 1280 x 720 @ 60 hz qt.qpa.eglfs.kms: mode 6 1024 x 768 @ 75 hz qt.qpa.eglfs.kms: mode 7 1024 x 768 @ 70 hz qt.qpa.eglfs.kms: mode 8 1024 x 768 @ 60 hz qt.qpa.eglfs.kms: mode 9 800 x 600 @ 75 hz qt.qpa.eglfs.kms: mode 10 800 x 600 @ 60 hz qt.qpa.eglfs.kms: mode 11 640 x 480 @ 75 hz qt.qpa.eglfs.kms: mode 12 640 x 480 @ 60 hz qt.qpa.eglfs.kms: mode 13 640 x 480 @ 60 hz qt.qpa.eglfs.kms: mode 14 720 x 400 @ 70 hz qt.qpa.eglfs.kms: mode 15 720 x 400 @ 70 hz qt.qpa.eglfs.kms: Selected mode 0 : 1280 x 1024 @ 60 hz for output "HDMI1" qt.qpa.eglfs.kms: Physical size is QSizeF(330, 270) mm for output "HDMI1" qt.qpa.eglfs.kms: Output HDMI1 can use 2 planes: 28 30

qt.qpa.eglfs.kms: EDID data for output "HDMI1": identifier 'HIQ', manufacturer 'Kaohsiung Opto Electronics Americas, Inc.', model 'B71A', serial '20051117', physical size: 330.00x270.00 qt.qpa.eglfs.kms: Creating new global GBM mouse cursor

qt.qpa.eglfs.kms: Initializing cursor atlas from ":/cursor.json" Failed to move cursor on screen HDMI1: -14 qt.qpa.eglfs.kms: Sorted screen list: QVector(OrderedScreen(QPlatformScreen=0x4e3580 ("HDMI1") : 2147483647 / QPoint(0,0) / primary: false)) qt.qpa.eglfs.kms: Adding QPlatformScreen 0x4e3580 ( "HDMI1" ) to QPA with geometry QRect(0,0 1280x1024) and isPrimary= false qt.qpa.input: evdevkeyboard: Using device discovery qt.qpa.input: udev device discovery for type QFlags(Device_Keyboard)

qt.qpa.input: Found matching devices () qt.qpa.input: evdevmouse: Using device discovery qt.qpa.input: udev device discovery for type QFlags(Device_Mouse|Device_Touchpad) qt.qpa.input: Found matching devices () qt.qpa.input: evdevtouch: Using device discovery qt.qpa.input: udev device discovery for type QFlags(Device_Touchpad|Device_Touchscreen)

QML Debugger: Waiting for connection on port 10001... qml: spectrum tab render complete qt.qpa.eglfs.kms: Creating gbm_surface for screen HDMI1 with format 0x34325258 qrc:/main.qml:128:13: QML TabBar: Binding loop detected for property "height" Created context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 1, colorSpace QSurfaceFormat::ColorSpace(DefaultColorSpace), profile QSurfaceFormat::OpenGLContextProfile(NoProfile)) with config: EGL_BUFFER_SIZE: 32 EGL_ALPHA_SIZE: 8 EGL_BLUE_SIZE: 8 EGL_GREEN_SIZE: 8 EGL_RED_SIZE: 8 EGL_DEPTH_SIZE: 24 EGL_STENCIL_SIZE: 8 EGL_CONFIG_CAVEAT: 12344 EGL_CONFIG_ID: 9 EGL_LEVEL: 0 EGL_MAX_PBUFFER_HEIGHT: 4096 EGL_MAX_PBUFFER_PIXELS: 16777216 EGL_MAX_PBUFFER_WIDTH: 4096 EGL_NATIVE_RENDERABLE: 1 EGL_NATIVE_VISUAL_ID: 875713112 EGL_NATIVE_VISUAL_TYPE: 0 EGL_SAMPLES: 0 EGL_SAMPLE_BUFFERS: 0 EGL_SURFACE_TYPE: 1031 EGL_TRANSPARENT_TYPE: 12344 EGL_TRANSPARENT_BLUE_VALUE: -1 EGL_TRANSPARENT_GREEN_VALUE: -1 EGL_TRANSPARENT_RED_VALUE: -1 EGL_BIND_TO_TEXTURE_RGB: 1 EGL_BIND_TO_TEXTURE_RGBA: 1 EGL_MIN_SWAP_INTERVAL: 0 EGL_MAX_SWAP_INTERVAL: 10

QEGLPlatformContext: Failed to make temporary surface current, format not updated (3003) qt.qpa.eglfs.kms: Adding FB, size 1280x1024, DRM format 0x34325258 qt.qpa.eglfs.kms: Mode already set, skipping modesetting for screen HDMI1 qt.qpa.eglfs.kms: Adding FB, size 1280x1024, DRM format 0x34325258

net147 commented 6 years ago

@sergey-suloev libMali.so is compiled with support for GBM and Wayland so it requires the Wayland library even though you are not using it. If you are using Wayland, the Wayland compositor (e.g. Weston) will be using libEGL.so and the Wayland client will be using libwayland-egl.so to talk to the compositor. In this case though, your application is talking directly to libEGL.so same as a Wayland compositor. Since libwayland-egl.so and libEGL.so are both symbolic links to the same libMali.so, libMali.so is functioning as multiple libraries - of which libwayland-egl.so depends on the Wayland libraries.

It is possible to compile a libMali.so with GBM support enabled and Wayland support disabled but you need access to the proprietary Mali DDK for that. It is also possible to compile libMali.so as split libraries instead of a combined library with symbolic links.

sergey-suloev commented 6 years ago

@net147 so Wayland client/server libs are needed in our scenario only because libMali.so is linked against it and there is no direct usage of Wayland by Qt5 , correct? Yes, I know we could compile appropriate blobs if we had DDK... But it costs money.. and Allwinner sucks to provide all required blobs to users.

net147 commented 6 years ago

@sergey-suloev Correct

net147 commented 6 years ago

@sergey-suloev Just for reference, are you using simple framebuffer, sun4i-drm or a different DRM driver? Which kernel?

sergey-suloev commented 6 years ago

@net147 I am using sun50i A64, sun4i-drm, kernel 4.17-rc6 I would like to use eglfs_kms integration for 32bit platforms too (a20, h3, etc). Do you think the blob named "libmali-utgard-400-r7p0-gbm.so" should work ? https://github.com/rockchip-linux/libmali/tree/29mirror/lib/arm-linux-gnueabihf I am asking because it is r7p0, not sure about compatibility with our r6p2 kernel module.

net147 commented 6 years ago

@sergey-suloev You can check https://github.com/mosajjal/r6p2/tree/master/libwayland_for_mali but please note the licensing of these blobs is not clear.

sergey-suloev commented 6 years ago

@net147 for personal use should be fine ?

net147 commented 6 years ago

@sergey-suloev Perhaps. The blobs are from Allwinner. See README at https://github.com/mosajjal/r6p2

sergey-suloev commented 6 years ago

@net147 well.. that repo looks quite old, more than 2 years ago. that maybe for the old kernel

net147 commented 6 years ago

@sergey-suloev It is definitely compatible with the kernel driver in this repository and mainline kernel. The Mali blobs will work with almost any kernel version, it is just the kernel driver needs to be patched to work with the kernel. You can even run r3p2 blobs with mainline kernel with enough patching - though you do lose dma-buf support.