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

Commit

Permalink
Add post_frame event to wlr_output, use wlr_drm_plane_make_current in…
Browse files Browse the repository at this point in the history
… wlr_drm_output_read_pixels
  • Loading branch information
emersion committed Oct 7, 2017
1 parent 35f9700 commit d0db6a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions backend/drm/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
1 change: 1 addition & 0 deletions include/wlr/types/wlr_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions types/wlr_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion types/wlr_screenshooter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit d0db6a8

Please sign in to comment.