render: drop wlr_renderer_read_pixels() flags

These are unused.
This commit is contained in:
Simon Ser 2022-10-03 11:44:21 +02:00
parent 50cc1ef4d3
commit 6832ae14aa
8 changed files with 12 additions and 27 deletions

View file

@ -407,7 +407,7 @@ static bool output_cursor_to_picture(struct wlr_x11_output *output,
} }
bool result = wlr_renderer_read_pixels( bool result = wlr_renderer_read_pixels(
renderer, DRM_FORMAT_ARGB8888, NULL, renderer, DRM_FORMAT_ARGB8888,
stride, buffer->width, buffer->height, 0, 0, 0, 0, stride, buffer->width, buffer->height, 0, 0, 0, 0,
data); data);

View file

@ -40,7 +40,7 @@ struct wlr_renderer_impl {
struct wlr_renderer *renderer); struct wlr_renderer *renderer);
uint32_t (*preferred_read_format)(struct wlr_renderer *renderer); uint32_t (*preferred_read_format)(struct wlr_renderer *renderer);
bool (*read_pixels)(struct wlr_renderer *renderer, uint32_t fmt, bool (*read_pixels)(struct wlr_renderer *renderer, uint32_t fmt,
uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
void *data); void *data);
void (*destroy)(struct wlr_renderer *renderer); void (*destroy)(struct wlr_renderer *renderer);

View file

@ -14,10 +14,6 @@
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/render/wlr_texture.h> #include <wlr/render/wlr_texture.h>
enum wlr_renderer_read_pixels_flags {
WLR_RENDERER_READ_PIXELS_Y_INVERT = 1,
};
struct wlr_renderer_impl; struct wlr_renderer_impl;
struct wlr_drm_format_set; struct wlr_drm_format_set;
struct wlr_buffer; struct wlr_buffer;
@ -90,12 +86,9 @@ const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
/** /**
* Reads out of pixels of the currently bound surface into data. `stride` is in * Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes. * bytes.
*
* If `flags` is not NULl, the caller indicates that it accepts frame flags
* defined in enum wlr_renderer_read_pixels_flags.
*/ */
bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt, bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt,
uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, void *data); uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, void *data);
/** /**

View file

@ -415,7 +415,7 @@ static uint32_t gles2_preferred_read_format(
} }
static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer, static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
uint32_t drm_format, uint32_t *flags, uint32_t stride, uint32_t drm_format, uint32_t stride,
uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y,
uint32_t dst_x, uint32_t dst_y, void *data) { uint32_t dst_x, uint32_t dst_y, void *data) {
struct wlr_gles2_renderer *renderer = struct wlr_gles2_renderer *renderer =
@ -464,10 +464,6 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
pop_gles2_debug(renderer); pop_gles2_debug(renderer);
if (flags != NULL) {
*flags = 0;
}
return glGetError() == GL_NO_ERROR; return glGetError() == GL_NO_ERROR;
} }

View file

@ -457,7 +457,7 @@ static uint32_t pixman_preferred_read_format(
} }
static bool pixman_read_pixels(struct wlr_renderer *wlr_renderer, static bool pixman_read_pixels(struct wlr_renderer *wlr_renderer,
uint32_t drm_format, uint32_t *flags, uint32_t stride, uint32_t drm_format, uint32_t stride,
uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y,
uint32_t dst_x, uint32_t dst_y, void *data) { uint32_t dst_x, uint32_t dst_y, void *data) {
struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer); struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);

View file

@ -970,7 +970,7 @@ static void vulkan_destroy(struct wlr_renderer *wlr_renderer) {
} }
static bool vulkan_read_pixels(struct wlr_renderer *wlr_renderer, static bool vulkan_read_pixels(struct wlr_renderer *wlr_renderer,
uint32_t drm_format, uint32_t *flags, uint32_t stride, uint32_t drm_format, uint32_t stride,
uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y,
uint32_t dst_x, uint32_t dst_y, void *data) { uint32_t dst_x, uint32_t dst_y, void *data) {
// TODO: implement! // TODO: implement!

View file

@ -194,13 +194,13 @@ uint32_t renderer_get_render_buffer_caps(struct wlr_renderer *r) {
} }
bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt, bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt,
uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
void *data) { void *data) {
if (!r->impl->read_pixels) { if (!r->impl->read_pixels) {
return false; return false;
} }
return r->impl->read_pixels(r, fmt, flags, stride, width, height, return r->impl->read_pixels(r, fmt, stride, width, height,
src_x, src_y, dst_x, dst_y, data); src_x, src_y, dst_x, dst_y, data);
} }

View file

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