mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-10 13:29:44 -05:00
render/egl: remove wlr_egl context functions
This commit is contained in:
parent
95928cec72
commit
72073e5792
4 changed files with 15 additions and 42 deletions
|
|
@ -80,19 +80,4 @@ bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image);
|
||||||
|
|
||||||
int wlr_egl_dup_drm_fd(struct wlr_egl *egl);
|
int wlr_egl_dup_drm_fd(struct wlr_egl *egl);
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes the provided EGL context current
|
|
||||||
*
|
|
||||||
* Callers are expected to clear the current context when they are done by
|
|
||||||
* calling wlr_egl_unset_current.
|
|
||||||
*/
|
|
||||||
bool wlr_egl_make_current(struct wlr_egl *egl);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the current EGLContext
|
|
||||||
*/
|
|
||||||
bool wlr_egl_unset_current(struct wlr_egl *egl);
|
|
||||||
|
|
||||||
bool wlr_egl_is_current(struct wlr_egl *egl);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
12
render/egl.c
12
render/egl.c
|
|
@ -541,18 +541,6 @@ bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImage image) {
|
||||||
return egl->procs.eglDestroyImageKHR(egl->ctx.display, image);
|
return egl->procs.eglDestroyImageKHR(egl->ctx.display, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_egl_make_current(struct wlr_egl *egl) {
|
|
||||||
return wlr_egl_context_set_current(&egl->ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wlr_egl_unset_current(struct wlr_egl *egl) {
|
|
||||||
return wlr_egl_context_unset_current(&egl->ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wlr_egl_is_current(struct wlr_egl *egl) {
|
|
||||||
return wlr_egl_context_is_current(&egl->ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wlr_egl_context_set_current(struct wlr_egl_context *ctx) {
|
bool wlr_egl_context_set_current(struct wlr_egl_context *ctx) {
|
||||||
if (!eglMakeCurrent(ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
if (!eglMakeCurrent(ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
ctx->context)) {
|
ctx->context)) {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ struct wlr_gles2_renderer *gles2_get_renderer(
|
||||||
static struct wlr_gles2_renderer *gles2_get_renderer_in_context(
|
static struct wlr_gles2_renderer *gles2_get_renderer_in_context(
|
||||||
struct wlr_renderer *wlr_renderer) {
|
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);
|
||||||
assert(wlr_egl_is_current(renderer->egl));
|
assert(wlr_egl_context_is_current(&renderer->egl->ctx));
|
||||||
assert(renderer->current_buffer != NULL);
|
assert(renderer->current_buffer != NULL);
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ static void destroy_buffer(struct wlr_gles2_buffer *buffer) {
|
||||||
|
|
||||||
struct wlr_egl_context prev_ctx;
|
struct wlr_egl_context prev_ctx;
|
||||||
wlr_egl_context_save(&prev_ctx);
|
wlr_egl_context_save(&prev_ctx);
|
||||||
wlr_egl_make_current(buffer->renderer->egl);
|
wlr_egl_context_set_current(&buffer->renderer->egl->ctx);
|
||||||
|
|
||||||
push_gles2_debug(buffer->renderer);
|
push_gles2_debug(buffer->renderer);
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ static bool gles2_bind_buffer(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);
|
||||||
|
|
||||||
if (renderer->current_buffer != NULL) {
|
if (renderer->current_buffer != NULL) {
|
||||||
assert(wlr_egl_is_current(renderer->egl));
|
assert(wlr_egl_context_is_current(&renderer->egl->ctx));
|
||||||
|
|
||||||
push_gles2_debug(renderer);
|
push_gles2_debug(renderer);
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
@ -168,11 +168,11 @@ static bool gles2_bind_buffer(struct wlr_renderer *wlr_renderer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlr_buffer == NULL) {
|
if (wlr_buffer == NULL) {
|
||||||
wlr_egl_unset_current(renderer->egl);
|
wlr_egl_context_unset_current(&renderer->egl->ctx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_egl_make_current(renderer->egl);
|
wlr_egl_context_set_current(&renderer->egl->ctx);
|
||||||
|
|
||||||
struct wlr_gles2_buffer *buffer = get_buffer(renderer, wlr_buffer);
|
struct wlr_gles2_buffer *buffer = get_buffer(renderer, wlr_buffer);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
|
|
@ -503,7 +503,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);
|
wlr_egl_context_set_current(&renderer->egl->ctx);
|
||||||
|
|
||||||
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) {
|
||||||
|
|
@ -527,7 +527,7 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
|
||||||
renderer->procs.glDebugMessageCallbackKHR(NULL, NULL);
|
renderer->procs.glDebugMessageCallbackKHR(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_egl_unset_current(renderer->egl);
|
wlr_egl_context_unset_current(&renderer->egl->ctx);
|
||||||
wlr_egl_destroy(renderer->egl);
|
wlr_egl_destroy(renderer->egl);
|
||||||
|
|
||||||
if (renderer->drm_fd >= 0) {
|
if (renderer->drm_fd >= 0) {
|
||||||
|
|
@ -705,7 +705,7 @@ struct wlr_renderer *wlr_gles2_renderer_create_with_drm_fd(int drm_fd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
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)) {
|
if (!wlr_egl_context_set_current(&egl->ctx)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -844,7 +844,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
|
||||||
|
|
||||||
pop_gles2_debug(renderer);
|
pop_gles2_debug(renderer);
|
||||||
|
|
||||||
wlr_egl_unset_current(renderer->egl);
|
wlr_egl_context_unset_current(&renderer->egl->ctx);
|
||||||
|
|
||||||
return &renderer->wlr_renderer;
|
return &renderer->wlr_renderer;
|
||||||
|
|
||||||
|
|
@ -861,7 +861,7 @@ error:
|
||||||
renderer->procs.glDebugMessageCallbackKHR(NULL, NULL);
|
renderer->procs.glDebugMessageCallbackKHR(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_egl_unset_current(renderer->egl);
|
wlr_egl_context_unset_current(&renderer->egl->ctx);
|
||||||
|
|
||||||
free(renderer);
|
free(renderer);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
|
||||||
|
|
||||||
struct wlr_egl_context prev_ctx;
|
struct wlr_egl_context prev_ctx;
|
||||||
wlr_egl_context_save(&prev_ctx);
|
wlr_egl_context_save(&prev_ctx);
|
||||||
wlr_egl_make_current(texture->renderer->egl);
|
wlr_egl_context_set_current(&texture->renderer->egl->ctx);
|
||||||
|
|
||||||
push_gles2_debug(texture->renderer);
|
push_gles2_debug(texture->renderer);
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ static bool gles2_texture_invalidate(struct wlr_gles2_texture *texture) {
|
||||||
|
|
||||||
struct wlr_egl_context prev_ctx;
|
struct wlr_egl_context prev_ctx;
|
||||||
wlr_egl_context_save(&prev_ctx);
|
wlr_egl_context_save(&prev_ctx);
|
||||||
wlr_egl_make_current(texture->renderer->egl);
|
wlr_egl_context_set_current(&texture->renderer->egl->ctx);
|
||||||
|
|
||||||
push_gles2_debug(texture->renderer);
|
push_gles2_debug(texture->renderer);
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ void gles2_texture_destroy(struct wlr_gles2_texture *texture) {
|
||||||
|
|
||||||
struct wlr_egl_context prev_ctx;
|
struct wlr_egl_context prev_ctx;
|
||||||
wlr_egl_context_save(&prev_ctx);
|
wlr_egl_context_save(&prev_ctx);
|
||||||
wlr_egl_make_current(texture->renderer->egl);
|
wlr_egl_context_set_current(&texture->renderer->egl->ctx);
|
||||||
|
|
||||||
push_gles2_debug(texture->renderer);
|
push_gles2_debug(texture->renderer);
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ static struct wlr_texture *gles2_texture_from_pixels(
|
||||||
|
|
||||||
struct wlr_egl_context prev_ctx;
|
struct wlr_egl_context prev_ctx;
|
||||||
wlr_egl_context_save(&prev_ctx);
|
wlr_egl_context_save(&prev_ctx);
|
||||||
wlr_egl_make_current(renderer->egl);
|
wlr_egl_context_set_current(&renderer->egl->ctx);
|
||||||
|
|
||||||
push_gles2_debug(renderer);
|
push_gles2_debug(renderer);
|
||||||
|
|
||||||
|
|
@ -264,7 +264,7 @@ static struct wlr_texture *gles2_texture_from_dmabuf(
|
||||||
|
|
||||||
struct wlr_egl_context prev_ctx;
|
struct wlr_egl_context prev_ctx;
|
||||||
wlr_egl_context_save(&prev_ctx);
|
wlr_egl_context_save(&prev_ctx);
|
||||||
wlr_egl_make_current(renderer->egl);
|
wlr_egl_context_set_current(&renderer->egl->ctx);
|
||||||
|
|
||||||
bool external_only;
|
bool external_only;
|
||||||
texture->image =
|
texture->image =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue