launcher: logind : Fix to avoid compositor to go asleep when drm device removed

drm_device_is_kms is called multiple times for each DRM device node. When
weston_launcher_close is called on a non-kms DRM device, it will deactivate
the session and cause the compositor to sleep.

Add a check for "gone" event when the device gets removed, to avoid deactivating
the compositor.

The case was reproduced on an embedded device having muliple DRM nodes on
which the order of udev_enumerate_get_list_entry was not predictable.

Upstream Status: Proposed

Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
(cherry picked from commit 0a1912e121691c64b6919532180b32377ed9235a)
(cherry picked from commit a1859cfd8fff01524fa9d98bbfa5f15656943eb5)
diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index 34e6e5c..ff6cd73 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -483,10 +483,11 @@
 	 * "gone" means the device is gone. We handle it the same as "force" as
 	 * a following udev event will be caught, too.
 	 *
-	 * If it's our main DRM device, tell the compositor to go asleep. */
-
+	 * If it's our main DRM device and not "gone", tell the compositor to go asleep. */
 	if (!strcmp(type, "pause"))
 		launcher_logind_pause_device_complete(wl, major, minor);
+	else if (strcmp(type, "gone") == 0)
+		return;
 
 	if (wl->sync_drm && major == DRM_MAJOR)
 		launcher_logind_set_active(wl, false);