[psplash,RFC,12/14] Reverse modeset_list

Message ID 20220425075954.10427-13-vasyl.vavrychuk@opensynergy.com
State New
Headers show
Series Implement DRM backend | expand

Commit Message

Vasyl Vavrychuk April 25, 2022, 7:59 a.m. UTC
Now, it has the same order as connectors in drmModeGetResources. As
result splash screen will be drawn on the first connector.

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
---
 psplash-drm.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/psplash-drm.c b/psplash-drm.c
index 30850ed..2468cf1 100644
--- a/psplash-drm.c
+++ b/psplash-drm.c
@@ -185,7 +185,7 @@  static int modeset_prepare(int fd)
 	drmModeRes *res;
 	drmModeConnector *conn;
 	int i;
-	struct modeset_dev *dev;
+	struct modeset_dev *dev, *last_dev = NULL;
 	int ret;
 
 	/* retrieve resources */
@@ -226,8 +226,13 @@  static int modeset_prepare(int fd)
 
 		/* free connector data and link device into global list */
 		drmModeFreeConnector(conn);
-		dev->next = modeset_list;
-		modeset_list = dev;
+		if (last_dev == NULL) {
+			modeset_list = dev;
+			last_dev = dev;
+		} else {
+			last_dev->next = dev;
+			last_dev = dev;
+		}
 	}
 
 	/* free resources again */