summaryrefslogtreecommitdiffstats
path: root/meta-agl-drm-lease/recipes-core/psplash/files/0014-psplash-drm.c-Allocate-resources-only-for-the-first-.patch
blob: 28b1014b48095f97a0bcb2824853dce3e44de81a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 7423f166c8899b84448f68739d5293f19f8dfd06 Mon Sep 17 00:00:00 2001
From: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Date: Mon, 25 Apr 2022 10:59:53 +0300
Subject: [PATCH 14/17] psplash-drm.c: Allocate resources only for the first
 connector

Since splash screen is shown only on the first scanout, there is no need
to allocate resources for next connectors.

drm-backend backport from:
https://patchwork.yoctoproject.org/project/yocto/cover/20220425075954.10427-1-vasyl.vavrychuk@opensynergy.com/

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

diff --git a/psplash-drm.c b/psplash-drm.c
index 2468cf1..5e56286 100644
--- a/psplash-drm.c
+++ b/psplash-drm.c
@@ -39,6 +39,8 @@
 #include <xf86drmMode.h>
 #include "psplash-drm.h"
 
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
 struct modeset_dev;
 static int modeset_find_crtc(int fd, drmModeRes *res, drmModeConnector *conn,
 			     struct modeset_dev *dev);
@@ -196,8 +198,10 @@ static int modeset_prepare(int fd)
 		return -errno;
 	}
 
-	/* iterate all connectors */
-	for (i = 0; i < res->count_connectors; ++i) {
+	/* ~iterate all connectors~ - Use first connector if present. It is
+	   optimization related workaround since psplash supports drawing splash
+	   screen on one scanout anyway. */
+	for (i = 0; i < MIN(res->count_connectors, 1); ++i) {
 		/* get information for each connector */
 		conn = drmModeGetConnector(fd, res->connectors[i]);
 		if (!conn) {
-- 
2.25.1