viafb modetable conversion
cover viafb modetable conversion
Hi all,
finally the modetable conversion is here. The first patch does the conversion to get rid of some strange things and lot of defines. The conversion was done by a program and causes a lot of warnings by generating lines longer than 80 characters which I do not consider worth fixing. A side effect of this conversion seems to be that CRTs are happier with the resulting modes/clocks as the conversion program used floating point and therefore the resulting pixclocks are closer to what they should be.
The second patch is just sort of performance optimization by avoiding two unnecessary modetable walks.
Best regards,
Florian Tobias Schandinat
Florian Tobias Schandinat (2):
viafb: modetable conversion
viafb: avoid refresh and mode lookup in set_par
drivers/video/via/dvi.c | 2 +- drivers/video/via/hw.c | 41 +-- drivers/video/via/hw.h | 4 +- drivers/video/via/lcd.c | 53 +--- drivers/video/via/share.h | 331 -------------------- drivers/video/via/viafbdev.c | 32 +- drivers/video/via/viamode.c | 713 ++++++------------------------------------ drivers/video/via/viamode.h | 11 +- 8 files changed, 134 insertions(+), 1053 deletions(-)
Signature · 1 line
1.7.9
PATCH 1/2 viafb: modetable conversion
This patch converts the modetables used in viafb to
- remove the strange thing that sync_end and blanking_end contained the length and not the absolute value
- remove hundreds of useless defines
- use fb_videomode and not our own definition so modes defined in the subsystem and received via EDID are compatible with ours
As the modes are now stored in a flat structure and no longer in a tree like thing the lookup time was increased but as it is a rare event anyway it shouldn't matter. Otherwise the behaviour should be the same as before.
--- drivers/video/via/dvi.c | 2 +- drivers/video/via/hw.c | 41 +-- drivers/video/via/hw.h | 4 +- drivers/video/via/lcd.c | 53 +--- drivers/video/via/share.h | 331 -------------------- drivers/video/via/viamode.c | 713 ++++++------------------------------------- drivers/video/via/viamode.h | 11 +- 7 files changed, 120 insertions(+), 1035 deletions(-)
drivers/video/via/dvi.c +1 -1
@@ -176,7 +176,7 @@ void viafb_dvi_set_mode(const struct fb_var_screeninfo *var, u16 cxres, u16 cyres, int iga) { struct fb_var_screeninfo dvi_var = *var; -struct crt_mode_table *rb_mode; +const struct fb_videomode *rb_mode;int maxPixelClock; maxPixelClock = viaparinfo->shared->tmds_setting_info.max_pixel_clock;
drivers/video/via/hw.c +16 -25
69 lines not on this page · raw message
drivers/video/via/hw.h +3 -1
@@ -637,6 +637,8 @@ extern int viafb_LCD_ON;extern int viafb_DVI_ON;extern int viafb_hotplug; +struct display_timing var_to_timing (const struct fb_var_screeninfo *var, +u16 cxres,u16 cyres);void viafb_fill_crtc_timing (const struct fb_var_screeninfo *var,u16 cxres,u16 cyres,int iga);void viafb_set_vclock (u32 CLK ,int set_iga);
@@ -660,7 +662,7 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\int viafb_setmode (void );void viafb_fill_var_timing_info (struct fb_var_screeninfo *var, -struct crt_mode_table *mode); +const struct fb_videomode *mode);void __devinit viafb_init_chip_info (int chip_type);void __devinit viafb_init_dac (int set_iga);int viafb_get_refresh (int hres,int vres,u32 float_refresh);
drivers/video/via/lcd.c +7 -46
92 lines not on this page · raw message
drivers/video/via/share.h +0 -331
337 lines not on this page · raw message
drivers/video/via/viamode.c +89 -624
736 lines not on this page · raw message
drivers/video/via/viamode.h +4 -7
@@ -31,11 +31,6 @@ struct VPITTable {unsigned char AR [StdAR]; }; -struct VideoModeTable { -struct crt_mode_table *crtc; -int mode_array; -}; -struct patch_table {int table_length;struct io_reg *io_reg_table;
@@ -60,7 +55,9 @@ extern struct io_reg PM1024x768[];extern struct patch_table res_patch_table[];extern struct VPITTable VPIT ; -struct crt_mode_table *viafb_get_best_mode (int hres,int vres,int refresh); -struct crt_mode_table *viafb_get_best_rb_mode (int hres,int vres,int refresh); +const struct fb_videomode *viafb_get_best_mode (int hres,int vres, +int refresh); +const struct fb_videomode *viafb_get_best_rb_mode (int hres,int vres, +int refresh);#endif /* __VIAMODE_H__ */
Signature · 1 line
1.7.9
PATCH 2/2 viafb: avoid refresh and mode lookup in set_par
In reply to Florian Tobias SchandinatAs check_var already ensures that the mode is valid there is no need to do those expensive lookups here again. The only thing that might change is that the deprecated interface could report slightly different refresh rates due to rounding errors.
--- drivers/video/via/viafbdev.c | 32 ++++++++++++++------------------ 1 files changed, 14 insertions(+), 18 deletions(-)
drivers/video/via/viafbdev.c +14 -18
@@ -287,26 +287,22 @@ static int viafb_set_par(struct fb_info *info) viafb_second_yres, viafb_bpp1, 1); } - refresh =viafb_get_refresh (info->var.xres, info->var.yres, -get_var_refresh (&info->var)); -if (viafb_get_best_mode (viafbinfo->var.xres, viafbinfo->var.yres, - refresh)) { -if (viafb_dual_fb && viapar->iga_path ==IGA2 ) { - viafb_bpp1 = info->var.bits_per_pixel; - viafb_refresh1 = refresh; - }else { - viafb_bpp = info->var.bits_per_pixel; - viafb_refresh = refresh; - } - -if (info->var.accel_flags &FB_ACCELF_TEXT ) - info->flags &= ~FBINFO_HWACCEL_DISABLED ; -else - info->flags |=FBINFO_HWACCEL_DISABLED ; -viafb_setmode (); -viafb_pan_display (&info->var, info); + refresh =get_var_refresh (&info->var); +if (viafb_dual_fb && viapar->iga_path ==IGA2 ) { + viafb_bpp1 = info->var.bits_per_pixel; + viafb_refresh1 = refresh; + }else { + viafb_bpp = info->var.bits_per_pixel; + viafb_refresh = refresh; } +if (info->var.accel_flags &FB_ACCELF_TEXT ) + info->flags &= ~FBINFO_HWACCEL_DISABLED ; +else + info->flags |=FBINFO_HWACCEL_DISABLED ; +viafb_setmode (); +viafb_pan_display (&info->var, info); +return 0 ; }
Signature · 1 line
1.7.9