[Mesa-users] RPi4 issue with DRM_RENDER_ALLOW
Michael Taubert
info at arachnodroid.de
Tue Mar 16 07:08:47 UTC 2021
Good morning list!
To answer my own question...
It turns out that the Buildroot configure scripts silently disabling
dri3 when no DRI driver is selected. Though it seems that the Gallium
drivers for VC4/V3D reverting to DRI. But because there was no dri
support compiled in, it must fail in the end. So for everybody who is
trying to get a Buildroot linux with GPU acceleration, consider to
enable at least in
Target Packages -> Graphic libraries... -> mesa3d
Gallium KMSRO driver
Gallium v3d driver
Gallium vc4 driver
DRI swrast driver
With these options I got it working now and swrast is not being used.
Instead, using LIBGL_DEBUG=verbose, you will see that it reverts to
DRI3. With the -info you will also see that it is using the V3D 4.2
renderer.
Best regards,
Michael
Am 15.03.2021 um 18:24 schrieb Michael Taubert:
>
> Yes, that was one of my first thoughts so I check the permissions in
> the filesystem. I think they are okay, as everything is running with
> user root, at the moment.
>
> # namei -l /dev/dri/renderD128
> f: /dev/dri/renderD128
> drwxr-xr-x root root /
> drwxr-xr-x root root dev
> drwxr-xr-x root root dri
> crw-rw-rw- root video renderD128
>
> Today I had the chance to check that on a Raspbian and with strace I
> couldn't find a DRM_IOCTL_GEM_OPEN. They both have a permission denied
> on DRM_IOCTL_GET_UNIQUE, so I assume that the GEM_OPEN is the problem
> here. It makes me think that it's a problem with my compilation of
> Mesa3D or may be the configuration? According to the kernel manpage
> https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html
>
> "With render nodes, user-space can now control access to the render
> node via basic file-system access-modes. A running graphics server
> which authenticates clients on the privileged primary/legacy node is
> no longer required. Instead, a client can open the render node and is
> immediately granted GPU access."
>
> It seems to me that glxgears shouldn't even try to perform any
> privileged ioctl's on the render node (dev/dri/renderD128).
>
> On Raspbian, glxgears continues with a DRM_IOCTL_PRIME_FD_TO_HANDLE.
> So what is causing glxgears to use this, instead of a DRM_IOCTL_GEM_OPEN?
>
> Best regards,
>
> Michael
>
> Am 15.03.2021 um 14:02 schrieb Jens Owen:
>> It’s been a while for me, but you might check if you have an issue
>> with permissions. A quick check would be to see if glxgears works
>> when run as root.
>>
>> Hi all!
>>
>> The last days I've been struggling with mesa3d to get GPU
>> acceleration
>> on X, on my Raspberry Pi 4 Model B. Maybe someone knows how to
>> deal with it.
>>
>> Using Buildroot I've compiled a system with mesa3d, using KMSRO,
>> V3D and
>> VC4 Gallium drivers. X11 is starting up, stating that DRI is
>> initialised
>> and everything seems to work. But when I run glxinfo or glxgears,
>> it is
>> stating 'Failed to open bo 1: Permission denied'. glxgears opens a
>> window which simply stays black. So I started to track it down
>> and ended
>> up in drivers/drm/drm_ioctl.c.
>>
>> The specific function that returns EACCES (-13) is
>> drm_ioctl_permit().
>> To identify the failing condition I've added some DRM_DEBUG() for
>> each
>> one of the four condition there. After enabling drm.debug with
>>
>> # echo 0xf > /sys/module/drm/parameters/debug
>>
>> I see that it fails on the DRM_RENDER_ALLOW condition. I don't
>> know how
>> this all works together and what it means, in detail. So I'm lost
>> now. I
>> assume that X11 is occupying the exclusive access to the render node
>> /dev/dri/renderD128. But how does glxgears should work now? What I'm
>> trying to archive is to run chromium with GPU acceleration, but
>> the GPU
>> process is crashing and reverts to software rendering.
>>
>> When running glxinfo it is showing all the renderer information,
>> which
>> looks good, though it shows that permission denied too. All
>> programs are
>> running as root at the moment and the filesystem permissions look
>> good.
>>
>> As I said, I'm lost and don't know that much about all this to go
>> any
>> further, so I'm stuck at it now. I hope someone here got the missing
>> piece for me to get it working, though I'm not sure wether it is the
>> right place for this question. May be it's related to kernel
>> configuration, to the Raspberry firmware, or what so ever. But I
>> even
>> don't know that.
>>
>> Software used:
>>
>> Mesa3D 20.3.4
>> Linux 5.10.y (branch at github.com/raspberrypi/linux
>> <http://github.com/raspberrypi/linux>)
>> Firmware stable (branch at github.com/raspberrypi/firmware
>> <http://github.com/raspberrypi/firmware>)
>>
>> Thank you in advance. Further down you will find some output from
>> strace
>> and drm.debug.
>>
>> Best regards,
>>
>> Michael
>>
>> ==== strace of glxgears
>> openat(AT_FDCWD, "/dev/dri/renderD128",
>> O_RDWR|O_LARGEFILE|O_CLOEXEC) = 6
>> ioctl(6, DRM_IOCTL_VERSION, 0x15084e0) = 0
>> ioctl(6, DRM_IOCTL_VERSION, 0x15084e0) = 0
>> ioctl(6, DRM_IOCTL_GET_UNIQUE, 0xbedebcd0) = -1 EACCES
>> (Permission denied)
>> ioctl(6, DRM_IOCTL_EXYNOS_GEM_GET or DRM_IOCTL_PANFROST_GET_PARAM
>> or DRM_IOCTL_QXL_GETPARAM or DRM_IOCTL_SIS_FB_ALLOC or
>> DRM_IOCTL_TEGRA_SYNCPT_WAIT or DRM_IOCTL_V3D_GET_PARAM or
>> DRM_IOCTL_VC4_MMAP_BO, 0xbedebf00) = 0
>> ioctl(6, DRM_IOCTL_EXYNOS_GEM_GET or DRM_IOCTL_PANFROST_GET_PARAM
>> or DRM_IOCTL_QXL_GETPARAM or DRM_IOCTL_SIS_FB_ALLOC or
>> DRM_IOCTL_TEGRA_SYNCPT_WAIT or DRM_IOCTL_V3D_GET_PARAM or
>> DRM_IOCTL_VC4_MMAP_BO, 0xbedebf10) = 0
>> ioctl(6, DRM_IOCTL_EXYNOS_GEM_GET or DRM_IOCTL_PANFROST_GET_PARAM
>> or DRM_IOCTL_QXL_GETPARAM or DRM_IOCTL_SIS_FB_ALLOC or
>> DRM_IOCTL_TEGRA_SYNCPT_WAIT or DRM_IOCTL_V3D_GET_PARAM or
>> DRM_IOCTL_VC4_MMAP_BO, 0xbedebf28) = 0
>> ioctl(6, DRM_IOCTL_EXYNOS_GEM_GET or DRM_IOCTL_PANFROST_GET_PARAM
>> or DRM_IOCTL_QXL_GETPARAM or DRM_IOCTL_SIS_FB_ALLOC or
>> DRM_IOCTL_TEGRA_SYNCPT_WAIT or DRM_IOCTL_V3D_GET_PARAM or
>> DRM_IOCTL_VC4_MMAP_BO, 0xbedebf28) = 0
>> ioctl(4, DRM_IOCTL_GET_CAP, 0xbedebf90) = 0
>> ioctl(6, DRM_IOCTL_SYNCOBJ_CREATE, 0xbedec770) = 0
>> ioctl(6, DRM_IOCTL_AMDGPU_CTX or DRM_IOCTL_ETNAVIV_GEM_NEW or
>> DRM_IOCTL_LIMA_GEM_INFO or DRM_IOCTL_MSM_GEM_NEW or
>> DRM_IOCTL_V3D_CREATE_BO or DRM_IOCTL_VC4_WAIT_BO, 0xbedec460) = 0
>> ioctl(6, DRM_IOCTL_ETNAVIV_GEM_INFO or DRM_IOCTL_OMAP_GEM_NEW or
>> DRM_IOCTL_PANFROST_MMAP_BO or DRM_IOCTL_V3D_MMAP_BO or
>> DRM_IOCTL_VC4_CREATE_BO or DRM_IOCTL_VIRTGPU_GETPARAM,
>> 0xbedec410) = 0
>> openat(AT_FDCWD, "/sys/devices/system/cpu/online",
>> O_RDONLY|O_CLOEXEC) = 7
>> ioctl(6, DRM_IOCTL_AMDGPU_CTX or DRM_IOCTL_ETNAVIV_GEM_NEW or
>> DRM_IOCTL_LIMA_GEM_INFO or DRM_IOCTL_MSM_GEM_NEW or
>> DRM_IOCTL_V3D_CREATE_BO or DRM_IOCTL_VC4_WAIT_BO, 0xbedec240) = 0
>> ioctl(6, DRM_IOCTL_ETNAVIV_GEM_INFO or DRM_IOCTL_OMAP_GEM_NEW or
>> DRM_IOCTL_PANFROST_MMAP_BO or DRM_IOCTL_V3D_MMAP_BO or
>> DRM_IOCTL_VC4_CREATE_BO or DRM_IOCTL_VIRTGPU_GETPARAM,
>> 0xbedec210) = 0
>> ioctl(6, DRM_IOCTL_GEM_OPEN, 0xbedec818) = -1 EACCES (Permission
>> denied)
>> write(2, "V3D:-1:: Failed to open bo 2: Pe"..., 48V3D:-1:: Failed
>> to open bo 2: Permission denied
>> ioctl(6, DRM_IOCTL_SYNCOBJ_CREATE, 0xbedec6d8) = 0
>> ioctl(6, DRM_IOCTL_AMDGPU_CTX or DRM_IOCTL_ETNAVIV_GEM_NEW or
>> DRM_IOCTL_LIMA_GEM_INFO or DRM_IOCTL_MSM_GEM_NEW or
>> DRM_IOCTL_V3D_CREATE_BO or DRM_IOCTL_VC4_WAIT_BO, 0xbedec3c8) = 0
>> ioctl(6, DRM_IOCTL_ETNAVIV_GEM_INFO or DRM_IOCTL_OMAP_GEM_NEW or
>> DRM_IOCTL_PANFROST_MMAP_BO or DRM_IOCTL_V3D_MMAP_BO or
>> DRM_IOCTL_VC4_CREATE_BO or DRM_IOCTL_VIRTGPU_GETPARAM,
>> 0xbedec378) = 0
>> ioctl(6, DRM_IOCTL_AMDGPU_CTX or DRM_IOCTL_ETNAVIV_GEM_NEW or
>> DRM_IOCTL_LIMA_GEM_INFO or DRM_IOCTL_MSM_GEM_NEW or
>> DRM_IOCTL_V3D_CREATE_BO or DRM_IOCTL_VC4_WAIT_BO, 0xbedec1a8) = 0
>> ioctl(6, DRM_IOCTL_ETNAVIV_GEM_INFO or DRM_IOCTL_OMAP_GEM_NEW or
>> DRM_IOCTL_PANFROST_MMAP_BO or DRM_IOCTL_V3D_MMAP_BO or
>> DRM_IOCTL_VC4_CREATE_BO or DRM_IOCTL_VIRTGPU_GETPARAM,
>> 0xbedec178) = 0
>> ioctl(6, DRM_IOCTL_GEM_OPEN, 0xbedec818) = -1 EACCES (Permission
>> denied)
>> write(2, "V3D:-1:: Failed to open bo 2: Pe"..., 48V3D:-1:: Failed
>> to open bo 2: Permission denied
>>
>>
>>
>>
>> ====== drm.debug
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.920528]
>> [drm:drm_stub_open [drm]]
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.920751]
>> [drm:drm_open [drm]] comm="glxgears", pid=448, minor=1
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.920995]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_GET_MAGIC
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.921207]
>> [drm:drm_getmagic [drm]] 1
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.921520]
>> [drm:drm_ioctl [drm]] comm="Xorg" pid=237, dev=0xe201, auth=1,
>> DRM_IOCTL_AUTH_MAGIC
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.921733]
>> [drm:drm_authmagic [drm]] 1
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.922042]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.922257]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.929723]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.929942]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.944279]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.944500]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.950969]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.951187]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.956154]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe201,
>> auth=1, VC4_GET_PARAM
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.956367]
>> [drm:drm_ioctl [drm]] comm="glxgears", pid=448, ret=-19
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.956652]
>> [drm:drm_stub_open [drm]]
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.956870]
>> [drm:drm_open [drm]] comm="glxgears", pid=448, minor=128
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.957103]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe280,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.957317]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe280,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.957548]
>> [drm:drm_release [drm]] open_count = 3
>> Mar 14 18:55:47 buildroot user.debug kernel: [35999.957754]
>> [drm:drm_file_free.part.0 [drm]] comm="glxgears", pid=448,
>> dev=0xe280, open_count=3
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.050627]
>> [drm:drm_stub_open [drm]]
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.050844]
>> [drm:drm_open [drm]] comm="glxgears", pid=448, minor=128
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.051068]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe280,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.051279]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe280,
>> auth=1, DRM_IOCTL_VERSION
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.051502]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe280,
>> auth=1, DRM_IOCTL_GET_UNIQUE
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.051704]
>> [drm:drm_ioctl_permit [drm]] DRM_RENDER_ALLOW
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.051905]
>> [drm:drm_ioctl [drm]] comm="glxgears", pid=448, ret=-13
>> ...snip...
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.121036]
>> [drm:drm_ioctl [drm]] comm="glxgears" pid=448, dev=0xe280,
>> auth=1, DRM_IOCTL_GEM_OPEN
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.121241]
>> [drm:drm_ioctl_permit [drm]] DRM_RENDER_ALLOW
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.121433]
>> [drm:drm_ioctl [drm]] comm="Xorg" pid=237, dev=0xe280, auth=1,
>> V3D_MMAP_BO
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.121635]
>> [drm:drm_ioctl [drm]] comm="glxgears", pid=448, ret=-13
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.121825]
>> [drm:drm_ioctl [drm]] comm="Xorg" pid=237, dev=0xe280, auth=1,
>> V3D_WAIT_BO
>> Mar 14 18:55:47 buildroot user.debug kernel: [36000.122071]
>> [drm:drm_ioctl [drm]] comm="Xorg" pid=237, dev=0xe280, auth=1,
>> V3D_SUBMIT_CL
>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <https://lists.freedesktop.org/archives/mesa-users/attachments/20210314/4dc3eead/attachment-0001.htm
>> <https://lists.freedesktop.org/archives/mesa-users/attachments/20210314/4dc3eead/attachment-0001.htm>>
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> mesa-users mailing list
>> mesa-users at lists.freedesktop.org
>> <mailto:mesa-users at lists.freedesktop.org>
>> https://lists.freedesktop.org/mailman/listinfo/mesa-users
>> <https://lists.freedesktop.org/mailman/listinfo/mesa-users>
>>
>>
>> ------------------------------
>>
>> End of mesa-users Digest, Vol 130, Issue 3
>> ******************************************
>>
>>
>> _______________________________________________
>> mesa-users mailing list
>> mesa-users at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-users
>
> _______________________________________________
> mesa-users mailing list
> mesa-users at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-users/attachments/20210316/e2cd57bc/attachment-0001.htm>
More information about the mesa-users
mailing list