From nobody Tue Apr 16 20:12:51 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 4VJwFb3xL0z5H0Vm; Tue, 16 Apr 2024 20:12:51 +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 4VJwFb22rMz4swB; Tue, 16 Apr 2024 20:12:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298371; 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=GXr3dEicL9EZ4NQ1Cq6FyS5C9A2ItQbFnarhWcrfKr4=; b=DPB/lpz6IsKcZcsab4+AujjWHcze8kmvmuztaLxGwH5z7dRwDEi2gLBuqF6UMAJ3GgZLuT nSCtIVzGXluT/mQb9BS8sVf//eOhPm8WeYyOxK4LdP8kmU0RaG5i6kzSK626H3xcIaZCrm pdWNospYa8iDd6TvHwf8zscH0bBrgpqJtfmt6ozTWgTRTFX9bFMPhLu0/rnotQdHy1tTrn lqVzWWyucnFfPLVUH0zHGsFzqQEfUa2c/o7on50DOaA3fR5Cgqure6UPEP9Q7Vc9wNdFz0 GHOM5IjfRPWAF4He7+zAvQUtbJAdnUU8OR4gCEnQVsgsGbbUisGLqvPIejrerg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713298371; a=rsa-sha256; cv=none; b=Y5knfE4eYIY17gxuAWuWr8lFdCJg3rjSiREw9uUji7RKIvjM92PXi5x8ipoSWKquG0qL4k 9tgbBRJSJWQJt9Dop12OdRgYqp8h+I+0NrW0D2CoawwsLwcTXXVq+2zRnaXXEsu22TPIps U9yXUzZ1+nBsgTDv2JrLiHNCxKCqb0KgiKXo7zagVUiERlr+XzObAPAzTzisXdWvecxy/a sFTX/mu6VhMPeb9anb3Y9muN/ITin0BrGAVmym4uqe1jm8at8pmeVW9+RueXefUyI2n+ri oCoTeE0riVHheEfLXa/5YRNCErlHLHXCdF1c/Z7Pz36Rp8ASrYpESwFjyyq3OQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298371; 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=GXr3dEicL9EZ4NQ1Cq6FyS5C9A2ItQbFnarhWcrfKr4=; b=DuznT3c17yDTYjP8nVT3g4cxn523GlADfowJE1s4+iFEYoelxBJ4ry1hzyvR1gR72B288e N7o6tkCpOJOME9wFGZmmyiJCLS5KSOHvwnvCEXmQTEK/HRnjAkDK10dU2Qvp/+WZ4LE4mC MzQbctLbu5WQN0w4/B0CMM/jFOL/O9qMfTXA/HNYIDTEJmD/NF7VeQStbPowzi2k7YLMrl U9ECx0szXMbC7CMcD/Xe/yLwM42RcWaVt+NrWid1DjbfPczbu4otlyMyg63Q7g/Mp1EwRZ zS+SWELGU+cH6N8VivCR/YC6PVcX9CD1SL1JyPcZTHhWd+MJvQA2LIKSM4rP9w== 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 4VJwFb1TKvzxPN; Tue, 16 Apr 2024 20:12:51 +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 43GKCpQe038061; Tue, 16 Apr 2024 20:12:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GKCptI038058; Tue, 16 Apr 2024 20:12:51 GMT (envelope-from git) Date: Tue, 16 Apr 2024 20:12:51 GMT Message-Id: <202404162012.43GKCptI038058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 32c08f492557 - stable/14 - loader: Move gfx functions to gfx.lua.8 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/stable/14 X-Git-Reftype: branch X-Git-Commit: 32c08f492557b8159f0017412eb8b3b7183d5754 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=32c08f492557b8159f0017412eb8b3b7183d5754 commit 32c08f492557b8159f0017412eb8b3b7183d5754 Author: Warner Losh AuthorDate: 2024-02-16 03:53:55 +0000 Commit: Warner Losh CommitDate: 2024-04-16 19:54:24 +0000 loader: Move gfx functions to gfx.lua.8 Now that the fb_* and term_* functions are available in the gfx table, move the documentation to gfx.lua.8. Add information about backwards compatibility. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43907 (cherry picked from commit a8f8c53761c4b0436c9d546ebe046003f1b3d88f) --- stand/lua/Makefile | 1 + stand/lua/gfx.lua.8 | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ stand/lua/loader.lua.8 | 89 ++++++++--------------------------------- 3 files changed, 124 insertions(+), 72 deletions(-) diff --git a/stand/lua/Makefile b/stand/lua/Makefile index e8fa16e6b589..4462a803beef 100644 --- a/stand/lua/Makefile +++ b/stand/lua/Makefile @@ -7,6 +7,7 @@ MAN= loader.conf.lua.5 \ config.lua.8 \ core.lua.8 \ drawer.lua.8 \ + gfx.lua.8 \ hook.lua.8 \ loader.lua.8 \ menu.lua.8 \ diff --git a/stand/lua/gfx.lua.8 b/stand/lua/gfx.lua.8 new file mode 100644 index 000000000000..82d3f90f4af7 --- /dev/null +++ b/stand/lua/gfx.lua.8 @@ -0,0 +1,106 @@ +.\" +.\" Copyright (c) 2024 Netflix, Inc. +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd February 6, 2024 +.Dt GFX.LUA 8 +.Os +.Sh NAME +.Nm gfx.lua +.Nd Fx Lua gfx module +.Sh DESCRIPTION +The built-in graphics related Lua bindings for the +.Fx +boot loaders using the Lua interpreter are available via the +.Ic gfx +table. +.Ss Exported Functions +The following functions are exported in the +.Nm loader +table. +.Bl -tag -width term_putimage +.It Fn fb_bezier x0 y0 x1 y1 x2 y2 width +Draw a bezier curve through the points +.Pq Va x0 , Va y0 , +.Pq Va x1 , Va y1 , +and +.Pq Va x2 , Va y2 +of width +.Va width . +The units are in pixels and have an origin of +.Pq 0 , 0 . +.It Fn fb_drawrect x0 y0 x1 y1 fill +Fill in a rectangle with the pixel +.Va fill +with the corners +.Pq Va x0 , Va y0 +and +.Pq Va x1 , Va y1 . +The units are in pixels and have an origin of +.Pq 0 , 0 . +.It Fn fb_line x0 y0 x1 y1 width +Draw a line from +.Pq Va x0 , Va y0 +to +.Pq Va x1 , Va y1 +with a width of +.Va width . +The units are in pixels and have an origin of +.Pq 0 , 0 . +.It Fn fb_putimage name x0 y0 x1 y1 f +Load the PNG file +.Va name +and place it in the rectangle +with the corners +.Pq Va x0 , Va y0 +and +.Pq Va x1 , Va y1 +and fill with pixel +.Va f . +The units are in pixels and have an origin of +.Pq 0 , 0 . +.It Fn fb_set_pixel x y +Sets the pixel at +.Pq Va x , Va y . +The units are in pixels and have an origin of +.Pq 0 , 0 . +.It Fn term_drawrect x0 y0 x1 y1 +Draw the outline of a rectangle with the text coordinate corners of +.Pq Va x0 , Va y0 +and +.Pq Va x1 , Va y1 . +The units are in character cells and have an origin of +.Pq 1 , 1 . +.It Fn term_putimage name x0 y0 x1 y1 f +Load the PNG file +.Va name +and place it in the rectangle +with the text coordinate corners +.Pq Va x0 , Va y0 +and +.Pq Va x1 , Va y1 +and fill with pixel +.Va f . +The units are in character cells and have an origin of +.Pq 1 , 1 . +.El +.Pp +This table is optional and should only be used if it is non-nil and if +.Fn core.isFramebufferConsole +is true. +.Ss Compatibility +All the interfaces described above are also available via the +.Ic loader +table through at last FreeBSD 15.0. +.Sh SEE ALSO +.Xr loader.conf 5 , +.Xr core.lua 8 , +.Xr loader 8 , +.Xr loader.lua 8 +.Sh AUTHORS +The +.Nm +man page was written by +.An Warner Losh Aq Mt imp@FreeBSD.org . + diff --git a/stand/lua/loader.lua.8 b/stand/lua/loader.lua.8 index cd436255d4a5..ff3b91ddfb09 100644 --- a/stand/lua/loader.lua.8 +++ b/stand/lua/loader.lua.8 @@ -147,80 +147,24 @@ environments. Removes the environment variable .Va name from the loader's environment list. -.It Fn fb_bezier x0 y0 x1 y1 x2 y2 width -Draw a bezier curve through the points -.Pq Va x0 , Va y0 , -.Pq Va x1 , Va y1 , -and -.Pq Va x2 , Va y2 -of width -.Va width . -The units are in pixels and have an origin of -.Pq 0 , 0 . -.It Fn fb_drawrect x0 y0 x1 y1 fill -Fill in a rectangle with the pixel -.Va fill -with the corners -.Pq Va x0 , Va y0 -and -.Pq Va x1 , Va y1 . -The units are in pixels and have an origin of -.Pq 0 , 0 . -.It Fn fb_line x0 y0 x1 y1 width -Draw a line from -.Pq Va x0 , Va y0 -to -.Pq Va x1 , Va y1 -with a width of -.Va width . -The units are in pixels and have an origin of -.Pq 0 , 0 . -.It Fn fb_putimage name x0 y0 x1 y1 f -Load the PNG file -.Va name -and place it in the rectangle -with the corners -.Pq Va x0 , Va y0 -and -.Pq Va x1 , Va y1 -and fill with pixel -.Va f . -The units are in pixels and have an origin of -.Pq 0 , 0 . -.It Fn fb_set_pixel x y -Sets the pixel at -.Pq Va x , Va y . -The units are in pixels and have an origin of -.Pq 0 , 0 . -.It Fn term_drawrect x0 y0 x1 y1 -Draw the outline of a rectangle with the text coordinate corners of -.Pq Va x0 , Va y0 -and -.Pq Va x1 , Va y1 . -The units are in character cells and have an origin of -.Pq 1 , 1 . -.It Fn term_putimage name x0 y0 x1 y1 f -Load the PNG file -.Va name -and place it in the rectangle -with the text coordinate corners -.Pq Va x0 , Va y0 -and -.Pq Va x1 , Va y1 -and fill with pixel -.Va f . -The units are in character cells and have an origin of -.Pq 1 , 1 . .El -.Pp -The functions starting with -.Fn fb_ +.Ss Compatibility +The functions +.Fn fb_bezier , +.Fn fb_drawrect , +.Fn fb_line , +.Fn fb_putimage , +.Fn fb_set_pixel , +.Fn term_drawrect , and -.Fn term_ -are optional. -They should only be used if they are non-nil and if -.Fn core.isFramebufferConsole -is true. +.Fn term_putimage +have moved to the +.Ic gfx +table. +They remain in the +.Ic loader +table for a transition period and are documented in +.Xr gfx.lua 8 . .Ss Default File In addition, the Lua interpreters start with the file .Pa /boot/lua/loader.lua @@ -231,6 +175,7 @@ If autoboot is enabled, the loaded files will boot. .Sh SEE ALSO .Xr loader.conf 5 , .Xr core.lua 8 , +.Xr gfx.lua 8 , .Xr loader 8 , .Xr sysctl 8 .Sh AUTHORS