nvk: Move the nouveau_ws_context to nvk_queue
Otherwise, different queues aren't actually going to run independently. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27205>
This commit is contained in:

committed by
Marge Bot

parent
3273eaf52a
commit
86e79cd744
@@ -166,25 +166,11 @@ nvk_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||
dev->vk.command_buffer_ops = &nvk_cmd_buffer_ops;
|
||||
dev->pdev = pdev;
|
||||
|
||||
const enum nouveau_ws_engines engines =
|
||||
NOUVEAU_WS_ENGINE_COPY |
|
||||
NOUVEAU_WS_ENGINE_3D |
|
||||
NOUVEAU_WS_ENGINE_COMPUTE;
|
||||
|
||||
ret = nouveau_ws_context_create(dev->ws_dev, engines, &dev->ws_ctx);
|
||||
if (ret) {
|
||||
if (ret == -ENOSPC)
|
||||
result = vk_error(dev, VK_ERROR_TOO_MANY_OBJECTS);
|
||||
else
|
||||
result = vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
goto fail_ws_dev;
|
||||
}
|
||||
|
||||
result = nvk_descriptor_table_init(dev, &dev->images,
|
||||
8 * 4 /* tic entry size */,
|
||||
1024, 1024 * 1024);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_ws_ctx;
|
||||
goto fail_ws_dev;
|
||||
|
||||
/* Reserve the descriptor at offset 0 to be the null descriptor */
|
||||
uint32_t null_image[8] = { 0, };
|
||||
@@ -282,8 +268,6 @@ fail_samplers:
|
||||
nvk_descriptor_table_finish(dev, &dev->samplers);
|
||||
fail_images:
|
||||
nvk_descriptor_table_finish(dev, &dev->images);
|
||||
fail_ws_ctx:
|
||||
nouveau_ws_context_destroy(dev->ws_ctx);
|
||||
fail_ws_dev:
|
||||
nouveau_ws_device_destroy(dev->ws_dev);
|
||||
fail_init:
|
||||
@@ -314,7 +298,6 @@ nvk_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
|
||||
nvk_heap_finish(dev, &dev->shader_heap);
|
||||
nvk_descriptor_table_finish(dev, &dev->samplers);
|
||||
nvk_descriptor_table_finish(dev, &dev->images);
|
||||
nouveau_ws_context_destroy(dev->ws_ctx);
|
||||
nouveau_ws_device_destroy(dev->ws_dev);
|
||||
vk_free(&dev->vk.alloc, dev);
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include "vk_meta.h"
|
||||
#include "vk_queue.h"
|
||||
|
||||
struct novueau_ws_context;
|
||||
struct nvk_physical_device;
|
||||
struct vk_pipeline_cache;
|
||||
|
||||
@@ -35,7 +34,6 @@ struct nvk_device {
|
||||
struct nvk_physical_device *pdev;
|
||||
|
||||
struct nouveau_ws_device *ws_dev;
|
||||
struct nouveau_ws_context *ws_ctx;
|
||||
|
||||
struct nvk_descriptor_table images;
|
||||
struct nvk_descriptor_table samplers;
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "vk_queue.h"
|
||||
|
||||
struct novueau_ws_bo;
|
||||
struct nouveau_ws_context;
|
||||
struct novueau_ws_push;
|
||||
struct nvk_device;
|
||||
|
||||
@@ -48,6 +49,7 @@ struct nvk_queue {
|
||||
struct vk_queue vk;
|
||||
|
||||
struct {
|
||||
struct nouveau_ws_context *ws_ctx;
|
||||
uint32_t syncobj;
|
||||
} drm;
|
||||
|
||||
|
@@ -45,7 +45,7 @@ push_builder_init(struct nvk_queue *queue,
|
||||
pb->max_push = is_vmbind ? 0 :
|
||||
MIN2(NVK_PUSH_MAX_PUSH, dev->ws_dev->max_push);
|
||||
pb->req = (struct drm_nouveau_exec) {
|
||||
.channel = dev->ws_ctx->channel,
|
||||
.channel = queue->drm.ws_ctx->channel,
|
||||
.push_count = 0,
|
||||
.wait_count = 0,
|
||||
.sig_count = 0,
|
||||
@@ -296,15 +296,30 @@ nvk_queue_init_drm_nouveau(struct nvk_device *dev,
|
||||
VkResult result;
|
||||
int err;
|
||||
|
||||
const enum nouveau_ws_engines engines =
|
||||
NOUVEAU_WS_ENGINE_COPY |
|
||||
NOUVEAU_WS_ENGINE_3D |
|
||||
NOUVEAU_WS_ENGINE_COMPUTE;
|
||||
|
||||
err = nouveau_ws_context_create(dev->ws_dev, engines, &queue->drm.ws_ctx);
|
||||
if (err != 0) {
|
||||
if (err == -ENOSPC)
|
||||
return vk_error(dev, VK_ERROR_TOO_MANY_OBJECTS);
|
||||
else
|
||||
return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
}
|
||||
|
||||
err = drmSyncobjCreate(dev->ws_dev->fd, 0, &queue->drm.syncobj);
|
||||
if (err < 0) {
|
||||
result = vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
goto fail_init;
|
||||
goto fail_context;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_init:
|
||||
fail_context:
|
||||
nouveau_ws_context_destroy(queue->drm.ws_ctx);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -314,6 +329,7 @@ nvk_queue_finish_drm_nouveau(struct nvk_device *dev,
|
||||
{
|
||||
ASSERTED int err = drmSyncobjDestroy(dev->ws_dev->fd, queue->drm.syncobj);
|
||||
assert(err == 0);
|
||||
nouveau_ws_context_destroy(queue->drm.ws_ctx);
|
||||
}
|
||||
|
||||
VkResult
|
||||
|
Reference in New Issue
Block a user