|
|
|
@ -190,7 +190,7 @@ static void frame_send_ready(struct wlr_screencopy_frame_v1 *frame,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool frame_shm_copy(struct wlr_screencopy_frame_v1 *frame,
|
|
|
|
|
struct wlr_buffer *src_buffer, uint32_t *flags) {
|
|
|
|
|
struct wlr_buffer *src_buffer) {
|
|
|
|
|
struct wlr_output *output = frame->output;
|
|
|
|
|
struct wlr_renderer *renderer = output->renderer;
|
|
|
|
|
assert(renderer);
|
|
|
|
@ -208,16 +208,13 @@ static bool frame_shm_copy(struct wlr_screencopy_frame_v1 *frame,
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t renderer_flags = 0;
|
|
|
|
|
bool ok = false;
|
|
|
|
|
if (!wlr_renderer_begin_with_buffer(renderer, src_buffer)) {
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
ok = wlr_renderer_read_pixels(renderer, format, &renderer_flags,
|
|
|
|
|
ok = wlr_renderer_read_pixels(renderer, format,
|
|
|
|
|
stride, width, height, x, y, 0, 0, data);
|
|
|
|
|
wlr_renderer_end(renderer);
|
|
|
|
|
*flags = renderer_flags & WLR_RENDERER_READ_PIXELS_Y_INVERT ?
|
|
|
|
|
ZWLR_SCREENCOPY_FRAME_V1_FLAGS_Y_INVERT : 0;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
wlr_buffer_end_data_ptr_access(frame->buffer);
|
|
|
|
@ -293,14 +290,13 @@ static void frame_handle_output_commit(struct wl_listener *listener,
|
|
|
|
|
wl_list_remove(&frame->output_commit.link);
|
|
|
|
|
wl_list_init(&frame->output_commit.link);
|
|
|
|
|
|
|
|
|
|
uint32_t flags = 0;
|
|
|
|
|
bool ok;
|
|
|
|
|
switch (frame->buffer_cap) {
|
|
|
|
|
case WLR_BUFFER_CAP_DMABUF:
|
|
|
|
|
ok = frame_dma_copy(frame, buffer);
|
|
|
|
|
break;
|
|
|
|
|
case WLR_BUFFER_CAP_DATA_PTR:
|
|
|
|
|
ok = frame_shm_copy(frame, buffer, &flags);
|
|
|
|
|
ok = frame_shm_copy(frame, buffer);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
abort(); // unreachable
|
|
|
|
@ -311,7 +307,7 @@ static void frame_handle_output_commit(struct wl_listener *listener,
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
zwlr_screencopy_frame_v1_send_flags(frame->resource, flags);
|
|
|
|
|
zwlr_screencopy_frame_v1_send_flags(frame->resource, 0);
|
|
|
|
|
frame_send_damage(frame);
|
|
|
|
|
frame_send_ready(frame, event->when);
|
|
|
|
|
frame_destroy(frame);
|
|
|
|
|