From patchwork Mon Jan 21 04:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 156145 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp5942425jaa; Sun, 20 Jan 2019 20:22:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN5EjVp4HyWdlrGxkhQuk53CXeoj5oQuAZbFiO5C3eFIPurDqurPi8EKpQiPNWpmAzNpXX4f X-Received: by 2002:a63:554b:: with SMTP id f11mr10326047pgm.37.1548044544961; Sun, 20 Jan 2019 20:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548044544; cv=none; d=google.com; s=arc-20160816; b=ESEOopkKUiGBikpNmTi2c+145lrogDlcFb1wIUlj3s3/zo9QcyIvxV6/nMlMAAdadW fzt2rOqdWi43LrfQ3hMezMHiWq41tuDLG4pGXwBDKI761WRjNhutjU/yn7maNYHHtUKE ntXQkxqWnAMni1/WAsrdBTxjQrBijUJL355KbweFgzr5Yt5dFI+L5x+y5YQ3hRMUfNAR 8s8u2UJdUjCYRHgjE4/yv+qLyKpTbjpXsJb4Udpoj1GFhAwHaZdvdjjWIqfqvtTWwOix rirdJKLMjgqMTTM2MAZmwc8dSx5VzWo5QUaviLPjjSajx9gUrbHg3qXkOqP81Tgcg/Ri TY7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:user-agent:message-id:subject:to:from:date :delivered-to; bh=AxdNxeQTrKVjdHKVTstNUU0aPHoW3FdDfNRemUkjrjQ=; b=crjhODM2DDMFFnbBPloZlUBig944JFzAhlujA2z/6qsIhFRETRxOIb59Oys1noYpyp TthQfTFKXqAx/yN5WQ6X4MoG0ecJ4dZgZmbEwWhzJW/ygMxYuyxYHV1Nyw+ehoBVXeTO z5lrB0BM1MkHUlckAtQpPu5DgkewqfT9FPdE+7Whtd6ZKbG67A95z0uy11IPqgsZAblj 4kQuNXBN8olmOKzZh3yuLScoTlCFxHPsCfwpjb7Ozc4zkU7bOgiMqgBY00uLXN6TWDLt oOAnU2+FfLHFC5IB8hXrgHr52AuFuLSmnQm/0wKQhmWVokII1Pr+WXZycn7wcvHewivm R8UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o12si11804897pgn.145.2019.01.20.20.22.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Jan 2019 20:22:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 245A06E0E3; Mon, 21 Jan 2019 04:22:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by gabe.freedesktop.org (Postfix) with ESMTPS id E6B9B6E0E3 for ; Mon, 21 Jan 2019 04:22:18 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id c21so11551935qkl.6 for ; Sun, 20 Jan 2019 20:22:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version; bh=CpPMpjhb3lB7s2KZRGykFLTqswu/y32QmJo5HrnL5As=; b=aDtYyh6YQLGXr0vP0g1JS2P1999nhdbur5dQfq30OWZuR9cMSCnKvG6NyCUqx7Ok1a JIKDG6oOOb70zoldzW/N+KaP2XKXfFYl3I3S/Y79Wk0XUwjb/5XuTndReVE1iDGSj8Zi 2DfvHLm3fANR9R3la92PQUavYFf5YUU3wLi4QMTDznSZupxwi4yp3NfPeC3P9Xzi09w5 jpe9WRXoiP/V2W0rEo3YVnpbRXCVOpYoBMDZLyse8TasZwqhaEW+shlme7mfbw5rg5RE T7XSlv5+MDwasCgrSWxsRa/jGRsp8yFzBun7VK2NTugOnMJPuXIUyqk+CBR1PHgJ8eFo az0A== X-Gm-Message-State: AJcUukdw4XZWLuqEUGhrNDbM2DTTu8TjybPzwqbO9Wcq0cfj+kS2jfMN dRpwdAvK9X2Hg/OBZOtUmGo6kO+OKTU= X-Received: by 2002:a37:4b44:: with SMTP id y65mr22477595qka.316.1548044538138; Sun, 20 Jan 2019 20:22:18 -0800 (PST) Received: from xanadu.home (modemcable228.104-82-70.mc.videotron.ca. [70.82.104.228]) by smtp.gmail.com with ESMTPSA id c48sm67891799qtd.9.2019.01.20.20.22.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Jan 2019 20:22:17 -0800 (PST) Date: Sun, 20 Jan 2019 23:22:11 -0500 (EST) From: Nicolas Pitre To: Bartlomiej Zolnierkiewicz Subject: [PATCH] vgacon: unconfuse vc_origin when using soft scrollback Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When CONFIG_VGACON_SOFT_SCROLLBACK is selected, the VGA display memory index and vc_visible_origin don't change when scrollback is activated. The actual screen content is saved away and the scrollbackdata is copied over it. However the vt code, and /dev/vcs devices in particular, still expect vc_origin to always point at the actual screen content not the displayed scrollback content. So adjust vc_origin to point at the saved screen content when scrollback is active and set it back to vc_visible_origin when restoring the screen. This fixes /dev/vcsa that return scrollback content when they shouldn't (onli /dev/vcsa without a number should), and also fixes /dev/vcsu that should return scrollback content when scrollback is active but currently doesn't. An unnecessary call to vga_set_mem_top() is also removed. Signed-off-by: Nicolas Pitre Cc: stable@vger.kernel.org # v4.19+ --- I tagged it for stable starting with v4.19 as this is the kernel that introduced /dev/vcsu* which is directly affected. Users of earlier kernels most likely won't care. diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 09731b2f68..c6b3bdbbdb 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -271,6 +271,7 @@ static void vgacon_scrollback_update(struct vc_data *c, int t, int count) static void vgacon_restore_screen(struct vc_data *c) { + c->vc_origin = c->vc_visible_origin; vgacon_scrollback_cur->save = 0; if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { @@ -287,8 +288,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) int start, end, count, soff; if (!lines) { - c->vc_visible_origin = c->vc_origin; - vga_set_mem_top(c); + vgacon_restore_screen(c); return; } @@ -298,6 +298,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) if (!vgacon_scrollback_cur->save) { vgacon_cursor(c, CM_ERASE); vgacon_save_screen(c); + c->vc_origin = (unsigned long)c->vc_screenbuf; vgacon_scrollback_cur->save = 1; } @@ -335,7 +336,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) int copysize; int diff = c->vc_rows - count; - void *d = (void *) c->vc_origin; + void *d = (void *) c->vc_visible_origin; void *s = (void *) c->vc_screenbuf; count *= c->vc_size_row;