novueau/bo: add nouveau_ws_bo_wait

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Karol Herbst
2022-06-01 01:04:08 +02:00
committed by Marge Bot
parent d71a4d73b8
commit cd46cf852b
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -73,3 +73,15 @@ nouveau_ws_bo_map(struct nouveau_ws_bo *bo, enum nouveau_ws_bo_map_flags flags)
return res;
}
bool
nouveau_ws_bo_wait(struct nouveau_ws_bo *bo, enum nouveau_ws_bo_map_flags flags)
{
struct drm_nouveau_gem_cpu_prep req = {};
req.handle = bo->handle;
if (flags & NOUVEAU_WS_BO_WR)
req.flags |= NOUVEAU_GEM_CPU_PREP_WRITE;
return !drmCommandWrite(bo->fd, DRM_NOUVEAU_GEM_CPU_PREP, &req, sizeof(req));
}
+1
View File
@@ -31,6 +31,7 @@ struct nouveau_ws_bo {
struct nouveau_ws_bo *nouveau_ws_bo_new(struct nouveau_ws_device *, uint64_t size, uint64_t align, enum nouveau_ws_bo_flags);
void nouveau_ws_bo_destroy(struct nouveau_ws_bo *);
void *nouveau_ws_bo_map(struct nouveau_ws_bo *, enum nouveau_ws_bo_map_flags);
bool nouveau_ws_bo_wait(struct nouveau_ws_bo *, enum nouveau_ws_bo_map_flags flags);
static inline void
nouveau_ws_bo_ref(struct nouveau_ws_bo *bo)