From nobody Fri Jun 6 14:44:42 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bDPGz28b8z5xF5d; Fri, 06 Jun 2025 14:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bDPGz0jxFz3FbP; Fri, 06 Jun 2025 14:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749221083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sXsMDgKF0KrFGEVcxcY//xrtghFz3K7/mGcPFZINJDU=; b=bA2988frUZ4G9M8KggpF/TiP48/lYj+cvBA0xmbz8RaCpgEqXKko68Uoq2Q+G/0OaeDaAt 4WVLWv3fZFyFlMCbqjyKubQBaXmSCUtxVc6sJzrwsdA/+dOL/yyxUk4rNbpP6+oYMr8iRB l3shSu94TDwrVi1smho/f7aDgLEBaK72bseY6V17jUn1rs2Krutm58xjnSGP6xjO/o4392 GBKlzRNFoN+oy3IA2K2mtCSdVdF4CBxKuxPfyg0s/Tsxd///L1FIwre3+MN6Xh1+3JgiYx WfRkhbOHqj9fApkdHZbb5Xn4O2C/PK63yzlhurVzFQ228L+yEzch2wuxTlVRuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749221083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sXsMDgKF0KrFGEVcxcY//xrtghFz3K7/mGcPFZINJDU=; b=KTjhXKmYQrl15xR9QQHp//pgt9McRtG9/R1EkpuHcpANbu+wuKwl32qdWOVvCUKIP7gVHP BeqcpwMGziqU2yTA7+/5PAlfJ1V+LQI0RAt3FRVMCNjdUDL5+C3cKyHTEk4DoMpgbSWIcv XqIBwf9oz0FxNWoRIux1lSPCW/cyVnqoUQchbKTvZmGusnWIhxNU55k0vintUPx64a5fQ0 akGGFyQcx913Lezg0vVT8yHK8g2/KgzTspVbjvlXtmqApSSNPaemDp8uUikt57aXywT9JD q9lu74GMBHOcCWGPJUHCt1zuTCH4M/9Q4h8PYFZtHrtbcqG3x0iHQ/F4PDESpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749221083; a=rsa-sha256; cv=none; b=D7p9JNDGzo5XG/H145Boc3N1fx1WBnIB1BTgOswQykTjNR3mkI6jJo7lv2bjZ7YcVt7fHv f0DEUQs+clyRMdQAT3P830FZn6baaaSWZavvgwPMvBxp6cG/6cSesf0WYJg16VN71T099Z yXsKwBGjNMcdi4RHdddmjn/mvMm1Va9evwCPwS8a/YAegzMLZZ6/1DK6Du5YuoPtxBzGMA gSnK4yYbFJxZzjvUyxQ0m95kEKVAO0NmzSiFcQtKHYhHoN94Prl68INepCLVelpU8Q4kZL foyEd/yBW0sy8KF1U0wR6OBe9T/dngtQ07bSG4sbzS/U8EQR6gBjnE87d2mMOw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bDPGz052Cz10GM; Fri, 06 Jun 2025 14:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 556Eigxi078033; Fri, 6 Jun 2025 14:44:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 556Eig3m078030; Fri, 6 Jun 2025 14:44:42 GMT (envelope-from git) Date: Fri, 6 Jun 2025 14:44:42 GMT Message-Id: <202506061444.556Eig3m078030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: bef6d85b6de5 - main - lualoader: allow graphical bits to be disabled with loader_gfx List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bef6d85b6de55e0e7adcfa1fd2e4abdcecbf9564 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bef6d85b6de55e0e7adcfa1fd2e4abdcecbf9564 commit bef6d85b6de55e0e7adcfa1fd2e4abdcecbf9564 Author: Kyle Evans AuthorDate: 2025-06-06 14:44:14 +0000 Commit: Kyle Evans CommitDate: 2025-06-06 14:44:29 +0000 lualoader: allow graphical bits to be disabled with loader_gfx Some people prefer the old ASCII art look and it's good to have a way to confirm that the fallbacks still work right on systems that have a functional framebuffer available. Add a loader_gfx loader.conf(5) variable to disable the eager use of graphics for these use-cases. While we're here, clean up the style in the area a little bit; the early porting that I did to lualoader did a lot of redundant ~= nil that has carried over into some of the later work. We can drop some of that, and also re-organize some of these variables to improve readability. ziaee notes that the positioning of the orb is a bit off; this is due to a change in positioning that happened in 1b4e1171315398dec ("loader: Fix orb position") to account for the image dimensions. This should be partially reverted to get it right; we shouldn't assume that we can use the same shift in gfx-* definitions for both the ASCII art and the associated image -- the {image, image_rl} pair should be converted to something more like an fbimg or gfx table that has the image, image width and a shift override to avoid messing up the ASCII positioning when disabled (or with no graphics available). Reviewed by: imp, manu, ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D50706 --- stand/defaults/loader.conf | 1 + stand/defaults/loader.conf.5 | 8 +++++++- stand/lua/drawer.lua | 30 +++++++++++++++--------------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf index b1e87520a2d4..5d66708d30ef 100644 --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -105,6 +105,7 @@ efi_max_resolution="1x1" # Set the max resolution for EFI loader to use: # WidthxHeight (e.g. 1920x1080) #kernels="kernel kernel.old" # Kernels to display in the boot menu kernels_autodetect="YES" # Auto-detect kernel directories in /boot +#loader_gfx="YES" # Use graphical images when available #loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none #comconsole_speed="115200" # Set the current serial console speed #console="vidconsole" # A comma separated list of console(s) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 807d8ae62e9a..021f68f2309e 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -21,7 +21,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.Dd February 9, 2025 +.Dd June 5, 2025 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -414,6 +414,12 @@ the beastie boot menu will be skipped. If set to .Dq NO , the autoboot menu will not be displayed +.It Va loader_gfx +If set to +.Dq NO , +the ASCII art version of the brand and logo will be used even if graphical +versions are available. +Additionally, the menu frame will be drawn with ASCII art as well. .It Va loader_logo Pq Dq Li orbbw Selects a desired logo in the beastie boot menu. Possible values are: diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index ee33ae753916..d4c6bf850e86 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -217,6 +217,13 @@ local function defaultframe() return "double" end +local function gfxenabled() + return (loader.getenv("loader_gfx") or "yes"):lower() ~= "no" +end +local function gfxcapable() + return core.isFramebufferConsole() and gfx.term_putimage +end + local function drawframe() local x = menu_position.x - 3 local y = menu_position.y - 1 @@ -242,7 +249,7 @@ local function drawframe() x = x + shift.x y = y + shift.y - if core.isFramebufferConsole() and gfx.term_drawrect ~= nil then + if gfxenabled() and gfxcapable() then gfx.term_drawrect(x, y, x + w, y + h) return true end @@ -332,11 +339,9 @@ local function drawbrand() y = y + branddef.shift.y end - if core.isFramebufferConsole() and - gfx.term_putimage ~= nil and - branddef.image ~= nil then - if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) - then + local gfx_requested = branddef.image and gfxenabled() + if gfx_requested and gfxcapable() then + if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then return true end end @@ -383,16 +388,11 @@ local function drawlogo() y = y + logodef.shift.y end - if core.isFramebufferConsole() and - gfx.term_putimage ~= nil and - logodef.image ~= nil then - local y1 = 15 + local gfx_requested = logodef.image and gfxenabled() + if gfx_requested and gfxcapable() then + local y1 = logodef.image_rl or 15 - if logodef.image_rl ~= nil then - y1 = logodef.image_rl - end - if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) - then + if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then return true end end