nvk: Rework nvk_queue_submit_simple()

This is a few changes rolled into one:

 1. Add a sync flag to force a stall before returning
 2. Re-order dw and push_dw_count to put the count first
 3. Take an array of extra BOs instead of just one

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-01-30 20:12:00 -06:00 committed by Marge Bot
parent f25d239675
commit 16bdefa530
5 changed files with 25 additions and 19 deletions

View file

@ -308,8 +308,8 @@ nvk_queue_init_context_draw_state(struct nvk_queue *queue)
P_NV9097_SET_VERTEX_STREAM_SUBSTITUTE_A(p, zero_addr >> 32);
P_NV9097_SET_VERTEX_STREAM_SUBSTITUTE_B(p, zero_addr);
return nvk_queue_submit_simple(queue, push_data, nv_push_dw_count(&push),
NULL /* extra_bo */);
return nvk_queue_submit_simple(queue, nv_push_dw_count(&push), push_data,
0, NULL, false /* sync */);
}
void

View file

@ -63,8 +63,8 @@ zero_vram(struct nvk_device *dev, struct nouveau_ws_bo *bo)
P_NV902D_RENDER_SOLID_PRIM_POINT_SET_X(p, 1, extra / 4);
P_NV902D_RENDER_SOLID_PRIM_POINT_Y(p, 1, height);
return nvk_queue_submit_simple(&dev->queue, push_data,
nv_push_dw_count(&push), bo);
return nvk_queue_submit_simple(&dev->queue, nv_push_dw_count(&push),
push_data, 1, &bo, false /* sync */);
}
VkResult

View file

@ -335,8 +335,10 @@ nvk_queue_finish(struct nvk_device *dev, struct nvk_queue *queue)
VkResult
nvk_queue_submit_simple(struct nvk_queue *queue,
const uint32_t *dw, uint32_t dw_count,
struct nouveau_ws_bo *extra_bo)
uint32_t dw_count, const uint32_t *dw,
uint32_t extra_bo_count,
struct nouveau_ws_bo **extra_bos,
bool sync)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nouveau_ws_bo *push_bo;
@ -354,12 +356,13 @@ nvk_queue_submit_simple(struct nvk_queue *queue,
memcpy(push_map, dw, dw_count * 4);
const bool sync = dev->pdev->dev->debug_flags & NVK_DEBUG_PUSH_SYNC;
const bool debug_sync = dev->pdev->dev->debug_flags & NVK_DEBUG_PUSH_SYNC;
result = nvk_queue_submit_simple_drm_nouveau(queue, push_bo, dw_count,
extra_bo, sync);
result = nvk_queue_submit_simple_drm_nouveau(queue, dw_count, push_bo,
extra_bo_count, extra_bos,
sync || debug_sync);
if ((sync && result != VK_SUCCESS) ||
if ((debug_sync && result != VK_SUCCESS) ||
(dev->pdev->dev->debug_flags & NVK_DEBUG_PUSH_DUMP)) {
struct nv_push push = {
.start = (uint32_t *)dw,

View file

@ -60,13 +60,16 @@ void nvk_queue_finish(struct nvk_device *dev, struct nvk_queue *queue);
VkResult nvk_queue_init_context_draw_state(struct nvk_queue *queue);
VkResult nvk_queue_submit_simple(struct nvk_queue *queue,
const uint32_t *dw, uint32_t dw_count,
struct nouveau_ws_bo *extra_bo);
uint32_t dw_count, const uint32_t *dw,
uint32_t extra_bo_count,
struct nouveau_ws_bo **extra_bos,
bool sync);
VkResult nvk_queue_submit_simple_drm_nouveau(struct nvk_queue *queue,
struct nouveau_ws_bo *push_bo,
uint32_t push_dw_count,
struct nouveau_ws_bo *extra_bo,
struct nouveau_ws_bo *push_bo,
uint32_t extra_bo_count,
struct nouveau_ws_bo **extra_bos,
bool sync);
VkResult nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,

View file

@ -112,9 +112,10 @@ push_submit(struct push_builder *pb, struct nvk_queue *queue, bool sync)
VkResult
nvk_queue_submit_simple_drm_nouveau(struct nvk_queue *queue,
struct nouveau_ws_bo *push_bo,
uint32_t push_dw_count,
struct nouveau_ws_bo *extra_bo,
struct nouveau_ws_bo *push_bo,
uint32_t extra_bo_count,
struct nouveau_ws_bo **extra_bos,
bool sync)
{
struct nvk_device *dev = nvk_queue_device(queue);
@ -123,9 +124,8 @@ nvk_queue_submit_simple_drm_nouveau(struct nvk_queue *queue,
push_builder_init(dev, &pb);
push_add_push(&pb, push_bo, 0, push_dw_count);
if (extra_bo)
push_add_bo(&pb, extra_bo, NOUVEAU_WS_BO_RDWR);
for (uint32_t i = 0; i < extra_bo_count; i++)
push_add_bo(&pb, extra_bos[i], NOUVEAU_WS_BO_RDWR);
return push_submit(&pb, queue, sync);
}