From c5171914af73a9f6f18d9eaa49a233dd32680983 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 15 Jun 2024 00:42:19 +0200 Subject: [PATCH] amdgpu: Allow creating userptr BO's from files When creating BOs from a userptr, AMDGPU_GEM_USERPTR_ANONONLY was specified which will cause validation to fail if the mapping is backed by a file. This is an issue when trying to import shm-backed buffers, as might often be the case for Wayland clients. Remove this restriction to allow the use of shm-backed buffers. --- amdgpu/amdgpu_bo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index 672f000d..7986eed9 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -578,8 +578,7 @@ drm_public int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev, struct drm_amdgpu_gem_userptr args; args.addr = (uintptr_t)cpu; - args.flags = AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_REGISTER | - AMDGPU_GEM_USERPTR_VALIDATE; + args.flags = AMDGPU_GEM_USERPTR_REGISTER | AMDGPU_GEM_USERPTR_VALIDATE; args.size = size; r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_USERPTR, &args, sizeof(args));