From 31ea61b390a3295248458ab7e8388848fb6810d0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 13 Nov 2022 17:08:00 +0100 Subject: [PATCH] render: add wlr_renderer.events.lost --- include/wlr/render/wlr_renderer.h | 6 ++++++ render/wlr_renderer.c | 1 + 2 files changed, 7 insertions(+) diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index 7d4e6720..c5c6be55 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -26,6 +26,12 @@ struct wlr_fbox; struct wlr_renderer { struct { struct wl_signal destroy; + /** + * Emitted when the GPU is lost, e.g. on GPU reset. + * + * Compositors should destroy the renderer and re-create it. + */ + struct wl_signal lost; } events; // private state diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index b10b7513..7a18d95f 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -44,6 +44,7 @@ void wlr_renderer_init(struct wlr_renderer *renderer, renderer->impl = impl; wl_signal_init(&renderer->events.destroy); + wl_signal_init(&renderer->events.lost); } void wlr_renderer_destroy(struct wlr_renderer *r) {