From nobody Fri Feb 16 04:00:31 2024 X-Original-To: dev-commits-src-all@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 4TbdWM6jQVz59ZKH; Fri, 16 Feb 2024 04:00:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TbdWM2tGZz4HTT; Fri, 16 Feb 2024 04:00:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708056031; 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=i6SxmD3taaDQ89aw9rkbd3gdBiYzZjb2upMl0HUnEGE=; b=UpaltDj5D9ddPpSZHtCPAI+DcunC/65VK3Ptv0RUE8eEwI9ayS2k6Nxa7Etvx6JZTesXIe PMTzU+4fcqNmZ4iQl6iueHnTERiEuLuKvkkJvvvAQjxMZS4QjmPX4qsG29Rl5OnmbkS4iV 0SRLZFoEM8eIY1zOLPDCgiEa1J8maNZuGDaWeXRif5gm+4yz+G/KwV4Fy/fXJWxVEStPEk /t+t3qLn5jAJnsGFtUjbToLtSJRNqefM4u1d1Cr/a6Wiv9DJLljaCFjeNWfuUrgWk4AKGv hX7EePFwM+p2lssD2B8JP0fzKJ6PB4DBnZBQkx8kZa+or7iE1v5ZMpFMagL76Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708056031; 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=i6SxmD3taaDQ89aw9rkbd3gdBiYzZjb2upMl0HUnEGE=; b=tH/BX7aqNYCVaAMkD0PE/SEO19kITodvUVKHpBFmvbbGqZ3WL8nGz+vC8G5XVLq2CI0xNc 480tZPX7iPgcucSqGeyW/l4s6tlewxrAeueriHWPobj6XMca8WdA8JlDn2TNtJu88tw61J w3OK8phB8BLxPhAwJSTx1n6WAYSdhZNWtmpZZn72mWHiDRcCZKBILaNAGjSrAyZDUz4jdB jQAh57FPhVuCwFB/aoTGskfwWpS1q/Sl0qpejjMootHLSbUGvMvM656ZusA3qCoeO45G3m tR8Q7RC5/pzPz0luyCUrRjCrroGC4bKoYPTkH74b+k1oT5wvqaQt0arNdO83Vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708056031; a=rsa-sha256; cv=none; b=fTb+kKI9ff7y08tPIre5mTsJx79rz+zRYdWr9vEKJ3GHbf72wVahqaqvMzAd55nOsy6ad7 aLrV2Kxo52tbhx+iwMH1KsrzoIaOpx4/NTwKfimj8wwj85mspLzZ3NcvIPumopi5i0uJEh YwXJJ+/7mRZeo0+3NV/2e4F8AI3fIkvwZ2gVwCYdVx54aPHbKWdgHyYG+M2a+0m89XV4sF yrlUfBIAHwx0BIwHirRrhjU7rZ576gJW2CfrwJu7iWDVIa7lnVt5hjvN/FKFlquOU95R9/ 8Vphjz8BT/J9e3C8TZ8V8SJj7TIMnKi1XWi7V8SLV1CMB2iokMDSd/vcemRXHg== 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 4TbdWM1hpyz18b3; Fri, 16 Feb 2024 04:00:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41G40Vkd019206; Fri, 16 Feb 2024 04:00:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41G40VHa019203; Fri, 16 Feb 2024 04:00:31 GMT (envelope-from git) Date: Fri, 16 Feb 2024 04:00:31 GMT Message-Id: <202402160400.41G40VHa019203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0fd98b8a7691 - main - loader: Move drawer.lua over to gfx table. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0fd98b8a7691b4f11e1bfbcb53a3a7c68d7c1fb7 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0fd98b8a7691b4f11e1bfbcb53a3a7c68d7c1fb7 commit 0fd98b8a7691b4f11e1bfbcb53a3a7c68d7c1fb7 Author: Warner Losh AuthorDate: 2024-02-16 03:54:04 +0000 Commit: Warner Losh CommitDate: 2024-02-16 03:59:23 +0000 loader: Move drawer.lua over to gfx table. Drawer.lua is the only bit of lua code in the base that uses any of the functons moved from the loader table to the gfx table. Move the main code to using the gfx dispatch. Add compat code for running on old loaders that creates the newer-style gfx table with the term_* functions we call in it populated. This will even work on the super old versions of the loader that don't have them (we'll still skip using them). Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43908 --- stand/lua/drawer.lua | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 2dcf7d5de0f8..a009b78164df 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -47,6 +47,19 @@ local frame_size local default_shift local shift +-- Make this code compatible with older loader binaries. We moved the term_* +-- functions from loader to the gfx. if we're running on an older loader that +-- has these functions, create aliases for them in gfx. The loader binary might +-- be so old as to not have them, but in that case, we want to copy the nil +-- values. The new loader will provide loader.* versions of all the gfx.* +-- functions for backwards compatibility, so we only define the functions we use +-- here. +if gfx == nil then + gfx = {} + gfx.term_drawrect = loader.term_drawrect + gfx.term_putimage = loader.term_putimage +end + local function menuEntryName(drawing_menu, entry) local name_handler = menu_name_handlers[entry.entry_type] @@ -225,8 +238,8 @@ local function drawframe() x = x + shift.x y = y + shift.y - if core.isFramebufferConsole() and loader.term_drawrect ~= nil then - loader.term_drawrect(x, y, x + w, y + h) + if core.isFramebufferConsole() and gfx.term_drawrect ~= nil then + gfx.term_drawrect(x, y, x + w, y + h) return true end @@ -312,9 +325,9 @@ local function drawbrand() end if core.isFramebufferConsole() and - loader.term_putimage ~= nil and + gfx.term_putimage ~= nil and branddef.image ~= nil then - if loader.term_putimage(branddef.image, 1, 1, 0, 7, 0) + if gfx.term_putimage(branddef.image, 1, 1, 0, 7, 0) then return true end @@ -363,14 +376,14 @@ local function drawlogo() end if core.isFramebufferConsole() and - loader.term_putimage ~= nil and + gfx.term_putimage ~= nil and logodef.image ~= nil then local y1 = 15 if logodef.image_rl ~= nil then y1 = logodef.image_rl end - if loader.term_putimage(logodef.image, x, y, 0, y + y1, 0) + if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then return true end