nvk: Rework nvk_cmd_push a bit
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:32:03 +0000 (21:32 +0000)
Instead of taking an nvk_cmd_bo take a nouveau_ws_bo and keep the map
pointer separate.  We'll need to do this when we start pushing stuff
that isn't nvk_cmd_bo.  Also, rework the bounds to be in bytes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_cmd_buffer.c
src/nouveau/vulkan/nvk_cmd_buffer.h
src/nouveau/vulkan/nvk_queue_drm_nouveau.c

index 4a3f02e..45a6392 100644 (file)
@@ -111,9 +111,10 @@ nvk_cmd_buffer_flush_push(struct nvk_cmd_buffer *cmd)
 {
    if (likely(cmd->push_bo != NULL)) {
       struct nvk_cmd_push push = {
-         .bo = cmd->push_bo,
-         .start_dw = cmd->push.start - (uint32_t *)cmd->push_bo->map,
-         .dw_count = nv_push_dw_count(&cmd->push),
+         .bo = cmd->push_bo->bo,
+         .map = cmd->push.start,
+         .bo_offset = (char *)cmd->push.start - (char *)cmd->push_bo->map,
+         .range = nv_push_dw_count(&cmd->push) * 4,
       };
       util_dynarray_append(&cmd->pushes, struct nvk_cmd_push, push);
    }
@@ -456,8 +457,8 @@ nvk_cmd_buffer_dump(struct nvk_cmd_buffer *cmd, FILE *fp)
 
    util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, p) {
       struct nv_push push = {
-         .start = (uint32_t *)p->bo->map + p->start_dw,
-         .end = (uint32_t *)p->bo->map + p->start_dw + p->dw_count,
+         .start = (uint32_t *)p->map,
+         .end = (uint32_t *)((char *)p->map + p->range),
       };
       vk_push_print(fp, &push, &dev->pdev->info);
    }
index 1945f27..cc36468 100644 (file)
@@ -100,9 +100,10 @@ struct nvk_compute_state {
 };
 
 struct nvk_cmd_push {
-   struct nvk_cmd_bo *bo;
-   uint32_t start_dw;
-   uint32_t dw_count;
+   struct nouveau_ws_bo *bo;
+   void *map;
+   uint32_t bo_offset;
+   uint32_t range;
 };
 
 struct nvk_cmd_bo_ref {
index 31875ac..e0b31f2 100644 (file)
@@ -194,7 +194,7 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
             push_add_bo(&pb, bo->bo, NOUVEAU_WS_BO_RD);
 
          util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, push)
-            push_add_push(&pb, push->bo->bo, push->start_dw * 4, push->dw_count * 4);
+            push_add_push(&pb, push->bo, push->bo_offset, push->range);
 
          util_dynarray_foreach(&cmd->bo_refs, struct nvk_cmd_bo_ref, ref)
             push_add_bo(&pb, ref->bo, NOUVEAU_WS_BO_RDWR);