video: fbdev: Check Standard Timing against DMT
Subsystems (2)
PATCH 2/3 video: fbdev: Check Standard Timing against DMT
Add the VESA Display Monitor Timing (DMT) table.
During parsing of Standard Timings, it compare the 2 byte STD code with DMT to see what the VESA mode should be. If there is no entry in the vesa_modes table or no match found, it fallsback to the GTF timings.
--- drivers/video/fbdev/core/fbmon.c | 20 ++++++---- drivers/video/fbdev/core/modedb.c | 84 +++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 10 +++++ 3 files changed, 107 insertions(+), 7 deletions(-)
drivers/video/fbdev/core/fbmon.c +13 -7
@@ -526,16 +526,22 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode, refresh = (block[1 ] &0x3f ) +60 ;DPRINTK (" %dx%d@%dHz\n" , xres, yres, refresh); -for (i =0 ; i <VESA_MODEDB_SIZE ; i++) { -if (vesa_modes[i].xres = xres && - vesa_modes[i].yres = yres && - vesa_modes[i].refresh = refresh) { - *mode = vesa_modes[i]; +for (i =0 ; i <DMT_SIZE ; i++) { +u32 std_2byte_code = block[0 ] <<8 | block[1 ]; + +if (std_2byte_code = dmt_modes[i].std_2byte_code) { +if (!dmt_modes[i].mode) +break ; + *mode = *dmt_modes[i].mode; mode->flag |=FB_MODE_IS_STANDARD ; -return 1 ; +DPRINTK (" DMT id=%d\n" , dmt_modes[i].dmt_id); +break ; } } -calc_mode_timings (xres, yres, refresh, mode); + +if (i =DMT_SIZE || !dmt_modes[i].mode) +calc_mode_timings (xres, yres, refresh, mode); +return 1 ; }
drivers/video/fbdev/core/modedb.c +84 -0
90 lines not on this page · raw message
include/linux/fb.h +10 -0
@@ -727,6 +727,8 @@ extern int fb_videomode_from_videomode(const struct videomode *vm,/* drivers/video/modedb.c */ #define VESA_MODEDB_SIZE 43 +#define DMT_SIZE 0x50 +extern void fb_var_to_videomode (struct fb_videomode *mode,const struct fb_var_screeninfo *var); extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
@@ -777,9 +779,17 @@ struct fb_videomode {u32 flag; }; +struct dmt_videomode { +u32 dmt_id; +u32 std_2byte_code; +u32 cvt_3byte_code; +const struct fb_videomode *mode; +}; +extern const char *fb_mode_option;extern const struct fb_videomode vesa_modes[];extern const struct fb_videomode cea_modes[64 ]; +extern const struct dmt_videomode dmt_modes[];struct fb_modelist {struct list_head list;
Signature · 9 lines
1.8.1.5 ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -----------------------------------------------------------------------------------
Quoted 61 lines · David Ung
Add the VESA Display Monitor Timing (DMT) table.
During parsing of Standard Timings, it compare the 2 byte STD code with DMT to see what the VESA mode should be. If there is no entry in thevesa_modestable or no match found, it fallsback to the GTF timings.Signed-off-by David Ung <[email protected]>--- drivers/video/fbdev/core/fbmon.c | 20 ++++++---- drivers/video/fbdev/core/modedb.c | 84 +++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 10 +++++ 3 files changed, 107 insertions(+), 7 deletions(-)drivers/video/fbdev/core/fbmon.c +13
-7@@ -526,16 +526,22 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode, refresh = (block[1 ] &0x3f ) +60 ;DPRINTK (" %dx%d@%dHz\n" , xres, yres, refresh); -for (i =0 ; i <VESA_MODEDB_SIZE ; i++) { -if (vesa_modes[i].xres == xres && - vesa_modes[i].yres == yres && - vesa_modes[i].refresh == refresh) { - *mode = vesa_modes[i]; +for (i =0 ; i <DMT_SIZE ; i++) { +u32 std_2byte_code = block[0 ] <<8 | block[1 ]; + +if (std_2byte_code == dmt_modes[i].std_2byte_code) { +if (!dmt_modes[i].mode) +break ; + *mode = *dmt_modes[i].mode; mode->flag |=FB_MODE_IS_STANDARD ; -return 1 ; +DPRINTK (" DMT id=%d\n" , dmt_modes[i].dmt_id); +break ; } } -calc_mode_timings (xres, yres, refresh, mode); + +if (i ==DMT_SIZE || !dmt_modes[i].mode) +calc_mode_timings (xres, yres, refresh, mode); +return 1 ; }drivers/video/fbdev/core/modedb.c +6
-0@@ -497,6 +497,90 @@ const struct fb_videomode vesa_modes[] = { FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, };EXPORT_SYMBOL (vesa_modes); + +const struct dmt_videomode dmt_modes[DMT_SIZE ] = { + {0x01 ,0x0000 ,0x000000 , &vesa_modes[0 ] }, + {0x02 ,0x3119 ,0x000000 , &vesa_modes[1 ] }, + {0x03 ,0x0000 ,0x000000 , &vesa_modes[2 ] }, + {0x04 ,0x3140 ,0x000000 , &vesa_modes[3 ] },
drivers/video/fbdev/core/modedb.c const struct fb_videomode vesa_modes[] = { · line 515
Quoted 10 lines
drivers/video/fbdev/core/modedb.c +10
-0+ { 0x05, 0x314c, 0x000000, &vesa_modes[4] }, + { 0x06, 0x314f, 0x000000, &vesa_modes[5] }, + { 0x07, 0x3159, 0x000000, &vesa_modes[6] }, + { 0x08, 0x0000, 0x000000, &vesa_modes[7] }, + { 0x09, 0x4540, 0x000000, &vesa_modes[8] }, + { 0x0a, 0x454c, 0x000000, &vesa_modes[9] }, + { 0x0b, 0x454f, 0x000000, &vesa_modes[10] }, + { 0x0c, 0x4559, 0x000000, &vesa_modes[11] }, + { 0x0d, 0x0000, 0x000000, 0 }, + { 0x0e, 0x0000, 0x000000, 0 },
You've filled only some of the modes in this table. What's the logic which modes are left out?
Tomi
Quoted 20 lines
drivers/video/fbdev/core/modedb.c const struct fb_videomode vesa_modes[] = { · line 497
Quoted 7 lines
drivers/video/fbdev/core/modedb.c +0
-0@@ -497,6 +497,90 @@ const struct fb_videomode vesa_modes[] = { FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED,
FB_MODE_IS_VESA},Quoted 12 lines
drivers/video/fbdev/core/modedb.c +11
-0};EXPORT_SYMBOL (vesa_modes); + +const struct dmt_videomode dmt_modes[DMT_SIZE ] = { + {0x01 ,0x0000 ,0x000000 , &vesa_modes[0 ] }, + {0x02 ,0x3119 ,0x000000 , &vesa_modes[1 ] }, + {0x03 ,0x0000 ,0x000000 , &vesa_modes[2 ] }, + {0x04 ,0x3140 ,0x000000 , &vesa_modes[3 ] }, + {0x05 ,0x314c ,0x000000 , &vesa_modes[4 ] }, + {0x06 ,0x314f ,0x000000 , &vesa_modes[5 ] }, + {0x07 ,0x3159 ,0x000000 , &vesa_modes[6 ] }, + {0x08 ,0x0000 ,0x000000 , &vesa_modes[7 ] }, + {0x09 ,0x4540 ,0x000000 , &vesa_modes[8 ] },
Quoted 9 lines
drivers/video/fbdev/core/modedb.c const struct fb_videomode vesa_modes[] = { · line 515
Quoted 5 lines
drivers/video/fbdev/core/modedb.c +5
-0+ { 0x0a, 0x454c, 0x000000, &vesa_modes[9] }, + { 0x0b, 0x454f, 0x000000, &vesa_modes[10] }, + { 0x0c, 0x4559, 0x000000, &vesa_modes[11] }, + { 0x0d, 0x0000, 0x000000, 0 }, + { 0x0e, 0x0000, 0x000000, 0 },You've filled only some of the modes in this table. What's the logic which modes are left out?
For DMT id 0xd, it has no STD 2byte id, no 3byte CVT code and no mode timings currently defined in vesa_modes struct.
There is 80 DMT ids, but only 43 vesa_modes defined in fbdev. So I've left those entries empty. If we eventually have all the VESA timings, the last column could be eliminated.
David
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
Quoted 30 lines · David Ung
Quoted 20 lines
drivers/video/fbdev/core/modedb.c const struct fb_videomode vesa_modes[] = { · line 497
Quoted 7 lines
drivers/video/fbdev/core/modedb.c +0
-0@@ -497,6 +497,90 @@ const struct fb_videomode vesa_modes[] = { FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED,
FB_MODE_IS_VESA},Quoted 12 lines
drivers/video/fbdev/core/modedb.c +11
-0};EXPORT_SYMBOL (vesa_modes); + +const struct dmt_videomode dmt_modes[DMT_SIZE ] = { + {0x01 ,0x0000 ,0x000000 , &vesa_modes[0 ] }, + {0x02 ,0x3119 ,0x000000 , &vesa_modes[1 ] }, + {0x03 ,0x0000 ,0x000000 , &vesa_modes[2 ] }, + {0x04 ,0x3140 ,0x000000 , &vesa_modes[3 ] }, + {0x05 ,0x314c ,0x000000 , &vesa_modes[4 ] }, + {0x06 ,0x314f ,0x000000 , &vesa_modes[5 ] }, + {0x07 ,0x3159 ,0x000000 , &vesa_modes[6 ] }, + {0x08 ,0x0000 ,0x000000 , &vesa_modes[7 ] }, + {0x09 ,0x4540 ,0x000000 , &vesa_modes[8 ] },Quoted 9 lines
drivers/video/fbdev/core/modedb.c const struct fb_videomode vesa_modes[] = { · line 515
Quoted 5 lines
drivers/video/fbdev/core/modedb.c +5
-0+ { 0x0a, 0x454c, 0x000000, &vesa_modes[9] }, + { 0x0b, 0x454f, 0x000000, &vesa_modes[10] }, + { 0x0c, 0x4559, 0x000000, &vesa_modes[11] }, + { 0x0d, 0x0000, 0x000000, 0 }, + { 0x0e, 0x0000, 0x000000, 0 },You've filled only some of the modes in this table. What's the logic which modes are left out?
Quoted 5 lines
For DMT id
0xd, it has no STD 2byte id, no 3byte CVT code and no mode timings currently defined invesa_modesstruct.
There is 80 DMT ids, but only 43vesa_modesdefined in fbdev. So I've left those entries empty. If we eventually have all the VESA timings, the last column could be eliminated.
Ok. So you added the modes to vesa_modes table that you were interested in for your use case, and then filled the dmt_modes table with the modes that were available in vesa_modes?
That's ok, I just want to understand the logic for which modes you added and which you left out.
Tomi
Quoted 36 lines · David Ung
Add the VESA Display Monitor Timing (DMT) table.
During parsing of Standard Timings, it compare the 2 byte STD code with DMT to see what the VESA mode should be. If there is no entry in thevesa_modestable or no match found, it fallsback to the GTF timings.Signed-off-by David Ung <[email protected]>--- drivers/video/fbdev/core/fbmon.c | 20 ++++++---- drivers/video/fbdev/core/modedb.c | 84 +++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 10 +++++ 3 files changed, 107 insertions(+), 7 deletions(-)drivers/video/fbdev/core/fbmon.c +8
-6@@ -526,16 +526,22 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode, refresh = (block[1 ] &0x3f ) +60 ;DPRINTK (" %dx%d@%dHz\n" , xres, yres, refresh); -for (i =0 ; i <VESA_MODEDB_SIZE ; i++) { -if (vesa_modes[i].xres == xres && - vesa_modes[i].yres == yres && - vesa_modes[i].refresh == refresh) { - *mode = vesa_modes[i]; +for (i =0 ; i <DMT_SIZE ; i++) { +u32 std_2byte_code = block[0 ] <<8 | block[1 ]; + +if (std_2byte_code == dmt_modes[i].std_2byte_code) { +if (!dmt_modes[i].mode) +break ; + *mode = *dmt_modes[i].mode; mode->flag |=FB_MODE_IS_STANDARD ; -return 1 ; +DPRINTK (" DMT id=%d\n" , dmt_modes[i].dmt_id);
drivers/video/fbdev/core/fbmon.c static int get_std_timing(unsigned char *block, struct fb_videomode *mode, · line 546
Quoted 10 lines
drivers/video/fbdev/core/fbmon.c +5
-1+break ; } } -calc_mode_timings (xres, yres, refresh, mode); + +if (i ==DMT_SIZE || !dmt_modes[i].mode) +calc_mode_timings (xres, yres, refresh, mode); +return 1 ; }
I think this could be made a bit cleaner.
The xres/yres/refresh calculation in get_std_timing doesn't matter for the DMT code above. So in get_std_timing() you could first do the search for the DMT mode, and if found, return from the function. After that the code would do the GTF calculation.
Tomi
DQo+IE9uIDAzLzEyLzE0IDIzOjQ5LCBEYXZpZCBVbmcgd3JvdGU6DQo+ID4gQWRkIHRoZSBWRVNB IERpc3BsYXkgTW9uaXRvciBUaW1pbmcgKERNVCkgdGFibGUuDQo+ID4gRHVyaW5nIHBhcnNpbmcg b2YgU3RhbmRhcmQgVGltaW5ncywgaXQgY29tcGFyZSB0aGUgMiBieXRlIFNURCBjb2RlDQo+ID4g d2l0aCBETVQgdG8gc2VlIHdoYXQgdGhlIFZFU0EgbW9kZSBzaG91bGQgYmUuICBJZiB0aGVyZSBp cyBubyBlbnRyeSBpb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CBkaXNjbG9zdXJlIG9yIGRpc3RyaWJ1dGlvbg0KaXMgcHJvaGliaXRlZC4gIElmIHlv dSBhcmUgbm90IHRoZSBpbnRlbmRlZCByZWNpcGllbnQsIHBsZWFzZSBjb250YWN0IHRoZSBzZW5k ZXIgYnkNCnJlcGx5IGVtYWlsIGFuZCBkZXN0cm95IGFsbCBjb3BpZXMgb2YgdGhlIG9yaWdpbmFs IG1lc3NhZ2UuDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0K
Quoted 55 lines · David Ung
Quoted 55 lines · David Ung
Quoted 10 lines
Add the VESA Display Monitor Timing (DMT) table.
During parsing of Standard Timings, it compare the 2 byte STD code with DMT to see what the VESA mode should be. If there is no entry in thevesa_modestable or no match found, it fallsback to the GTF timings.Signed-off-by David Ung <[email protected]>--- drivers/video/fbdev/core/fbmon.c | 20 ++++++----
drivers/video/fbdev/core/modedb.c| 84+++++++++++++++++++++++++++++++++++++++
drivers/video/fbdev/core/fbmon.c static int get_std_timing(unsigned char *block,
Quoted 9 lines
include/linux/fb.h | 10 +++++ 3 files changed, 107 insertions(+), 7 deletions(-)drivers/video/fbdev/core/fbmon.c +0
-0@@ -526,16 +526,22 @@ static int get_std_timing(unsigned char *block,struct
fb_videomode*mode,Quoted 8 lines
drivers/video/fbdev/core/fbmon.c +0
-5refresh = (block[1 ] &0x3f ) +60 ;DPRINTK (" %dx%d@%dHz\n" , xres, yres, refresh); -for (i =0 ; i <VESA_MODEDB_SIZE ; i++) { -if (vesa_modes[i].xres == xres && - vesa_modes[i].yres == yres && - vesa_modes[i].refresh == refresh) { - *mode = vesa_modes[i];drivers/video/fbdev/core/fbmon.c static int get_std_timing(unsigned char *block, struct fb_videomode *mode,
Quoted 10 lines
drivers/video/fbdev/core/fbmon.c +8
-1+for (i =0 ; i <DMT_SIZE ; i++) { +u32 std_2byte_code = block[0 ] <<8 | block[1 ]; + +if (std_2byte_code == dmt_modes[i].std_2byte_code) { +if (!dmt_modes[i].mode) +break ; + *mode = *dmt_modes[i].mode; mode->flag |=FB_MODE_IS_STANDARD ; -return 1 ; + DPRINTK(" DMT id=%d\n",dmt_modes[i].dmt_id);
drivers/video/fbdev/core/fbmon.c static int get_std_timing(unsigned char *block, struct fb_videomode *mode, · line 546
Quoted 10 lines
drivers/video/fbdev/core/fbmon.c +5
-1+break ; } } -calc_mode_timings (xres, yres, refresh, mode); + +if (i ==DMT_SIZE || !dmt_modes[i].mode) +calc_mode_timings (xres, yres, refresh, mode); +return 1 ; }I think this could be made a bit cleaner.
Quoted 7 lines
Quoted 5 lines
The xres/yres/refresh calculation in
get_std_timingdoesn't matter for the DMT code above. So inget_std_timing()you could first do the search for the DMT mode, and if found, return from the function. After that the code would do the GTF calculation.Yes, I've deleted the xres/yres/refresh calculation.
Sorry it's taken a while for me to respond...
I mean that the whole 'switch (ratio)' and related code in the beginning of the get_std_timing() are not needed for the DMT loop. All that could be moved inside the 'if (i == DMT_SIZE || !dmt_modes[i].mode)' block.
Also, in my opinion the code would be more easily understandable with something like:
for (dmt loop) {
if (std_2byte_code matches)
break;
}if (i < DMT_SIZE && dmt_modes[i].mode) {
// DMT mode found
} else {
// calculate GTF
}Tomi