nvk: Initialize the 2D engine

Partially a revert of 28a6874f75e61 ("nvk: Stop initializing the 2D
engine")
This commit is contained in:
Mel Henning 2025-11-22 20:09:26 -05:00
parent be75ece095
commit 5aab36b32e
4 changed files with 41 additions and 1 deletions

View file

@ -6,6 +6,7 @@ nvk_files = files(
'nvk_buffer.h',
'nvk_buffer_view.c',
'nvk_buffer_view.h',
'nvk_cmd_2d.c',
'nvk_cmd_buffer.c',
'nvk_cmd_buffer.h',
'nvk_cmd_clear.c',

View file

@ -0,0 +1,30 @@
/*
* Copyright © 2025 Valve Corporation
* SPDX-License-Identifier: MIT
*/
#include "nvk_cmd_buffer.h"
#include "nvk_entrypoints.h"
#include "nvk_format.h"
#include "nv_push_cl902d.h"
#include "clc697.h"
VkResult
nvk_push_2d_state_init(struct nvk_queue *queue, struct nv_push *p)
{
struct nvk_device *dev = nvk_queue_device(queue);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
/* 2D state */
P_MTHD(p, NV902D, SET_OBJECT);
P_NV902D_SET_OBJECT(p, {
.class_id = pdev->info.cls_eng2d,
.engine_id = 0,
});
P_IMMD(p, NV902D, SET_CLIP_ENABLE, V_FALSE);
P_IMMD(p, NV902D, SET_PIXELS_FROM_MEMORY_CORRAL_SIZE,
(pdev->info.cls_eng3d >= AMPERE_A) ? 0x3ff : 0x3f);
return VK_SUCCESS;
}

View file

@ -355,6 +355,12 @@ nvk_queue_init_context_state(struct nvk_queue *queue)
return result;
}
if (queue->engines & NVKMD_ENGINE_2D) {
result = nvk_push_2d_state_init(queue, p);
if (result != VK_SUCCESS)
return result;
}
if (queue->engines & NVKMD_ENGINE_COMPUTE) {
result = nvk_push_dispatch_state_init(queue, p);
if (result != VK_SUCCESS)

View file

@ -64,7 +64,7 @@ nvk_queue_engines_from_queue_flags(VkQueueFlags queue_flags)
{
enum nvkmd_engines engines = 0;
if (queue_flags & VK_QUEUE_GRAPHICS_BIT) {
engines |= NVKMD_ENGINE_3D;
engines |= NVKMD_ENGINE_3D | NVKMD_ENGINE_2D;
/* We rely on compute shaders for queries */
engines |= NVKMD_ENGINE_COMPUTE;
}
@ -112,6 +112,9 @@ void nvk_queue_destroy(struct nvk_device *dev, struct nvk_queue *queue);
VkResult nvk_push_draw_state_init(struct nvk_queue *queue,
struct nv_push *p);
VkResult nvk_push_2d_state_init(struct nvk_queue *queue,
struct nv_push *p);
VkResult nvk_push_dispatch_state_init(struct nvk_queue *queue,
struct nv_push *p);