summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2023-04-17 11:51:10 +0200
committerDaniel Stone <daniels@collabora.com>2023-04-19 13:36:45 +0000
commit9e070c0840c622344f2281e051ecf813e58d0aff (patch)
treecf885c4b5d90890f42cd57eed4a2aa2a6cd33eb7
parentd0301c9a82227e0490115d1b58ca6cb95f683c1b (diff)
downloadweston-9e070c0840c622344f2281e051ecf813e58d0aff.tar.gz
backend-drm: obtain DRM backend from listener in session_notify()
The session_listener is embedded in the DRM backend structure. Use this to obtain the DRM backend with container_of(). That way the DRM backend will not have to be found from the compositor. This is trivial now, but in the multi-backend case would entail iterating over all backends to find the correct one. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
-rw-r--r--libweston/backend-drm/drm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
index f2a3755d..1078b89b 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -3206,7 +3206,8 @@ static void
session_notify(struct wl_listener *listener, void *data)
{
struct weston_compositor *compositor = data;
- struct drm_backend *b = to_drm_backend(compositor);
+ struct drm_backend *b =
+ container_of(listener, struct drm_backend, session_listener);
struct drm_device *device = b->drm;
struct weston_output *output;