From owner-svn-src-all@FreeBSD.ORG Wed Jan 27 17:00:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56FDE1065672; Wed, 27 Jan 2010 17:00:43 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4630E8FC14; Wed, 27 Jan 2010 17:00:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0RH0gNk073638; Wed, 27 Jan 2010 17:00:42 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0RH0gMd073636; Wed, 27 Jan 2010 17:00:42 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201001271700.o0RH0gMd073636@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 27 Jan 2010 17:00:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203078 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2010 17:00:43 -0000 Author: jkim Date: Wed Jan 27 17:00:42 2010 New Revision: 203078 URL: http://svn.freebsd.org/changeset/base/203078 Log: Use VESA palette load/save functions if VESA BIOS says the current palette format is higher than 6-bit instead of relying VGA compatibility flag. This fixes palette problem of NVIDIA GeForce 6600. Reduce code differences between palette load/save functions while we are here. Tested by: danfe Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Wed Jan 27 16:47:02 2010 (r203077) +++ head/sys/dev/fb/vesa.c Wed Jan 27 17:00:42 2010 (r203078) @@ -1367,10 +1367,11 @@ vesa_save_palette(video_adapter_t *adp, { int bits; - if ((adp == vesa_adp) && - (adp->va_info.vi_flags & V_INFO_NONVGA) != 0 && - (bits = vesa_bios_get_dac()) >= 6) - return (vesa_bios_save_palette(0, 256, palette, bits)); + if (adp == vesa_adp && VESA_MODE(adp->va_mode)) { + bits = vesa_bios_get_dac(); + if ((adp->va_info.vi_flags & V_INFO_NONVGA) != 0 || bits > 6) + return (vesa_bios_save_palette(0, 256, palette, bits)); + } return ((*prevvidsw->save_palette)(adp, palette)); } @@ -1380,10 +1381,11 @@ vesa_load_palette(video_adapter_t *adp, { int bits; - if ((adp == vesa_adp) && - (adp->va_info.vi_flags & V_INFO_NONVGA) != 0 && - (bits = vesa_bios_get_dac()) >= 6) - return (vesa_bios_load_palette(0, 256, palette, bits)); + if (adp == vesa_adp && VESA_MODE(adp->va_mode)) { + bits = vesa_bios_get_dac(); + if ((adp->va_info.vi_flags & V_INFO_NONVGA) != 0 || bits > 6) + return (vesa_bios_load_palette(0, 256, palette, bits)); + } return ((*prevvidsw->load_palette)(adp, palette)); } @@ -1581,12 +1583,14 @@ get_palette(video_adapter_t *adp, int ba int bits; int error; - if ((base < 0) || (base >= 256) || (count < 0) || (count > 256)) + if (base < 0 || base >= 256 || count < 0 || count > 256) return (1); if ((base + count) > 256) return (1); - if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 || - (bits = vesa_bios_get_dac()) < 6) + if (!VESA_MODE(adp->va_mode)) + return (1); + bits = vesa_bios_get_dac(); + if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 && bits <= 6) return (1); r = malloc(count * 3, M_DEVBUF, M_WAITOK); @@ -1617,10 +1621,14 @@ set_palette(video_adapter_t *adp, int ba int bits; int error; - if ((base < 0) || (base >= 256) || (base + count > 256)) + if (base < 0 || base >= 256 || count < 0 || count > 256) + return (1); + if ((base + count) > 256) + return (1); + if (!VESA_MODE(adp->va_mode)) return (1); - if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 || - (bits = vesa_bios_get_dac()) < 6) + bits = vesa_bios_get_dac(); + if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 && bits <= 6) return (1); r = malloc(count * 3, M_DEVBUF, M_WAITOK);