<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Good morning list!</p>
    <p>To answer my own question...</p>
    <p>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<br>
    </p>
    <p>Target Packages -> Graphic libraries... -> mesa3d</p>
    <p>Gallium KMSRO driver<br>
      Gallium v3d driver<br>
      Gallium vc4 driver<br>
      DRI swrast driver</p>
    <p>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.</p>
    <p>Best regards,</p>
    <p>Michael<br>
    </p>
    <div class="moz-cite-prefix">Am 15.03.2021 um 18:24 schrieb Michael
      Taubert:<br>
    </div>
    <blockquote type="cite"
      cite="mid:a3d5770d-feea-1669-e22f-4f8673b34e53@arachnodroid.de">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>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.</p>
      <p># namei -l /dev/dri/renderD128<br>
        f: /dev/dri/renderD128<br>
        drwxr-xr-x root root  /<br>
        drwxr-xr-x root root  dev<br>
        drwxr-xr-x root root  dri<br>
        crw-rw-rw- root video renderD128<br>
      </p>
      <p>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 <a
          class="moz-txt-link-freetext"
          href="https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html"
          moz-do-not-send="true">https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html</a><br>
      </p>
      <p>"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."</p>
      <p>It seems to me that glxgears shouldn't even try to perform any
        privileged ioctl's on the render node (dev/dri/renderD128).</p>
      <p>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?</p>
      <p>Best regards,</p>
      <p>Michael<br>
      </p>
      <div class="moz-cite-prefix">Am 15.03.2021 um 14:02 schrieb Jens
        Owen:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAJ5TNtb_0wZYeB1SBNf1igHx0Sw0QeqOHnvZHRZC6nk0jN0QDw@mail.gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div dir="auto">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.</div>
        <div dir="auto"><br>
        </div>
        <div>
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"
              dir="auto"> Hi all!<br>
              <br>
              The last days I've been struggling with mesa3d to get GPU
              acceleration <br>
              on X, on my Raspberry Pi 4 Model B. Maybe someone knows
              how to deal with it.<br>
              <br>
              Using Buildroot I've compiled a system with mesa3d, using
              KMSRO, V3D and <br>
              VC4 Gallium drivers. X11 is starting up, stating that DRI
              is initialised <br>
              and everything seems to work. But when I run glxinfo or
              glxgears, it is <br>
              stating 'Failed to open bo 1: Permission denied'. glxgears
              opens a <br>
              window which simply stays black. So I started to track it
              down and ended <br>
              up in drivers/drm/drm_ioctl.c.<br>
              <br>
              The specific function that returns EACCES (-13) is
              drm_ioctl_permit(). <br>
              To identify the failing condition I've added some
              DRM_DEBUG() for each <br>
              one of the four condition there. After enabling drm.debug
              with<br>
              <br>
              # echo 0xf > /sys/module/drm/parameters/debug<br>
              <br>
              I see that it fails on the DRM_RENDER_ALLOW condition. I
              don't know how <br>
              this all works together and what it means, in detail. So
              I'm lost now. I <br>
              assume that X11 is occupying the exclusive access to the
              render node <br>
              /dev/dri/renderD128. But how does glxgears should work
              now? What I'm <br>
              trying to archive is to run chromium with GPU
              acceleration, but the GPU <br>
              process is crashing and reverts to software rendering.<br>
              <br>
              When running glxinfo it is showing all the renderer
              information, which <br>
              looks good, though it shows that permission denied too.
              All programs are <br>
              running as root at the moment and the filesystem
              permissions look good.<br>
              <br>
              As I said, I'm lost and don't know that much about all
              this to go any <br>
              further, so I'm stuck at it now. I hope someone here got
              the missing <br>
              piece for me to get it working, though I'm not sure wether
              it is the <br>
              right place for this question. May be it's related to
              kernel <br>
              configuration, to the Raspberry firmware, or what so ever.
              But I even <br>
              don't know that.<br>
              <br>
              Software used:<br>
              <br>
              Mesa3D 20.3.4<br>
              Linux 5.10.y (branch at <a
                href="http://github.com/raspberrypi/linux"
                rel="noreferrer" target="_blank" moz-do-not-send="true">github.com/raspberrypi/linux</a>)<br>
              Firmware stable (branch at <a
                href="http://github.com/raspberrypi/firmware"
                rel="noreferrer" target="_blank" moz-do-not-send="true">github.com/raspberrypi/firmware</a>)<br>
              <br>
              Thank you in advance. Further down you will find some
              output from strace <br>
              and drm.debug.<br>
              <br>
              Best regards,<br>
              <br>
              Michael<br>
              <br>
              ==== strace of glxgears<br>
              openat(AT_FDCWD, "/dev/dri/renderD128",
              O_RDWR|O_LARGEFILE|O_CLOEXEC) = 6<br>
              ioctl(6, DRM_IOCTL_VERSION, 0x15084e0)  = 0<br>
              ioctl(6, DRM_IOCTL_VERSION, 0x15084e0)  = 0<br>
              ioctl(6, DRM_IOCTL_GET_UNIQUE, 0xbedebcd0) = -1 EACCES
              (Permission denied)<br>
              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<br>
              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<br>
              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<br>
              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<br>
              ioctl(4, DRM_IOCTL_GET_CAP, 0xbedebf90) = 0<br>
              ioctl(6, DRM_IOCTL_SYNCOBJ_CREATE, 0xbedec770) = 0<br>
              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<br>
              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<br>
              openat(AT_FDCWD, "/sys/devices/system/cpu/online",
              O_RDONLY|O_CLOEXEC) = 7<br>
              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<br>
              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<br>
              ioctl(6, DRM_IOCTL_GEM_OPEN, 0xbedec818) = -1 EACCES
              (Permission denied)<br>
              write(2, "V3D:-1:: Failed to open bo 2: Pe"..., 48V3D:-1::
              Failed to open bo 2: Permission denied<br>
              ioctl(6, DRM_IOCTL_SYNCOBJ_CREATE, 0xbedec6d8) = 0<br>
              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<br>
              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<br>
              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<br>
              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<br>
              ioctl(6, DRM_IOCTL_GEM_OPEN, 0xbedec818) = -1 EACCES
              (Permission denied)<br>
              write(2, "V3D:-1:: Failed to open bo 2: Pe"..., 48V3D:-1::
              Failed to open bo 2: Permission denied<br>
              <br>
              <br>
              <br>
              <br>
              ====== drm.debug<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.920528] [drm:drm_stub_open [drm]]<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.920751] [drm:drm_open [drm]] comm="glxgears",
              pid=448, minor=1<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.921207] [drm:drm_getmagic [drm]] 1<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.921733] [drm:drm_authmagic [drm]] 1<br>
              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<br>
              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<br>
              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<br>
              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<br>
              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<br>
              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<br>
              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<br>
              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<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.956367] [drm:drm_ioctl [drm]] comm="glxgears",
              pid=448, ret=-19<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.956652] [drm:drm_stub_open [drm]]<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.956870] [drm:drm_open [drm]] comm="glxgears",
              pid=448, minor=128<br>
              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<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [35999.957548] [drm:drm_release [drm]] open_count = 3<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [36000.050627] [drm:drm_stub_open [drm]]<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [36000.050844] [drm:drm_open [drm]] comm="glxgears",
              pid=448, minor=128<br>
              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<br>
              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<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [36000.051704] [drm:drm_ioctl_permit [drm]]
              DRM_RENDER_ALLOW<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [36000.051905] [drm:drm_ioctl [drm]] comm="glxgears",
              pid=448, ret=-13<br>
              ...snip...<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [36000.121241] [drm:drm_ioctl_permit [drm]]
              DRM_RENDER_ALLOW<br>
              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<br>
              Mar 14 18:55:47 buildroot user.debug kernel:
              [36000.121635] [drm:drm_ioctl [drm]] comm="glxgears",
              pid=448, ret=-13<br>
              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<br>
              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<br>
              <br>
              -------------- next part --------------<br>
              An HTML attachment was scrubbed...<br>
              URL: <<a
href="https://lists.freedesktop.org/archives/mesa-users/attachments/20210314/4dc3eead/attachment-0001.htm"
                rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.freedesktop.org/archives/mesa-users/attachments/20210314/4dc3eead/attachment-0001.htm</a>><br>
              <br>
              ------------------------------<br>
              <br>
              Subject: Digest Footer<br>
              <br>
              _______________________________________________<br>
              mesa-users mailing list<br>
              <a href="mailto:mesa-users@lists.freedesktop.org"
                target="_blank" moz-do-not-send="true">mesa-users@lists.freedesktop.org</a><br>
              <a
                href="https://lists.freedesktop.org/mailman/listinfo/mesa-users"
                rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/mesa-users</a><br>
              <br>
              <br>
              ------------------------------<br>
              <br>
              End of mesa-users Digest, Vol 130, Issue 3<br>
              ******************************************<br>
            </blockquote>
          </div>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
mesa-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mesa-users@lists.freedesktop.org" moz-do-not-send="true">mesa-users@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-users" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/mesa-users</a>
</pre>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
mesa-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mesa-users@lists.freedesktop.org">mesa-users@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-users">https://lists.freedesktop.org/mailman/listinfo/mesa-users</a>
</pre>
    </blockquote>
  </body>
</html>