mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
render/egl: remove wlr_egl_swap_buffers
This commit is contained in:
parent
76ed2255ef
commit
50b120927d
2 changed files with 0 additions and 73 deletions
|
@ -37,7 +37,6 @@ struct wlr_egl_context {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_egl {
|
struct wlr_egl {
|
||||||
EGLenum platform;
|
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
EGLConfig config; // may be EGL_NO_CONFIG
|
EGLConfig config; // may be EGL_NO_CONFIG
|
||||||
EGLContext context;
|
EGLContext context;
|
||||||
|
@ -51,7 +50,6 @@ struct wlr_egl {
|
||||||
bool image_dma_buf_export_mesa;
|
bool image_dma_buf_export_mesa;
|
||||||
bool image_dmabuf_import_ext;
|
bool image_dmabuf_import_ext;
|
||||||
bool image_dmabuf_import_modifiers_ext;
|
bool image_dmabuf_import_modifiers_ext;
|
||||||
bool swap_buffers_with_damage;
|
|
||||||
|
|
||||||
// Device extensions
|
// Device extensions
|
||||||
bool device_drm_ext;
|
bool device_drm_ext;
|
||||||
|
@ -65,7 +63,6 @@ struct wlr_egl {
|
||||||
PFNEGLQUERYWAYLANDBUFFERWL eglQueryWaylandBufferWL;
|
PFNEGLQUERYWAYLANDBUFFERWL eglQueryWaylandBufferWL;
|
||||||
PFNEGLBINDWAYLANDDISPLAYWL eglBindWaylandDisplayWL;
|
PFNEGLBINDWAYLANDDISPLAYWL eglBindWaylandDisplayWL;
|
||||||
PFNEGLUNBINDWAYLANDDISPLAYWL eglUnbindWaylandDisplayWL;
|
PFNEGLUNBINDWAYLANDDISPLAYWL eglUnbindWaylandDisplayWL;
|
||||||
PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC eglSwapBuffersWithDamage; // KHR or EXT
|
|
||||||
PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT;
|
PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT;
|
||||||
PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT;
|
PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT;
|
||||||
PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC eglExportDMABUFImageQueryMESA;
|
PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC eglExportDMABUFImageQueryMESA;
|
||||||
|
@ -170,9 +167,6 @@ void wlr_egl_save_context(struct wlr_egl_context *context);
|
||||||
*/
|
*/
|
||||||
bool wlr_egl_restore_context(struct wlr_egl_context *context);
|
bool wlr_egl_restore_context(struct wlr_egl_context *context);
|
||||||
|
|
||||||
bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
|
||||||
pixman_region32_t *damage);
|
|
||||||
|
|
||||||
bool wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface);
|
bool wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface);
|
||||||
|
|
||||||
int wlr_egl_dup_drm_fd(struct wlr_egl *egl);
|
int wlr_egl_dup_drm_fd(struct wlr_egl *egl);
|
||||||
|
|
67
render/egl.c
67
render/egl.c
|
@ -196,8 +196,6 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
egl->platform = platform;
|
|
||||||
|
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
if (eglInitialize(egl->display, &major, &minor) == EGL_FALSE) {
|
if (eglInitialize(egl->display, &major, &minor) == EGL_FALSE) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize EGL");
|
wlr_log(WLR_ERROR, "Failed to initialize EGL");
|
||||||
|
@ -219,17 +217,6 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
egl->exts.buffer_age_ext =
|
egl->exts.buffer_age_ext =
|
||||||
check_egl_ext(display_exts_str, "EGL_EXT_buffer_age");
|
check_egl_ext(display_exts_str, "EGL_EXT_buffer_age");
|
||||||
|
|
||||||
if (check_egl_ext(display_exts_str, "EGL_KHR_swap_buffers_with_damage")) {
|
|
||||||
egl->exts.swap_buffers_with_damage = true;
|
|
||||||
load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
|
|
||||||
"eglSwapBuffersWithDamageKHR");
|
|
||||||
} else if (check_egl_ext(display_exts_str,
|
|
||||||
"EGL_EXT_swap_buffers_with_damage")) {
|
|
||||||
egl->exts.swap_buffers_with_damage = true;
|
|
||||||
load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
|
|
||||||
"eglSwapBuffersWithDamageEXT");
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
||||||
|
@ -487,60 +474,6 @@ bool wlr_egl_restore_context(struct wlr_egl_context *context) {
|
||||||
context->read_surface, context->context);
|
context->read_surface, context->context);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
|
||||||
pixman_region32_t *damage) {
|
|
||||||
// Never block when swapping buffers on Wayland
|
|
||||||
if (egl->platform == EGL_PLATFORM_WAYLAND_EXT) {
|
|
||||||
eglSwapInterval(egl->display, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLBoolean ret;
|
|
||||||
if (damage != NULL && egl->exts.swap_buffers_with_damage) {
|
|
||||||
EGLint width = 0, height = 0;
|
|
||||||
eglQuerySurface(egl->display, surface, EGL_WIDTH, &width);
|
|
||||||
eglQuerySurface(egl->display, surface, EGL_HEIGHT, &height);
|
|
||||||
|
|
||||||
pixman_region32_t flipped_damage;
|
|
||||||
pixman_region32_init(&flipped_damage);
|
|
||||||
wlr_region_transform(&flipped_damage, damage,
|
|
||||||
WL_OUTPUT_TRANSFORM_FLIPPED_180, width, height);
|
|
||||||
|
|
||||||
int nrects;
|
|
||||||
pixman_box32_t *rects =
|
|
||||||
pixman_region32_rectangles(&flipped_damage, &nrects);
|
|
||||||
EGLint egl_damage[4 * nrects + 1];
|
|
||||||
for (int i = 0; i < nrects; ++i) {
|
|
||||||
egl_damage[4*i] = rects[i].x1;
|
|
||||||
egl_damage[4*i + 1] = rects[i].y1;
|
|
||||||
egl_damage[4*i + 2] = rects[i].x2 - rects[i].x1;
|
|
||||||
egl_damage[4*i + 3] = rects[i].y2 - rects[i].y1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pixman_region32_fini(&flipped_damage);
|
|
||||||
|
|
||||||
if (nrects == 0) {
|
|
||||||
// Swapping with no rects is the same as swapping with the entire
|
|
||||||
// surface damaged. To swap with no damage, we set the damage region
|
|
||||||
// to a single empty rectangle.
|
|
||||||
nrects = 1;
|
|
||||||
memset(egl_damage, 0, sizeof(egl_damage));
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = egl->procs.eglSwapBuffersWithDamage(egl->display, surface,
|
|
||||||
egl_damage, nrects);
|
|
||||||
} else {
|
|
||||||
ret = eglSwapBuffers(egl->display, surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
wlr_log(WLR_ERROR, "eglSwapBuffers failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_egl_unset_current(egl);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
|
EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
|
||||||
struct wl_resource *data, EGLint *fmt, int *width, int *height,
|
struct wl_resource *data, EGLint *fmt, int *width, int *height,
|
||||||
bool *inverted_y) {
|
bool *inverted_y) {
|
||||||
|
|
Loading…
Reference in a new issue