aboutsummaryrefslogtreecommitdiff
path: root/include/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/utils.h')
-rw-r--r--include/utils.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/include/utils.h b/include/utils.h
index 7d76a2d..74fdd59 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -2,23 +2,21 @@
#define GSR_UTILS_H
#include "vec2.h"
+#include "../include/egl.h"
+#include "../include/defs.h"
#include <stdbool.h>
+#include <stdint.h>
#include <X11/extensions/Xrandr.h>
-typedef enum {
- GSR_GPU_VENDOR_AMD,
- GSR_GPU_VENDOR_INTEL,
- GSR_GPU_VENDOR_NVIDIA
-} gsr_gpu_vendor;
-
-typedef struct {
- gsr_gpu_vendor vendor;
- int gpu_version; /* 0 if unknown */
-} gsr_gpu_info;
-
typedef struct {
+ const char *name;
+ int name_len;
vec2i pos;
vec2i size;
+ XRRCrtcInfo *crt_info; /* Only on x11 */
+ uint32_t connector_id; /* Only on x11 and drm */
+ gsr_monitor_rotation rotation; /* Only on x11 and wayland */
+ uint32_t monitor_identifier; /* Only on drm and wayland */
} gsr_monitor;
typedef struct {
@@ -30,13 +28,19 @@ typedef struct {
double clock_get_monotonic_seconds(void);
-typedef void (*active_monitor_callback)(const XRROutputInfo *output_info, const XRRCrtcInfo *crt_info, const XRRModeInfo *mode_info, void *userdata);
-void for_each_active_monitor_output(Display *display, active_monitor_callback callback, void *userdata);
-bool get_monitor_by_name(Display *display, const char *name, gsr_monitor *monitor);
+typedef void (*active_monitor_callback)(const gsr_monitor *monitor, void *userdata);
+void for_each_active_monitor_output_x11(Display *display, active_monitor_callback callback, void *userdata);
+void for_each_active_monitor_output(const gsr_egl *egl, gsr_connection_type connection_type, active_monitor_callback callback, void *userdata);
+bool get_monitor_by_name(const gsr_egl *egl, gsr_connection_type connection_type, const char *name, gsr_monitor *monitor);
+gsr_monitor_rotation drm_monitor_get_display_server_rotation(const gsr_egl *egl, const gsr_monitor *monitor);
-bool gl_get_gpu_info(Display *dpy, gsr_gpu_info *info);
+bool gl_get_gpu_info(gsr_egl *egl, gsr_gpu_info *info);
/* |output| should be at least 128 bytes in size */
-bool gsr_get_valid_card_path(char *output);
+bool gsr_get_valid_card_path(gsr_egl *egl, char *output);
+/* |render_path| should be at least 128 bytes in size */
+bool gsr_card_path_get_render_path(const char *card_path, char *render_path);
+
+int even_number_ceil(int value);
#endif /* GSR_UTILS_H */