nvk: Rework nvk_cmd_push a bit

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>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:12:06 -06:00 committed by Marge Bot
parent eed24d89dd
commit d5a31866ec
3 changed files with 11 additions and 9 deletions

View 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);
}

View 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 {

View 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);