Bug 252197 - benchmarks/glmark2: expose KMS console and Wayland support
Summary: benchmarks/glmark2: expose KMS console and Wayland support
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: patch, patch-ready
Depends on:
Blocks:
 
Reported: 2020-12-27 11:06 UTC by Jan Beich
Modified: 2021-03-12 10:45 UTC (History)
0 users

See Also:
jbeich: merge-quarterly?


Attachments
v1 (3.51 KB, patch)
2020-12-27 11:06 UTC, Jan Beich
no flags Details | Diff
v1.1 (3.56 KB, patch)
2020-12-28 02:18 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2020-12-27 11:06:42 UTC
Created attachment 220990 [details]
v1

Make it possible to compare performance overhead between windowing systems.

Tested on 13.0 (base r368766) amd64 via Intel Skylake GT2 (0x1912):
- glmark2 and glmark2-es2 run fine under Xwayland
- glmark2-drm and glmark2-es2-drm run fine under console
- glmark2-wayland and glmark2-es2-wayland run fine under Sway
- libglvnd ( review D25020 ) builds fine
- DRM=ON WAYLAND=ON X11=ON builds fine
- X11=ON DRM=OFF WAYLAND=OFF builds fine
- X11=ON DRM=OFF X11=OFF builds fine
- DRM=ON X11=OFF X11=OFF builds fine

 =>> Checking shared library dependencies
  0x00000001 NEEDED               Shared library: [libX11.so.6]
  0x00000001 NEEDED               Shared library: [libc++.so.1]
  0x00000001 NEEDED               Shared library: [libc.so.7]
  0x00000001 NEEDED               Shared library: [libcxxrt.so.1]
+ 0x00000001 NEEDED               Shared library: [libdrm.so.2]
+ 0x00000001 NEEDED               Shared library: [libgbm.so.1]
  0x00000001 NEEDED               Shared library: [libgcc_s.so.1]
  0x00000001 NEEDED               Shared library: [libjpeg.so.8]
  0x00000001 NEEDED               Shared library: [libm.so.5]
  0x00000001 NEEDED               Shared library: [libpng16.so.16]
  0x00000001 NEEDED               Shared library: [libthr.so.3]
+ 0x00000001 NEEDED               Shared library: [libudev.so.0]
+ 0x00000001 NEEDED               Shared library: [libwayland-client.so.0]
+ 0x00000001 NEEDED               Shared library: [libwayland-egl.so.1]
  0x00000001 NEEDED               Shared library: [libz.so.6]
Comment 1 Jan Beich freebsd_committer freebsd_triage 2020-12-28 02:18:37 UTC
Created attachment 221035 [details]
v1.1

- Disallow building without DRM, WAYLAND, X11 due to build error
- Adjust DRM_DESC after ports r559445
Comment 2 Jan Beich freebsd_committer freebsd_triage 2020-12-30 10:08:23 UTC
I plan to merge this into 2021Q1. Wayland support is important to me.
Comment 3 Alexey Dokuchaev freebsd_committer freebsd_triage 2021-01-12 02:15:34 UTC
> glmark2-drm and glmark2-es2-drm run fine under console
Actually, both of them segfault for me (just as they used to do before, so I've never enabled them).  Looking at https://github.com/glmark2/glmark2/issues/125 it seems that those patches only fix the -l mode (--list-scenes) which is quite useless as to the actual benchmarking.  Can you elaborate/confirm?

I cannot test or comment on the Wayland part, I guess it's okay to have it enabled (as it had metastased into other ports already) so long as it can be turned off.
Comment 4 Jan Beich freebsd_committer freebsd_triage 2021-01-12 12:55:07 UTC
(In reply to Alexey Dokuchaev from comment #3)
> Actually, both of them segfault for me (just as they used to do before, so I've never enabled them).

Which drm-*-kmod version did you test? glmark2-drm and glmark2-es2-drm require GBM but DMABUF isn't supported by drm-legacy-kmod. nvidia-driver probably still doesn't support KMS unlike Linux version.

> it seems that those patches only fix the -l mode (--list-scenes)

In upstream issue the first tested command was "glmark2-drm -d" i.e., didn't contain "-l" flag. Without the patches I get the following:

$ glmark2-drm
Error: eglCreateWindowSurface failed with error: 0x3009
Error: eglCreateWindowSurface failed with error: 0x3009
Error: CanvasGeneric: Invalid EGL state
Error: main: Could not initialize canvas

$ glmark2-es2-drm
Error: eglCreateWindowSurface failed with error: 0x3009
Error: eglCreateWindowSurface failed with error: 0x3009
Error: CanvasGeneric: Invalid EGL state
Error: main: Could not initialize canvas

> I cannot test or comment on the Wayland part

Wayland support can be tested (and nested) from Xorg comfort zone e.g.,

  $ startx
  xorg$ pkg install cage glmark2
  xorg$ cage -d glmark2-wayland

However, wlroots like glmark2-drm may not work without DMABUF support.
Comment 5 Jan Beich freebsd_committer freebsd_triage 2021-01-12 15:32:44 UTC
FWIW, if glmark2-drm doesn't work for you confirm with kmscube and mpv --gpu-context=drm.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2021-01-21 05:49:47 UTC
If you plan to review (again), please, do so before 2021-01-26 when maintainer timeout kicks in.
Comment 7 Alexey Dokuchaev freebsd_committer freebsd_triage 2021-01-26 06:09:22 UTC
> Which drm-*-kmod version did you test? glmark2-drm and glmark2-es2-drm require
> GBM but DMABUF isn't supported by drm-legacy-kmod.
I'm currently on drm-current-kmod-5.4.62.g20210113, but probably need to downgrade to drm-current-kmod-4.16.g20200320 because of non-working resume after STR.  My test system is Intel HD Graphics 620 (Kaby Lake GT2) if that matters.

I don't know how to test/enable GDB and DMABUF features.

> In upstream issue the first tested command was "glmark2-drm -d" i.e., didn't
> contain "-l" flag. Without the patches I get the following:
The question is, with the patches, does the actual benchmark run for you on the console with KMS/DRM modules loaded?

> you confirm with kmscube
It also does not work here, it reports:
# failed to initialize
# failed to initialize EGL

> when maintainer timeout kicks in.
There is no timeout.  As I've said, I do not object to proposed changes in principle, but only once we made them work for everyone, not just you.
Comment 8 Alexey Dokuchaev freebsd_committer freebsd_triage 2021-01-26 06:17:39 UTC
(In reply to Jan Beich from comment #4)
> xorg$ cage -d glmark2-wayland
Is this expected?
$ env XDG_RUNTIME_DIR=/tmp cage -d glmark2-wayland
$ 00:00:00.026 [../cage.c:159] Unable to drop root (we shouldn't be able to restore it after setuid), refusing to start
Comment 9 Jan Beich freebsd_committer freebsd_triage 2021-01-26 07:33:59 UTC
(In reply to Alexey Dokuchaev from comment #7)
> I don't know how to test/enable GDB and DMABUF features.

DMABUF is also used by VAAPI, so check if `mpv --no-config --hwdec=vaapi` works on X11.

> The question is, with the patches, does the actual benchmark run for you on the
> console with KMS/DRM modules loaded?

Yep.

$ glmark2-drm
WARNING: Kernel has no file descriptor comparison support: No such file or directory
=======================================================
    glmark2 2020.04
=======================================================
    OpenGL Information
    GL_VENDOR:     Intel
    GL_RENDERER:   Mesa Intel(R) HD Graphics 530 (SKL GT2)
    GL_VERSION:    4.6 (Compatibility Profile) Mesa 20.2.3
=======================================================
[build] use-vbo=false: FPS: 60 FrameTime: 16.667 ms
[build] use-vbo=true: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=nearest: FPS: 59 FrameTime: 16.949 ms
[texture] texture-filter=linear: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=mipmap: FPS: 60 FrameTime: 16.667 ms
[shading] shading=gouraud: FPS: 60 FrameTime: 16.667 ms
[shading] shading=blinn-phong-inf: FPS: 60 FrameTime: 16.667 ms
[shading] shading=phong: FPS: 60 FrameTime: 16.667 ms
[shading] shading=cel: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=high-poly: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=normals: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=height: FPS: 60 FrameTime: 16.667 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 60 FrameTime: 16.667 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 59 FrameTime: 16.949 ms
[pulsar] light=false:quads=5:texture=false: FPS: 60 FrameTime: 16.667 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 59 FrameTime: 16.949 ms
[desktop] effect=shadow:windows=4: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 60 FrameTime: 16.667 ms
[ideas] speed=duration: FPS: 59 FrameTime: 16.949 ms
[jellyfish] <default>: FPS: 60 FrameTime: 16.667 ms
[terrain] <default>: FPS: 29 FrameTime: 34.483 ms
[shadow] <default>: FPS: 60 FrameTime: 16.667 ms
[refract] <default>: FPS: 59 FrameTime: 16.949 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
=======================================================
                                  glmark2 Score: 58
=======================================================

$ glmark2-es2-drm
WARNING: Kernel has no file descriptor comparison support: No such file or directory
=======================================================
    glmark2 2020.04
=======================================================
    OpenGL Information
    GL_VENDOR:     Intel
    GL_RENDERER:   Mesa Intel(R) HD Graphics 530 (SKL GT2)
    GL_VERSION:    OpenGL ES 3.2 Mesa 20.2.3
=======================================================
[build] use-vbo=false: FPS: 60 FrameTime: 16.667 ms
[build] use-vbo=true: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=nearest: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=linear: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=mipmap: FPS: 60 FrameTime: 16.667 ms
[shading] shading=gouraud: FPS: 60 FrameTime: 16.667 ms
[shading] shading=blinn-phong-inf: FPS: 60 FrameTime: 16.667 ms
[shading] shading=phong: FPS: 60 FrameTime: 16.667 ms
[shading] shading=cel: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=high-poly: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=normals: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=height: FPS: 60 FrameTime: 16.667 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 60 FrameTime: 16.667 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 58 FrameTime: 17.241 ms
[pulsar] light=false:quads=5:texture=false: FPS: 60 FrameTime: 16.667 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 59 FrameTime: 16.949 ms
[desktop] effect=shadow:windows=4: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 60 FrameTime: 16.667 ms
[ideas] speed=duration: FPS: 59 FrameTime: 16.949 ms
[jellyfish] <default>: FPS: 60 FrameTime: 16.667 ms
[terrain] <default>: FPS: 29 FrameTime: 34.483 ms
[shadow] <default>: FPS: 60 FrameTime: 16.667 ms
[refract] <default>: FPS: 59 FrameTime: 16.949 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
=======================================================
                                  glmark2 Score: 58
=======================================================

>> you confirm with kmscube
> It also does not work here, it reports:
> # failed to initialize
> # failed to initialize EGL

Does modesetting from xorg-server work? If so try running kmscube as root.

(In reply to Alexey Dokuchaev from comment #8)
> Is this expected?
> $ env XDG_RUNTIME_DIR=/tmp cage -d glmark2-wayland
> $ 00:00:00.026 [../cage.c:159] Unable to drop root (we shouldn't be able to restore it after setuid), refusing to start

Running as root is generally not supported. Running nested as regular but different user requires adjusting permissions to X11/Wayland socket. Running on console requires "service seatd onestart" or setuid bit to grab input/drm then fork and drop permissions.
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-01-28 18:48:05 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jan 28 18:47:36 UTC 2021
New revision: 563151
URL: https://svnweb.freebsd.org/changeset/ports/563151

Log:
  benchmarks/glmark2: expose KMS console and Wayland support

  PR:		252197
  Reviewed by:	danfe (maintainer)

Changes:
  head/benchmarks/glmark2/Makefile
  head/benchmarks/glmark2/distinfo
  head/benchmarks/glmark2/pkg-plist
Comment 11 Jan Beich freebsd_committer freebsd_triage 2021-01-28 19:06:50 UTC
(In reply to Alexey Dokuchaev from comment #7)
> There is no timeout.

I can wait but if you only provide feedback at the last minute it gives an impression you're not interested.

> As I've said, I do not object to proposed changes in principle,

comment 3 said "it's okay". I've only engaged further assuming good faith but maybe that was a mistake.

> but only once we made them work for everyone, not just you.

Everyone is a plural, not just you or me. As evidenced by kmscube it appears KMS is partially broken for you[1]. I've invited someone else to test on #freebsd-xorg (via Gitter) but after 2 days no one volunteered.

[1] With such snail pace of your feedback I don't think it can be debugged in this bug. For example, KMS stuff may not work on syscons(4) but vt(4) is default on amd64+UEFI since base r268158.
Comment 12 Alexey Dokuchaev freebsd_committer freebsd_triage 2021-02-07 12:50:04 UTC
Over to interested committer, there's not much for me to do about the port at this point.