render/egl: remove surface and buffer age args from make_current

These aren't used anymore.
This commit is contained in:
Simon Ser 2021-01-09 12:13:35 +01:00
parent 1d461687d2
commit 3f7e0cf5f0
8 changed files with 19 additions and 45 deletions

View File

@ -116,7 +116,7 @@ bool drm_surface_make_current(struct wlr_drm_surface *surf,
} }
struct wlr_egl *egl = wlr_gles2_renderer_get_egl(surf->renderer->wlr_rend); struct wlr_egl *egl = wlr_gles2_renderer_get_egl(surf->renderer->wlr_rend);
if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(egl)) {
return false; return false;
} }
if (!wlr_renderer_bind_buffer(surf->renderer->wlr_rend, surf->back_buffer)) { if (!wlr_renderer_bind_buffer(surf->renderer->wlr_rend, surf->back_buffer)) {

View File

@ -52,7 +52,7 @@ static bool output_attach_render(struct wlr_output *wlr_output,
return false; return false;
} }
if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(egl)) {
return false; return false;
} }
if (!wlr_renderer_bind_buffer(output->backend->renderer, if (!wlr_renderer_bind_buffer(output->backend->renderer,

View File

@ -125,7 +125,7 @@ static bool output_attach_render(struct wlr_output *wlr_output,
return false; return false;
} }
if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(egl)) {
return false; return false;
} }
if (!wlr_renderer_bind_buffer(output->backend->renderer, if (!wlr_renderer_bind_buffer(output->backend->renderer,
@ -433,7 +433,7 @@ static bool output_set_cursor(struct wlr_output *wlr_output,
return false; return false;
} }
if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(egl)) {
return false; return false;
} }
if (!wlr_renderer_bind_buffer(output->backend->renderer, wlr_buffer)) { if (!wlr_renderer_bind_buffer(output->backend->renderer, wlr_buffer)) {

View File

@ -106,7 +106,7 @@ static bool output_attach_render(struct wlr_output *wlr_output,
return false; return false;
} }
if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(egl)) {
return false; return false;
} }
if (!wlr_renderer_bind_buffer(x11->renderer, output->back_buffer)) { if (!wlr_renderer_bind_buffer(x11->renderer, output->back_buffer)) {

View File

@ -45,7 +45,6 @@ struct wlr_egl {
struct { struct {
// Display extensions // Display extensions
bool bind_wayland_display_wl; bool bind_wayland_display_wl;
bool buffer_age_ext;
bool image_base_khr; bool image_base_khr;
bool image_dma_buf_export_mesa; bool image_dma_buf_export_mesa;
bool image_dmabuf_import_ext; bool image_dmabuf_import_ext;
@ -141,14 +140,12 @@ bool wlr_egl_export_image_to_dmabuf(struct wlr_egl *egl, EGLImageKHR image,
bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image); bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image);
/** /**
* Make the EGL context current. The provided surface will be made current * Make the EGL context current.
* unless EGL_NO_SURFACE.
* *
* Callers are expected to clear the current context when they are done by * Callers are expected to clear the current context when they are done by
* calling wlr_egl_unset_current. * calling wlr_egl_unset_current.
*/ */
bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface, bool wlr_egl_make_current(struct wlr_egl *egl);
int *buffer_age);
bool wlr_egl_unset_current(struct wlr_egl *egl); bool wlr_egl_unset_current(struct wlr_egl *egl);

View File

@ -220,9 +220,6 @@ struct wlr_egl *wlr_egl_create(EGLenum platform, void *remote_display,
load_egl_proc(&egl->procs.eglDestroyImageKHR, "eglDestroyImageKHR"); load_egl_proc(&egl->procs.eglDestroyImageKHR, "eglDestroyImageKHR");
} }
egl->exts.buffer_age_ext =
check_egl_ext(display_exts_str, "EGL_EXT_buffer_age");
egl->exts.image_dmabuf_import_ext = egl->exts.image_dmabuf_import_ext =
check_egl_ext(display_exts_str, "EGL_EXT_image_dma_buf_import"); check_egl_ext(display_exts_str, "EGL_EXT_image_dma_buf_import");
if (check_egl_ext(display_exts_str, if (check_egl_ext(display_exts_str,
@ -414,32 +411,12 @@ EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window) {
return surf; return surf;
} }
static int egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface) { bool wlr_egl_make_current(struct wlr_egl *egl) {
if (!egl->exts.buffer_age_ext) { if (!eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
return -1; egl->context)) {
}
EGLint buffer_age;
EGLBoolean ok = eglQuerySurface(egl->display, surface,
EGL_BUFFER_AGE_EXT, &buffer_age);
if (!ok) {
wlr_log(WLR_ERROR, "Failed to get EGL surface buffer age");
return -1;
}
return buffer_age;
}
bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface,
int *buffer_age) {
if (!eglMakeCurrent(egl->display, surface, surface, egl->context)) {
wlr_log(WLR_ERROR, "eglMakeCurrent failed"); wlr_log(WLR_ERROR, "eglMakeCurrent failed");
return false; return false;
} }
if (buffer_age != NULL) {
*buffer_age = egl_get_buffer_age(egl, surface);
}
return true; return true;
} }
@ -751,7 +728,7 @@ bool wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface) {
// Reset the current EGL surface in case it's the one we're destroying, // Reset the current EGL surface in case it's the one we're destroying,
// otherwise the next wlr_egl_make_current call will result in a // otherwise the next wlr_egl_make_current call will result in a
// use-after-free. // use-after-free.
wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(egl);
} }
return eglDestroySurface(egl->display, surface); return eglDestroySurface(egl->display, surface);
} }

View File

@ -41,7 +41,7 @@ static void destroy_buffer(struct wlr_gles2_buffer *buffer) {
wl_list_remove(&buffer->link); wl_list_remove(&buffer->link);
wl_list_remove(&buffer->buffer_destroy.link); wl_list_remove(&buffer->buffer_destroy.link);
wlr_egl_make_current(buffer->renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(buffer->renderer->egl);
push_gles2_debug(buffer->renderer); push_gles2_debug(buffer->renderer);
@ -575,7 +575,7 @@ static bool gles2_blit_dmabuf(struct wlr_renderer *wlr_renderer,
gles2_src_tex->inverted_y = !gles2_src_tex->inverted_y; gles2_src_tex->inverted_y = !gles2_src_tex->inverted_y;
} }
if (!wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(renderer->egl)) {
goto texture_destroy_out; goto texture_destroy_out;
} }
@ -673,7 +673,7 @@ struct wlr_egl *wlr_gles2_renderer_get_egl(struct wlr_renderer *wlr_renderer) {
static void gles2_destroy(struct wlr_renderer *wlr_renderer) { static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(renderer->egl);
struct wlr_gles2_buffer *buffer, *buffer_tmp; struct wlr_gles2_buffer *buffer, *buffer_tmp;
wl_list_for_each_safe(buffer, buffer_tmp, &renderer->buffers, link) { wl_list_for_each_safe(buffer, buffer_tmp, &renderer->buffers, link) {
@ -861,7 +861,7 @@ extern const GLchar tex_fragment_src_rgbx[];
extern const GLchar tex_fragment_src_external[]; extern const GLchar tex_fragment_src_external[];
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) { if (!wlr_egl_make_current(egl)) {
return NULL; return NULL;
} }

View File

@ -29,7 +29,7 @@ struct wlr_gles2_texture *gles2_get_texture(
static struct wlr_gles2_texture *get_gles2_texture_in_context( static struct wlr_gles2_texture *get_gles2_texture_in_context(
struct wlr_texture *wlr_texture) { struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
wlr_egl_make_current(texture->renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(texture->renderer->egl);
return texture; return texture;
} }
@ -138,7 +138,7 @@ struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
uint32_t height, const void *data) { uint32_t height, const void *data) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(renderer->egl);
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) { if (fmt == NULL) {
@ -180,7 +180,7 @@ struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
struct wl_resource *resource) { struct wl_resource *resource) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(renderer->egl);
if (!renderer->procs.glEGLImageTargetTexture2DOES) { if (!renderer->procs.glEGLImageTargetTexture2DOES) {
return NULL; return NULL;
@ -245,7 +245,7 @@ struct wlr_texture *gles2_texture_from_dmabuf(struct wlr_renderer *wlr_renderer,
struct wlr_dmabuf_attributes *attribs) { struct wlr_dmabuf_attributes *attribs) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(renderer->egl);
if (!renderer->procs.glEGLImageTargetTexture2DOES) { if (!renderer->procs.glEGLImageTargetTexture2DOES) {
return NULL; return NULL;