From nobody Sat Dec 21 16:41:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 171054734057715.752847874978102; Fri, 15 Mar 2024 17:02:20 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id A3B7439652; Sat, 16 Mar 2024 00:02:15 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id BEEBB21E31 for ; Sat, 16 Mar 2024 00:01:37 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Fri, 15 Mar 2024 17:01:37 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id i23-20020ac84f57000000b0042f1e47e652sm2409124qtw.79.2024.03.15.17.01.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 17:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; t=1710547296; x=1711152096; darn=seabios.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=es4cuejV6k9cMNPXKrzFb+OcZiHmmJiiyZcb7i7nHQg=; b=D8+nz8vcZ/ApfHNcFdDPH7Iudo5dhkydWC1yAjxH4ikkcclTyDqtDKiaw78gyFCk2z sVMi2Xt4a80ym4kZX/NR4aT0Ic0Eze+/IGYS3PLNSQ9ONUxdu91kSbbfVqaBdTvgrH9a H1E19zxIgsW7bSl0IwqMFKOmNFzcC/cyoc7g0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710547296; x=1711152096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=es4cuejV6k9cMNPXKrzFb+OcZiHmmJiiyZcb7i7nHQg=; b=tydPSoVrnQsBEdMmk9cKMVhh82lXKeAhlJ/2fZA4I6UYYshRyhckYfZUwo4ye4qVMm wCK4cHLtsYPiORHQP/5aIzDlM/WWWEi5V9zxc1aRWTxOZ3w9yI2OcCwjJfGG2p4PMxDH Y2uKRPeC7VMUDRRZQs0SYvLThg658NpsSCBiiVaL/bB0kE27iLOt0wAvt+574aKHhKJy kStotdfBYOnjvQRV5RNzBDGb1xJ/Y+q9oaY+jKebJjZWfYwuFGmPp2lswPvLbMw+bpBO dp3FJq6irdcJCjqvNak9tsrzW+0+ij91CLmEuQ/OR2SEGu2FgrFTc1RBmJVpey9Ln08n PsVQ== X-Gm-Message-State: AOJu0YwMrjrPvh9kAdIefwiA/JcHMO45/N1Fxc+jPb9btjhUi1EmUzCs zqdd3cYq1Tq0TyHO1eg9ln9t4pp8ZoJ5N6yjSFrIr3F1M9B4O+BvN6QLMGrvgJEJmnqAQUBBiSB V X-Google-Smtp-Source: AGHT+IEeAVepjZ44gm1Q9+p5doKpz3wVrzc9nfjL08Hzuo4p2nL0Mkc7YPqrcgxc9/VBtjQZavzNWQ== X-Received: by 2002:a05:6808:3099:b0:3c3:782a:9937 with SMTP id bl25-20020a056808309900b003c3782a9937mr3285843oib.24.1710547296449; Fri, 15 Mar 2024 17:01:36 -0700 (PDT) From: Kevin O'Connor To: seabios@seabios.org Date: Fri, 15 Mar 2024 19:57:48 -0400 Message-ID: <20240316000129.4099892-3-kevin@koconnor.net> In-Reply-To: <20240316000129.4099892-1-kevin@koconnor.net> References: <20240316000129.4099892-1-kevin@koconnor.net> MIME-Version: 1.0 X-Spam-Level: *** Message-ID-Hash: 6NCUK6LPXYIJVJHD2YITIDTOIHVA77F6 X-Message-ID-Hash: 6NCUK6LPXYIJVJHD2YITIDTOIHVA77F6 X-MailFrom: kevin@koconnor.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH 2/2] vgasrc: Rename vgahw_get_linesize() to vgahw_minimum_linelength() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1710547342302100001 Content-Type: text/plain; charset="utf-8" Make the relationship between vgahw_get_linelength() and vgahw_get_linesize() more clear by renaming it to vgahw_minimum_linelength(). Signed-off-by: Kevin O'Connor --- vgasrc/cbvga.c | 14 +++++++------- vgasrc/stdvga.c | 16 +++++++++++----- vgasrc/stdvga.h | 1 + vgasrc/vbe.c | 2 +- vgasrc/vgahw.h | 12 ++++++------ vgasrc/vgautil.h | 3 +-- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 9e3cc93..243e6be 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -81,6 +81,13 @@ cbvga_set_window(struct vgamode_s *curmode_g, int window= , int val) return -1; } =20 +int +cbvga_minimum_linelength(struct vgamode_s *vmode_g) +{ + /* Can't change mode, always report active pitch. */ + return GET_GLOBAL(CBlinelength); +} + int cbvga_get_linelength(struct vgamode_s *curmode_g) { @@ -156,13 +163,6 @@ 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 9d8f556..da67af4 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -275,6 +275,14 @@ stdvga_set_window(struct vgamode_s *curmode_g, int win= dow, int val) return -1; } =20 +// Minimum framebuffer bytes between each vertical line for given mode +int +stdvga_minimum_linelength(struct vgamode_s *vmode_g) +{ + return DIV_ROUND_UP(GET_GLOBAL(vmode_g->width) * vga_bpp(vmode_g), 8); +} + +// Return number of framebuffer bytes between start of each vertical line int stdvga_get_linelength(struct vgamode_s *curmode_g) { @@ -282,6 +290,7 @@ stdvga_get_linelength(struct vgamode_s *curmode_g) return val * 8 / stdvga_vram_ratio(curmode_g); } =20 +// Set number of framebuffer bytes between start of each vertical line int stdvga_set_linelength(struct vgamode_s *curmode_g, int val) { @@ -290,6 +299,7 @@ stdvga_set_linelength(struct vgamode_s *curmode_g, int = val) return 0; } =20 +// Return framebuffer offset of first byte of displayed content int stdvga_get_displaystart(struct vgamode_s *curmode_g) { @@ -299,6 +309,7 @@ stdvga_get_displaystart(struct vgamode_s *curmode_g) return addr * 4 / stdvga_vram_ratio(curmode_g); } =20 +// Set framebuffer offset of first byte of displayed content int stdvga_set_displaystart(struct vgamode_s *curmode_g, int val) { @@ -321,11 +332,6 @@ stdvga_set_dacformat(struct vgamode_s *curmode_g, int = val) return -1; } =20 -int -stdvga_get_linesize(struct vgamode_s *vmode_g) -{ - return DIV_ROUND_UP(GET_GLOBAL(vmode_g->width) * vga_bpp(vmode_g), 8); -} =20 /**************************************************************** * Save/Restore state diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h index 5164ca1..ce79783 100644 --- a/vgasrc/stdvga.h +++ b/vgasrc/stdvga.h @@ -68,6 +68,7 @@ void stdvga_set_scan_lines(u8 lines); u16 stdvga_get_vde(void); int stdvga_get_window(struct vgamode_s *curmode_g, int window); int stdvga_set_window(struct vgamode_s *curmode_g, int window, int val); +int stdvga_minimum_linelength(struct vgamode_s *vmode_g); int stdvga_get_linelength(struct vgamode_s *curmode_g); int stdvga_set_linelength(struct vgamode_s *curmode_g, int val); int stdvga_get_displaystart(struct vgamode_s *curmode_g); diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index 3efb54f..d2aaace 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -110,7 +110,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 vgahw_get_linesize(vmode_g); + int linesize =3D vgahw_minimum_linelength(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 bd33e20..a6ddaa9 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -95,6 +95,12 @@ static inline int vgahw_get_linelength(struct vgamode_s = *curmode_g) { return stdvga_get_linelength(curmode_g); } =20 +static inline int vgahw_minimum_linelength(struct vgamode_s *vmode_g) { + if (CONFIG_VGA_EMULATE_TEXT) + return cbvga_minimum_linelength(vmode_g); + return stdvga_minimum_linelength(vmode_g); +} + static inline int vgahw_set_linelength(struct vgamode_s *curmode_g, int va= l) { if (CONFIG_VGA_CIRRUS) return clext_set_linelength(curmode_g, val); @@ -151,10 +157,4 @@ 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_EMULATE_TEXT) - 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 245a562..ce307c9 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -9,6 +9,7 @@ struct vgamode_s *cbvga_find_mode(int mode); void cbvga_list_modes(u16 seg, u16 *dest, u16 *last); int cbvga_get_window(struct vgamode_s *curmode_g, int window); int cbvga_set_window(struct vgamode_s *curmode_g, int window, int val); +int cbvga_minimum_linelength(struct vgamode_s *vmode_g); int cbvga_get_linelength(struct vgamode_s *curmode_g); int cbvga_set_linelength(struct vgamode_s *curmode_g, int val); int cbvga_get_displaystart(struct vgamode_s *curmode_g); @@ -17,7 +18,6 @@ int cbvga_get_dacformat(struct vgamode_s *curmode_g); int cbvga_set_dacformat(struct vgamode_s *curmode_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); void cbvga_setup_modes(u64 addr, u8 bpp, u32 xlines, u32 ylines, u32 linel= ength); int cbvga_setup(void); =20 @@ -77,7 +77,6 @@ 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.44.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org