meson/freedreno: Fix lua requirement
[mesa.git] / src / freedreno / drm / freedreno_bo.c
index 04f9c1d16b4f65bcc5d0ecb82caab46125df7459..862465cfe43c5eea3e001c37fc67ec417d911264 100644 (file)
@@ -73,6 +73,7 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
        bo->size = size;
        bo->handle = handle;
        bo->iova = bo->funcs->iova(bo);
+       bo->flags = FD_RELOC_FLAGS_INIT;
 
        p_atomic_set(&bo->refcnt, 1);
        list_inithead(&bo->list);
@@ -131,9 +132,11 @@ fd_bo_new_ring(struct fd_device *dev, uint32_t size)
 {
        uint32_t flags = DRM_FREEDRENO_GEM_GPUREADONLY;
        struct fd_bo *bo = bo_new(dev, size, flags, &dev->ring_cache);
-       if (bo)
+       if (bo) {
                bo->bo_reuse = RING_CACHE;
-       fd_bo_set_name(bo, "cmdstream");
+               bo->flags |= FD_RELOC_DUMP;
+               fd_bo_set_name(bo, "cmdstream");
+       }
        return bo;
 }
 
@@ -225,8 +228,16 @@ out_unlock:
        return bo;
 }
 
+void
+fd_bo_mark_for_dump(struct fd_bo *bo)
+{
+       bo->flags |= FD_RELOC_DUMP;
+}
+
 uint64_t fd_bo_get_iova(struct fd_bo *bo)
 {
+       /* ancient kernels did not support this */
+       assert(bo->iova != 0);
        return bo->iova;
 }
 
@@ -307,6 +318,7 @@ int fd_bo_get_name(struct fd_bo *bo, uint32_t *name)
 
 uint32_t fd_bo_handle(struct fd_bo *bo)
 {
+       bo->bo_reuse = NO_CACHE;
        return bo->handle;
 }