aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/viafbdev.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-06 19:04:43 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-06 19:22:49 -0400
commit94715ba97508dd42919a7525e362efb00dde1271 (patch)
tree9ad5e92149e59eed1b0385a950608608d7df0494 /drivers/video/via/viafbdev.c
parent363699722a2a6801d098693fa15bc3b68d6b4f31 (diff)
viafb: add new funcions to select a single mode
This patch introduces 2 new functions for selecting a single mode based on hres, vres and refresh rate and changes some uses to use those. The advantage is that it is less error prone than doing the selection based on refresh rate everywhere and allows replacing the modetable structure. This includes a little change that users may notice: If a refresh rate was given as module parameters but does not exist in the modetable prior to this patch a refresh rate of 60 was assumed and after this patch the closest supported refresh rate to the one provided by the user is used. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r--drivers/video/via/viafbdev.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 3eaf607bdf48..0c0ef9568cf3 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -201,7 +201,6 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
201 struct fb_info *info) 201 struct fb_info *info)
202{ 202{
203 int depth, refresh; 203 int depth, refresh;
204 struct VideoModeTable *vmode_entry;
205 struct viafb_par *ppar = info->par; 204 struct viafb_par *ppar = info->par;
206 u32 line; 205 u32 line;
207 206
@@ -211,8 +210,10 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
211 if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE) 210 if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE)
212 return -EINVAL; 211 return -EINVAL;
213 212
214 vmode_entry = viafb_get_mode(var->xres, var->yres); 213 /* the refresh rate is not important here, as we only want to know
215 if (!vmode_entry) { 214 * whether the resolution exists
215 */
216 if (!viafb_get_best_mode(var->xres, var->yres, 60)) {
216 DEBUG_MSG(KERN_INFO 217 DEBUG_MSG(KERN_INFO
217 "viafb: Mode %dx%dx%d not supported!!\n", 218 "viafb: Mode %dx%dx%d not supported!!\n",
218 var->xres, var->yres, var->bits_per_pixel); 219 var->xres, var->yres, var->bits_per_pixel);
@@ -254,7 +255,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
254 get_var_refresh(var)); 255 get_var_refresh(var));
255 256
256 /* Adjust var according to our driver's own table */ 257 /* Adjust var according to our driver's own table */
257 viafb_fill_var_timing_info(var, refresh, vmode_entry); 258 viafb_fill_var_timing_info(var,
259 viafb_get_best_mode(var->xres, var->yres, refresh));
258 if (var->accel_flags & FB_ACCELF_TEXT && 260 if (var->accel_flags & FB_ACCELF_TEXT &&
259 !ppar->shared->vdev->engine_mmio) 261 !ppar->shared->vdev->engine_mmio)
260 var->accel_flags = 0; 262 var->accel_flags = 0;
@@ -1816,9 +1818,8 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1816 default_var.xres_virtual = default_xres; 1818 default_var.xres_virtual = default_xres;
1817 default_var.yres_virtual = default_yres; 1819 default_var.yres_virtual = default_yres;
1818 default_var.bits_per_pixel = viafb_bpp; 1820 default_var.bits_per_pixel = viafb_bpp;
1819 viafb_fill_var_timing_info(&default_var, viafb_get_refresh( 1821 viafb_fill_var_timing_info(&default_var, viafb_get_best_mode(
1820 default_var.xres, default_var.yres, viafb_refresh), 1822 default_var.xres, default_var.yres, viafb_refresh));
1821 viafb_get_mode(default_var.xres, default_var.yres));
1822 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); 1823 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo);
1823 viafbinfo->var = default_var; 1824 viafbinfo->var = default_var;
1824 1825
@@ -1857,9 +1858,8 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1857 default_var.xres_virtual = viafb_second_xres; 1858 default_var.xres_virtual = viafb_second_xres;
1858 default_var.yres_virtual = viafb_second_yres; 1859 default_var.yres_virtual = viafb_second_yres;
1859 default_var.bits_per_pixel = viafb_bpp1; 1860 default_var.bits_per_pixel = viafb_bpp1;
1860 viafb_fill_var_timing_info(&default_var, viafb_get_refresh( 1861 viafb_fill_var_timing_info(&default_var, viafb_get_best_mode(
1861 default_var.xres, default_var.yres, viafb_refresh1), 1862 default_var.xres, default_var.yres, viafb_refresh1));
1862 viafb_get_mode(default_var.xres, default_var.yres));
1863 1863
1864 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); 1864 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1);
1865 viafb_check_var(&default_var, viafbinfo1); 1865 viafb_check_var(&default_var, viafbinfo1);
@@ -2032,9 +2032,9 @@ int __init viafb_init(void)
2032 return r; 2032 return r;
2033#endif 2033#endif
2034 if (parse_mode(viafb_mode, &dummy_x, &dummy_y) 2034 if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
2035 || !viafb_get_mode(dummy_x, dummy_y) 2035 || !viafb_get_best_mode(dummy_x, dummy_y, viafb_refresh)
2036 || parse_mode(viafb_mode1, &dummy_x, &dummy_y) 2036 || parse_mode(viafb_mode1, &dummy_x, &dummy_y)
2037 || !viafb_get_mode(dummy_x, dummy_y) 2037 || !viafb_get_best_mode(dummy_x, dummy_y, viafb_refresh1)
2038 || viafb_bpp < 0 || viafb_bpp > 32 2038 || viafb_bpp < 0 || viafb_bpp > 32
2039 || viafb_bpp1 < 0 || viafb_bpp1 > 32 2039 || viafb_bpp1 < 0 || viafb_bpp1 > 32
2040 || parse_active_dev()) 2040 || parse_active_dev())