Dominik Behr | 8ff2bf8 | 2020-12-08 21:22:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 The Chromium OS Authors. All rights reserved. |
| 3 | * Use of this source code is governed by a BSD-style license that can be |
| 4 | * found in the LICENSE file. |
| 5 | */ |
| 6 | #ifndef _MINIGBM_HELPERS_H_ |
| 7 | #define _MINIGBM_HELPERS_H_ |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | extern "C" { |
| 11 | #endif |
| 12 | |
Gurchetan Singh | cadc54f | 2021-02-01 12:03:11 -0800 | [diff] [blame^] | 13 | #define GBM_DEV_TYPE_FLAG_DISCRETE (1u << 0) /* Discrete GPU. Separate chip, dedicated VRAM. */ |
| 14 | #define GBM_DEV_TYPE_FLAG_DISPLAY (1u << 1) /* Device capable of display. */ |
| 15 | #define GBM_DEV_TYPE_FLAG_3D (1u << 2) /* Device capable or 3D rendering. */ |
| 16 | #define GBM_DEV_TYPE_FLAG_ARMSOC (1u << 3) /* Device on ARM SOC. */ |
| 17 | #define GBM_DEV_TYPE_FLAG_USB (1u << 4) /* USB device, udl, evdi. */ |
| 18 | #define GBM_DEV_TYPE_FLAG_BLOCKED (1u << 5) /* Unsuitable device e.g. vgem, udl, evdi. */ |
Dominik Behr | 8ff2bf8 | 2020-12-08 21:22:38 -0800 | [diff] [blame] | 19 | #define GBM_DEV_TYPE_FLAG_INTERNAL_LCD (1u << 6) /* Device is driving internal LCD. */ |
| 20 | |
| 21 | struct gbm_device_info { |
| 22 | uint32_t dev_type_flags; |
| 23 | int dri_node_num; /* DRI node number (0..63), for easy matching of devices. */ |
| 24 | unsigned int connectors; |
| 25 | unsigned int connected; |
| 26 | }; |
| 27 | |
| 28 | #define GBM_DETECT_FLAG_CONNECTED (1u << 0) /* Check if any connectors are connected. SLOW! */ |
| 29 | |
| 30 | int gbm_detect_device_info(unsigned int detect_flags, int fd, struct gbm_device_info *info); |
| 31 | int gbm_detect_device_info_path(unsigned int detect_flags, const char *dev_node, |
| 32 | struct gbm_device_info *info); |
| 33 | |
| 34 | /* |
| 35 | * Select "default" device to use for graphics memory allocator. |
| 36 | */ |
| 37 | int gbm_get_default_device_fd(void); |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | #endif |