Skip to contentSkip to conversation

fbdev: macmodes: compare the pixel clock of each candidate mode

PATCH Applied Tim Douglas 3 participants 3 messages Nov 18 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: macmodes: compare the pixel clock of each candidate mode

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.

---
 drivers/video/fbdev/macmodes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/macmodes.c +1 -1
index b16a9d9be..7ea40fd34 100644
@@ -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

Signature · 1 line
2.39.5
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] fbdev: macmodes: missing Fixes trailer for mac_var_to_vmode() bug fix --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] fbdev: macmodes: missing Fixes trailer for mac_var_to_vmode() bug fix
--

commit a5693e36289da1dfee41e154db2fb9b39fdc0554
Author: Tim Douglas <[email protected]>

Quoted 14 lines

fbdev: macmodes: compare the pixel clock of each candidate mode

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.

Quoted 4 lines

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

[Severity: Low]
Since this fixes the second-pass pixel clock check in mac_var_to_vmode(), should this include:

Fixes d876c11a0fd4 ("fbdev: mac_var_to_mode() fix")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Applied
#2 lore raw
In reply to Tim Douglas
Quoted 12 lines · Tim Douglas

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.

Quoted 7 lines

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

---
  drivers/video/fbdev/macmodes.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

applied.

Thanks!
Helge