Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit d0db6a8

Browse files
committed
Add post_frame event to wlr_output, use wlr_drm_plane_make_current in wlr_drm_output_read_pixels
1 parent 35f9700 commit d0db6a8

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

backend/drm/drm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
636636

637637
static void wlr_drm_connector_read_pixels(struct wlr_output *_output,
638638
void *out_data) {
639-
struct wlr_drm_output *output = (struct wlr_drm_output *)_output;
640-
struct wlr_drm_crtc *crtc = output->crtc;
641-
struct wlr_drm_plane *plane = crtc->primary;
639+
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
640+
struct wlr_drm_plane *plane = conn->crtc->primary;
641+
wlr_drm_plane_make_current(conn->renderer, plane);
642642
glReadPixels(0, 0, plane->width, plane->height, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
643643
out_data);
644644
}
@@ -846,6 +846,7 @@ static void page_flip_handler(int fd, unsigned seq,
846846

847847
if (drm->session->active) {
848848
wl_signal_emit(&conn->output.events.frame, &conn->output);
849+
wl_signal_emit(&conn->output.events.post_frame, &conn->output);
849850
}
850851
}
851852

include/wlr/types/wlr_output.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct wlr_output {
3737

3838
struct {
3939
struct wl_signal frame;
40+
struct wl_signal post_frame;
4041
struct wl_signal resolution;
4142
struct wl_signal destroy;
4243
} events;

types/wlr_output.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void wlr_output_init(struct wlr_output *output,
105105
output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
106106
output->scale = 1;
107107
wl_signal_init(&output->events.frame);
108+
wl_signal_init(&output->events.post_frame);
108109
wl_signal_init(&output->events.resolution);
109110
wl_signal_init(&output->events.destroy);
110111
}

types/wlr_screenshooter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void screenshooter_shoot(struct wl_client *client,
5959
state->output = output;
6060
state->screenshot = screenshot;
6161
state->frame_listener.notify = output_frame_notify;
62-
wl_signal_add(&output->events.frame, &state->frame_listener);
62+
wl_signal_add(&output->events.post_frame, &state->frame_listener);
6363
}
6464

6565
static struct orbital_screenshooter_interface screenshooter_impl = {

0 commit comments

Comments
 (0)