JeffyCN / xorg-xserver

X server with glamor hacks for gles2 and rga based exa
Other
15 stars 23 forks source link

xorg-xserver ask for gbm_create_device on X11 #9

Closed avafinger closed 2 years ago

avafinger commented 2 years ago

Hi Jeffy,

Debian 11, installed libmali-valhall-g610-g6p0-x11_1.9-1_arm64.deb and your rockchip/debian/1.20.11 deb package since i get error while building deb for rk3588.

I get this error with X11:

/usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/libglamoregl.so: undefined symbol: gbm_create_device
xinit: giving up
xinit: unable to connect to X server: Connection refused
ldd /usr/lib/xorg/modules/libglamoregl.so
    linux-vdso.so.1 (0x0000007faa3fe000)
    libgbm.so.1 => /usr/lib/aarch64-linux-gnu/mali/libgbm.so.1 (0x0000007faa34c000)
    libepoxy.so.0 => /lib/aarch64-linux-gnu/libepoxy.so.0 (0x0000007faa1f6000)
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007faa14b000)
    libbsd.so.0 => /lib/aarch64-linux-gnu/libbsd.so.0 (0x0000007faa126000)
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007faa0f5000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa9f7f000)
    /lib/ld-linux-aarch64.so.1 (0x0000007faa3ce000)
    libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007fa9f6b000)
    libmd.so.0 => /lib/aarch64-linux-gnu/libmd.so.0 (0x0000007fa9f4f000)

dpkg -l |grep mali
ii  libmali-valhall-g610-g6p0-x11         1.9-1                           arm64        Mali GPU User-Space Binary Drivers
avafinger commented 2 years ago

Installing your libmali deb i get to the Desktop, but not sure yet it is using mali:

xorg-server cb4c69b80 HACK: glamor: xv: Support AFBC dma buffer (https://www.debian.org/support) 
Current version of pixman: 0.40.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: Sun Aug 14 22:46:16 2022
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
arm_release_ver of this libmali is 'g6p0-01eac0', rk_so_ver is '5'.
(II) modeset(0): Bind output 195 to current crtc 102.
(II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip

(xfwm4:1138): xfwm4-WARNING **: 22:46:23.076: Unsupported GL renderer (llvmpipe (LLVM 11.0.1, 128 bits)).

The first installed libmali-valhall-g610-g6p0-x11_1.9-1_arm64.deb is built in Ubuntu with CLI, the one that worked is built by you (BSP).

I rebuilt libmali-valhall-g610-g6p0-x11_1.9-1_arm64.deb in Debian 11 but still the same error.

JeffyCN commented 2 years ago

the fisrt log means you are building x with mali, the correct way would be uninstall mali before building other pkg, and reinstall after built.

the second log looks fine(mali doesn't provide opengl/libgl), you can test with glmark2-es2.

avafinger commented 2 years ago

Hi Jeffy, Thanks for the info. glmark2-es2 works with your libmali-valhall-g610-g6p0-x11_1.9-1_arm64.deb. I will try to build again and see what i get.

Regarding xorg-xserver:
I removed libmali (and purged), reinstalled stock xorg-server,libdrm-dev,libgl, egl and rebooted to make sure it was not using any cached files. Cloned your repo again and tried to build it.

Still have this error in glamor

libtool: link: gcc -g -O2 -ffile-prefix-map=/home/rock/rockchip/xorg-xserver/xorg-xserver=. -fstack-protector-strong -Wformat -Werror=format-security -pthread -Wl,-z -Wl,relro -Wl,-Bsymbolic -o Xephyr ephyr.o ephyr_draw.o ephyrinit.o ephyrcursor.o hostx.o ephyrvideo.o ephyr_glamor_glx.o ephyr_glamor_xv.o -Wl,--export-dynamic  ../../../exa/.libs/libexa.a ../../../glamor/.libs/libglamor.a -lepoxy ../../../glamor/.libs/libglamor_egl_stubs.a ../../../dix/.libs/libdix.a ../../../hw/kdrive/src/.libs/libkdrive.a -ldbus-1 -ludev ../../../fb/.libs/libfb.a ../../../mi/.libs/libmi.a ../../../xfixes/.libs/libxfixes.a ../../../Xext/.libs/libXext.a -lselinux ../../../dbe/.libs/libdbe.a ../../../record/.libs/librecord.a ../../../glx/.libs/libglx.a ../../../glx/.libs/libglxvnd.a ../../../randr/.libs/librandr.a ../../../render/.libs/librender.a ../../../damageext/.libs/libdamageext.a ../../../dri3/.libs/libdri3.a ../../../present/.libs/libpresent.a ../../../miext/sync/.libs/libsync.a ../../../miext/damage/.libs/libdamage.a ../../../miext/shadow/.libs/libshadow.a ../../../Xi/.libs/libXi.a ../../../xkb/.libs/libxkb.a ../../../xkb/.libs/libxkbstubs.a ../../../composite/.libs/libcomposite.a ../../../os/.libs/libos.a -lgbm -lEGL -lgcrypt -lunwind -lpixman-1 -lXfont2 -lsystemd -lxshmfence -lGL -ldl -lXau -lXdmcp -lxcb-shape -lxcb-render-util -lxcb-render -lxcb-util -lxcb-image -lxcb-icccm -lxcb-shm -lxcb-keysyms -lxcb-randr -lxcb-xkb -lxcb-xv -ldrm -lxcb-glx -lxcb-xf86dri -lX11-xcb -lX11 -lxcb -laudit -lm -lbsd -pthread
/usr/bin/ld: ../../../glamor/.libs/libglamor.a(glamor.o): in function `glamor_init':
./debian/build/main/glamor/../../../../glamor/glamor.c:677: undefined reference to `glamor_glx_screen_init'
collect2: error: ld returned 1 exit status

Note: libgl1-mesa-glx is installed, but not enforced during the build.

Update: Just built libmali again with default debian11 xorg-server, libglx-dev,libglx-mesa0, mesa-common-dev libxv-dev libegl1-mesa-dev, purged libmali-valhall-g610-g6p0-x11

Still the same issue: /usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/libglamoregl.so: undefined symbol: gbm_create_device

What should i look for?

JeffyCN commented 2 years ago

there was a typo, please update and retry

avafinger commented 2 years ago

libmali and xorg-xserver?

JeffyCN commented 2 years ago

xserver

avafinger commented 2 years ago

Still have the linker error:

/usr/bin/ld: ../../../glamor/.libs/libglamor.a(glamor.o): in function `glamor_init':
./debian/build/main/glamor/../../../../glamor/glamor.c:677: undefined reference to `glamor_glx_screen_init'

Problem is it keeps finding and defining GLXEXT even after i remove it explicitly: sudo apt-get remove --purge libgl1-mesa-glx

Can you spot if it is the correct way to link:

libtool: link: gcc -g -O2 -ffile-prefix-map=/home/rock/rockchip/xorg-xserver/xorg-xserver=. -fstack-protector-strong -Wformat -Werror=format-security -pthread -Wl,-z -Wl,relro -Wl,-Bsymbolic -o Xephyr ephyr.o ephyr_draw.o ephyrinit.o ephyrcursor.o hostx.o ephyrvideo.o ephyr_glamor_glx.o ephyr_glamor_xv.o -Wl,--export-dynamic  ../../../exa/.libs/libexa.a ../../../glamor/.libs/libglamor.a -lepoxy ../../../glamor/.libs/libglamor_egl_stubs.a ../../../dix/.libs/libdix.a ../../../hw/kdrive/src/.libs/libkdrive.a -ldbus-1 -ludev ../../../fb/.libs/libfb.a ../../../mi/.libs/libmi.a ../../../xfixes/.libs/libxfixes.a ../../../Xext/.libs/libXext.a -lselinux ../../../dbe/.libs/libdbe.a ../../../record/.libs/librecord.a ../../../glx/.libs/libglx.a ../../../glx/.libs/libglxvnd.a ../../../randr/.libs/librandr.a ../../../render/.libs/librender.a ../../../damageext/.libs/libdamageext.a ../../../dri3/.libs/libdri3.a ../../../present/.libs/libpresent.a ../../../miext/sync/.libs/libsync.a ../../../miext/damage/.libs/libdamage.a ../../../miext/shadow/.libs/libshadow.a ../../../Xi/.libs/libXi.a ../../../xkb/.libs/libxkb.a ../../../xkb/.libs/libxkbstubs.a ../../../composite/.libs/libcomposite.a ../../../os/.libs/libos.a -lgbm -lEGL -lgcrypt -lunwind -lpixman-1 -lXfont2 -lsystemd -lxshmfence -lGL -ldl -lXau -lXdmcp -lxcb-shape -lxcb-render-util -lxcb-render -lxcb-util -lxcb-image -lxcb-icccm -lxcb-shm -lxcb-keysyms -lxcb-randr -lxcb-xkb -lxcb-xv -ldrm -lxcb-glx -lxcb-xf86dri -lX11-xcb -lX11 -lxcb -laudit -lm -lbsd -pthread
/usr/bin/ld: ../../../glamor/.libs/libglamor.a(glamor.o): in function `glamor_init':

gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
w
```arranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

sudo find . -name libglamor.a | xargs nm -D

glamor.o:
nm: glamor.o: no symbols

glamor_copy.o:
nm: glamor_copy.o: no symbols

glamor_core.o:
nm: glamor_core.o: no symbols

glamor_dash.o:
nm: glamor_dash.o: no symbols

glamor_font.o:
nm: glamor_font.o: no symbols

glamor_glx.o:
nm: glamor_glx.o: no symbols

glamor_composite_glyphs.o:
nm: glamor_composite_glyphs.o: no symbols

glamor_image.o:
nm: glamor_image.o: no symbols

glamor_lines.o:
nm: glamor_lines.o: no symbols

glamor_segs.o:
nm: glamor_segs.o: no symbols

glamor_render.o:
nm: glamor_render.o: no symbols

glamor_gradient.o:
nm: glamor_gradient.o: no symbols

glamor_prepare.o:
nm: glamor_prepare.o: no symbols

glamor_program.o:
nm: glamor_program.o: no symbols

glamor_rects.o:
nm: glamor_rects.o: no symbols

glamor_spans.o:
nm: glamor_spans.o: no symbols

glamor_text.o:
nm: glamor_text.o: no symbols

glamor_transfer.o:
nm: glamor_transfer.o: no symbols

glamor_transform.o:
nm: glamor_transform.o: no symbols

glamor_trapezoid.o:
nm: glamor_trapezoid.o: no symbols

glamor_triangles.o:
nm: glamor_triangles.o: no symbols

glamor_addtraps.o:
nm: glamor_addtraps.o: no symbols

glamor_glyphblt.o:
nm: glamor_glyphblt.o: no symbols

glamor_points.o:
nm: glamor_points.o: no symbols

glamor_pixmap.o:
nm: glamor_pixmap.o: no symbols

glamor_largepixmap.o:
nm: glamor_largepixmap.o: no symbols

glamor_picture.o:
nm: glamor_picture.o: no symbols

glamor_vbo.o:
nm: glamor_vbo.o: no symbols

glamor_window.o:
nm: glamor_window.o: no symbols

glamor_fbo.o:
nm: glamor_fbo.o: no symbols

glamor_compositerects.o:
nm: glamor_compositerects.o: no symbols

glamor_utils.o:
nm: glamor_utils.o: no symbols

glamor_sync.o:
nm: glamor_sync.o: no symbols

glamor_xv.o:
nm: glamor_xv.o: no symbols
sudo find . -name libglamor.a | xargs readelf -sW | grep glamor_glx_screen_init
    91: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND glamor_glx_screen_init
JeffyCN commented 2 years ago

reuploaded, needs to include the config.h

JeffyCN commented 2 years ago

if your mali deb doesn't work, please upload it, maybe i can check what is different

avafinger commented 2 years ago

Please, here is the x11 deb that does not work (debian11 X11), on ubuntu (gbm) it works: libmali.zip

avafinger commented 2 years ago

Still the same error. Fresh clone, -b rockchip/debian/1.20.11

Here is the complete log for analysis: build_log.zip

JeffyCN commented 2 years ago

Still the same error. Fresh clone, -b rockchip/debian/1.20.11

Here is the complete log for analysis: build_log.zip

that version should failed to build glamor_glx.c due to header order.

try to upload, the newest version would be:

+++ b/glamor/glamor_glx.c
@@ -21,6 +21,10 @@
  * IN THE SOFTWARE.
  */

+#include "dix-config.h" <---- including defination of GLXEXT
+
+#ifdef GLXEXT
+
 #include <epoxy/glx.h>
 #include "glamor_context.h"

@@ -66,3 +70,5 @@ glamor_glx_screen_init(struct glamor_context *glamor_ctx)

     return True;
 }
+
+#endif // GLXEXT
JeffyCN commented 2 years ago

Please, here is the x11 deb that does not work (debian11 X11), on ubuntu (gbm) it works: libmali.zip

it looks like your libgbm.so.1 doesn't link with libmali_hook, which it was built with "link_with : libhook". could due to different version of meson.

maybe try:


+++ b/meson.build
@@ -215,7 +215,8 @@ foreach name, values : map
     shared_library(
       wrapper,
       dummy_source,
-      link_with : libhook,
+      link_with : [libhook, libmali],
JeffyCN commented 2 years ago

could not repro that error:

 ./scripts/update_debian.sh lib/aarch64-linux-gnu/libmali-valhall-g610-g6p0-x11-gbm.so
 dpkg-buildpackage -us -uc -b --host-arch arm64
readelf -d libmali-valhall-g610-g6p0-x11-gbm/libgbm.so|grep Sha
 0x0000000000000001 (NEEDED)             Shared library: [libmali_hook.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libmali.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

maybe upload the generated libmali-valhall-g610-g6p0-x11-gbm directory

avafinger commented 2 years ago

Hi Jeffy, Hmm, you have a different repo.

I am using: git clone https://gitlab.com/rk3588_linux/linux/libmali

find -name libmali-valhall-g610-g6p0-x11-gbm.so find -name libmali-valhall-g610-g6p0-x11.so ./debian/libmali-valhall-g610-g6p0-x11/usr/lib/aarch64-linux-gnu/libmali-valhall-g610-g6p0-x11.so ./lib/arm-linux-gnueabihf/libmali-valhall-g610-g6p0-x11.so ./lib/aarch64-linux-gnu/libmali-valhall-g610-g6p0-x11.so

readelf -d ./libmali-valhall-g610-g6p0-x11/libgbm.so

Dynamic section at offset 0xe20 contains 22 entries:
  Tag        Type                         Name/Value
 0x000000000000000e (SONAME)             Library soname: [libgbm.so.1]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/hook:$ORIGIN/../optimize_3/aarch64-linux-gnu]
 0x000000000000000c (INIT)               0x428
 0x000000000000000d (FINI)               0x564
 0x0000000000000019 (INIT_ARRAY)         0x10e10
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x10e18
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x1f0
 0x0000000000000005 (STRTAB)             0x2b8
 0x0000000000000006 (SYMTAB)             0x210
 0x000000000000000a (STRSZ)              150 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x10fe8
 0x0000000000000002 (PLTRELSZ)           48 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x3f8
 0x0000000000000007 (RELA)               0x350
 0x0000000000000008 (RELASZ)             168 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          3
 0x0000000000000000 (NULL)               0x0

Please, Can you share your repo?

avafinger commented 2 years ago

the xorg-xserver was built successfully. i will test it with your libmali deb.

JeffyCN commented 2 years ago

https://github.com/JeffyCN/rockchip_mirrors/tree/libmali

avafinger commented 2 years ago

xorg-xserver is working. Just a question, glmark2-es2 seems to be slower than wayland, twice slower at least. Is this expected?

avafinger commented 2 years ago

Unfortunately, it did not work, the same as before. Are you on Debian 11 or Debian 10? I will redo everything on Debian 10 and check.

readelf -d libmali-valhall-g610-g6p0-x11-gbm/libgbm.so

Dynamic section at offset 0xe20 contains 22 entries:
  Tag        Type                         Name/Value
 0x000000000000000e (SONAME)             Library soname: [libgbm.so.1]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/hook:$ORIGIN/../optimize_3/aarch64-linux-gnu:$ORIGIN/]
 0x000000000000000c (INIT)               0x430
 0x000000000000000d (FINI)               0x574
 0x0000000000000019 (INIT_ARRAY)         0x10e10
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x10e18
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x1f0
 0x0000000000000005 (STRTAB)             0x2b8
 0x0000000000000006 (SYMTAB)             0x210
 0x000000000000000a (STRSZ)              159 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x10fe8
 0x0000000000000002 (PLTRELSZ)           48 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x400
 0x0000000000000007 (RELA)               0x358
 0x0000000000000008 (RELASZ)             168 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          3
 0x0000000000000000 (NULL)               0x0
lsb_release -ra
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye
meson -v
0.56.2

sudo dpkg -i libmali-valhall-g610-g6p0-x11-gbm_1.9-1_arm64.deb

X.Org X Server 1.20.11
X Protocol Version 11, Revision 0
Build Operating System: linux Debian
Current Operating System: Linux rock5b 5.10.66-rk3588 #1 SMP Sun Jul 10 16:34:34 -03 2022 aarch64
Kernel command line: earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait  root=UUID=7f04f94c-3323-49b8-a781-7f85f60d816e
Build Date: 13 April 2021  04:07:31PM
xorg-server e21378a configure.ac: Fix gbm function check errors (https://www.debian.org/support) 
Current version of pixman: 0.40.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: Tue Aug 16 15:43:00 2022
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
/usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/libglamoregl.so: undefined symbol: gbm_create_device
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
avafinger commented 2 years ago

xorg-xserver fixed. libmali to be rebuilt on debian 10 and see if it is ok. Thank You!

JeffyCN commented 2 years ago

the dummy libgbm.so should link to libmali_hook.so, it's written in the meson.build with 1/ as-needed disabled 2/ link_with libhook and libmali

i don't know why, and could not repro it. i was cross building it on my debian 10 host with meson 0.62(tried 0.56 too).