• Thomas Zimmermann's avatar
    fbdev: vesafb: Detect VGA compatibility from screen info's VESA attributes · c2bc958b
    Thomas Zimmermann authored
    Test the vesa_attributes field in struct screen_info for compatibility
    with VGA hardware. Vesafb currently tests bit 1 in screen_info's
    capabilities field which indicates a 64-bit lfb address and is
    unrelated to VGA compatibility.
    
    Section 4.4 of the Vesa VBE 2.0 specifications defines that bit 5 in
    the mode's attributes field signals VGA compatibility. The mode is
    compatible with VGA hardware if the bit is clear. In that case, the
    driver can access VGA state of the VBE's underlying hardware. The
    vesafb driver uses this feature to program the color LUT in palette
    modes. Without, colors might be incorrect.
    
    The problem got introduced in commit 89ec4c23 ("[PATCH] vesafb: Fix
    incorrect logo colors in x86_64"). It incorrectly stores the mode
    attributes in the screen_info's capabilities field and updates vesafb
    accordingly. Later, commit 5e8ddcbe ("Video mode probing support for
    the new x86 setup code") fixed the screen_info, but did not update vesafb.
    Color output still tends to work, because bit 1 in capabilities is
    usually 0.
    
    Besides fixing the bug in vesafb, this commit introduces a helper that
    reads the correct bit from screen_info.
    Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
    Fixes: 5e8ddcbe ("Video mode probing support for the new x86 setup code")
    Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
    Cc: <stable@vger.kernel.org> # v2.6.23+
    Signed-off-by: default avatarHelge Deller <deller@gmx.de>
    c2bc958b
vesafb.c 14.7 KB