mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 08:20:12 +01:00
nvk: Use submit_simple for draw state init
We also move it to being a queue function. This architecturally makes more sense even if it seems a bit redundant at first. Worst case, we initialize multiple times but this guarantees that we're initialized by the time we try to submit something. It also doesn't matter now because we only have the one queue. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
a132e18846
commit
4ebb6ca41b
5 changed files with 17 additions and 21 deletions
|
|
@ -28,14 +28,14 @@ nvk_cmd_buffer_3d_cls(struct nvk_cmd_buffer *cmd)
|
|||
}
|
||||
|
||||
VkResult
|
||||
nvk_device_init_context_draw_state(struct nvk_device *dev)
|
||||
nvk_queue_init_context_draw_state(struct nvk_queue *queue)
|
||||
{
|
||||
struct nouveau_ws_push *pb =
|
||||
nouveau_ws_push_new(dev->pdev->dev, NVK_CMD_BUF_SIZE);
|
||||
if (pb == NULL)
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
struct nvk_device *dev = nvk_queue_device(queue);
|
||||
|
||||
struct nv_push *p = P_SPACE(pb, 0x1000);
|
||||
uint32_t push_data[512];
|
||||
struct nv_push push;
|
||||
nv_push_init(&push, push_data, ARRAY_SIZE(push_data));
|
||||
struct nv_push *p = &push;
|
||||
|
||||
P_MTHD(p, NV9097, SET_OBJECT);
|
||||
P_NV9097_SET_OBJECT(p, {
|
||||
|
|
@ -46,10 +46,8 @@ nvk_device_init_context_draw_state(struct nvk_device *dev)
|
|||
for (uint32_t mme = 0, mme_pos = 0; mme < NVK_MME_COUNT; mme++) {
|
||||
size_t size;
|
||||
uint32_t *dw = nvk_build_mme(dev, mme, &size);
|
||||
if (dw == NULL) {
|
||||
nouveau_ws_push_destroy(pb);
|
||||
if (dw == NULL)
|
||||
return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
}
|
||||
|
||||
assert(size % sizeof(uint32_t) == 0);
|
||||
const uint32_t num_dw = size / sizeof(uint32_t);
|
||||
|
|
@ -310,12 +308,8 @@ nvk_device_init_context_draw_state(struct nvk_device *dev)
|
|||
P_NV9097_SET_VERTEX_STREAM_SUBSTITUTE_A(p, zero_addr >> 32);
|
||||
P_NV9097_SET_VERTEX_STREAM_SUBSTITUTE_B(p, zero_addr);
|
||||
|
||||
int ret = nouveau_ws_push_submit(pb, dev->pdev->dev, dev->ctx);
|
||||
nouveau_ws_push_destroy(pb);
|
||||
if (ret)
|
||||
return vk_error(dev, VK_ERROR_INITIALIZATION_FAILED);
|
||||
|
||||
return VK_SUCCESS;
|
||||
return nvk_queue_submit_simple(queue, push_data, nv_push_dw_count(&push),
|
||||
NULL /* extra_bo */);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -207,10 +207,6 @@ nvk_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||
if (result != VK_SUCCESS)
|
||||
goto fail_zero_page;
|
||||
|
||||
result = nvk_device_init_context_draw_state(device);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_queue;
|
||||
|
||||
result = nvk_device_init_meta(device);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_queue;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ nvk_device_physical(struct nvk_device *device)
|
|||
return (struct nvk_physical_device *)device->vk.physical;
|
||||
}
|
||||
|
||||
VkResult nvk_device_init_context_draw_state(struct nvk_device *dev);
|
||||
|
||||
VkResult nvk_device_init_meta(struct nvk_device *dev);
|
||||
void nvk_device_finish_meta(struct nvk_device *dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -257,8 +257,14 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
|
|||
}
|
||||
nouveau_ws_bo_unmap(queue->empty_push, empty_push_map);
|
||||
|
||||
result = nvk_queue_init_context_draw_state(queue);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_empty_push;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_empty_push:
|
||||
nouveau_ws_bo_destroy(queue->empty_push);
|
||||
fail_init:
|
||||
vk_queue_finish(&queue->vk);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ VkResult nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
|
|||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue