video: fbdev: Check Standard Timing against DMT
Subsystems (2)
PATCH v2 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.
Signed-off-by David Ung <[email protected]>
--- drivers/video/fbdev/core/fbmon.c | 76 +++++++++++++++++++---------------- drivers/video/fbdev/core/modedb.c | 84 +++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 10 +++++ 3 files changed, 136 insertions(+), 34 deletions(-)
drivers/video/fbdev/core/fbmon.c +42 -34
@@ -498,44 +498,52 @@ static int get_est_timing(unsigned char *block, struct fb_videomode *mode)static int get_std_timing (unsigned char *block,struct fb_videomode *mode,int ver,int rev) { -int xres, yres =0 , refresh, ratio, i; - - xres = (block[0 ] +31 ) *8 ; -if (xres <=256 ) -return 0 ; +int i; - ratio = (block[1 ] &0xc0 ) >>6 ; -switch (ratio) { -case 0 : -/* in EDID 1.3 the meaning of 0 changed to 16:10 (prior 1:1) */ -if (ver <1 || (ver =1 && rev <3 )) - yres = xres; -else - yres = (xres *10 )/16 ; -break ; -case 1 : - yres = (xres *3 )/4 ; -break ; -case 2 : - yres = (xres *4 )/5 ; -break ; -case 3 : - yres = (xres *9 )/16 ; -break ; +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) +break ; } - 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]; - mode->flag |=FB_MODE_IS_STANDARD ; -return 1 ; + +if (i <DMT_SIZE && dmt_modes[i].mode) { +/* DMT mode found */ + *mode = *dmt_modes[i].mode; + mode->flag |=FB_MODE_IS_STANDARD ; +DPRINTK (" DMT id=%d\n" , dmt_modes[i].dmt_id); + + }else { +int xres, yres =0 , refresh, ratio; + + xres = (block[0 ] +31 ) *8 ; +if (xres <=256 ) +return 0 ; + + ratio = (block[1 ] &0xc0 ) >>6 ; +switch (ratio) { +case 0 : +/* in EDID 1.3 the meaning of 0 changed to 16:10 (prior 1:1) */ +if (ver <1 || (ver =1 && rev <3 )) + yres = xres; +else + yres = (xres *10 )/16 ; +break ; +case 1 : + yres = (xres *3 )/4 ; +break ; +case 2 : + yres = (xres *4 )/5 ; +break ; +case 3 : + yres = (xres *9 )/16 ; +break ; } + refresh = (block[1 ] &0x3f ) +60 ; +DPRINTK (" %dx%d@%dHz\n" , xres, yres, refresh); + +calc_mode_timings (xres, yres, refresh, 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. -----------------------------------------------------------------------------------