From nobody Fri Nov 24 17:32:00 2023 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 4ScMVS2Z6nz51Npw; Fri, 24 Nov 2023 17:32:00 +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 4ScMVS1yBRz4LQG; Fri, 24 Nov 2023 17:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700847120; 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=KIqIrAAZIJoGddyo7ZQ2ADs0onw/G29dYNmELKW9iXo=; b=v8Z0IDrl5KAbPMHpN7fiut9AcmDalBtnm7pLKlgbM3RtGC3IvDZMbTHtv8g/UK1l5PtZha /Jj0DffbzrjMhSIVIT4uf5qezSXb/iejaOOyuNtGLTmF+rf/Zl//gzR8YWjrKon7dmZY5z s65l1ik4cpIYlcu7NYdb2c1l+FUOI3UIczgYgHrTJ7tuQK/FRmzmNsOAx/lNEDtKcp8qbw 1PoC8wcxzlkUhaitP3zVd+mgyyNsRJ49PtPdr1LCKPZKXHCewSUQIDbX+3onV/zrbR5MvY AYPUkuqh5SgCEWmXjGROycOI6yy+eXXZPIjH9yJLahmu5I8ykeBRoucwQisB5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700847120; 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=KIqIrAAZIJoGddyo7ZQ2ADs0onw/G29dYNmELKW9iXo=; b=lSKOaOoIxkths5Gkv+rFaDksZ6HJ/5g8tufxw9CR9/1YKEPofV/d89TkXNgwKB7OHqk/ha zxEzUjsfkvdAYQS/tsSPNqSuMrhMlcqyuJslcybY3lyEHfUZFAcdjVTpSoS/B+r5NqTc/l aL+yrq52RJ3UTsavqkv9acbxPGLmkALq+HgrtoYqM6euOeWe+7+Y8b40S37TgwrVw7R3Lx UBF9Zae96MQDaXHXo4QBQrprZH+tFBIHoIxAM+H/4CXs3XPrLhboPfz704P7rgHAGbz0fT 4IaYoUI/U+aI/qhPOYnLPK8GiPclX5CHDxEu5/bJagED3D5U0zzTgyU7jUonuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700847120; a=rsa-sha256; cv=none; b=I4rDHu8QCw+KhcrY8jYyMRl55JZplgAJ/WBcBD7JvvmuMU5iJ2Qw5Mzrd+6/dSUTPP3ivT byV1LFWJ8hcFkU+SBBO9nFywiqn61OoxFu8XmkgEq7tEVhU//Sn+zC6KZWbYXhTYYSkdF8 5p6cBwx11vza6gbJSYfhmED692x3TKS5vU6d2zFTooWg5wU2xikllj097q8PDhivVB0F8s 3G/T/l1LjQWrFMuBb8DAXOSIPR25g48lEzd2YEn2EH2IHuHkPZhCDcHqA9JXQd3LdblnS4 RkpN42uSzUg2mLMROBVHCGDUPFYN3p6tsxLv4vk/x9va7E3+v3v8x/21IbVwNA== 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 4ScMVS10zTztx6; Fri, 24 Nov 2023 17:32:00 +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 3AOHW0pq062922; Fri, 24 Nov 2023 17:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AOHW0B9062919; Fri, 24 Nov 2023 17:32:00 GMT (envelope-from git) Date: Fri, 24 Nov 2023 17:32:00 GMT Message-Id: <202311241732.3AOHW0B9062919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= Subject: git: f18b3ce0b7be - main - vt(4): Always call vt_window_switch() in vtterm_cnungrab() 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f18b3ce0b7be0b24a743ec59077ca8e7929a353c Auto-Submitted: auto-generated The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=f18b3ce0b7be0b24a743ec59077ca8e7929a353c commit f18b3ce0b7be0b24a743ec59077ca8e7929a353c Author: Jean-Sébastien Pédron AuthorDate: 2023-11-24 17:30:35 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-11-24 17:31:33 +0000 vt(4): Always call vt_window_switch() in vtterm_cnungrab() [Why] This ensures that vtterm_cnungrab() is the mirror of vtterm_cngrab(). And the latter always call vt_window_switch() and thus the backend's vd_postswitch(). This makes sure that whatever the backend did during vtterm_cngrab(), it can undo it during vtterm_cnungrab(). Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D42752 --- sys/dev/vt/vt_core.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index bfd99665be4a..4a1031f1aa69 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -2046,7 +2046,7 @@ static void vtterm_cnungrab(struct terminal *tm) { struct vt_device *vd; - struct vt_window *vw; + struct vt_window *vw, *grabwindow; vw = tm->tm_softc; vd = vw->vw_device; @@ -2055,10 +2055,19 @@ vtterm_cnungrab(struct terminal *tm) if (vtterm_cnungrab_noswitch(vd, vw) != 0) return; - if (!cold && vd->vd_grabwindow != vw) - vt_window_switch(vd->vd_grabwindow); - + /* + * We set `vd_grabwindow` to NULL before calling vt_window_switch() + * because it allows the underlying vt(4) backend to distinguish a + * "grab" from an "ungrab" of the console. + * + * This is used by `vt_drmfb` in drm-kmod to call either + * fb_debug_enter() or fb_debug_leave() appropriately. + */ + grabwindow = vd->vd_grabwindow; vd->vd_grabwindow = NULL; + + if (!cold) + vt_window_switch(grabwindow); } static void