1 /* 2 * Copyright 2020 Google LLC 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef VKR_DEVICE_MEMORY_H 7 #define VKR_DEVICE_MEMORY_H 8 9 #include "vkr_common.h" 10 11 struct gbm_bo; 12 13 struct vkr_device_memory { 14 struct vkr_object base; 15 16 struct vkr_device *device; 17 uint32_t property_flags; 18 uint32_t valid_fd_types; 19 20 /* gbm bo backing non-external mappable memory */ 21 struct gbm_bo *gbm_bo; 22 23 uint64_t allocation_size; 24 uint32_t memory_type_index; 25 26 bool exported; 27 }; 28 VKR_DEFINE_OBJECT_CAST(device_memory, VK_OBJECT_TYPE_DEVICE_MEMORY, VkDeviceMemory) 29 30 void 31 vkr_context_init_device_memory_dispatch(struct vkr_context *ctx); 32 33 void 34 vkr_device_memory_release(struct vkr_device_memory *mem); 35 36 int 37 vkr_device_memory_export_fd(struct vkr_device_memory *mem, 38 VkExternalMemoryHandleTypeFlagBits handle_type, 39 int *out_fd); 40 41 #endif /* VKR_DEVICE_MEMORY_H */ 42