• Finn Thain's avatar
    fbdev: mac_var_to_mode() fix · d876c11a
    Finn Thain authored
    The valkyriefb driver assumes that this logic holds:
    
    mac_vmode_to_var(X, cmode, &var);
    mac_var_to_vmode(&var, &vmode, &cmode);
    assert(vmode == X);
    
    But it doesn't hold because mac_var_to_vmode() can return a mode with a
    slower pixel clock, even when a match is available. So we end up with this
    failure:
    
    using video mode 11 and color mode 0.
    valkyriefb: vmode 12 not valid.
    valkyriefb: can't set default video mode
    valkyriefb: vmode 12 not valid.
    
    Rather than have mac_var_to_mode() return the first reasonable mode it
    finds, have it return the mode that is closest to the requested one (or
    the mode with the closest longer pixel clock period if there is no exact
    match).
    Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
    Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    d876c11a
macmodes.c 12.3 KB