diff options
| author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-11-15 13:42:06 -0500 | 
|---|---|---|
| committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-11-18 09:37:57 -0500 | 
| commit | a6538ced35872a86d37d6ca32b1d9ddb5fe2c4b7 (patch) | |
| tree | 6bf2caa5187d1c83db895676dac960eb6175e73f /tinywl | |
| parent | 6d6e70b9e0e40b6d38ba9276127b869bae893d43 (diff) | |
| download | wlroots-a6538ced35872a86d37d6ca32b1d9ddb5fe2c4b7.tar.xz | |
tinywl: autocreate allocator and init output
Diffstat (limited to 'tinywl')
| -rw-r--r-- | tinywl/tinywl.c | 18 | 
1 files changed, 16 insertions, 2 deletions
| diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index b11549be..82f0977a 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -7,6 +7,7 @@  #include <unistd.h>  #include <wayland-server-core.h>  #include <wlr/backend.h> +#include <wlr/render/allocator.h>  #include <wlr/render/wlr_renderer.h>  #include <wlr/types/wlr_cursor.h>  #include <wlr/types/wlr_compositor.h> @@ -34,6 +35,7 @@ struct tinywl_server {  	struct wl_display *wl_display;  	struct wlr_backend *backend;  	struct wlr_renderer *renderer; +	struct wlr_allocator *allocator;  	struct wlr_xdg_shell *xdg_shell;  	struct wl_listener new_xdg_surface; @@ -676,6 +678,10 @@ static void server_new_output(struct wl_listener *listener, void *data) {  		}  	} +	/* Configures the output created by the backend to use our allocator +	 * and our renderer */ +	wlr_output_init_render(wlr_output, server->allocator, server->renderer); +  	/* Allocates and configures our state for this output */  	struct tinywl_output *output =  		calloc(1, sizeof(struct tinywl_output)); @@ -841,12 +847,20 @@ int main(int argc, char *argv[]) {  	 * if an X11 server is running. */  	server.backend = wlr_backend_autocreate(server.wl_display); -	/* If we don't provide a renderer, autocreate makes a GLES2 renderer for us. +	/* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The user +	 * can also specify a renderer using the WLR_RENDERER env var.  	 * The renderer is responsible for defining the various pixel formats it  	 * supports for shared memory, this configures that for clients. */ -	server.renderer = wlr_backend_get_renderer(server.backend); +	server.renderer = wlr_renderer_autocreate(server.backend);  	wlr_renderer_init_wl_display(server.renderer, server.wl_display); +	/* Autocreates an allocator for us. +	 * The allocator is the bridge between the renderer and the backend. It +	 * handles the buffer creation, allowing wlroots to render onto the +	 * screen */ +	 server.allocator = wlr_allocator_autocreate(server.backend, +		server.renderer); +  	/* This creates some hands-off wlroots interfaces. The compositor is  	 * necessary for clients to allocate surfaces and the data device manager  	 * handles the clipboard. Each of these wlroots interfaces has room for you | 
