[PATCH] fbdev: macmodes: compare the pixel clock of each candidate mode

From: Tim Douglas

Date: Tue Nov 17 2026 - 20:26:06 EST


In the second pass through the mode table in mac_var_to_vmode(),
the requested pixel clock period was compared with the first mode's
period at every step. The last mode at that resolution was therefore
returned even when its period was too short. Compare against the
current candidate's period.

Tested on a Performa 6200CD using a kernel with local platform
support. With video=valkyriefb:vmode:10 (800x600 at 60 Hz), the
measured refresh rate was about 72 Hz before the fix and 60 Hz
afterward. At 640x480, 67 Hz was also selected for a 60 Hz request
before the fix.

AI assistance was used to investigate the mode-table walk and draft
the fix.

Signed-off-by: Tim Douglas <me@xxxxxxxxxxx>
---
drivers/video/fbdev/macmodes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/macmodes.c b/drivers/video/fbdev/macmodes.c
index b16a9d9be..7ea40fd34 100644
--- a/drivers/video/fbdev/macmodes.c
+++ b/drivers/video/fbdev/macmodes.c
@@ -342,7 +342,7 @@ int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,

if (mode->xres != clk_mode->xres || mode->yres != clk_mode->yres)
break;
- if (var->pixclock > mode->pixclock)
+ if (var->pixclock > clk_mode->pixclock)
break;
if (mode->vmode != clk_mode->vmode)
continue;

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
--
2.39.5