• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
14 #include "vk_physical_device.h"
15 #include "vk_sync.h"
16 #include "vk_sync_timeline.h"
17 #include "vk_util.h"
18 #include "wsi_common.h"
19 
20 #include "lib/kmod/pan_kmod.h"
21 
22 struct panfrost_model;
23 struct pan_blendable_format;
24 struct panfrost_format;
25 struct panvk_instance;
26 
27 struct panvk_physical_device {
28    struct vk_physical_device vk;
29 
30    struct {
31       struct pan_kmod_dev *dev;
32       struct pan_kmod_dev_props props;
33    } kmod;
34 
35    const struct panfrost_model *model;
36 
37    struct {
38       dev_t primary_rdev;
39       dev_t render_rdev;
40    } drm;
41 
42    struct {
43       const struct pan_blendable_format *blendable;
44       const struct panfrost_format *all;
45    } formats;
46 
47    char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
48    uint8_t cache_uuid[VK_UUID_SIZE];
49 
50    struct vk_sync_type drm_syncobj_type;
51    struct vk_sync_timeline_type sync_timeline_type;
52    const struct vk_sync_type *sync_types[3];
53 
54    struct wsi_device wsi_device;
55 };
56 
57 VK_DEFINE_HANDLE_CASTS(panvk_physical_device, vk.base, VkPhysicalDevice,
58                        VK_OBJECT_TYPE_PHYSICAL_DEVICE)
59 
60 static inline struct panvk_physical_device *
to_panvk_physical_device(struct vk_physical_device * phys_dev)61 to_panvk_physical_device(struct vk_physical_device *phys_dev)
62 {
63    return container_of(phys_dev, struct panvk_physical_device, vk);
64 }
65 
66 VkResult panvk_physical_device_init(struct panvk_physical_device *device,
67                                     struct panvk_instance *instance,
68                                     drmDevicePtr drm_device);
69 
70 void panvk_physical_device_finish(struct panvk_physical_device *device);
71 
72 #endif
73