aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_output.h7
-rw-r--r--types/wlr_output.c15
2 files changed, 16 insertions, 6 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index f9bce91f..b5523100 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -1,9 +1,9 @@
#ifndef WLR_TYPES_WLR_OUTPUT_H
#define WLR_TYPES_WLR_OUTPUT_H
+#include <stdbool.h>
#include <wayland-util.h>
#include <wayland-server.h>
-#include <stdbool.h>
struct wlr_output_mode {
uint32_t flags; // enum wl_output_mode
@@ -44,8 +44,9 @@ struct wlr_output {
uint32_t scale;
int32_t width, height;
int32_t phys_width, phys_height; // mm
- int32_t subpixel; // enum wl_output_subpixel
- int32_t transform; // enum wl_output_transform
+ enum wl_output_subpixel subpixel;
+ enum wl_output_transform transform;
+ bool needs_swap;
float transform_matrix[16];
diff --git a/types/wlr_output.c b/types/wlr_output.c
index 93d4de93..85e3d05e 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -291,6 +291,8 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) {
}
void wlr_output_swap_buffers(struct wlr_output *output) {
+ wl_signal_emit(&output->events.swap_buffers, &output);
+
struct wlr_output_cursor *cursor;
wl_list_for_each(cursor, &output->cursors, link) {
if (output->hardware_cursor == cursor) {
@@ -299,9 +301,8 @@ void wlr_output_swap_buffers(struct wlr_output *output) {
output_cursor_render(cursor);
}
- wl_signal_emit(&output->events.swap_buffers, &output);
-
output->impl->swap_buffers(output);
+ output->needs_swap = false;
}
void wlr_output_set_gamma(struct wlr_output *output,
@@ -319,6 +320,9 @@ uint32_t wlr_output_get_gamma_size(struct wlr_output *output) {
}
static void output_cursor_reset(struct wlr_output_cursor *cursor) {
+ if (cursor->output->hardware_cursor != cursor) {
+ cursor->output->needs_swap = true;
+ }
if (cursor->surface != NULL) {
wl_list_remove(&cursor->surface_commit.link);
wl_list_remove(&cursor->surface_destroy.link);
@@ -347,6 +351,7 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
}
wlr_log(L_INFO, "Falling back to software cursor");
+ cursor->output->needs_swap = true;
if (cursor->renderer == NULL) {
cursor->renderer = wlr_gles2_renderer_create(cursor->output->backend);
@@ -370,7 +375,11 @@ static void output_cursor_commit(struct wlr_output_cursor *cursor) {
cursor->width = cursor->surface->current->width;
cursor->height = cursor->surface->current->height;
- // TODO: if hardware cursor, upload pixels
+ if (cursor->output->hardware_cursor != cursor) {
+ cursor->output->needs_swap = true;
+ } else {
+ // TODO: upload pixels
+ }
}
static inline int64_t timespec_to_msec(const struct timespec *a) {