• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2022 Collabora Ltd. and Red Hat Inc.
3  * SPDX-License-Identifier: MIT
4  */
5 #ifndef NVK_DEVICE_H
6 #define NVK_DEVICE_H 1
7 
8 #include "nvk_private.h"
9 
10 #include "nvk_descriptor_table.h"
11 #include "nvk_heap.h"
12 #include "nvk_queue.h"
13 #include "nvk_upload_queue.h"
14 #include "vk_device.h"
15 #include "vk_meta.h"
16 #include "vk_queue.h"
17 
18 struct nvk_physical_device;
19 struct vk_pipeline_cache;
20 
21 struct nvk_slm_area {
22    simple_mtx_t mutex;
23    struct nouveau_ws_bo *bo;
24    uint32_t bytes_per_warp;
25    uint32_t bytes_per_tpc;
26 };
27 
28 struct nouveau_ws_bo *
29 nvk_slm_area_get_bo_ref(struct nvk_slm_area *area,
30                         uint32_t *bytes_per_warp_out,
31                         uint32_t *bytes_per_mp_out);
32 
33 struct nvk_device {
34    struct vk_device vk;
35    struct nvk_physical_device *pdev;
36 
37    struct nouveau_ws_device *ws_dev;
38 
39    struct nvk_upload_queue upload;
40 
41    struct nvk_descriptor_table images;
42    struct nvk_descriptor_table samplers;
43    struct nvk_heap shader_heap;
44    struct nvk_heap event_heap;
45    struct nvk_slm_area slm;
46    struct nouveau_ws_bo *zero_page;
47    struct nouveau_ws_bo *vab_memory;
48 
49    struct nvk_queue queue;
50 
51    struct vk_pipeline_cache *mem_cache;
52 
53    struct vk_meta_device meta;
54 };
55 
56 VK_DEFINE_HANDLE_CASTS(nvk_device, vk.base, VkDevice, VK_OBJECT_TYPE_DEVICE)
57 
58 VkResult nvk_device_ensure_slm(struct nvk_device *dev,
59                                uint32_t bytes_per_thread);
60 
61 static inline struct nvk_physical_device *
nvk_device_physical(struct nvk_device * dev)62 nvk_device_physical(struct nvk_device *dev)
63 {
64    return (struct nvk_physical_device *)dev->vk.physical;
65 }
66 
67 VkResult nvk_device_init_meta(struct nvk_device *dev);
68 void nvk_device_finish_meta(struct nvk_device *dev);
69 
70 #endif
71