mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 16:00:09 +01:00
nvk/queue: Rework context state init
The queue now owns the nv_push and just invokes the per-engine functions to fill it with context state init data. This also splits out 3D and compute into separate helpers and pulls M2MF off into its own thing. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27205>
This commit is contained in:
parent
b02f83e5c6
commit
ced7c5193e
4 changed files with 69 additions and 39 deletions
|
|
@ -17,8 +17,10 @@
|
|||
#include "cla1c0.h"
|
||||
#include "clc0c0.h"
|
||||
#include "clc5c0.h"
|
||||
#include "nvk_cl90c0.h"
|
||||
#include "nvk_cl9097.h"
|
||||
#include "nvk_cla0c0.h"
|
||||
#include "nvk_clb0c0.h"
|
||||
#include "nvk_clb1c0.h"
|
||||
#include "nvk_clc3c0.h"
|
||||
#include "nvk_clc597.h"
|
||||
|
|
@ -39,6 +41,23 @@
|
|||
#define NVC6C0_QMDV03_00_VAL_SET(p,a...) NVVAL_MW_SET((p), NVC6C0, QMDV03_00, ##a)
|
||||
#define NVC6C0_QMDV03_00_DEF_SET(p,a...) NVDEF_MW_SET((p), NVC6C0, QMDV03_00, ##a)
|
||||
|
||||
VkResult
|
||||
nvk_push_dispatch_state_init(struct nvk_device *dev, struct nv_push *p)
|
||||
{
|
||||
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||
|
||||
P_MTHD(p, NV90C0, SET_OBJECT);
|
||||
P_NV90C0_SET_OBJECT(p, {
|
||||
.class_id = pdev->info.cls_compute,
|
||||
.engine_id = 0,
|
||||
});
|
||||
|
||||
if (pdev->info.cls_compute == MAXWELL_COMPUTE_A)
|
||||
P_IMMD(p, NVB0C0, SET_SELECT_MAXWELL_TEXTURE_HEADERS, V_TRUE);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static inline uint16_t
|
||||
nvk_cmd_buffer_compute_cls(struct nvk_cmd_buffer *cmd)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,12 +22,9 @@
|
|||
#include "nouveau_context.h"
|
||||
|
||||
#include "nvk_cl902d.h"
|
||||
#include "nvk_cl9039.h"
|
||||
#include "nvk_cl9097.h"
|
||||
#include "nvk_cl90b5.h"
|
||||
#include "nvk_cl90c0.h"
|
||||
#include "nvk_clb0c0.h"
|
||||
|
||||
#include "nvk_cl9097.h"
|
||||
#include "nvk_cla097.h"
|
||||
#include "nvk_clb097.h"
|
||||
#include "nvk_clb197.h"
|
||||
|
|
@ -80,37 +77,20 @@ nvk_mme_set_priv_reg(struct mme_builder *b)
|
|||
}
|
||||
|
||||
VkResult
|
||||
nvk_queue_init_context_draw_state(struct nvk_queue *queue)
|
||||
nvk_push_draw_state_init(struct nvk_device *dev, struct nv_push *p)
|
||||
{
|
||||
struct nvk_device *dev = nvk_queue_device(queue);
|
||||
|
||||
uint32_t push_data[2048];
|
||||
struct nv_push push;
|
||||
nv_push_init(&push, push_data, ARRAY_SIZE(push_data));
|
||||
struct nv_push *p = &push;
|
||||
|
||||
/* M2MF state */
|
||||
if (dev->pdev->info.cls_m2mf <= FERMI_MEMORY_TO_MEMORY_FORMAT_A) {
|
||||
/* we absolutely do not support Fermi, but if somebody wants to toy
|
||||
* around with it, this is a must
|
||||
*/
|
||||
P_MTHD(p, NV9039, SET_OBJECT);
|
||||
P_NV9039_SET_OBJECT(p, {
|
||||
.class_id = dev->pdev->info.cls_m2mf,
|
||||
.engine_id = 0,
|
||||
});
|
||||
}
|
||||
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||
|
||||
/* 3D state */
|
||||
P_MTHD(p, NV9097, SET_OBJECT);
|
||||
P_NV9097_SET_OBJECT(p, {
|
||||
.class_id = dev->pdev->info.cls_eng3d,
|
||||
.class_id = pdev->info.cls_eng3d,
|
||||
.engine_id = 0,
|
||||
});
|
||||
|
||||
for (uint32_t mme = 0, mme_pos = 0; mme < NVK_MME_COUNT; mme++) {
|
||||
size_t size;
|
||||
uint32_t *dw = nvk_build_mme(&nvk_device_physical(dev)->info, mme, &size);
|
||||
uint32_t *dw = nvk_build_mme(&pdev->info, mme, &size);
|
||||
if (dw == NULL)
|
||||
return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
|
|
@ -439,18 +419,7 @@ nvk_queue_init_context_draw_state(struct nvk_queue *queue)
|
|||
if (dev->pdev->info.cls_eng3d == MAXWELL_A)
|
||||
P_IMMD(p, NVB097, SET_SELECT_MAXWELL_TEXTURE_HEADERS, V_TRUE);
|
||||
|
||||
/* Compute state */
|
||||
P_MTHD(p, NV90C0, SET_OBJECT);
|
||||
P_NV90C0_SET_OBJECT(p, {
|
||||
.class_id = dev->pdev->info.cls_compute,
|
||||
.engine_id = 0,
|
||||
});
|
||||
|
||||
if (dev->pdev->info.cls_compute == MAXWELL_COMPUTE_A)
|
||||
P_IMMD(p, NVB0C0, SET_SELECT_MAXWELL_TEXTURE_HEADERS, V_TRUE);
|
||||
|
||||
return nvk_queue_submit_simple(queue, nv_push_dw_count(&push), push_data,
|
||||
0, NULL);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <xf86drm.h>
|
||||
|
||||
#include "nvk_cl9039.h"
|
||||
#include "nvk_cl9097.h"
|
||||
#include "nvk_cl90b5.h"
|
||||
#include "nvk_cla0c0.h"
|
||||
|
|
@ -312,6 +313,42 @@ nvk_queue_submit(struct vk_queue *vk_queue,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
nvk_queue_init_context_state(struct nvk_queue *queue)
|
||||
{
|
||||
struct nvk_device *dev = nvk_queue_device(queue);
|
||||
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||
VkResult result;
|
||||
|
||||
uint32_t push_data[2048];
|
||||
struct nv_push push;
|
||||
nv_push_init(&push, push_data, ARRAY_SIZE(push_data));
|
||||
struct nv_push *p = &push;
|
||||
|
||||
/* M2MF state */
|
||||
if (pdev->info.cls_m2mf <= FERMI_MEMORY_TO_MEMORY_FORMAT_A) {
|
||||
/* we absolutely do not support Fermi, but if somebody wants to toy
|
||||
* around with it, this is a must
|
||||
*/
|
||||
P_MTHD(p, NV9039, SET_OBJECT);
|
||||
P_NV9039_SET_OBJECT(p, {
|
||||
.class_id = dev->pdev->info.cls_m2mf,
|
||||
.engine_id = 0,
|
||||
});
|
||||
}
|
||||
|
||||
result = nvk_push_draw_state_init(dev, p);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
result = nvk_push_dispatch_state_init(dev, p);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
return nvk_queue_submit_simple(queue, nv_push_dw_count(&push),
|
||||
push_data, 0, NULL);
|
||||
}
|
||||
|
||||
VkResult
|
||||
nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
|
||||
const VkDeviceQueueCreateInfo *pCreateInfo,
|
||||
|
|
@ -331,7 +368,7 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
|
|||
if (result != VK_SUCCESS)
|
||||
goto fail_init;
|
||||
|
||||
result = nvk_queue_init_context_draw_state(queue);
|
||||
result = nvk_queue_init_context_state(queue);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_drm;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
struct novueau_ws_bo;
|
||||
struct nouveau_ws_context;
|
||||
struct novueau_ws_push;
|
||||
struct nv_push;
|
||||
struct nvk_device;
|
||||
|
||||
struct nvk_queue_state {
|
||||
|
|
@ -68,7 +69,11 @@ 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_push_draw_state_init(struct nvk_device *dev,
|
||||
struct nv_push *p);
|
||||
|
||||
VkResult nvk_push_dispatch_state_init(struct nvk_device *dev,
|
||||
struct nv_push *p);
|
||||
|
||||
/* this always syncs, so only use when that doesn't matter */
|
||||
VkResult nvk_queue_submit_simple(struct nvk_queue *queue,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue