From e88a37a280e4cb786033279312c2602999d7c28e Mon Sep 17 00:00:00 2001 From: Damian Hobson-Garcia Date: Thu, 14 Apr 2022 18:31:29 +0900 Subject: drm-lease: RPi4: Disable DRM_AUTH checks on wayland_clients DRM authentication does not work via a DRM Leases because the client can only authenticate against a lease owner (primary node), since the lease does not have a corresponding device file in the filesystem for clients to open. Bypassing DRM authentication by using render nodes is not yet fully supported in mesa, so for now, just try to authenticate and continue even if it fails. Bug-AGL: SPEC-4317 Change-Id: Ie6c82162037964da697d3ece80a8c463980d2658 Signed-off-by: Damian Hobson-Garcia --- ...able-DRM_AUTH-checks-on-wayland-protocols.patch | 42 ++++++++++++++++++++++ .../recipes-graphics/mesa/mesa_22.%.bbappend | 4 +++ 2 files changed, 46 insertions(+) create mode 100644 meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch create mode 100644 meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend (limited to 'meta-agl-drm-lease/dynamic-layers') diff --git a/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch new file mode 100644 index 00000000..f6be51e0 --- /dev/null +++ b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch @@ -0,0 +1,42 @@ +From f583672221b8451d03f739bc96428e97809d021a Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Tue, 5 Apr 2022 18:09:02 +0900 +Subject: [PATCH] Workaround: Disable DRM_AUTH check on wayland protocols + +DRM authentication does not work via a DRM Leases because the client +can only authenticate against a lease owner (primary node), since +the lease does not have a corresponding device file in the filesystem +for clients to open. + +The wl_drm protocol needs authentication to import/export prime fds +on kernel versions < 5.6. For newer kernel versions, prime +import/export no longer requires DRM_AUTH, so processing can proceed +even if DRM authentication fails. + +A proper implementation would check if the device is actually a +DRM lease and/or whether the import/export can succeed without +authentication. For now, just try to authenticate and ignore +any failures. +--- + src/egl/drivers/dri2/platform_drm.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c +index d0ab172..260a2c6 100644 +--- a/src/egl/drivers/dri2/platform_drm.c ++++ b/src/egl/drivers/dri2/platform_drm.c +@@ -508,7 +508,10 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id) + { + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + +- return drmAuthMagic(dri2_dpy->fd, id); ++ /* WORKAROUND: Ignore DRM_AUTH failures. Ideally should only be done for ++ clienits coming through a DRM lease, but just make it global for now */ ++ drmAuthMagic(dri2_dpy->fd, id); ++ return 0; + } + + static void +-- +2.17.1 + diff --git a/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend new file mode 100644 index 00000000..15e3aeba --- /dev/null +++ b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch" + -- cgit 1.2.3-korg