• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <stdint.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #define GBM_DEV_TYPE_FLAG_DISCRETE (1u << 0)	 /* Discrete GPU. Separate chip, dedicated VRAM. */
16 #define GBM_DEV_TYPE_FLAG_DISPLAY (1u << 1)	 /* Device capable of display. */
17 #define GBM_DEV_TYPE_FLAG_3D (1u << 2)		 /* Device capable or 3D rendering. */
18 #define GBM_DEV_TYPE_FLAG_ARMSOC (1u << 3)	 /* Device on ARM SOC. */
19 #define GBM_DEV_TYPE_FLAG_USB (1u << 4)		 /* USB device, udl, evdi. */
20 #define GBM_DEV_TYPE_FLAG_BLOCKED (1u << 5)	 /* Unsuitable device e.g. vgem, udl, evdi. */
21 #define GBM_DEV_TYPE_FLAG_INTERNAL_LCD (1u << 6) /* Device is driving internal LCD. */
22 
23 struct gbm_device;
24 
25 struct gbm_device_info {
26 	uint32_t dev_type_flags;
27 	int dri_node_num; /* DRI node number (0..63), for easy matching of devices. */
28 	unsigned int connectors;
29 	unsigned int connected;
30 };
31 
32 #define GBM_DETECT_FLAG_CONNECTED (1u << 0) /* Check if any connectors are connected. SLOW! */
33 
34 int gbm_detect_device_info(unsigned int detect_flags, int fd, struct gbm_device_info *info);
35 int gbm_detect_device_info_path(unsigned int detect_flags, const char *dev_node,
36 				struct gbm_device_info *info);
37 
38 /*
39  * Create "default" gbm device.
40  */
41 struct gbm_device *minigbm_create_default_device(int *out_fd);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif
48