mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
pan/kmod: Allow mmap() on foreign buffers
If the BO comes from a different subsystem
(args.extra_flags & DRM_PANTHOR_BO_IS_IMPORTED), we should normally
add extra DMA_BUF_IOCTL_SYNC calls around CPU accesses to ensure the
CPU mapping consistency, but this is something we never worried about
(we've always assumed exporters were exposing uncached mappings with
NOP {begin,end}_cpu_access() implementations), and it worked fine until
now.
The long term plan is to hook up DMA_BUF_IOCTL_SYNC, but this requires
more work, and we need a quick fix that can be backported easily, hence
this revert+FIXME.
Fixes: b5e47ba894 ("pan/kmod: Add new helpers to sync BO CPU mappings")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14963
Closes: https://gitlab.freedesktop.org/panfrost/mesa/-/issues/282
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1101
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit 30f1d5bab9)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
parent
b299e0323a
commit
7ee55d3a5f
3 changed files with 19 additions and 9 deletions
|
|
@ -3484,7 +3484,7 @@
|
|||
"description": "pan/kmod: Allow mmap() on foreign buffers",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "b5e47ba8941467a4e2f53907a6645a0703852e62",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -350,11 +350,16 @@ panfrost_kmod_bo_import(struct pan_kmod_dev *dev, uint32_t handle, uint64_t size
|
|||
goto err_free_bo;
|
||||
}
|
||||
|
||||
/* If the BO comes from a different subsystem, we don't allow
|
||||
* mmap() to avoid the CPU-sync churn.
|
||||
/* FIXME: If the BO comes from a different subsystem
|
||||
* (args.extra_flags & DRM_PANTHOR_BO_IS_IMPORTED), we should normally
|
||||
* add extra DMA_BUF_IOCTL_SYNC calls around CPU accesses to ensure the
|
||||
* CPU mapping consistency, but this is something we never worried about
|
||||
* (we've always assumed exporters were exposing uncached mappings with
|
||||
* NOP {begin,end}_cpu_access() implementations), and it worked fine until
|
||||
* now.
|
||||
* The long term plan is to hook up DMA_BUF_IOCTL_SYNC, but this requires
|
||||
* more work.
|
||||
*/
|
||||
if (args.extra_flags & DRM_PANFROST_BO_IS_IMPORTED)
|
||||
flags |= PAN_KMOD_BO_FLAG_NO_MMAP;
|
||||
}
|
||||
|
||||
pan_kmod_bo_init(&panfrost_bo->base, dev, NULL, size,
|
||||
|
|
|
|||
|
|
@ -445,11 +445,16 @@ panthor_kmod_bo_import(struct pan_kmod_dev *dev, uint32_t handle, uint64_t size,
|
|||
goto err_free_bo;
|
||||
}
|
||||
|
||||
/* If the BO comes from a different subsystem, we don't allow
|
||||
* mmap() to avoid the CPU-sync churn.
|
||||
/* FIXME: If the BO comes from a different subsystem
|
||||
* (args.extra_flags & DRM_PANTHOR_BO_IS_IMPORTED), we should normally
|
||||
* add extra DMA_BUF_IOCTL_SYNC calls around CPU accesses to ensure the
|
||||
* CPU mapping consistency, but this is something we never worried about
|
||||
* (we've always assumed exporters were exposing uncached mappings with
|
||||
* NOP {begin,end}_cpu_access() implementations), and it worked fine until
|
||||
* now.
|
||||
* The long term plan is to hook up DMA_BUF_IOCTL_SYNC, but this requires
|
||||
* more work.
|
||||
*/
|
||||
if (args.extra_flags & DRM_PANTHOR_BO_IS_IMPORTED)
|
||||
flags |= PAN_KMOD_BO_FLAG_NO_MMAP;
|
||||
}
|
||||
|
||||
/* Create a unsignalled syncobj on import. Will serve as a
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue