aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-09-09 11:32:03 +0200
committeremersion <contact@emersion.fr>2017-10-07 16:22:02 +0200
commitd0db6a80ab64ee1f5d090677c18f57109b36575a (patch)
tree79b6f3ec9abbfa494b777ff41a63d0e30c86b991
parent35f970025133dc5ad627936a3cdeacb37b532072 (diff)
Add post_frame event to wlr_output, use wlr_drm_plane_make_current in wlr_drm_output_read_pixels
-rw-r--r--backend/drm/drm.c7
-rw-r--r--include/wlr/types/wlr_output.h1
-rw-r--r--types/wlr_output.c1
-rw-r--r--types/wlr_screenshooter.c2
4 files changed, 7 insertions, 4 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 117e5749..ec0c29f7 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -636,9 +636,9 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
static void wlr_drm_connector_read_pixels(struct wlr_output *_output,
void *out_data) {
- struct wlr_drm_output *output = (struct wlr_drm_output *)_output;
- struct wlr_drm_crtc *crtc = output->crtc;
- struct wlr_drm_plane *plane = crtc->primary;
+ struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
+ struct wlr_drm_plane *plane = conn->crtc->primary;
+ wlr_drm_plane_make_current(conn->renderer, plane);
glReadPixels(0, 0, plane->width, plane->height, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
out_data);
}
@@ -846,6 +846,7 @@ static void page_flip_handler(int fd, unsigned seq,
if (drm->session->active) {
wl_signal_emit(&conn->output.events.frame, &conn->output);
+ wl_signal_emit(&conn->output.events.post_frame, &conn->output);
}
}
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 509e1bcb..a7ad2dbd 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -37,6 +37,7 @@ struct wlr_output {
struct {
struct wl_signal frame;
+ struct wl_signal post_frame;
struct wl_signal resolution;
struct wl_signal destroy;
} events;
diff --git a/types/wlr_output.c b/types/wlr_output.c
index abad1aec..e0220e6b 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -105,6 +105,7 @@ void wlr_output_init(struct wlr_output *output,
output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
output->scale = 1;
wl_signal_init(&output->events.frame);
+ wl_signal_init(&output->events.post_frame);
wl_signal_init(&output->events.resolution);
wl_signal_init(&output->events.destroy);
}
diff --git a/types/wlr_screenshooter.c b/types/wlr_screenshooter.c
index 43e5fcd9..5f20925c 100644
--- a/types/wlr_screenshooter.c
+++ b/types/wlr_screenshooter.c
@@ -59,7 +59,7 @@ static void screenshooter_shoot(struct wl_client *client,
state->output = output;
state->screenshot = screenshot;
state->frame_listener.notify = output_frame_notify;
- wl_signal_add(&output->events.frame, &state->frame_listener);
+ wl_signal_add(&output->events.post_frame, &state->frame_listener);
}
static struct orbital_screenshooter_interface screenshooter_impl = {