Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp257469pxj; Thu, 13 May 2021 04:20:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJo4NfZkpPp3wqukEznAfrR6vflKM+bZHNIr5TvwYMNZucULuwg2gFQpec5RU9b7pEqkT/ X-Received: by 2002:a05:6e02:48b:: with SMTP id b11mr24140787ils.110.1620904855936; Thu, 13 May 2021 04:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620904855; cv=none; d=google.com; s=arc-20160816; b=wdEBkdVkfmH9zmqT+MVsHhc5EYrmTvoDDyGNfiui/F8ayZU1MLU2G0gIb4lJsUogQs ZnKbGQ26SaSbQkkHm0HOLxxp3VpJTPv2UjV+fxpwP8ZMSw+naStiGmG1oD4i30YX82x/ OtPjYDmveevh/z/Bk0W3dYXbQR3f0cfYVoNJiPnlWLRrNewhSejkb+wGqH6fdrDZpRbK VGQ//anQeJcLURXC82wa/h0+C0jqv4iUv9jqKPbNEYI8De+QmChkI4HkICGcgcUhhZud atIFSRMfpkae1UAOjUtkMh6c5M/o98woIpATrZuek1NjnybkgNlpPXJHN2aZkNFTZOXx U6iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=lr4XTjWaBfyIW1uhz8SWwO4mBYzUOUC4cUjhjTypjVI=; b=nkLfvgmOkvFL6PbfZ7lZGV9n3uiK7XKMtVZ8uIBpc/03mmHzvJzBauJcRYy8MASqAl E6jWgOvWmkuA3V01JiQ3tpfu9wM5Q0XPrkAoQtdToficSwJOTqMArZZ4L4o1VcF1A08S 0NZGdxo9mJxyRkg7lnQ81gOtHbJwSGJkSkiD+XRPs/P0PaitOX8nmWs42PS3BC/ZKpAK cNRWScnmegYwkGqIkfRAhRSAznTvt9CqCemssisAyh5ThOE2f58Npoognf8/BpMUtuo3 8tym/3a2wHHsveVLEYq4jPDqjW1s/blTVyjFHN4Ki5q+8ApGkt3USHFlYmTpX2FQFeAg gkfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si3659967jas.117.2021.05.13.04.20.42; Thu, 13 May 2021 04:20:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbhEMJwy (ORCPT + 99 others); Thu, 13 May 2021 05:52:54 -0400 Received: from angie.orcam.me.uk ([78.133.224.34]:33188 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbhEMJww (ORCPT ); Thu, 13 May 2021 05:52:52 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id CF68E92009D; Thu, 13 May 2021 11:51:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id CA8CA92009C; Thu, 13 May 2021 11:51:41 +0200 (CEST) Date: Thu, 13 May 2021 11:51:41 +0200 (CEST) From: "Maciej W. Rozycki" To: Greg Kroah-Hartman , Jiri Slaby cc: Linus Torvalds , Tetsuo Handa , Daniel Vetter , Martin Hostettler , Peilin Ye , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] vgacon: Record video mode changes with VT_RESIZEX In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix an issue with VGA console font size changes made after the initial video text mode has been changed with a user tool like `svgatextmode' calling the VT_RESIZEX ioctl. As it stands in that case the original screen geometry continues being used to validate further VT resizing. Consequently when the video adapter is firstly reprogrammed from the original say 80x25 text mode using a 9x16 character cell (720x400 pixel resolution) to say 80x37 text mode and the same character cell (720x592 pixel resolution), and secondly the CRTC character cell updated to 9x8 (by loading a suitable font with the KD_FONT_OP_SET request of the KDFONTOP ioctl), the VT geometry does not get further updated from 80x37 and only upper half of the screen is used for the VT, with the lower half showing rubbish corresponding to whatever happens to be there in the video memory that maps to that part of the screen. Of course the proportions change according to text mode geometries and font sizes chosen. Address the problem then, by updating the text mode geometry defaults rather than checking against them whenever the VT is resized via a user ioctl. Signed-off-by: Maciej W. Rozycki Fixes: e400b6ec4ede ("vt/vgacon: Check if screen resize request comes from userspace") Cc: stable@vger.kernel.org # v2.6.24+ --- No changes from v1. --- drivers/video/console/vgacon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) Index: linux-macro-ide/drivers/video/console/vgacon.c =================================================================== --- linux-macro-ide.orig/drivers/video/console/vgacon.c +++ linux-macro-ide/drivers/video/console/vgacon.c @@ -1089,12 +1089,20 @@ static int vgacon_resize(struct vc_data if ((width << 1) * height > vga_vram_size) return -EINVAL; + if (user) { + /* + * Ho ho! Someone (svgatextmode, eh?) may have reprogrammed + * the video mode! Set the new defaults then and go away. + */ + screen_info.orig_video_cols = width; + screen_info.orig_video_lines = height; + vga_default_font_height = c->vc_font.height; + return 0; + } if (width % 2 || width > screen_info.orig_video_cols || height > (screen_info.orig_video_lines * vga_default_font_height)/ c->vc_font.height) - /* let svgatextmode tinker with video timings and - return success */ - return (user) ? 0 : -EINVAL; + return -EINVAL; if (con_is_visible(c) && !vga_is_gfx) /* who knows */ vgacon_doresize(c, width, height);