From nobody Sat May 10 09:55:15 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1496078741122873.5893550617467; Mon, 29 May 2017 10:25:41 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dFOPb-0002pd-En; Mon, 29 May 2017 19:24:59 +0200 Received: from das-labor.org ([188.40.89.130]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dFOPR-0002ms-23 for seabios@seabios.org; Mon, 29 May 2017 19:24:57 +0200 From: Patrick Rudolph Authentication-Results: das-labor.org; dkim=permerror (bad message/signature format) To: seabios@seabios.org Date: Mon, 29 May 2017 19:25:12 +0200 Message-ID: <20170529172514.8308-4-siro@das-labor.org> In-Reply-To: <20170529172514.8308-1-siro@das-labor.org> References: <20170529172514.8308-1-siro@das-labor.org> X-Spam-Score: -2.7 (--) Subject: [SeaBIOS] [PATCH 3/5] SeaVGABIOS/vbe: Query driver for scanline pitch v2 X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Query the driver for the real scanline pitch in bytes. As cbvga doesn't change the pitch on mode change, always return the same pitch, that might exceed width times Bytes-per-pixel. Report the default stdvga pitch for all other drivers. Signed-off-by: Patrick Rudolph --- vgasrc/cbvga.c | 7 +++++++ vgasrc/stdvga.c | 5 +++++ vgasrc/vbe.c | 2 +- vgasrc/vgahw.h | 6 ++++++ vgasrc/vgautil.h | 2 ++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 49af7f9..6b3233e 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -124,6 +124,13 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags) return 0; } =20 +int +cbvga_get_linesize(struct vgamode_s *vmode_g) +{ + /* Can't change mode, always report active pitch. */ + return GET_GLOBAL(CBlinelength); +} + #define CB_TAG_FRAMEBUFFER 0x0012 struct cb_framebuffer { u32 tag; diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index 886deca..0e24297 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -321,6 +321,11 @@ stdvga_set_dacformat(struct vgamode_s *vmode_g, int va= l) return -1; } =20 +int +stdvga_get_linesize(struct vgamode_s *vmode_g) +{ + return DIV_ROUND_UP(vmode_g->width * vga_bpp(vmode_g), 8); +} =20 /**************************************************************** * Save/Restore state diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index facad19..724c1ba 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -107,7 +107,7 @@ vbe_104f01(struct bregs *regs) // Basic information about mode. int width =3D GET_GLOBAL(vmode_g->width); int height =3D GET_GLOBAL(vmode_g->height); - int linesize =3D DIV_ROUND_UP(width * vga_bpp(vmode_g), 8); + int linesize =3D vgahw_get_linesize(vmode_g); SET_FARVAR(seg, info->bytes_per_scanline, linesize); SET_FARVAR(seg, info->xres, width); SET_FARVAR(seg, info->yres, height); diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h index dab2b4d..2a85eba 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -139,4 +139,10 @@ static inline int vgahw_save_restore(int cmd, u16 seg,= void *data) { return stdvga_save_restore(cmd, seg, data); } =20 +static inline int vgahw_get_linesize(struct vgamode_s *vmode_g) { + if (CONFIG_VGA_COREBOOT) + return cbvga_get_linesize(vmode_g); + return stdvga_get_linesize(vmode_g); +} + #endif // vgahw.h diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h index 08c4e8d..fae5fba 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -17,6 +17,7 @@ int cbvga_get_dacformat(struct vgamode_s *vmode_g); int cbvga_set_dacformat(struct vgamode_s *vmode_g, int val); int cbvga_save_restore(int cmd, u16 seg, void *data); int cbvga_set_mode(struct vgamode_s *vmode_g, int flags); +int cbvga_get_linesize(struct vgamode_s *vmode_g); int cbvga_setup(void); =20 // clext.c @@ -63,6 +64,7 @@ void stdvga_list_modes(u16 seg, u16 *dest, u16 *last); void stdvga_build_video_param(void); void stdvga_override_crtc(int mode, u8 *crtc); int stdvga_set_mode(struct vgamode_s *vmode_g, int flags); +int stdvga_get_linesize(struct vgamode_s *vmode_g); void stdvga_set_packed_palette(void); =20 // swcursor.c --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios