Path: blob/21.2-virgl/src/vulkan/device-select-layer/device_select.h
7095 views
/*1* Copyright © 2019 Red Hat2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/22#ifndef DEVICE_SELECT_H23#define DEVICE_SELECT_H2425#include <stdbool.h>26#include <stdint.h>27#include "xf86drm.h"2829/* We don't use `drmPciDeviceInfo` because it uses 16-bit ids,30* instead of Vulkan's 32-bit ones. */31struct device_info {32uint32_t vendor_id;33uint32_t device_id;34};3536struct device_pci_info {37struct device_info dev_info;38drmPciBusInfo bus_info;39bool has_bus_info;40bool cpu_device;41};4243#ifdef VK_USE_PLATFORM_XCB_KHR44int device_select_find_xcb_pci_default(struct device_pci_info *devices, uint32_t device_count);45#else46static inline int device_select_find_xcb_pci_default(struct device_pci_info *devices, uint32_t device_count) { return -1; }47#endif4849#ifdef VK_USE_PLATFORM_WAYLAND_KHR50int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint32_t device_count);51#else52static inline int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint32_t device_count) { return -1; }53#endif5455#endif565758