Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4959257pxj; Wed, 12 May 2021 17:46:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDd73exD+AxCZSN7WctKiAneFXAWNarVooPaPGe5gl4EN14n/Q2wzxVIO++Zm6NIgP2Vor X-Received: by 2002:a17:906:170f:: with SMTP id c15mr40023197eje.358.1620866817226; Wed, 12 May 2021 17:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620866817; cv=none; d=google.com; s=arc-20160816; b=LVqGUY5UUvocu48aQUCzq990i8iwsUiLI83DGw/lOf7djBr6UlVcwxOl4qxfyDiiPp ULmqhBofTUT52pRMsmvrPuP8KaCwey2urswjWAmZoIt6IyurUbZsFKJWjy/nHm7n5nPr qwrkLy7VCS6SXZ17NEtG8tbIDxXRxySxGkWoY5U4mO8FCzYtZ8Ace99/UulmLk1s8Czn T+sKUl/YZj3M5t74D+REUoabvHtAWKD5Tyyi5Abtk4b3i2nLPe4uXkyTwxOTs7lzEDAC W+lKh4nnwnr4UT9GX4Oo0nfRa1YawDxGR974yDyFwM00MZed2maf7rTLcY88NXkMAvVG +tDw== 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=7JAvw0bQPwag2iUfR4zmBYCnMKvb6dK0cTCY3shsvqI=; b=sdAjIMzbetfMsHl2+GlDox1fHVGfRVI9wFWlxeew9lyEgDhQIaQ/LgvjqEi6SwEocL oJ2b8YFx5VY7N9+CP5RpvGROBNvk/QPqLlEugX5OV4nQqI21v4iVWxb6jvC8JsfKIcUq 8ObcoZWObB/ecZlcfB/E6rESuqFVbiW4/VxD3GtnIP9KnjbbKb/zmHtBT55HNsnGk5UG 6ByQm5LYFuHeH7ehPBpiMbmp8XyoWdzAjwW3aCU3LVCpfaDoMn5NXutdczfmkj3IvXNr MwXyk9yiLnqp9AGUrYuwV7C/x6/LfmQzhS6RwoJb64iiyCgRbC0DpVhcuqDrui6BgxjU iF+A== 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 f10si1495099ejf.291.2021.05.12.17.46.33; Wed, 12 May 2021 17:46:57 -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 S232357AbhEMAlY (ORCPT + 99 others); Wed, 12 May 2021 20:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241887AbhEMAiv (ORCPT ); Wed, 12 May 2021 20:38:51 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 08247C06134B; Wed, 12 May 2021 17:37:20 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id E2D6E92009E; Thu, 13 May 2021 02:37:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id DB98492009C; Thu, 13 May 2021 02:37:19 +0200 (CEST) Date: Thu, 13 May 2021 02:37:19 +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 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+ --- 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);