Skip to contentSkip to conversation

fbdev: tag interlaced mode in sysfs

PATCH In review Daniel THOMPSON 2 participants 3 messages May 9, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: tag interlaced mode in sysfs

A patch to tag interlaced modes with 'i' whenever they appear in .../mode and .../modelist.

Signature · 4 lines
Daniel Thompson (STMicroelectronics) <[email protected]>
1000 Aztec West, Almondsbury, Bristol, BS32 4SQ. 01454 462659

If a car is a horseless carriage then is a motorcycle a horseless horse?

Modify the sysfs description of a video mode such that interlaced modes are indicated by suffixing the number of visible lines with an i (e.g. U:1920x1080i-50). This is useful to disambiguate some of the CEA-861 video format timings (especially those for EDTV).

drivers/video/fbsysfs.c +8 -1
Index: linux-2.6.17-rc3/drivers/video/fbsysfs.c
===================================================================
@@ -95,13 +95,20 @@
 		       const struct fb_videomode *mode)
 {
 	char m = 'U';
+	char *v = "";
+
 	if (mode->flag & FB_MODE_IS_DETAILED)
 		m = 'D';
 	if (mode->flag & FB_MODE_IS_VESA)
 		m = 'V';
 	if (mode->flag & FB_MODE_IS_STANDARD)
 		m = 'S';
-	return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d-%d\n", m, mode->xres, mode->yres, mode->refresh);
+
+	if (mode->vmode & FB_VMODE_INTERLACED)
+		v = "i";
+
+	return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d%s-%d\n",
+	                m, mode->xres, mode->yres, v, mode->refresh);
 }
 
 static ssize_t store_mode(struct class_device *class_device, const char * buf,
#1 lore raw
Quoted 2 lines · Daniel THOMPSON

A patch to tag interlaced modes with 'i' whenever they appear in .../mode and .../modelist.

And while we're at it, while not tag doublescanned modes with `d'?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw
Quoted 5 lines · Geert Uytterhoeven
Quoted 2 lines · Daniel THOMPSON

A patch to tag interlaced modes with 'i' whenever they appear in .../mode and .../modelist.

And while we're at it, while not tag doublescanned modes with `d'?

[Taken maintainer off CC: while we discuss things].

On reflection I would suggest we go a little further and tag all the scan types with [p/i/d] since it is typically (very slightly) easier to parse strings without optional fields.

Revised patch follows.

Signature · 4 lines
Daniel Thompson (STMicroelectronics) <[email protected]>
1000 Aztec West, Almondsbury, Bristol, BS32 4SQ. 01454 462659

If a car is a horseless carriage then is a motorcycle a horseless horse?

Modify the sysfs description of a video mode such that modes are tagged with their scan type, (p)rogessive, (i)nterlaced, (d)ouble scan. For example, U:1920x1080i-50. This is useful to disambiguate some of the CEA-861 video format timings (especially those for EDTV).

drivers/video/fbsysfs.c +10 -1
Index: linux-2.6.17-rc3/drivers/video/fbsysfs.c
===================================================================
@@ -95,13 +95,22 @@
 		       const struct fb_videomode *mode)
 {
 	char m = 'U';
+	char v = 'p';
+
 	if (mode->flag & FB_MODE_IS_DETAILED)
 		m = 'D';
 	if (mode->flag & FB_MODE_IS_VESA)
 		m = 'V';
 	if (mode->flag & FB_MODE_IS_STANDARD)
 		m = 'S';
-	return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d-%d\n", m, mode->xres, mode->yres, mode->refresh);
+
+	if (mode->vmode & FB_VMODE_INTERLACED)
+		v = 'i';
+	if (mode->vmode & FB_VMODE_DOUBLE)
+		v = 'd';
+
+	return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d%c-%d\n",
+	                m, mode->xres, mode->yres, v, mode->refresh);
 }
 
 static ssize_t store_mode(struct class_device *class_device, const char * buf,