| 1 |
/* |
| 2 |
* Copyright © 2021 Collabora Ltd. |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef PANVK_PHYSICAL_DEVICE_H |
| 7 |
#define PANVK_PHYSICAL_DEVICE_H |
| 8 |
|
| 9 |
#include <stdint.h> |
| 10 |
#include <sys/types.h> |
| 11 |
|
| 12 |
#include "panvk_instance.h" |
| 13 |
#include "panvk_macros.h" |
| 14 |
|
| 15 |
#include "vk_physical_device.h" |
| 16 |
#include "vk_sync.h" |
| 17 |
#include "vk_sync_timeline.h" |
| 18 |
#include "vk_util.h" |
| 19 |
#include "wsi_common.h" |
| 20 |
|
| 21 |
#include "lib/kmod/pan_kmod.h" |
| 22 |
|
| 23 |
struct pan_model; |
| 24 |
struct pan_blendable_format; |
| 25 |
struct pan_format; |
| 26 |
struct panvk_instance; |
| 27 |
|
| 28 |
struct panvk_physical_device { |
| 29 |
struct vk_physical_device vk; |
| 30 |
|
| 31 |
struct { |
| 32 |
struct pan_kmod_dev *dev; |
| 33 |
} kmod; |
| 34 |
|
| 35 |
const struct pan_model *model; |
| 36 |
|
| 37 |
union { |
| 38 |
struct { |
| 39 |
struct { |
| 40 |
uint32_t chunk_size; |
| 41 |
uint32_t initial_chunks; |
| 42 |
uint32_t max_chunks; |
| 43 |
} tiler; |
| 44 |
} csf; |
| 45 |
}; |
| 46 |
|
| 47 |
struct { |
| 48 |
dev_t primary_rdev; |
| 49 |
dev_t render_rdev; |
| 50 |
} drm; |
| 51 |
|
| 52 |
struct { |
| 53 |
const struct pan_blendable_format *blendable; |
| 54 |
const struct pan_format *all; |
| 55 |
} formats; |
| 56 |
|
| 57 |
char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; |
| 58 |
uint8_t cache_uuid[VK_UUID_SIZE]; |
| 59 |
|
| 60 |
struct { |
| 61 |
VkMemoryHeap heaps[1]; |
| 62 |
uint32_t heap_count; |
| 63 |
|
| 64 |
VkMemoryType types[4]; |
| 65 |
uint32_t type_count; |
| 66 |
|
| 67 |
uint64_t max_supported_va; |
| 68 |
alignas(8) uint64_t heap_used; |
| 69 |
} memory; |
| 70 |
|
| 71 |
struct vk_sync_type drm_syncobj_type; |
| 72 |
struct vk_sync_timeline_type sync_timeline_type; |
| 73 |
const struct vk_sync_type *sync_types[3]; |
| 74 |
|
| 75 |
struct wsi_device wsi_device; |
| 76 |
|
| 77 |
uint64_t compute_core_mask; |
| 78 |
uint64_t fragment_core_mask; |
| 79 |
}; |
| 80 |
|
| 81 |
VK_DEFINE_HANDLE_CASTS(panvk_physical_device, vk.base, VkPhysicalDevice, |
| 82 |
VK_OBJECT_TYPE_PHYSICAL_DEVICE) |
| 83 |
|
| 84 |
static inline struct panvk_physical_device * |
| 85 |
to_panvk_physical_device(struct vk_physical_device *phys_dev) |
| 86 |
{ |
| 87 |
return container_of(phys_dev, struct panvk_physical_device, vk); |
| 88 |
} |
| 89 |
|
| 90 |
float panvk_get_gpu_system_timestamp_period( |
| 91 |
const struct panvk_physical_device *device); |
| 92 |
|
| 93 |
VkResult panvk_physical_device_init(struct panvk_physical_device *device, |
| 94 |
struct panvk_instance *instance, |
| 95 |
drmDevicePtr drm_device); |
| 96 |
|
| 97 |
void panvk_physical_device_finish(struct panvk_physical_device *device); |
| 98 |
|
| 99 |
|
| 100 |
VkSampleCountFlags panvk_get_sample_counts(unsigned arch, |
| 101 |
unsigned max_tib_size, |
| 102 |
unsigned max_cbuf_atts, |
| 103 |
unsigned format_size); |
| 104 |
|
| 105 |
#ifdef PAN_ARCH |
| 106 |
void panvk_per_arch(get_physical_device_extensions)( |
| 107 |
const struct panvk_physical_device *device, |
| 108 |
struct vk_device_extension_table *ext); |
| 109 |
|
| 110 |
void panvk_per_arch(get_physical_device_features)( |
| 111 |
const struct panvk_instance *instance, |
| 112 |
const struct panvk_physical_device *device, struct vk_features *features); |
| 113 |
|
| 114 |
void panvk_per_arch(get_physical_device_properties)( |
| 115 |
const struct panvk_instance *instance, |
| 116 |
const struct panvk_physical_device *device, |
| 117 |
struct vk_properties *properties); |
| 118 |
#endif |
| 119 |
|
| 120 |
#endif |