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>
This commit is contained in:
Philipp Zabel 2023-04-17 11:51:10 +02:00 committed by Daniel Stone
parent d0301c9a82
commit 9e070c0840

View File

@ -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;