Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 2020 20:54:09 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Frederic Chardon <chardon.frederic@gmail.com>
Cc:        Niclas Zeising <zeising+freebsd@daemonic.se>, freebsd-x11@freebsd.org, FreeBSD Questions Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Wayland on FreeBSD
Message-ID:  <wo6a-ouni-wny@FreeBSD.org>
In-Reply-To: <CAMODbknWFRzru%2B1Ej3XGV6fUmdKRQB-wUf-3bEqqrQJryw37MQ@mail.gmail.com> (Frederic Chardon's message of "Mon, 20 Apr 2020 20:25:23 %2B0200")
References:  <CAFYkXjmfyLZAi1HZe-RE3wLxa6GRNP6GkmtZG-4T2puRDOz0JA@mail.gmail.com> <o8rn-snio-wny@FreeBSD.org> <CAMODbkmL5PT0Q3inE=o9T2T-Gw-d6_JcHCXZSYpfm_UGdXfzxg@mail.gmail.com> <6c7abdcf-aeef-4af4-b8f4-9d7fd0e45cf0@localhost> <7fba319c-c012-8893-3ce0-e2a166c38d2d@daemonic.se> <CAMODbkkGvUUwXqzFieyM-MMwQiRu2b6L1hmvgMn9MchDkpB7ig@mail.gmail.com> <d082-pa3p-wny@FreeBSD.org> <CAMODbknWFRzru%2B1Ej3XGV6fUmdKRQB-wUf-3bEqqrQJryw37MQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Frederic Chardon <chardon.frederic@gmail.com> writes:

> Le lun. 20 avr. 2020 =C3=A0 15:20, Jan Beich <jbeich@freebsd.org> a =C3=
=A9crit :
>
>>
>> Frederic Chardon <chardon.frederic@gmail.com> writes:
>>
>> > Le lun. 20 avr. 2020 =C3=A0 12:20, Niclas Zeising
>> > <zeising+freebsd@daemonic.se> a =C3=A9crit :
>> >
>> >>
>> >> On 2020-04-20 12:07, Greg V wrote:
>> >> > Apr 20, 2020 12:56:35 PM Frederic Chardon <chardon.frederic@gmail.c=
om>:
>> >> >
>> >> >> Le dim. 19 avr. 2020 =C3=A0 13:50, Jan Beich <jbeich@freebsd.org> =
a =C3=A9crit :
>> >> >>
>> >> >>>
>> >> >>>
>> >> >>> I'm using Sway myself primarily with X11 applications. For exampl=
e,
>> >> >>> "vblank_mode=3D0 glxgears" shows 3x more FPS than on real Xorg se=
rver. ;)
>> >> >>>
>> >> >>
>> >> >> I decided to give it a try, is hardware acceleration supposed to w=
ork?
>> >> >> glxgears gives 10x less fps than with X, and 3D is incredibly
>> >> >> sluggish.
>> >> >> eglinfo output that leads me to believe it is not:
>> >> >> GBM platform:
>> >> >> i965_dri.so does not support the 0xffffffff PCI ID.
>> >> >>
>> >> >> It is with sway, -current from yesterday, intel HD4000 iGPU (Ivybr=
idge i5-3320M)
>> >> >> no difference between drm-devel-kmod or drm-current-kmod.
>> >> >
>> >> > Sway itself wouldn't even start without hardware rendering, it does=
n't *have* a software renderer.
>> >> >
>> >> > For the X applications like glxgears, I guess with the mesa build
>> >> > that's in official ports currently you still need that DRI3
>> >> > something environment variable..
>> >>
>> >> You shouldn't need that one.  We switched the default to use DRI3 not
>> >> long after xorg-server was updated to 1.20.
>> >> https://svnweb.freebsd.org/ports?view=3Drevision&revision=3D528071
>> >> It should also be in the latest quarterly branch.
>> >> Regards
>> >> --
>> >> Niclas
>> >
>> > With or without LIBGL_DRI3_ENABLE=3D1 in the environment the result is
>> > the same. I use official packages, updated yesterday.
>> >
>> > The problem I face might be due to permission issue. ktrace shows this:
>> > 28047 eglinfo  CALL  openat(AT_FDCWD,0x7fffffffc820,0x100002<O_RDWR|O_=
CLOEXEC>)
>> > 28047 eglinfo  NAMI  "/dev/dri/card0"
>> > 28047 eglinfo  RET   openat 3
>> > /..../
>> > 28047 eglinfo  CALL  ioctl(0x3,0xc0106446,0x7fffffffbc70)
>> > 28047 eglinfo  RET   ioctl -1 errno 13 Permission denied
>>
>> What initializes DRI3 is Xwayland which is started by Sway. DRI3 can
>> fail for weird reasons (e.g., bug 241821), so make sure you have
>>
>> https://reviews.freebsd.org/D23846
>>
>> As graphics/mesa-demos doesn't install eglgears_wayland to check OpenGL
>> acceleration in native Wayland clients try multimedia/mpv instead e.g.,
>>
>>   $ pkg install mpv
>>   $ mpv --no-config --msg-level=3Dvo/gpu=3Dv --gpu-api=3Dopengl --gpu-co=
ntext=3Dwayland /path/to/foo.mp4
>
> Thanks, I'm at r360105 so this fix is included. mpv doesn't output any er=
ror.

What does mpv show as GL_RENDERER? If not llvmpipe (or swrast) then
hardware acceleration in native Wayland clients works fine for you.

> I installed benchmarks/glmark2, it scores an average of 8 times less
> fps under wayland than X11. So wayland in general works, but OpenGL is
> slow. Is it expected?

glmark2 doesn't seem to support Wayland natively, so like glxgears it
tests Xwayland support. If Xwayland failed to initialize DRI3 then
all X11 clients would use slow software rendering.

  $ printenv | fgrep -i display
  DISPLAY=3D:0
  WAYLAND_DISPLAY=3Dwayland-0

  $ env -u DISPLAY glmark2
  Error: main: Could not initialize canvas

  $ env -u DISPLAY glmark2-es2
  Error: main: Could not initialize canvas

Try starting Sway via "ktrace -i" or replace Xwayland binary with a
wrapper (see below) that starts it via ktrace. Tracing glxgears is too
late as Mesa will simply give up if DRI3 is not initialized.

# Make sure Xwayland on restart prints "i965_dri.so does not support the 0x=
ffffffff PCI ID."
$ pkill Xwayland
$ PATH=3D$HOME/.local/bin:$PATH
$ cat ~/.local/bin/Xwayland
#! /bin/sh

# Exclude current directory from PATH
PATH=3D$(IFS=3D:; for p in $PATH; do case $p in (${0%/*});; (*) echo -n "$p=
:" ;; esac; done)

# Run the actual app
exec ktrace -f /tmp/xwayland.$(id -u).ktrace ${0##*/} "$@"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?wo6a-ouni-wny>