mediatek: get prime fd with drv_bo_get_plane_fd
Instead of calling drmPrimeHandleToFD directly, call drv_bo_get_plane_fd so that the FD is exported with DRM_RDWR if possible. When a handle is exported, the drm framework caches the underlying dma_buf struct, even if all fd references are closed. This means that the flags from the first export operation end up being the primary flags for all subsequent export attempts. This change ensures that the O_RDWR flag is set on the first call, to prevent permission checks in PlatformSharedMemoryRegion from failing. BUG=b:151394062 TEST=youtube on arcvm on kukui Change-Id: I9de7bb67b45b3669704f3487889b10ed62493418 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2101054 Tested-by: David Stevens <stevensd@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: David Stevens <stevensd@chromium.org>
This commit is contained in:
parent
912c4c33a9
commit
ddb56b5eac
1 changed files with 2 additions and 2 deletions
|
|
@ -178,8 +178,8 @@ static void *mediatek_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint3
|
|||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
ret = drmPrimeHandleToFD(bo->drv->fd, gem_map.handle, DRM_CLOEXEC, &prime_fd);
|
||||
if (ret) {
|
||||
prime_fd = drv_bo_get_plane_fd(bo, 0);
|
||||
if (prime_fd < 0) {
|
||||
drv_log("Failed to get a prime fd\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue