mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
freedreno/drm: Simplify backend mmap impl
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24733>
This commit is contained in:
parent
6f467fc6a3
commit
53ccb421a2
1 changed files with 16 additions and 17 deletions
|
|
@ -586,23 +586,14 @@ fd_bo_is_cached(struct fd_bo *bo)
|
||||||
void *
|
void *
|
||||||
fd_bo_map_os_mmap(struct fd_bo *bo)
|
fd_bo_map_os_mmap(struct fd_bo *bo)
|
||||||
{
|
{
|
||||||
if (!bo->map) {
|
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = bo->funcs->offset(bo, &offset);
|
ret = bo->funcs->offset(bo, &offset);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return os_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||||
bo->map = os_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
|
||||||
bo->dev->fd, offset);
|
bo->dev->fd, offset);
|
||||||
if (bo->map == MAP_FAILED) {
|
|
||||||
ERROR_MSG("mmap failed: %s", strerror(errno));
|
|
||||||
bo->map = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bo->map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
@ -614,7 +605,15 @@ fd_bo_map(struct fd_bo *bo)
|
||||||
if (bo->alloc_flags & FD_BO_NOMAP)
|
if (bo->alloc_flags & FD_BO_NOMAP)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return bo->funcs->map(bo);
|
if (!bo->map) {
|
||||||
|
bo->map = bo->funcs->map(bo);
|
||||||
|
if (bo->map == MAP_FAILED) {
|
||||||
|
ERROR_MSG("mmap failed: %s", strerror(errno));
|
||||||
|
bo->map = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bo->map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue