output: add wlr_output_preferred_read_format()

The read format is dependent on the output, so we first need to make it
current. This fixes a race condition in wlr-screencopy-v1 where a dmabuf
client would cause EGL_NO_SURFACE to be bound at the time when
screencopy needs to query for the preferred format, causing GL errors.
This commit is contained in:
Ilia Bozhinov 2018-11-23 21:20:57 +01:00
parent c70b8f64b7
commit fb5691b6cc
5 changed files with 22 additions and 15 deletions

View file

@ -139,15 +139,6 @@ int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *r, int format,
return r->impl->get_dmabuf_modifiers(r, format, modifiers);
}
bool wlr_renderer_preferred_read_format(struct wlr_renderer *r,
enum wl_shm_format *fmt) {
if (!r->impl->preferred_read_format || !r->impl->read_pixels) {
return false;
}
*fmt = r->impl->preferred_read_format(r);
return true;
}
bool wlr_renderer_read_pixels(struct wlr_renderer *r, enum wl_shm_format fmt,
uint32_t *flags, 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,