| 1 |
/* |
| 2 |
* Copyright © 2022 Imagination Technologies Ltd. |
| 3 |
* |
| 4 |
* based in part on anv driver which is: |
| 5 |
* Copyright © 2015 Intel Corporation |
| 6 |
* |
| 7 |
* based in part on radv driver which is: |
| 8 |
* Copyright © 2016 Red Hat. |
| 9 |
* Copyright © 2016 Bas Nieuwenhuizen |
| 10 |
* |
| 11 |
* SPDX-License-Identifier: MIT |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef PVR_PHYSICAL_DEVICE_H |
| 15 |
#define PVR_PHYSICAL_DEVICE_H |
| 16 |
|
| 17 |
#include "vk_physical_device.h" |
| 18 |
|
| 19 |
#include <stdint.h> |
| 20 |
#include <sys/types.h> |
| 21 |
#include <xf86drm.h> |
| 22 |
|
| 23 |
#include "util/mesa-blake3.h" |
| 24 |
|
| 25 |
#include "wsi_common.h" |
| 26 |
|
| 27 |
#include "pvr_device_info.h" |
| 28 |
#include "pvr_formats.h" |
| 29 |
|
| 30 |
#if defined(VK_USE_PLATFORM_DISPLAY_KHR) || defined(VK_USE_PLATFORM_WAYLAND_KHR) |
| 31 |
# define PVR_USE_WSI_PLATFORM true |
| 32 |
#else |
| 33 |
# define PVR_USE_WSI_PLATFORM false |
| 34 |
#endif |
| 35 |
|
| 36 |
struct pvr_instance; |
| 37 |
typedef struct _pco_ctx pco_ctx; |
| 38 |
|
| 39 |
struct pvr_physical_device { |
| 40 |
struct vk_physical_device vk; |
| 41 |
|
| 42 |
/* Back-pointer to instance */ |
| 43 |
struct pvr_instance *instance; |
| 44 |
|
| 45 |
char *render_path; |
| 46 |
char *display_path; |
| 47 |
bool has_primary; |
| 48 |
|
| 49 |
/* primary node (cardN) of the render device |
| 50 |
* Only valid when has_primary is true. |
| 51 |
*/ |
| 52 |
dev_t primary_devid; |
| 53 |
/* render node (renderN) of the render device */ |
| 54 |
dev_t render_devid; |
| 55 |
|
| 56 |
struct pvr_winsys *ws; |
| 57 |
struct pvr_device_info dev_info; |
| 58 |
struct pvr_device_runtime_info dev_runtime_info; |
| 59 |
|
| 60 |
VkPhysicalDeviceMemoryProperties memory; |
| 61 |
|
| 62 |
struct wsi_device wsi_device; |
| 63 |
|
| 64 |
pco_ctx *pco_ctx; |
| 65 |
|
| 66 |
struct pvr_format_table formats; |
| 67 |
|
| 68 |
uint8_t device_uuid[BLAKE3_KEY_LEN]; |
| 69 |
uint8_t cache_uuid[BLAKE3_KEY_LEN]; |
| 70 |
}; |
| 71 |
|
| 72 |
VK_DEFINE_HANDLE_CASTS(pvr_physical_device, |
| 73 |
vk.base, |
| 74 |
VkPhysicalDevice, |
| 75 |
VK_OBJECT_TYPE_PHYSICAL_DEVICE) |
| 76 |
|
| 77 |
VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, |
| 78 |
struct pvr_instance *instance, |
| 79 |
drmDevicePtr drm_render_device, |
| 80 |
drmDevicePtr drm_display_device); |
| 81 |
|
| 82 |
void pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice, |
| 83 |
char *const *comp_display, |
| 84 |
char *const *comp_render); |
| 85 |
|
| 86 |
void pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice); |
| 87 |
|
| 88 |
void pvr_physical_device_free_pipeline_cache( |
| 89 |
struct pvr_physical_device *const pdevice); |
| 90 |
|
| 91 |
#endif /* PVR_PHYSICAL_DEVICE_H */ |