From 51bbf779ba2c9d5954e2c9470a8eae7c1ddd38a5 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 7 Jun 2022 13:47:35 +0100 Subject: Switch from using (E)GL to wl_shm. eglInitialize() is slow (~50-100ms), and uses a fair amount of memory (~100 MB). For such a small, simple program that just wants to launch as quickly as possible, wl_shm performs better. --- src/surface.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/surface.h') diff --git a/src/surface.h b/src/surface.h index b8b132f..8abd1e1 100644 --- a/src/surface.h +++ b/src/surface.h @@ -3,21 +3,28 @@ #include #include -#include "egl.h" -#include "gl.h" +#include +#include "color.h" +#include "image.h" struct surface { - struct egl egl; - struct gl gl; struct wl_surface *wl_surface; + struct wl_shm_pool *wl_shm_pool; int32_t width; int32_t height; + int32_t stride; + int index; + struct wl_buffer *buffers[2]; + + int shm_pool_size; + int shm_pool_fd; + uint8_t *shm_pool_data; bool redraw; }; void surface_initialise( struct surface *surface, - struct wl_display *wl_display, + struct wl_shm *wl_shm, struct image *texture); void surface_destroy(struct surface *surface); void surface_draw( -- cgit v1.2.3