From nobody Tue Jun 30 19:53:06 2026 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 4gqYjH1LY2z6jp18 for ; Tue, 30 Jun 2026 19:53:07 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gqYjH02xhz4104 for ; Tue, 30 Jun 2026 19:53:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782849187; 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=spVunqLngtZdS74eRmIMnSgym1jhFJ7Jn30VvQvmQFc=; b=P/iE8YOYcgbFL7ulldxPr3GiLqbZ6OKd7yTl5TcrBemw0q13mD5H7EI7bjlgT2oDiJN5Q5 wzoujyv8wgRaOk49/JnIfg1CER27WAMbSY0qVgRuN25l8xOmmpH5WiaKlcKc0mgaG4K9or Mqbs8iVHLHL3LGSOcks9puEe3JMSnj/fHgKntMCh/Bvnj/5cVZ3Pzg1uejZjE2KHGlJ1c2 vlTtQMeTNOX++w0ymKW72JyDUXjGhnOpiTk4casmBlbPIOc14PwmI0CFn2DyIWcPIY9wtE gprSTkXaibhCsxO6BN9O+Yqx3nNsygJZrcahc0w4mDl6MxgX5I9NTagzbJPC9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782849187; a=rsa-sha256; cv=none; b=gHO7nFd7aPNTj/Cw7stF0lmI0WRLfoTqYuDL4W7rXEHMCaTw+UbdnKot079IGkvA2QPhB4 xgsvmBBGFb4EhhrOwmrjALXqZc84ZksvLK20WwLkAyS4IaBRekjQrqnkcls2P7puSN9dTf waqiT5cQM9Pfo9ZCdGToKr/mx2NMDnq2THDtezu+ouKsEzeOHQ/WdLhPbEOnptFNdcBkIk boiUNE6f0O2cdSM2yndeyMmrHAkBz3++/i36NAW4OkBbe6avSKyx27SS1Zj35ZJB0Z9x/E 7mV2RHWK66xE43bnzH1aKHwatMNRy3cilz09S6Tbkv5UN8mQTXpbXzhIc37qow== 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=1782849187; 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=spVunqLngtZdS74eRmIMnSgym1jhFJ7Jn30VvQvmQFc=; b=DUZ7kZ5sYA3mhrU8EdCfK2OMjxMRRhs+TGPFY471djF8IgXy4GkiOQHD6haGniLAEP+uzl eJnN4TxaqUqkTjfA6OJxmEDxQsfopuYnMdGWNkPpdcgXLsZe6SWZ210r0c75hL1vHS6hiV MMISlN5ABbDNjAiOykJBeBUHpuNsipI2G6nHggPrpzA4H/EGGnPK29slVWLLCzirSCTlhY jW09gKPJLaaHPib7GmvXg434ktTV9e5r1f2JAMCmsS3+PiJi1JaxQLxYAD7X1BVpyaQDqh da3k9V5VZ9KpJKobqGY1emVnZ6aOk+/QpIjS4y1rXIvQp+wIjgJ3dcFp8/0N6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gqYjG5mr3zyD1 for ; Tue, 30 Jun 2026 19:53:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26392 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 30 Jun 2026 19:53:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: 76aa776b5f47 - main - stand: Fix shadow buffer offset handling 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76aa776b5f47ecd0d45336e22795fef98af57d2f Auto-Submitted: auto-generated Date: Tue, 30 Jun 2026 19:53:06 +0000 Message-Id: <6a441ea2.26392.488d52a6@gitrepo.freebsd.org> The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=76aa776b5f47ecd0d45336e22795fef98af57d2f commit 76aa776b5f47ecd0d45336e22795fef98af57d2f Author: ShengYi Hung AuthorDate: 2026-06-24 14:31:03 +0000 Commit: ShengYi Hung CommitDate: 2026-06-30 19:52:55 +0000 stand: Fix shadow buffer offset handling The shadow buffer is addressed relative to `tg_origin`, which includes the padding offset, whereas `gfxfb_blt` operates on coordinates without that offset. To make `gfx_fb_copy_area` emulate the behavior of `gfxfb_blt`, the source coordinates must include the padding offset, while the destination coordinates must not. The original implementation omitted the offset from the source coordinates; this change corrects that. Additionally, `gfx_fb_cons_display` already applies the padding offset, so the redundant adjustment is removed. PR: 296246 Reported by: 2khramtsov@gmail.com Reviewed by: imp Tested by: 2khramtsov@gmail.com, junchoon@dec.sakura.ne.jp, naito.yuichiro_@gmail.com Fixes: 32da2f23ae4d MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57821 --- stand/common/gfx_fb.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 7ed0cf6bdb39..8185afccf944 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -1400,26 +1400,32 @@ gfx_fb_copy_area(teken_gfx_t *state, const teken_rect_t *s, pitch = state->tg_fb.fb_width; bytes = width * sizeof (*state->tg_shadow_fb); - uint32_t dst_x = dx + state->tg_origin.tp_col; - uint32_t dst_y = dy + state->tg_origin.tp_row; + uint32_t ssx = sx + state->tg_origin.tp_col; + uint32_t ssy = sy + state->tg_origin.tp_row; + uint32_t dsx = dx + state->tg_origin.tp_col; + uint32_t dsy = dy + state->tg_origin.tp_row; + uint32_t dst_x = dsx; + uint32_t dst_y = dsy; uint32_t dst_h = height; /* * To handle overlapping areas, set up reverse copy here. + * The origin offset cancels out in the comparison so the + * terminal-relative form is equivalent. */ if (dy * pitch + dx > sy * pitch + sx) { - sy += height; - dy += height; + ssy += height; + dsy += height; step = -step; } while (height-- > 0) { - uint32_t *source = &state->tg_shadow_fb[sy * pitch + sx]; - uint32_t *destination = &state->tg_shadow_fb[dy * pitch + dx]; + uint32_t *source = &state->tg_shadow_fb[ssy * pitch + ssx]; + uint32_t *destination = &state->tg_shadow_fb[dsy * pitch + dsx]; bcopy(source, destination, bytes); - sy += step; - dy += step; + ssy += step; + dsy += step; } gfx_shadow_mark_dirty(dst_x, dst_y, width, dst_h); @@ -1618,13 +1624,11 @@ gfx_fb_cons_display(uint32_t x, uint32_t y, uint32_t width, uint32_t height, */ if (gfx_state.tg_shadow_fb != NULL) { uint32_t pitch = gfx_state.tg_fb.fb_width; - uint32_t sy = y - gfx_state.tg_origin.tp_row; - uint32_t sx = x - gfx_state.tg_origin.tp_col; p = data; for (uint32_t row = 0; row < height; row++) { buf = (void *)(gfx_state.tg_shadow_fb + - (sy + row) * pitch + sx); + (y + row) * pitch + x); bitmap_cpy(buf, &p[row * width], width); } gfx_shadow_mark_dirty(x, y, width, height);