From nobody Fri Jun 13 02:23:48 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 4bJNVr6sBHz5ypNw; Fri, 13 Jun 2025 02:23:48 +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 4bJNVr4xTVz48tc; Fri, 13 Jun 2025 02:23:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749781428; 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=71nuP1b5RyiVWhg1NiDHU7h7PmYHrbWSXIgkkqZA698=; b=lBRcfEKDxs3DrPqjP68C7gROpu38VI75a/57Nh9Qff09/dYYzUjftXYJP1zDGhD2iTHnzU nAMit7+560MQTJ/RjEHxa5k1oOgUetbGrqz8M2+oU8H98ZrFZMaxlcCsWfVOkSAttWn2Uw F9tp2F3WKclGyOF+BfBzOs6KNDcCZwRyFOv9xefb/YWOxI7+ydyshW6aIhIirezva9NsbP r8zAPCp4fENjSVXvS9oygzNrSmJ28gYjigixXVwfELCNRBXUvoe9QNODbpjRxw9VBsSct7 zpwxaIsyarxRXpaHEvyyZffygY5N7XNnURzmNIX1VUGmI8ZAy2geZtecgw/rNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749781428; 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=71nuP1b5RyiVWhg1NiDHU7h7PmYHrbWSXIgkkqZA698=; b=V0O10fzI+P3RhKBnFrk/6F7IgrZHNaCmyjjsDXU0SKQkLYmpbMU+Z49f6pM/iWPe8ivvMd iuXB5A+B29u8oPRcaMEp3hBGylm9xJTaNNWWTYhIgRvuD8JnlN26/bWVSI+eM4NB9WG291 OiBsFX+OrrI5ZDDGdrET2eF7ZTBXDUdKfFfGJeSuL58wvsA5XZj+BuMagsVoKIepARhhyi 91ysAfBkWeARX3xDP8x8o2ALKha98kWpNHKRMHDIplc0tTQTFGWn/A6P67P3TXc8j64oo9 yp5hVqqrO4i4LmY8EvVBOUoj83YJ0Vz8QSVK2M4vxK6azINyqHuj3eOqixtB6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749781428; a=rsa-sha256; cv=none; b=IekWDs9hpJtaAeqlwLZmYezH8tKQULHozSYkoOEVW1Ls+GWYhtp1znoYTeXo4YzPMp5qYO wnbTi9Ne5PgNvygqA2BSDNCANETiYyG84QquQ5+mqztsR6sWVrTZUzHgRuaBgK6ToUdgWt OBwUeED5ufs32S/VMMEGgBfNjZsJ+7wMyCT9FLgzDlJG/YA1g6wHk2YmqRytr0Mx21wyD6 mNYBnOv0sz4ledWZKHXiNEYEcnmV87RT8FVXKEbQfKfQ39Mi1MCD95l0sp7LCgzJpveajN xu8uklToKBrj1hjmuWJf5mThUthQCs+hMlIzyCOV+RglhcfKsSMtY0QROIR/pA== 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 4bJNVr4629zfj8; Fri, 13 Jun 2025 02:23:48 +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 55D2NmSh003431; Fri, 13 Jun 2025 02:23:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55D2NmjC003428; Fri, 13 Jun 2025 02:23:48 GMT (envelope-from git) Date: Fri, 13 Jun 2025 02:23:48 GMT Message-Id: <202506130223.55D2NmjC003428@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: 33d3373faf30 - main - stand: lua: convert orb to a new format that allows per-graphic shift 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: 33d3373faf30d5e7a1890ab686d932c984bc4b75 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=33d3373faf30d5e7a1890ab686d932c984bc4b75 commit 33d3373faf30d5e7a1890ab686d932c984bc4b75 Author: Kyle Evans AuthorDate: 2025-06-13 02:23:39 +0000 Commit: Kyle Evans CommitDate: 2025-06-13 02:23:39 +0000 stand: lua: convert orb to a new format that allows per-graphic shift Previously, we had one shift that had to work for both the ASCII version and the image that we may draw if we have a framebuffer to play with. That makes it more difficult to get the positioning just right, so split them out into their own tables for convenience. While we're here, stop clipping off the bottom of the orb when the autoboot sequence is interrupted. There's plenty of space for it to move up a hair, so let's do that.. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D50801 --- stand/lua/drawer.lua | 104 ++++++++++++++++++++++++++++++++++-------------- stand/lua/gfx-orb.lua | 15 ++++--- stand/lua/gfx-orbbw.lua | 36 +++++++++-------- 3 files changed, 104 insertions(+), 51 deletions(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index d4c6bf850e86..bc0dc543a9fd 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -330,20 +330,23 @@ local function drawbrand() branddef = getBranddef(drawer.default_brand) end - local graphic = branddef.graphic + local graphic = branddef.ascii.image x = x + shift.x y = y + shift.y - if branddef.shift ~= nil then - x = x + branddef.shift.x - y = y + branddef.shift.y - end - local gfx_requested = branddef.image and gfxenabled() + local gfx_requested = branddef.fb and gfxenabled() if gfx_requested and gfxcapable() then - if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then + if branddef.fb.shift then + x = x + (branddef.fb.shift.x or 0) + y = y + (branddef.fb.shift.y or 0) + end + if gfx.term_putimage(branddef.fb.image, x, y, 0, 7, 0) then return true end + elseif branddef.ascii.shift then + x = x + (branddef.ascii.shift.x or 0) + y = y + (branddef.ascii.shift.y or 0) end draw(x, y, graphic) end @@ -359,8 +362,8 @@ local function drawlogo() local logodef = getLogodef(logo) - if logodef == nil or logodef.graphic == nil or - (not colored and logodef.requires_color) then + if logodef == nil or logodef.ascii == nil or + (not colored and logodef.ascii.requires_color) then -- Choose a sensible default if colored then logodef = getLogodef(drawer.default_color_logodef) @@ -374,7 +377,8 @@ local function drawlogo() end end - if logodef ~= nil and logodef.graphic == none then + -- XXX What the hell is going on here? + if logodef and logodef.ascii.image == none then shift = logodef.shift else shift = default_shift @@ -383,20 +387,23 @@ local function drawlogo() x = x + shift.x y = y + shift.y - if logodef ~= nil and logodef.shift ~= nil then - x = x + logodef.shift.x - y = y + logodef.shift.y - end - - local gfx_requested = logodef.image and gfxenabled() + local gfx_requested = logodef.fb and gfxenabled() if gfx_requested and gfxcapable() then - local y1 = logodef.image_rl or 15 + local y1 = logodef.fb.width or 15 - if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then + if logodef.fb.shift then + x = x + (logodef.fb.shift.x or 0) + y = y + (logodef.fb.shift.y or 0) + end + if gfx.term_putimage(logodef.fb.image, x, y, 0, y + y1, 0) then return true end + elseif logodef.ascii.shift then + x = x + (logodef.ascii.shift.x or 0) + y = y + (logodef.ascii.shift.y or 0) end - draw(x, y, logodef.graphic) + + draw(x, y, logodef.ascii.image) end local function drawitem(func) @@ -453,11 +460,15 @@ branddefs = { -- Indexed by valid values for loader_brand in loader.conf(5). Valid -- keys are: graphic (table depicting graphic) ["fbsd"] = { - graphic = fbsd_brand, - image = "/boot/images/freebsd-brand-rev.png", + ascii = { + image = fbsd_brand, + }, + fb = { + image = "/boot/images/freebsd-brand-rev.png", + }, }, ["none"] = { - graphic = none, + fb = { image = none }, }, } @@ -466,13 +477,19 @@ logodefs = { -- are: requires_color (boolean), graphic (table depicting graphic), and -- shift (table containing x and y). ["tribute"] = { - graphic = fbsd_brand, + ascii = { + image = fbsd_brand, + }, }, ["tributebw"] = { - graphic = fbsd_brand, + ascii = { + image = fbsd_brand, + }, }, ["none"] = { - graphic = none, + ascii = { + image = none, + }, shift = {x = 17, y = 0}, }, } @@ -492,14 +509,43 @@ drawer.default_bw_logodef = 'orbbw' -- drawer module in case it's a filesystem issue. drawer.default_fallback_logodef = 'none' --- These should go away after FreeBSD 13; only available for backwards --- compatibility with old logo- files. +-- Backwards compatibility shims for previous FreeBSD versions, please document +-- new additions +local function adapt_fb_shim(def) + -- In FreeBSD 14.x+, we have improved framebuffer support in the loader + -- and some graphics may have images that we can actually draw on the + -- screen. Those graphics may come with shifts that are distinct from + -- the ASCII version, so we move both ascii and image versions into + -- their own tables. + if not def.ascii then + def.ascii = { + image = def.graphic, + requires_color = def.requires_color, + shift = def.shift, + } + end + if def.image then + assert(not def.fb, + "Unrecognized graphic definition format") + + -- Legacy images may have adapted a shift from the ASCII + -- version, or perhaps we just didn't care enough to adjust it. + -- Steal the shift. + def.fb = { + image = def.image, + width = def.image_rl, + shift = def.shift, + } + end + return def +end + function drawer.addBrand(name, def) - branddefs[name] = def + branddefs[name] = adapt_fb_shim(def) end function drawer.addLogo(name, def) - logodefs[name] = def + logodefs[name] = adapt_fb_shim(def) end drawer.frame_styles = { diff --git a/stand/lua/gfx-orb.lua b/stand/lua/gfx-orb.lua index cd834a2d6b8e..6845d6fa07bb 100644 --- a/stand/lua/gfx-orb.lua +++ b/stand/lua/gfx-orb.lua @@ -27,7 +27,8 @@ return { logo = { - graphic = { + ascii = { + image = { " \027[31m``` \027[31;1m`\027[31m", " s` `.....---...\027[31;1m....--.``` -/\027[31m", " +o .--` \027[31;1m/y:` +.\027[31m", @@ -43,10 +44,14 @@ return { " `:` \027[31;1m`:`", " \027[31;1m.-- `--.", " .---.....----.\027[m", + }, + requires_color = true, + shift = {x = 5, y = -1}, + }, + fb = { + image = "/boot/images/freebsd-logo-rev.png", + width = 15, + shift = {x = 2, y = -2}, }, - requires_color = true, - shift = {x = 2, y = -1}, - image = "/boot/images/freebsd-logo-rev.png", - image_rl = 15 } } diff --git a/stand/lua/gfx-orbbw.lua b/stand/lua/gfx-orbbw.lua index a97174a6a5a4..135ff806b67c 100644 --- a/stand/lua/gfx-orbbw.lua +++ b/stand/lua/gfx-orbbw.lua @@ -27,23 +27,25 @@ return { logo = { - graphic = { - " ``` `", - " s` `.....---.......--.``` -/", - " +o .--` /y:` +.", - " yo`:. :o `+-", - " y/ -/` -o/", - " .- ::/sy+:.", - " / `-- /", - " `: :`", - " `: :`", - " / /", - " .- -.", - " -- -.", - " `:` `:`", - " .-- `--.", - " .---.....----.", + ascii = { + image = { + " ``` `", + " s` `.....---.......--.``` -/", + " +o .--` /y:` +.", + " yo`:. :o `+-", + " y/ -/` -o/", + " .- ::/sy+:.", + " / `-- /", + " `: :`", + " `: :`", + " / /", + " .- -.", + " -- -.", + " `:` `:`", + " .-- `--.", + " .---.....----.", + }, + shift = {x = 2, y = -1}, }, - shift = {x = 2, y = -1}, } }