From nobody Tue Apr 16 20:12:45 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 4VJwFT6m4Mz5H0KK; Tue, 16 Apr 2024 20:12:45 +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 4VJwFT4hHTz4t7s; Tue, 16 Apr 2024 20:12:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298365; 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=pJmVI7U5mD2R2IyYYl+4Tyw2Xyw8VqR7jMgn+OjSFGM=; b=hxf15gR9TZsQXheTyJU3XbqKK/LT74ufYZ0LaYu3Ay+R7A+4qrbjOVblb8/jHUkVlccsFS mXZj8d4YaTjXG7OXdm1F2fJ5/mcehRhUEYUIv0uVifYGSXw0zDy7/suX868hgo/d8kkJDx 1CCcDGCsf5XwMn2hv6L8RZZSpzi+lVJVseitctD4nkj8o+2weqMCtWPLSfTveLJhGyEwgr QYydlkh9sqPNOI/7V2UBizYAZxGemjdQCC6+V/0jMG3ziQnV+EJncVEnctMYNpjTy6aYm5 qxWS3ZIzZ4+c0OO3F8nQymPQqE2CoKChex4bkNHEeevMV8HoqPA1rJrUT2O02g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713298365; a=rsa-sha256; cv=none; b=tEzhQN5iuI5AQ52f8zB4GyOy1SKj3NfYnO8aKKIr4W6mSYSIjg95Fi2I1McalYP9w53sO+ l1jDmAftbHjM8e4Tz983b7PALJn0h4He3aSyWoreefsgiEHCSHyg6E4ueCZeSmvZ0F8TRV KlnVikntuhBlHTf3ueqOWcwG8BjiV0Sequ8100NwSqDM2Z2gt1PwUpNoTaHud2Hcg6lqkU cbyodYcwBBPN6nFKBpdyDd45RuxKCpnyQ2QMFfQrjn7bHbxnEpg9zbhmxgLspLT/n1R69o UxxXdP7XmndJmtwWeEezWz/YHaNeReWohEdfqh9uKYfBobOgIN7fvMiLNDJasw== 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=1713298365; 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=pJmVI7U5mD2R2IyYYl+4Tyw2Xyw8VqR7jMgn+OjSFGM=; b=Mb9471mygCKK5vfFozedtpI+SH2q7JTcD7DlSsU54VkPvhNi92XJexExUfk4Wta4/uNHaB gy7wi2+MAYMIzm+B1hClo0n9Ng9r+MTfrS9/CNfceEs63OBY0NPaJj3han5l9CfEeJXLqD ENK/yNYqRAvyG9eRwmGG5bGWeYbQYiq6iFrE8d5KZz9yb7SLKb/sIOCrwNkFSXz1P46TU8 qJv4Lgv3/kzYjttwCht5KfWxLL2KzYzk5kR5LZxqwlWKZAPwKzpEGl21z2DndoILP3D3TP cWEibdyuZ2XhdiYpIePneKqsh0pPcB7i4roE9+dQSYfKK+4psUmJ3m5ZRcWdCQ== 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 4VJwFT4GbDzxY0; Tue, 16 Apr 2024 20:12:45 +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 43GKCjfH037792; Tue, 16 Apr 2024 20:12:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GKCjb3037789; Tue, 16 Apr 2024 20:12:45 GMT (envelope-from git) Date: Tue, 16 Apr 2024 20:12:45 GMT Message-Id: <202404162012.43GKCjb3037789@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: 73fac51c5726 - stable/14 - loader: Create new 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: 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: 73fac51c572655a3d0e55af410f42dc15713ef31 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=73fac51c572655a3d0e55af410f42dc15713ef31 commit 73fac51c572655a3d0e55af410f42dc15713ef31 Author: Warner Losh AuthorDate: 2024-02-16 03:53:07 +0000 Commit: Warner Losh CommitDate: 2024-04-16 19:54:23 +0000 loader: Create new gfx table Create a new gfx global table. Put into it all the graphics bindings that we have in loader today. For now, have compatability binding for loader. Remove them from loader. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43902 (cherry picked from commit 9b16231032ddb40be282d76ec0d82b3a0ec96d60) --- stand/common/interp_lua.c | 27 +++++++++++++++++++++++++++ stand/liblua/lutils.c | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/stand/common/interp_lua.c b/stand/common/interp_lua.c index 3f758baebc2d..a347526b67c9 100644 --- a/stand/common/interp_lua.c +++ b/stand/common/interp_lua.c @@ -97,6 +97,31 @@ static const luaL_Reg loadedlibs[] = { {NULL, NULL} }; +static void +interp_init_md(lua_State *L) +{ + luaL_requiref(L, "gfx", luaopen_gfx, 1); + lua_pop(L, 1); /* Remove lib */ + + /* + * Add in the comparability references in the loader table. Doing it with + * a pseudo-embedded script is easier than the raw calls. + */ + if (luaL_dostring(L, + "loader.fb_bezier = gfx.fb_bezier\n" + "loader.fb_drawrect = gfx.fb_drawrect\n" + "loader.fb_line = gfx.fb_line\n" + "loader.fb_putimage = gfx.fb_putimage\n" + "loader.fb_setpixel = gfx.fb_setpixel\n" + "loader.term_drawrect = gfx.term_drawrect\n" + "loader.term_putimage = gfx.term_putimage") != 0) { + lua_pop(L, 1); + const char *errstr = lua_tostring(L, -1); + errstr = errstr == NULL ? "unknown" : errstr; + printf("Error adding compat loader bindings: %s.\n", errstr); + } +} + void interp_init(void) { @@ -123,6 +148,8 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } + interp_init_md(luap); + filename = getenv("loader_lua"); if (filename == NULL) filename = LOADER_LUA; diff --git a/stand/liblua/lutils.c b/stand/liblua/lutils.c index 20876f965f0c..0be9f5f28ac3 100644 --- a/stand/liblua/lutils.c +++ b/stand/liblua/lutils.c @@ -439,7 +439,6 @@ int luaopen_loader(lua_State *L) { luaL_newlib(L, loaderlib); - luaopen_gfx(L); /* Add loader.machine and loader.machine_arch properties */ lua_pushstring(L, MACHINE); lua_setfield(L, -2, "machine");