aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-02-10 02:47:01 +0100
committerdec05eba <dec05eba@protonmail.com>2024-02-10 03:48:43 +0100
commitb8843395acd03520b7630b6a1dc19f151f42382d (patch)
treef8da6cf22229ba44916de608c9bb46bfddcd8e79 /include
parentac73d9cb13ea7e4694b6b013de426cefddae4ca7 (diff)
Add screen rotation support (tested on amd/intel)
screen rotation in wayland is best effort, wayland doesn't give the necessary information to make it robust.
Diffstat (limited to 'include')
-rw-r--r--include/color_conversion.h7
-rw-r--r--include/egl.h2
-rw-r--r--include/utils.h12
3 files changed, 19 insertions, 2 deletions
diff --git a/include/color_conversion.h b/include/color_conversion.h
index 07b29f6..8bfe599 100644
--- a/include/color_conversion.h
+++ b/include/color_conversion.h
@@ -20,6 +20,11 @@ typedef enum {
} gsr_destination_color;
typedef struct {
+ int offset;
+ int rotation;
+} gsr_color_uniforms;
+
+typedef struct {
gsr_egl *egl;
gsr_source_color source_color;
@@ -33,7 +38,7 @@ typedef struct {
typedef struct {
gsr_color_conversion_params params;
- int rotation_uniforms[2];
+ gsr_color_uniforms uniforms[2];
gsr_shader shaders[2];
unsigned int framebuffers[2];
diff --git a/include/egl.h b/include/egl.h
index b8513fd..4705742 100644
--- a/include/egl.h
+++ b/include/egl.h
@@ -119,6 +119,7 @@ typedef struct {
void *output;
vec2i pos;
vec2i size;
+ int32_t transform;
char *name;
} gsr_wayland_output;
@@ -215,6 +216,7 @@ typedef struct {
void (*glBlendFunc)(unsigned int sfactor, unsigned int dfactor);
int (*glGetUniformLocation)(unsigned int program, const char *name);
void (*glUniform1f)(int location, float v0);
+ void (*glUniform2f)(int location, float v0, float v1);
} gsr_egl;
bool gsr_egl_load(gsr_egl *self, Display *dpy, bool wayland);
diff --git a/include/utils.h b/include/utils.h
index 26a0aed..898f375 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -18,13 +18,22 @@ typedef struct {
int gpu_version; /* 0 if unknown */
} gsr_gpu_info;
+typedef enum {
+ GSR_MONITOR_ROT_0,
+ GSR_MONITOR_ROT_90,
+ GSR_MONITOR_ROT_180,
+ GSR_MONITOR_ROT_270
+} gsr_monitor_rotation;
+
typedef struct {
const char *name;
int name_len;
vec2i pos;
vec2i size;
XRRCrtcInfo *crt_info; /* Only on x11 */
- uint32_t connector_id; /* Only on drm */
+ 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 enum {
@@ -46,6 +55,7 @@ typedef void (*active_monitor_callback)(const gsr_monitor *monitor, void *userda
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(gsr_egl *egl, gsr_gpu_info *info);