summaryrefslogtreecommitdiff
path: root/minigbm_helpers.h
diff options
context:
space:
mode:
authorDominik Behr <dbehr@chromium.org>2020-12-08 21:22:38 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-16 08:01:01 +0000
commit8ff2bf873f6d4b5c84c7ae854ebaeb70df514952 (patch)
tree2dec195008e6f0dbf6516cdc3020c6efa7a368e8 /minigbm_helpers.h
parent50855621e79fd1e71b30ca3fed85342795ba13a2 (diff)
downloadminigbm-8ff2bf873f6d4b5c84c7ae854ebaeb70df514952.tar.gz
minigbm: add helper function for detecting DRI devices
and discovering "default" device. These are utility functions to help virglrenderer and possibly other clients enumerate and discover DRI devices. They can be improved separately from virglrenderer. BUG=b:175246639 TEST=build and run together with virglrenderer change Change-Id: I86c3e68cdab5a824184e744c4c90fb7daa316377 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2583188 Tested-by: Dominik Behr <dbehr@chromium.org> Auto-Submit: Dominik Behr <dbehr@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Dominik Behr <dbehr@chromium.org>
Diffstat (limited to 'minigbm_helpers.h')
-rw-r--r--minigbm_helpers.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/minigbm_helpers.h b/minigbm_helpers.h
new file mode 100644
index 0000000..6264ac0
--- /dev/null
+++ b/minigbm_helpers.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef _MINIGBM_HELPERS_H_
+#define _MINIGBM_HELPERS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GBM_DEV_TYPE_FLAG_DISCRETE (1u << 0) /* Discrete GPU. Separate chip, dedicated VRAM. */
+#define GBM_DEV_TYPE_FLAG_DISPLAY (1u << 1) /* Device capable of display. */
+#define GBM_DEV_TYPE_FLAG_3D (1u << 2) /* Device capable or 3D rendering. */
+#define GBM_DEV_TYPE_FLAG_ARMSOC (1u << 3) /* Device on ARM SOC. */
+#define GBM_DEV_TYPE_FLAG_USB (1u << 4) /* USB device, udl, evdi. */
+#define GBM_DEV_TYPE_FLAG_BLOCKED (1u << 5) /* Unsuitable device e.g. vgem, udl, evdi. */
+#define GBM_DEV_TYPE_FLAG_INTERNAL_LCD (1u << 6) /* Device is driving internal LCD. */
+
+struct gbm_device_info {
+ uint32_t dev_type_flags;
+ int dri_node_num; /* DRI node number (0..63), for easy matching of devices. */
+ unsigned int connectors;
+ unsigned int connected;
+};
+
+#define GBM_DETECT_FLAG_CONNECTED (1u << 0) /* Check if any connectors are connected. SLOW! */
+
+int gbm_detect_device_info(unsigned int detect_flags, int fd, struct gbm_device_info *info);
+int gbm_detect_device_info_path(unsigned int detect_flags, const char *dev_node,
+ struct gbm_device_info *info);
+
+/*
+ * Select "default" device to use for graphics memory allocator.
+ */
+int gbm_get_default_device_fd(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif