Lima userspace drivers: Xorg/mesa/tools/etc for BPI-R2

As we got certrain succes with lima driver (Mali-450 support by lima) it’s good time to start new thread for OS-related support questions.

As i know - minimum requirements are: libdrm and mesa with lima support.

@eros to unmask lima for mesa add “-video_cards_lima” to /usr/portage/profiles/arch/arm/use.mask Rude, but useful quick-fix.

kmscube: https://github.com/yuq/kmscube

./kmscube -d -D /dev/dri/renderD128

shows:

pi@bpi-r2-gentoo ~/src/kmscube $ ./kmscube -d -D /dev/dri/renderD128
Using display 0x688c00 with EGL version 1.4
===================================
EGL information:
  version: "1.4"
  vendor: "Mesa Project"
  client extensions: "EGL_EXT_client_extensions EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug EGL_EXT_platform_x11 EGL_MESA_platform_gbm EGL_MESA_platform_surfaceless EGL_EXT_platform_device"
  display extensions: "EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_partial_update EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver "
===================================
OpenGL ES 2.x information:
  version: "OpenGL ES 2.0 Mesa 19.3.2"
  shading language version: "OpenGL ES GLSL ES 1.0.16"
  vendor: "lima"
  renderer: "Mali450"
  extensions: "GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_depth_texture GL_OES_packed_depth_stencil GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_EXT_occlusion_query_boolean GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers GL_EXT_map_buffer_range GL_KHR_debug GL_KHR_texture_compression_astc_ldr GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_separate_shader_objects GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex GL_OES_texture_border_clamp GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_KHR_parallel_shader_compile "
===================================

atleast i doesn’t halt :slight_smile: interrupts counter for lima irg grows :slight_smile:, dmesg is clean.

Looks like mesa’s lima driver doen’t need specific libdrm videocard duport.

1 Like

You’ve got it running? do you use gentoo specific sources or an universal way i can use in debian?

I’ve found this repo but i’m not sure this is right. Also it seems meson is build system needed for it. Maybe it is possible to crosscompile on other host?

https://linux-sunxi.org/Mali_Open_Source_Driver probably this may help. There are a few words about cross compiling on Debian.

Any latest mainline sousce is good i use 19.3.2

https://gitlab.freedesktop.org/mesa/mesa You cat get it from here. Or here

1 Like

tried this in a vm, some of the cross-compile-packages do not exist in ubuntu 18.4, installed meson over pip3 to get newer version, added ~/.local/bin to path to run meson hang on

meson.build:1339:0: ERROR: Pkg-config binary for machine MachineChoice.HOST not found. Giving up.

i cannot install this package

sudo apt install pkg-config:armhf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package pkg-config:armhf

will now try a debian buster in vm

Any progress?

Afrer some reserch i found (hopefully right) next:

  • For onsreen rendering lima needs gallium driver for mediatek in mesa which is absent (in lima git there are implementations for rockchip, sunxi, etc.) may be something else, but it’s a requiered minimum.

  • Xorg DDM driver likely isn’t needed modesetting should be enough.

UPD: most specific mesa 2D drivers replaced by one - kmsro. Going to tyr it.

UPD2: kmsro works! (I have no display right now, but X starts and logs look good) No patches needed, only to add mediatek to kmso list: mesa-19.3.2/src/gallium/targets/dri/meson.build:

foreach d : [[with_gallium_kmsro, [
               'armada-drm_dri.so',
               'exynos_dri.so',
               'hx8357d_dri.so',
               'ili9225_dri.so',
               'ili9341_dri.so',
               'imx-drm_dri.so',
               'meson_dri.so',
               'mi0283qt_dri.so',
               'mxsfb-drm_dri.so',
               'pl111_dri.so',
               'repaper_dri.so',
               'rockchip_dri.so',
               'mediatek_dri.so', <<----- this line was added
               'st7586_dri.so',
               'st7735r_dri.so',
               'stm_dri.so',
               'sun4i-drm_dri.so',

and mesa-19.3.2/src/gallium/targets/dri/target.c:

#if defined(GALLIUM_KMSRO)                                                                                                                                                                                                                          
DEFINE_LOADER_DRM_ENTRYPOINT(armada_drm)                                                                                                                                                                                                            
DEFINE_LOADER_DRM_ENTRYPOINT(exynos)                                                                                                                                                                                                                
DEFINE_LOADER_DRM_ENTRYPOINT(hx8357d)                                                                                                                                                                                                               
DEFINE_LOADER_DRM_ENTRYPOINT(ili9225)                                                                                                                                                                                                               
DEFINE_LOADER_DRM_ENTRYPOINT(ili9341)                                                                                                                                                                                                               
DEFINE_LOADER_DRM_ENTRYPOINT(imx_drm)                                                                                                                                                                                                               
DEFINE_LOADER_DRM_ENTRYPOINT(meson)                                                                                                                                                                                                                 
DEFINE_LOADER_DRM_ENTRYPOINT(mi0283qt)                                                                                                                                                                                                              
DEFINE_LOADER_DRM_ENTRYPOINT(mxsfb_drm)                                                                                                                                                                                                             
DEFINE_LOADER_DRM_ENTRYPOINT(pl111)                                                                                                                                                                                                                 
DEFINE_LOADER_DRM_ENTRYPOINT(repaper)                                                                                                                                                                                                               
DEFINE_LOADER_DRM_ENTRYPOINT(rockchip)                                                                                                                                                                                                              
DEFINE_LOADER_DRM_ENTRYPOINT(mediatek) <<----- this line added                                                                                                                                                                                                              
DEFINE_LOADER_DRM_ENTRYPOINT(st7586)                                                                                                                                                                                                                
DEFINE_LOADER_DRM_ENTRYPOINT(st7735r)                                                                                                                                                                                                               
DEFINE_LOADER_DRM_ENTRYPOINT(stm)                                                                                                                                                                                                                   
DEFINE_LOADER_DRM_ENTRYPOINT(sun4i_drm)                                                                                                                                                                                                             
#endif

glxinfo:

bpi-r2-gentoo ~/src/lima/mesa-19.3.2/src/gallium/targets/dri # glxinfo | grep OpenGL
OpenGL vendor string: lima
OpenGL renderer string: Mali450
OpenGL version string: 2.1 Mesa 19.3.2
OpenGL shading language version string: 1.20
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 19.3.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
OpenGL ES profile extensions:

glxgears: for now without picture :see_no_evil:

bpi-r2-gentoo ~ # glxgears  
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
292 frames in 5.0 seconds = 58.385 FPS
301 frames in 5.0 seconds = 60.022 FPS
298 frames in 5.0 seconds = 59.521 FPS
301 frames in 5.0 seconds = 60.052 FPS
301 frames in 5.0 seconds = 60.028 FPS

Found a monitor: Google Photos

glxgears withouy vertical sync:

pi@bpi-r2-gentoo /root $ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
3648 frames in 5.0 seconds = 729.522 FPS
4303 frames in 5.0 seconds = 860.597 FPS
4787 frames in 5.0 seconds = 957.391 FPS
4303 frames in 5.0 seconds = 860.524 FPS
4200 frames in 5.0 seconds = 839.970 FPS

btw, dmesg is overloaded by

[ 3247.537790] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_WAIT
[ 3247.537882] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_WAIT
[ 3247.538252] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_SUBMIT
[ 3247.538349] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_SUBMIT
[ 3247.538688] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_WAIT
[ 3247.538756] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_WAIT
[ 3247.539166] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_WAIT
[ 3247.539225] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_WAIT
[ 3247.539913] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_SUBMIT
[ 3247.540009] [drm:drm_ioctl] pid=4646, dev=0xe280, auth=1, LIMA_GEM_SUBMIT

syslog is loaded @100%

so i’m going to disable drm debug. FPS may also rise after that.

2 Likes

My build configuration:

meson --buildtype plain --libdir lib --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload -Dplatforms=surfaceless,x11,drm -Dllvm=true -Dlmsensors=false -Dlibunwind=false -Dgallium-nine=false -Dgallium-va=false -Dgall
ium-vdpau=false -Dgallium-xa=false -Dgallium-xvmc=false -Dgallium-opencl=disabled -Dosmesa=none -Dbuild-tests=false -Dglx=dri -Dshared-glapi=true -Ddri3=true -Degl=true -Dgbm=true -Dgles1=false -Dgles2=true -Dglvnd=false -Dselinux=false -Dvalg
rind=false -Ddri-drivers= -Dgallium-drivers=kmsro,lima,swrast -Dvulkan-drivers= -Dvulkan-overlay-layer=false --buildtype plain -Db_ndebug=true

You can definitely use these:

-Dgallium-drivers=kmsro,lima,swrast -Dplatforms=surfaceless,x11,drm

others may be distro related.

my xorg.conf:

Section "Device"
                Identifier              "mediatek"
                Driver                  "modesetting"
                Option                  "HWCursor" "false"
                Option                  "SwapbuffersWait" "true"
EndSection
Section "Monitor"
        Identifier      "Monitor0"
        Option          "DPMS" "false"
EndSection
Section "ServerFlags"
                Option                  "BlankTime" "0"
                Option                  "StandbyTime" "0"
                Option                  "SuspendTime" "0"
                Option                  "OffTime" "0"
                Option "AutoAddGPU" "off"
EndSection

Not all options are nessesary, but it works for me.

Xorl.log: Xorg.log.txt (17.0 КБ)

[   348.969] (II) AIGLX: Loaded and initialized mediatek
[   348.970] (II) GLX: Initialized DRI2 GL provider for screen 0

means that you’re likely succeed :slight_smile:

also:

[   391.715] (EE) modeset(0): present flip failed
[   392.402] (WW) modeset(0): Page flip failed: No such file or directory
[   392.402] (EE) modeset(0): present flip failed
[   393.006] (WW) modeset(0): Page flip failed: No such file or directory

a lot of warnings and errors, need to research that.

1 Like

Still try to setup build-environment

crosscompile packages missing in debian buster too…

try to setup armhf container there,but lxc-net seems not working…it seems it is qemu having problems here (got netwroking working so far by ignoring the errors and calling dhclient manually https://www.researchut.com/blog/cross_architecture_linux_containers/)

can install required packages and additional llvm + git in my buster-armhf container

apt install g++ meson python3-mako zlib1g-dev libexpat1-dev libdrm-dev flex bison libx11-dev libxext-dev libxdamage-dev libxcb-glx0-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-present-dev libxshmfence-dev libxxf86vm-dev libxrandr-dev x11proto-gl-dev x11proto-dri2-dev gettext pkg-config git llvm

git clone --single-branch --branch mesa-19.3.2 https://gitlab.freedesktop.org/mesa/mesa.git mesa-source
cd mesa-source
git checkout mesa-19.3.2

need to add builddir to your meson-command

meson build/ --buildtype plain --libdir lib --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload -Dplatforms=surfaceless,x11,drm -Dllvm=true -Dlmsensors=false -Dlibunwind=false -Dgallium-nine=false -Dgallium-va=false -Dgallium-vdpau=false -Dgallium-xa=false -Dgallium-xvmc=false -Dgallium-opencl=disabled -Dosmesa=none -Dbuild-tests=false -Dglx=dri -Dshared-glapi=true -Ddri3=true -Degl=true -Dgbm=true -Dgles1=false -Dgles2=true -Dglvnd=false -Dselinux=false -Dvalgrind=false -Ddri-drivers= -Dgallium-drivers=kmsro,lima,swrast -Dvulkan-drivers= -Dvulkan-overlay-layer=false --buildtype plain -Db_ndebug=true

currently compiling using ninja

ninja -C build/

build done…i hope they are compatible with my bootstrapped system :wink:

can i install into directory different to prefix?

# ninja -C build/ install
ninja: Entering directory `build/'
[1/2] Installing files.
Installing src/mapi/shared-glapi/libglapi.so.0.0.0 to /usr/lib
Installing src/mapi/es2api/libGLESv2.so.2.0.0 to /usr/lib
Installing src/glx/libGL.so.1.2.0 to /usr/lib
Installing src/gbm/libgbm.so.1.0.0 to /usr/lib
Installing src/egl/libEGL.so.1.0.0 to /usr/lib
Installing src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri
Installing /home/build/mesa/mesa-source/include/KHR/khrplatform.h to /usr/include/KHR
Installing /home/build/mesa/mesa-source/include/GLES2/gl2.h to /usr/include/GLES2
Installing /home/build/mesa/mesa-source/include/GLES2/gl2ext.h to /usr/include/GLES2
Installing /home/build/mesa/mesa-source/include/GLES2/gl2platform.h to /usr/include/GLES2
Installing /home/build/mesa/mesa-source/include/GLES3/gl3.h to /usr/include/GLES3
Installing /home/build/mesa/mesa-source/include/GLES3/gl31.h to /usr/include/GLES3
Installing /home/build/mesa/mesa-source/include/GLES3/gl32.h to /usr/include/GLES3
Installing /home/build/mesa/mesa-source/include/GLES3/gl3ext.h to /usr/include/GLES3
Installing /home/build/mesa/mesa-source/include/GLES3/gl3platform.h to /usr/include/GLES3
Installing /home/build/mesa/mesa-source/include/GL/gl.h to /usr/include/GL
Installing /home/build/mesa/mesa-source/include/GL/glcorearb.h to /usr/include/GL
Installing /home/build/mesa/mesa-source/include/GL/glext.h to /usr/include/GL
Installing /home/build/mesa/mesa-source/include/GL/glx.h to /usr/include/GL
Installing /home/build/mesa/mesa-source/include/GL/glxext.h to /usr/include/GL
Installing /home/build/mesa/mesa-source/include/EGL/egl.h to /usr/include/EGL
Installing /home/build/mesa/mesa-source/include/EGL/eglext.h to /usr/include/EGL
Installing /home/build/mesa/mesa-source/include/EGL/eglplatform.h to /usr/include/EGL
Installing /home/build/mesa/mesa-source/include/EGL/eglmesaext.h to /usr/include/EGL
Installing /home/build/mesa/mesa-source/include/EGL/eglextchromium.h to /usr/include/EGL
Installing /home/build/mesa/mesa-source/include/GL/internal/dri_interface.h to /usr/include/GL/internal
Installing /home/build/mesa/mesa-source/src/gbm/main/gbm.h to /usr/include
Installing /home/build/mesa/mesa-source/src/util/00-mesa-defaults.conf to /usr/share/drirc.d
Installing /home/build/mesa/mesa-source/build/meson-private/glesv2.pc to /usr/lib/pkgconfig
Installing /home/build/mesa/mesa-source/build/meson-private/dri.pc to /usr/lib/pkgconfig
Installing /home/build/mesa/mesa-source/build/meson-private/gbm.pc to /usr/lib/pkgconfig
Installing /home/build/mesa/mesa-source/build/meson-private/egl.pc to /usr/lib/pkgconfig
Installing /home/build/mesa/mesa-source/build/meson-private/gl.pc to /usr/lib/pkgconfig
Running custom install script '/usr/bin/python3 /home/build/mesa/mesa-source/bin/install_megadrivers.py /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so /usr/lib/dri armada-drm_dri.so exynos_dri.so hx8357d_dri.so ili9225_dri.so ili9341_dri.so imx-drm_dri.so meson_dri.so mi0283qt_dri.so mxsfb-drm_dri.so pl111_dri.so repaper_dri.so rockchip_dri.so st7586_dri.so st7735r_dri.so stm_dri.so sun4i-drm_dri.so swrast_dri.so kms_swrast_dri.so lima_dri.so'
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/armada-drm_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/exynos_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/hx8357d_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/ili9225_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/ili9341_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/imx-drm_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/meson_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/mi0283qt_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/mxsfb-drm_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/pl111_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/repaper_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/rockchip_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/st7586_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/st7735r_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/stm_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/sun4i-drm_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/swrast_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/kms_swrast_dri.so
installing /home/build/mesa/mesa-source/build/src/gallium/targets/dri/libgallium_dri.so to /usr/lib/dri/lima_dri.so
root@buster-armhf:/home/build/mesa/mesa-source# ls /usr/lib/dri
armada-drm_dri.so  imx-drm_dri.so     mxsfb-drm_dri.so	st7735r_dri.so
exynos_dri.so	   kms_swrast_dri.so  pl111_dri.so	stm_dri.so
hx8357d_dri.so	   lima_dri.so	      repaper_dri.so	sun4i-drm_dri.so
ili9225_dri.so	   meson_dri.so       rockchip_dri.so	swrast_dri.so
ili9341_dri.so	   mi0283qt_dri.so    st7586_dri.so
root@buster-armhf:/home/build/mesa/mesa-source# ls /usr/include/GL*
/usr/include/GL:
gl.h	     glext.h  glxext.h	glxmd.h     glxtokens.h
glcorearb.h  glx.h    glxint.h	glxproto.h  internal

/usr/include/GLES2:
gl2.h  gl2ext.h  gl2platform.h

/usr/include/GLES3:
gl3.h  gl31.h  gl32.h  gl3ext.h  gl3platform.h
root@buster-armhf:/home/build/mesa/mesa-source# tar -czf lima_armhf.tar.gz /usr/include/GL* usr/lib/dri/* /usr/lib/pkgconfig/* /usr/share/drirc.d
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from hard link targets
/bin/tar: usr/lib/dri/*: Cannot stat: No such file or directory
/bin/tar: Exiting with failure status due to previous errors
root@buster-armhf:/home/build/mesa/mesa-source# tar -czf lima_armhf.tar.gz /usr/include/GL* /usr/lib/dri/* /usr/lib/pkgconfig/* /usr/share/drirc.d
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from hard link targets

have uploaded binaries to my gdrive: https://drive.google.com/file/d/1FfKLXDsYnTZ6ADdswFX_H4VneDl5iW90/view?usp=sharing

my xorg reports this in log:

[ 24.373] (II) Initializing extension DRI3
[ 24.373] (II) Initializing extension X-Resource
[ 24.374] (II) Initializing extension XVideo
[ 24.376] (II) Initializing extension XVideo-MotionCompensation
[ 24.376] (II) Initializing extension SELinux
[ 24.376] (II) SELinux: Disabled on system
[ 24.376] (II) Initializing extension GLX
[ 24.377] (II) AIGLX: Screen 0 is not DRI2 capable
[ 24.406] (II) IGLX: Loaded and initialized swrast
[ 24.406] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[ 24.406] (II) Initializing extension XFree86-VidModeExtension
[ 24.407] (II) Initializing extension XFree86-DGA
[ 24.413] (II) Initializing extension XFree86-DRI
[ 24.413] (II) Initializing extension DRI2 …

but i have not done any modifications to mesa-source…

i have ~620 frames in 5s (=120 fps) on running glxgears in default resolution (~190 in maximize mode = 38 fps). on exit glxgears i got XIO: fatal IO error 11 (ressource temorarily unavailable)

my vendor string is vmware (i guess because i compiled in lxc-container in virtualbox-vm) :wink: wonder why there is not lima shown…

less /home/frank/glxinfo.txt                                     
OpenGL vendor string: VMware, Inc.                                              
OpenGL renderer string: llvmpipe (LLVM 7.0, 128 bits)                           
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.3.6              
OpenGL core profile shading language version string: 3.30                       
OpenGL core profile context flags: (none)                                       
OpenGL core profile profile mask: core profile                                  
OpenGL core profile extensions:                                                 
OpenGL version string: 3.1 Mesa 18.3.6                                          
OpenGL shading language version string: 1.40                                    
OpenGL context flags: (none)                                                    
OpenGL extensions:                                                              
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.3.6                     
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00       
OpenGL ES profile extensions:

have not modified my xorg.conf yet, only copied build files to my system and started system…

mhm, lima module was not loaded due to my blacklisting…load lima and restart lightdm…

xorg.log says same, frames are still same, cpu is 237% on glxgears…so something is still wrong, rebuild with your changes, but now i got “Segmentation fault at address 0xbc” in xorg log ;( but i see no hint which dri-module is loaded

This means you don’t use lima, it’s a sowtware OpenGL version.

Try to check if all previous versions are uninstalled.

Had replaced all files…but i try now building on r2 directly…i guess in vm it is linked to other libraries…

For me it took about 20 minutes.

build only takes 10 min…i installed and got same error… ;( any way to debug it?

[    23.371] (II) Loading sub module "glamoregl"                                                                                                                              
[    23.371] (II) LoadModule: "glamoregl"                                                                                                                                     
[    23.372] (II) Loading /usr/lib/xorg/modules/libglamoregl.so                                                                                                               
[    23.396] (II) Module glamoregl: vendor="X.Org Foundation"                                                                                                                 
[    23.396]    compiled for 1.20.4, module version = 1.0.1                                                                                                                   
[    23.396]    ABI class: X.Org ANSI C Emulation, version 0.4                                                                                                                
[    23.780] (EE)                                                                                                                                                             
[    23.780] (EE) Backtrace:                                                                                                                                                  
[    23.781] (EE)                                                                                                                                                             
[    23.781] (EE) Segmentation fault at address 0xbc                                                                                                                          
[    23.781] (EE)                                                                                                                                                             
Fatal server error:                                     
[    23.781] (EE) Caught signal 11 (Segmentation fault). Server aborting                                                                                                      

i had applied your changes (adding mediatek to 2 files) to source i cloned from git.

this is my /etc/X11/xorg.conf.d/20-dri.conf

Section "Device"
  Identifier  "mediatek"
  Driver      "modesetting"
  Option      "HWCursor" "false"
  Option      "SwapbuffersWait" "true"
EndSection

Section "Monitor"
  Identifier  "Monitor0"
  Option      "DPMS" "false"
EndSection

Section "ServerFlags"
  Option "AutoAddGPU" "off"
  Option "BlankTime" "0"
  Option "StandbyTime" "0"
  Option "SuspendTime" "0"
  Option "OffTime" "0"
EndSection

lima looks initialized and i have no further info in dmesg / syslog

arg…can’t get x-server working again without lima…removed /usr/include/dri and some other modules in /usr/lib installed by the ninja install-function…now i have x again :joy:

how is the linking between xorg and the right dri-module?

I migght ne wrong, but as i know it’s throuhgt libglamoregl, and int’s a parto of xorg.

By logs looks like segfault apperts on libglamoregl use, did you tried gdb?

in ma case this log part looks:

[ 40084.038] (II) LoadModule: "glamoregl"
[ 40084.039] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[ 40084.102] (II) Module glamoregl: vendor="X.Org Foundation"
[ 40084.103]    compiled for 1.20.6, module version = 1.0.1
[ 40084.103]    ABI class: X.Org ANSI C Emulation, version 0.4
[ 40084.961] (II) modeset(0): glamor X acceleration enabled on Mali450
[ 40084.961] (II) modeset(0): glamor initialized
[ 40084.961] (II) modeset(0): Output HDMI-1 has no monitor section
[ 40084.961] (II) modeset(0): Up to 1 crtcs needed for screen.
[ 40084.962] (II) modeset(0): Allocated crtc nr. 0 to this screen.
[ 40084.962] (II) modeset(0): Allocated crtc nr. 1 to this screen.
[ 40084.962] (II) modeset(0): EDID for output HDMI-1
[ 40084.962] (II) modeset(0): Output HDMI-1 disconnected
[ 40084.962] (WW) modeset(0): No outputs definitely connected, trying again...
[ 40084.962] (II) modeset(0): Output HDMI-1 disconnected
[ 40084.962] (WW) modeset(0): Unable to find connected outputs - setting 1024x768 initial framebuffer
[ 40084.962] (==) modeset(0): Using gamma correction (1.0, 1.0, 1.0)
[ 40084.962] (==) modeset(0): DPI set to (96, 96)

P.S. (no display connected)

I guess libglamoregl loads the dri module…if i remove dri-folder i have no segfault…i’m not familar with gdb…afaik i have to compile mesa with debug symbols right? Can you guide me here and how to start xorg/lightdm with gdb?

Likely yes, but I would recommend to start with xorg debug symbols. As I know Debian has *-dbg packages.

Start xorg is enough, without any DMs (startx, or X), so it should be like:

gdb starx, or gdb X

Then: run, backtrace For example: http://www.unknownroad.com/rtfm/gdbtut/gdbsegfault.html

You can also Google it: “gdb segfault”

BTW, almost forgot. Mesa requires libdrm

for mesa-19.3.2 libdrm-2.4.100 fits good. But if you use git mesa you probably should use git-version of libdrm.

lima uses amdpgu_scheduler, so libdrm probably should have amdgpu support, but i’m not shure for 100%.

How have you compiled (and which repo)? Should it not print error if any lib is not found?

https://cgit.freedesktop.org/mesa/drm/log/?h=libdrm-2.4.100 does it build by default with amdgpu or do i need any changes?

I use gentoo - source based distro, so installation involves compilation, I just need to apply patches.

I think it should just skip it.

I don’t remember, but you can try configure --help

http://www.linuxfromscratch.org/blfs/view/svn/x/libdrm.html hope this will help (am away from pc and r2, so can’t check right now)

tried compiling and installing libdrm, works so far, but after trying to recompile mesa i have many missing header-file…i don’t know why compile before works and now not…this file are really not there

../src/glx/glxclient.h:52:10: fatal error: GL/glxproto.h: No such file or directory

i reinstalled x11proto-dev to fix it

apt install --reinstall x11proto-dev

still same segfault ;( tried installing dbg-package and gdb and start x in gdb (not working)

root@bpi-r2:~# gdb /usr/lib/xorg/Xorg 
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/xorg/Xorg...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/lib/xorg/Xorg 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.9.0-8-arm64 armv8l Debian
Current Operating System: Linux bpi-r2 5.4.12-bpi-r2-lima #123 SMP Wed Jan 22 10:25:46 CET 2020 armv7l
Kernel command line: board=bpi-r2 earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait vmalloc=496M de
bug=7 initcall_debug=0 net.ifnames=0 video=1024x600
Build Date: 05 March 2019  08:11:12PM
xorg-server 2:1.20.4-1 (https://www.debian.org/support) 
Current version of pixman: 0.36.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Mon Jan 27 14:38:55 2020
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Program received signal SIGSEGV, Segmentation fault.
0xb26af638 in ?? () from /usr/lib/arm-linux-gnueabihf/libEGL_mesa.so.0

i try to enable debug-info in mesa, but have not found a working way…if i try with buildtype debug meson says it is already configured, removed now build-dir, but still “buildtype is: plain”

 meson build/ --buildtype debug ...

Did you ran backtrace? Looks like segfault is in mesa, so it’s good to build it with debug symbols. https://www.mesa3d.org/debugging.html

BTW, what distro do you use, does it’s image published? I can try it by myself.