Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] lib/sysfs: Fix fbcon unbind, again
@ 2018-03-05 12:54 Ville Syrjala
  2018-03-05 12:54 ` [igt-dev] [PATCH i-g-t 2/2] lib/sysfs: s/kick_fbcon/bind_fbcon/ Ville Syrjala
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ville Syrjala @ 2018-03-05 12:54 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Looks like unbinding the dummy con doesn't work on all machines. Instead
we have to bind fbcon (which is what we used to do before commit
d18fca7f6cf3 ("lib/sysfs: Fix fbcon rebind")). Since some machines need
the bind and others need the unbind let's do both. The most obvious
difference I observed between two machines that behave differently
was the order in which the console drivers were listed in sysfs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_sysfs.c | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index f8aae9d5c695..3b8308118432 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -503,14 +503,7 @@ bool igt_sysfs_set_boolean(int dir, const char *attr, bool value)
 	return igt_sysfs_printf(dir, attr, "%d", value) == 1;
 }
 
-/**
- * kick_fbcon:
- * @enable: boolean value
- *
- * This functions enables/disables the text console running on top of the
- * framebuffer device.
- */
-void kick_fbcon(bool enable)
+static void bind_con(const char *name, bool enable)
 {
 	const char *path = "/sys/class/vtconsole";
 	DIR *dir;
@@ -538,20 +531,39 @@ void kick_fbcon(bool enable)
 		if (len >= 0)
 			buf[len] = '\0';
 
-		if (!strstr(buf, enable ? "dummy device" :
-			    "frame buffer device"))
+		if (!strstr(buf, name))
 			continue;
 
 		sprintf(buf, "%s/%s/bind", path, de->d_name);
 		fd = open(buf, O_WRONLY);
 		if (fd != -1) {
-			igt_ignore_warn(write(fd, "0\n", 2));
+			igt_ignore_warn(write(fd, enable ? "1\n" : "0\n", 2));
 			close(fd);
 		}
+		break;
 	}
 	closedir(dir);
 }
 
+/**
+ * kick_fbcon:
+ * @enable: boolean value
+ *
+ * This functions enables/disables the text console running on top of the
+ * framebuffer device.
+ */
+void kick_fbcon(bool enable)
+{
+	/*
+	 * The vtcon bind interface seems somewhat broken. Possibly
+	 * depending on the order the console drivers have been
+	 * registered you either have to unbind the old driver,
+	 * or bind the new driver. Let's do both.
+	 */
+	bind_con("dummy device", !enable);
+	bind_con("frame buffer device", enable);
+}
+
 /**
  * kick_snd_hda_intel:
  *
-- 
2.16.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-05 21:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-05 12:54 [igt-dev] [PATCH i-g-t 1/2] lib/sysfs: Fix fbcon unbind, again Ville Syrjala
2018-03-05 12:54 ` [igt-dev] [PATCH i-g-t 2/2] lib/sysfs: s/kick_fbcon/bind_fbcon/ Ville Syrjala
2018-03-05 16:32 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/sysfs: Fix fbcon unbind, again Patchwork
2018-03-05 17:34 ` [igt-dev] [PATCH i-g-t 1/2] " Chris Wilson
2018-03-05 19:05   ` Ville Syrjälä
2018-03-05 21:16 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/2] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox