Skip to contentSkip to conversation

mono, gray and index configs

DISCUSSION Jon Smirl 4 participants 22 messages Aug 11, 2005 – Aug 22, 2005 Framebuffer layer

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

When filling in a fb_var_screeninfo how do I ask for mono, gray and index configs? Is is always request length red and green/blue length = zero to indicate a mono, gray or index config? Then grayscale is used to differentiate gray/mono from indexed?

Are there any more tricks to asking for a config? One trick I see is if bpp is set to a value where the hardware only supports one format at that bpp, ignore rbgt and set the config.

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#1 lore raw
Quoted 4 lines · Jon Smirl

When filling in a fb_var_screeninfo how do I ask for mono, gray and index configs? Is is always request length red and green/blue length = zero to indicate a mono, gray or index config? Then grayscale is used to differentiate gray/mono from indexed?

For pseudocolor (indexed), just indicate all offsets = 0 and all lengths equal to each other.

For monochrome, usually set bits_per_pixel = 1. (This is however not always true, as it's possible to have 2-color display with bits_per_pixel > 1). It's also possible to have mono01, mono10, 1-bit pseudocolor, 1-bit truecolor. For 1-bit truecolor, you can only use a primary color for the "foreground". So only one of the rgba will have a length = 1, the rest are zero. For monochrome/1-bit pseudocolor, it's similar to setting for pseudocolor except that all the lengths = 1 and offsets = 0. Currently, we have no way to specifically request for mono01, mono10, or 1-bit pseudocolor. Just check for fix->visual afterwards.

For grayscale, you use whatever format you want but you have to set var->grayscale to nonzero. (Grayscale just means that r=g=b, for those drivers that want to emulate grayscale).

For directcolor (indexed) vs truecolor, there is currently no way to specify which visual you want. You also have to check for fix->visual afterwards.

One of the reason I also want this sysfs attribute is because in at least 1 driver (i810fb), it's possible to choose between truecolor and directcolor but it uses a hack by checking for the var->nonstd flag.

Tony

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#21 lore raw
In reply to Jon Smirl
Quoted 3 lines · Jon Smirl

Are there any more tricks to asking for a config? One trick I see is if bpp is set to a value where the hardware only supports one format at that bpp, ignore rbgt and set the config.

Ignoring is not allowed, but rounding up is.

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#2 lore raw
In reply to Antonino A. Daplas
Quoted 3 lines · Antonino A. Daplas

that all the lengths = 1 and offsets = 0. Currently, we have no way to specifically request for mono01, mono10, or 1-bit pseudocolor. Just check for fix->visual afterwards.

For mono01 or mono10, if the visual is pseudocolor, just set the colormap to black/white or white/black.

Quoted 7 lines

For directcolor (indexed) vs truecolor, there is currently no way to specify which visual you want. You also have to check for fix->visual afterwards.

One of the reason I also want this sysfs attribute is because in at least 1 driver (i810fb), it's possible to choose between truecolor and directcolor but it uses a hack by checking for the var->nonstd flag.

So the driver should use directcolor instead of truecolor if the hardware supports it. The application can always set a linear colormap if it needs truecolor.

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#3 lore raw
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Antonino A. Daplas

that all the lengths = 1 and offsets = 0. Currently, we have no way to specifically request for mono01, mono10, or 1-bit pseudocolor. Just check for fix->visual afterwards.

For mono01 or mono10, if the visual is pseudocolor, just set the colormap to black/white or white/black.

I don't know. If I can change the colormap, I would advertise this as 1-bit pseudocolor, not monochrome. Otherwise, why differentiate between mono01 and mono10 if I can control what color is 0 and what color is 1. I think the closest definition of monochrome is 1-bit static pseudocolor. And we just have mono01 and mono10 to advertise how hardware treats 0/1 (background/foreground or reverse).

I have a few things that are still not clear to me. If I understand it correctly, monochrome means 2 colors regardless of the bit depth. So it's possible, for example, to have 8-bit monochrome that has only
two colors, ie 0x00 and 0xff. If this was 8-bit static pseudocolor,
then it has 256 different colors.

(Depending on how correct I am with the interpretation, there might be some bugs in fbdev on how it determines the color depth. No one is complaining yet though, so greater than 1-bit monochrome is probably rare if not nonexistent.)

Quoted 5 lines
Quoted 5 lines

For directcolor (indexed) vs truecolor, there is currently no way to specify which visual you want. You also have to check for fix->visual afterwards.

Quoted 7 lines
Quoted 3 lines

One of the reason I also want this sysfs attribute is because in at least 1 driver (i810fb), it's possible to choose between truecolor and directcolor but it uses a hack by checking for the var->nonstd flag.

So the driver should use directcolor instead of truecolor if the hardware supports it. The application can always set a linear colormap if it needs truecolor.

A few years ago, I discovered that there are several fbdev apps that make ssumptions which are not necessarily correct. For example, if bits_per_pixel > 8, the app assumes the format is truecolor. So the app produces wrong colors if fbdev is in directcolor mode (because it failed to set the cmap).

So, it is useful to have the capability to choose between truecolor and directcolor when dealing with those apps without rebooting or recompiling.

Tony

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#4 lore raw
Quoted 9 lines · Antonino Daplas
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Antonino A. Daplas

that all the lengths = 1 and offsets = 0. Currently, we have no way to specifically request for mono01, mono10, or 1-bit pseudocolor. Just check for fix->visual afterwards.

For mono01 or mono10, if the visual is pseudocolor, just set the colormap to black/white or white/black.

Quoted 6 lines

I don't know. If I can change the colormap, I would advertise this as 1-bit pseudocolor, not monochrome. Otherwise, why differentiate between mono01 and mono10 if I can control what color is 0 and what color is 1. I think the closest definition of monochrome is 1-bit static pseudocolor. And we just have mono01 and mono10 to advertise how hardware treats 0/1 (background/foreground or reverse).

Yes, for advertisement, that's true (cfr. amifb with bpp = 1, which is pseudocolor).

But when the app needs monochrome, it can ask for 1 bpp. If it returns a mono visual, fine. If it returns a pseudocolor visual, set the colormap to black/white.

Quoted 2 lines

I have a few things that are still not clear to me. If I understand it correctly, monochrome means 2 colors regardless of the bit depth.

Monochrome means 2 colors, which are black and white (or white and black). If the colors are different, it's (static) pseudocolor.

In fact monochrome is a special case of static pseudocolor.

Quoted 2 lines

So it's possible, for example, to have 8-bit monochrome that has only
two colors, ie 0x00 and 0xff. If this was 8-bit static pseudocolor,

Yes, cfr. old HP9000/300 graphics hardware.

Quoted 1 line

then it has 256 different colors.

Yes.

Quoted 4 lines

(Depending on how correct I am with the interpretation, there might be some bugs in fbdev on how it determines the color depth. No one is complaining yet though, so greater than 1-bit monochrome is probably rare if not nonexistent.)

There definitely are bugs w.r.t. this, especially in the 2.4 logo code ;-)

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines

For directcolor (indexed) vs truecolor, there is currently no way to specify which visual you want. You also have to check for fix->visual afterwards.

One of the reason I also want this sysfs attribute is because in at least 1 driver (i810fb), it's possible to choose between truecolor and directcolor but it uses a hack by checking for the var->nonstd flag.

So the driver should use directcolor instead of truecolor if the hardware supports it. The application can always set a linear colormap if it needs truecolor.

Quoted 5 lines

A few years ago, I discovered that there are several fbdev apps that make ssumptions which are not necessarily correct. For example, if bits_per_pixel > 8, the app assumes the format is truecolor. So the app produces wrong colors if fbdev is in directcolor mode (because it failed to set the cmap).

That's true. Many apps handle only a very limited subset of all capabilities, and fail miserably if the assumptions they make are not valid.

Quoted 3 lines

So, it is useful to have the capability to choose between truecolor and directcolor when dealing with those apps without rebooting or recompiling.

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#5 lore raw
Quoted 15 lines · Geert Uytterhoeven
Quoted 5 lines · Antonino Daplas
Quoted 4 lines · Geert Uytterhoeven
Quoted 3 lines · Antonino A. Daplas

that all the lengths = 1 and offsets = 0. Currently, we have no way to specifically request for mono01, mono10, or 1-bit pseudocolor. Just check for fix->visual afterwards.

Quoted 8 lines
Quoted 2 lines

For mono01 or mono10, if the visual is pseudocolor, just set the colormap to black/white or white/black.

I don't know. If I can change the colormap, I would advertise this as 1-bit pseudocolor, not monochrome. Otherwise, why differentiate between mono01 and mono10 if I can control what color is 0 and what color is 1. I think the closest definition of monochrome is 1-bit static pseudocolor. And we just have mono01 and mono10 to advertise how hardware treats 0/1 (background/foreground or reverse).

Quoted 3 lines

Yes, for advertisement, that's true (cfr. amifb with bpp = 1, which is pseudocolor).

Ok.

Quoted 11 lines

But when the app needs monochrome, it can ask for 1 bpp. If it returns a mono visual, fine. If it returns a pseudocolor visual, set the colormap to black/white.

Quoted 2 lines

I have a few things that are still not clear to me. If I understand it correctly, monochrome means 2 colors regardless of the bit depth.

Monochrome means 2 colors, which are black and white (or white and black). If the colors are different, it's (static) pseudocolor.

In fact monochrome is a special case of static pseudocolor.

Ok.

Quoted 6 lines
Quoted 3 lines

So it's possible, for example, to have 8-bit monochrome that has only
two colors, ie 0x00 and 0xff. If this was 8-bit static pseudocolor,

Yes, cfr. old HP9000/300 graphics hardware.

Hmm. Yes, there's a bug in fbdev then with regards to this hardware.

Quoted 11 lines
Quoted 1 line

then it has 256 different colors.

Yes.

Quoted 4 lines

(Depending on how correct I am with the interpretation, there might be some bugs in fbdev on how it determines the color depth. No one is complaining yet though, so greater than 1-bit monochrome is probably rare if not nonexistent.)

There definitely are bugs w.r.t. this, especially in the 2.4 logo code ;-)

Yes, I would agree. Do you know of any outstanding bugs on color handling in 2.6 code, especially for hardware with bitdepths < 8? I would like to fix them.

Tony

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

author
#6 lore raw

Here's a new version that actually lets me set all possible scanout configs on radeonfb. I can even set I4 but I don't think the code is correct for it yet everywhere in radeonfb. The core code in the patch should be ok. My further changes should be restricted to the radeonfb code. For example, I haven't added the logic to radeonfb to "round up" to the next config.

You get two new sysfs attributes:
configs - optional, but really nice to have, list of all configs supported by the driver
config - current config the hardware is set to.

example syntax...
[root@jonsmirl fb0]# cat configs
I4
I8
A1R5G5B5
R5G6B5
R8G8B8
A8R8G8B8
A4R4G4B4
A8I8
A2R10G10B10

Offsets are computed from the field widths. So if a card sets BGR vs RGB and you cat its config you will see RGB or BGR in the config string. M is used for a grayscale field.

So give the patch a try and start expanding it to handle other cards.

Signature · 2 lines
Jon Smirl
[email protected]
drivers/video/aty/radeon_accel.c +2 -5
@@ -48,7 +48,7 @@ static void radeonfb_prim_fillrect(struc
 		rinfo->dp_gui_master_cntl  /* contains, like GMC_DST_32BPP */
                 | GMC_BRUSH_SOLID_COLOR
                 | ROP3_P);
-	if (radeon_get_dstbpp(rinfo->depth) != DST_8BPP)
+	if ((rinfo->format == PIX_WIDTH_I4) || (rinfo->format == PIX_WIDTH_I8) || (rinfo->format == PIX_WIDTH_A8I8))
 		OUTREG(DP_BRUSH_FRGD_CLR, rinfo->pseudo_palette[region->color]);
 	else
 		OUTREG(DP_BRUSH_FRGD_CLR, region->color);
@@ -252,8 +252,6 @@ void radeonfb_engine_reset(struct radeon
 
 void radeonfb_engine_init (struct radeonfb_info *rinfo)
 {
-	unsigned long temp;
-
 	/* disable 3D engine */
 	OUTREG(RB3D_CNTL, 0);
 
@@ -287,8 +285,7 @@ void radeonfb_engine_init (struct radeon
 	OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX |
 					 DEFAULT_SC_BOTTOM_MAX));
 
-	temp = radeon_get_dstbpp(rinfo->depth);
-	rinfo->dp_gui_master_cntl = ((temp << 8) | GMC_CLR_CMP_CNTL_DIS);
+	rinfo->dp_gui_master_cntl = ((rinfo->format << 8) | GMC_CLR_CMP_CNTL_DIS);
 
 	radeon_fifo_wait (1);
 	OUTREG(DP_GUI_MASTER_CNTL, (rinfo->dp_gui_master_cntl |
drivers/video/aty/radeon_base.c +127 -90

284 lines not on this page · raw message

drivers/video/aty/radeonfb.h +1 -23
@@ -328,6 +328,7 @@ struct radeonfb_info {
 	u32			dp_gui_master_cntl;
 
 	struct pll_info		pll;
+	unsigned int		format; /* format of the scanout buffer */
 
 	int			mtrr_hdl;
 
@@ -511,29 +512,6 @@ static inline int round_div(int num, int
         return (num + (den / 2)) / den;
 }
 
-static inline int var_to_depth(const struct fb_var_screeninfo *var)
-{
-	if (var->bits_per_pixel != 16)
-		return var->bits_per_pixel;
-	return (var->green.length == 5) ? 15 : 16;
-}
-
-static inline u32 radeon_get_dstbpp(u16 depth)
-{
-	switch (depth) {
-       	case 8:
-       		return DST_8BPP;
-       	case 15:
-       		return DST_15BPP;
-       	case 16:
-       		return DST_16BPP;
-       	case 32:
-       		return DST_32BPP;
-       	default:
-       		return 0;
-	}
-}
-
 /*
  * 2D Engine helper routines
  */
drivers/video/fbsysfs.c +124 -28

178 lines not on this page · raw message

include/linux/fb.h +4 -0
@@ -598,6 +598,10 @@ struct fb_ops {
 
 	/* perform fb specific mmap */
 	int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
+
+	/* Get allowable configs */
+	char * (*fb_get_configs) (struct fb_info *info);
+
 };
 
 #ifdef CONFIG_FB_TILEBLITTING
include/video/radeon.h +12 -0
@@ -800,6 +800,18 @@
 #define DST_X_LEFT_TO_RIGHT_S                      0x80000000
 
 
+/* CRTC_PIC_WIDTH constants */
+#define PIX_WIDTH_I4                               0x00000001
+#define PIX_WIDTH_I8                               0x00000002
+#define PIX_WIDTH_A1R5G5B5                         0x00000003
+#define PIX_WIDTH_R5G6B5                           0x00000004
+#define PIX_WIDTH_R8B8G8                           0x00000005
+#define PIX_WIDTH_A8R8G8B8                         0x00000006
+#define PIX_WIDTH_A4R4B4G4                         0x00000007
+#define PIX_WIDTH_A8I8                             0x00000008
+#define PIX_WIDTH_A2R10G10B10                      0x00000009
+
+
 /* DP_DATATYPE bit constants */
 #define DST_8BPP                                   0x00000002
 #define DST_15BPP                                  0x00000003
#19 lore raw
In reply to Antonino A. Daplas
Quoted 7 lines · Antonino A. Daplas
Quoted 6 lines · Geert Uytterhoeven
Quoted 4 lines · Antonino Daplas

(Depending on how correct I am with the interpretation, there might be some bugs in fbdev on how it determines the color depth. No one is complaining yet though, so greater than 1-bit monochrome is probably rare if not nonexistent.)

Quoted 6 lines
Quoted 2 lines

There definitely are bugs w.r.t. this, especially in the 2.4 logo code ;-)

Yes, I would agree. Do you know of any outstanding bugs on color handling in 2.6 code, especially for hardware with bitdepths < 8? I would like to fix them.

Unfortunately not. Due to personel reasons, I temporarily don't have much time left to do real coding.

You can always try vgafb's 16 color mode and check for yourself.

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#20 lore raw
Quoted 9 lines · Geert Uytterhoeven
Quoted 8 lines · Antonino A. Daplas
Quoted 7 lines · Geert Uytterhoeven
Quoted 4 lines · Antonino Daplas

(Depending on how correct I am with the interpretation, there might be some bugs in fbdev on how it determines the color depth. No one is complaining yet though, so greater than 1-bit monochrome is probably rare if not nonexistent.)

There definitely are bugs w.r.t. this, especially in the 2.4 logo code ;-)

Quoted 8 lines
Quoted 3 lines

Yes, I would agree. Do you know of any outstanding bugs on color handling in 2.6 code, especially for hardware with bitdepths < 8? I would like to fix them.

Unfortunately not. Due to personel reasons, I temporarily don't have much time left to do real coding.

You can always try vgafb's 16 color mode and check for yourself.

That's okay. I'm actually emulating these low bit depths using pseudocolor whenever I look for bugs for depths < 4 (ie monochrome text attributes). I haven't found any yet except for the greater than 1-bit monochrome color handling which I've already fixed in my tree.

Tony

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

author
#7 lore raw
In reply to Jon Smirl

Could everyone give this a try and give me some feedback?

Quoted 36 lines · Jon Smirl

Here's a new version that actually lets me set all possible scanout configs on radeonfb. I can even set I4 but I don't think the code is correct for it yet everywhere in radeonfb. The core code in the patch should be ok. My further changes should be restricted to the radeonfb code. For example, I haven't added the logic to radeonfb to "round up" to the next config.

You get two new sysfs attributes:
configs - optional, but really nice to have, list of all configs supported by the driver
config - current config the hardware is set to.

example syntax...
[root@jonsmirl fb0]# cat configs
I4
I8
A1R5G5B5
R5G6B5
R8G8B8
A8R8G8B8
A4R4G4B4
A8I8
A2R10G10B10

Offsets are computed from the field widths. So if a card sets BGR vs RGB and you cat its config you will see RGB or BGR in the config string. M is used for a grayscale field.

So give the patch a try and start expanding it to handle other cards.

--
Jon Smirl
[email protected]

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#8 lore raw
Quoted 2 lines · Jon Smirl

Could everyone give this a try and give me some feedback?

Just merging your patch in my tree. Will give you feedback in a day or so.

Tony

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

author
#9 lore raw

The patch is just for testing, don't send it on. The radeonfb portion is definitely not finished.

This adds an optional function to each driver that advertises what configs it offers.

+char *radeonfb_getconfigs(struct fb_info *info)
+{
+ return "I4\nI8\nA1R5G5B5\nR5G6B5\nR8G8B8\nA8R8G8B8\nA4R4G4B4\nA8I8\nA2R10G10B10\n";
+}

static struct fb_ops radeonfb_ops = {
.owner = THIS_MODULE,
@@ -1873,6 +1909,7 @@ static struct fb_ops radeonfb_ops = {
.fb_fillrect = radeonfb_fillrect,
.fb_copyarea = radeonfb_copyarea,
.fb_imageblit = radeonfb_imageblit,
+ .fb_get_configs = radeonfb_getconfigs,
};

If you know what configs the driver support try setting them via the sysfs attribute. You can also check out your config match code by putting in non-supported configs and setting what gets returned in the attribute.

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#10 lore raw
Quoted 14 lines · Jon Smirl

The patch is just for testing, don't send it on. The radeonfb portion is definitely not finished.

This adds an optional function to each driver that advertises what configs it offers.

drivers/video/aty/radeon_base.c +4 -0
+char *radeonfb_getconfigs(struct fb_info *info)
+{
+	return "I4\nI8\nA1R5G5B5\nR5G6B5\nR8G8B8\nA8R8G8B8\nA4R4G4B4\nA8I8\nA2R10G10B10\n";
+}
 
  static struct fb_ops radeonfb_ops = {
 	.owner			= THIS_MODULE,

drivers/video/aty/radeon_base.c static struct fb_ops radeonfb_ops = { · line 1913

Quoted 5 lines
drivers/video/aty/radeon_base.c +1 -0
@@ -1873,6 +1909,7 @@ static struct fb_ops radeonfb_ops = {
 	.fb_fillrect		= radeonfb_fillrect,
 	.fb_copyarea		= radeonfb_copyarea,
 	.fb_imageblit		= radeonfb_imageblit,
+	.fb_get_configs		= radeonfb_getconfigs,
 };

Do we really need this?

You can easily write a `probe loop' to find out about all supported configs for a driver like this:

    for_all_possible_configs(config) {
	struct fb_var_screeninfo var;
	set_up_var(var, config);
	var.activate |= FB_ACTIVATE_TEST;
	if (ioctl(FBIOPUT_VSCREENINFO)) {
	    /* config not supported */
	} else if (config_has_changed(var, config) {
	    /* config not supported */
	} else {
	    /* config is supported */
	}
    }

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#11 lore raw
Quoted 11 lines
Quoted 3 lines

This adds an optional function to each driver that advertises what configs it offers.

Do we really need this?

You can easily write a `probe loop' to find out about all supported configs for a driver like this:

    for_all_possible_configs(config) {
        struct fb_var_screeninfo var;

This will actually try to set the mode right?

SDL does it this way and its caused me some pain dealing with framebuffers on hardware that has issues with certain modes. Its also a good bit slower for the app to startup while the code crunches out the pll settings.

From a users perspective I think advertising valid modes is a good thing.

Signature · 8 lines
Richard A. Smith


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#12 lore raw
Quoted 5 lines · Richard Smith
Quoted 5 lines
Quoted 2 lines

This adds an optional function to each driver that advertises what configs it offers.

Do we really need this?

Quoted 7 lines
Quoted 5 lines

You can easily write a `probe loop' to find out about all supported configs for a driver like this:

    for_all_possible_configs(config) {
        struct fb_var_screeninfo var;

This will actually try to set the mode right?

No, you cut the following line:

| var.activate |= FB_ACTIVATE_TEST;

which will cause the driver to check whether the mode is valid (or can be made valid by rounding up).

Quoted 6 lines

SDL does it this way and its caused me some pain dealing with framebuffers on hardware that has issues with certain modes. Its also a good bit slower for the app to startup while the code crunches out the pll settings.

Quoted 1 line

From a users perspective I think advertising valid modes is a good thing.

Except that on most hardware the list of valid modes is _very_ large... How many combinations of resolution, color depth, and timings do you think you can have? I guess the complete list can easily fill up all your RAM...

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#13 lore raw
Quoted 5 lines

No, you cut the following line:

| var.activate |= FB_ACTIVATE_TEST;

Sorry. I was shorting and I went too far.

Quoted 2 lines

which will cause the driver to check whether the mode is valid (or can be made valid by rounding up).

Ah well that sounds more like was thinking of. Is FB_ACTIVATE_TEST new from 2.4 -> 2.6?
Be nice if SDL (and other apps) did it that way rather than actually makeing the driver try to switch to the mode.

Signature · 8 lines
Richard A. Smith


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#14 lore raw
Quoted 6 lines · Richard Smith

Ah well that sounds more like was thinking of. Is FB_ACTIVATE_TEST new from 2.4 -> 2.6?
Be nice if SDL (and other apps) did it that way rather than actually makeing the driver try to switch to the mode.

2.4 has this also.

I agree with Geert though. Just too many combinations, and this is just for RGB.

Tony

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

author
#18 lore raw
In reply to Geert Uytterhoeven
Quoted 12 lines · Geert Uytterhoeven
Quoted 11 lines · Jon Smirl

The patch is just for testing, don't send it on. The radeonfb portion is definitely not finished.

This adds an optional function to each driver that advertises what configs it offers.

drivers/video/aty/radeon_base.c +4 -0
+char *radeonfb_getconfigs(struct fb_info *info)
+{
+     return "I4\nI8\nA1R5G5B5\nR5G6B5\nR8G8B8\nA8R8G8B8\nA4R4G4B4\nA8I8\nA2R10G10B10\n";
+}
Quoted 10 lines

drivers/video/aty/radeon_base.c static struct fb_ops radeonfb_ops = { · line 1913

Quoted 8 lines
  static struct fb_ops radeonfb_ops = {
      .owner                  = THIS_MODULE,
drivers/video/aty/radeon_base.c +1 -0
@@ -1873,6 +1909,7 @@ static struct fb_ops radeonfb_ops = {
      .fb_fillrect            = radeonfb_fillrect,
      .fb_copyarea            = radeonfb_copyarea,
      .fb_imageblit           = radeonfb_imageblit,
+     .fb_get_configs         = radeonfb_getconfigs,
 };

Do we really need this?

It is optional. It's used in sysfs, where you cat the config variable to get a list of valid configs. Once in sysfs a program could then use it to generate a list to pick from, etc...

It seems hard to use the search method if you are looking for a config that is in the middle of the list.

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#15 lore raw
In reply to Richard Smith
Quoted 11 lines · Richard Smith
Quoted 3 lines

No, you cut the following line:

| var.activate |= FB_ACTIVATE_TEST;

Sorry. I was shorting and I went too far.

Quoted 2 lines

which will cause the driver to check whether the mode is valid (or can be made valid by rounding up).

Ah well that sounds more like was thinking of. Is FB_ACTIVATE_TEST new from 2.4 -> 2.6?

It's been there from the beginning (i.e. from 1994). In fact very little was changed in the public (userspace) fbdev interface since then :-)

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

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#16 lore raw
Quoted 6 lines
Quoted 2 lines

Ah well that sounds more like was thinking of. Is FB_ACTIVATE_TEST new from 2.4 -> 2.6?

It's been there from the beginning (i.e. from 1994). In fact very little was changed in the public (userspace) fbdev interface since then :-)

Hmmm.. I just went and looked at the SDL code and indeed thats what its doing so I was mistaken. Untill now I was just assuming that SDL was doing that.

The stpcfb (from ST) code must be totally messing that IOCTL up then. I guess thats not so suprising since the stpcfb was broken in a couple of other ways. That device has been responsible for the bulk of my pain.

I'll go compare it to a few of the other drivers and see what its doing wrong now that I know its a bug and not a feature.

Thanks.

Signature · 8 lines
Richard A. Smith


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
#17 lore raw
Quoted 3 lines

Hmmm.. I just went and looked at the SDL code and indeed thats what its doing so I was mistaken. Untill now I was just assuming that SDL was doing that.

I think what led me to believe this is that SDL has a setting for broken modes. If you set this then it dosen't do a mode scan and only tries to set what you request. Normall it tries to match the nearest mode if it can't find what you request.

So I glarked out that the ioctl must be trying to apply the settings but I bet its for the other graphics backends that SDL supports.

Signature · 8 lines
Richard A. Smith


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf