nvk: Don't crash if we fail to allocate a push BO

Currently, we continue just fine until nvk_EndCommandBuffer calls
nvk_cmd_buffer_flush_push() and it crashes tring to look at
cmd->push_bo.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:12:01 -06:00 committed by Marge Bot
parent 23409aea73
commit 156d7dd012

View file

@ -114,12 +114,14 @@ nvk_cmd_buffer_new_push(struct nvk_cmd_buffer *cmd)
static void
nvk_cmd_buffer_flush_push(struct nvk_cmd_buffer *cmd)
{
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),
};
util_dynarray_append(&cmd->pushes, struct nvk_cmd_push, push);
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),
};
util_dynarray_append(&cmd->pushes, struct nvk_cmd_push, push);
}
cmd->push.start = cmd->push.end;
}