From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sam Ravnborg Subject: Re: [PATCH] fbcon: Disable accelerated scrolling Date: Wed, 28 Oct 2020 19:50:29 +0100 Message-ID: <20201028185029.GA683411@ravnborg.org> References: <20201028160600.3752105-1-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20201028160600.3752105-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "Nouveau" To: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz , Tetsuo Handa , Greg Kroah-Hartman , Linus Torvalds , "Gustavo A. R. Silva" , DRI Development , Peilin Ye , George Kennedy , Tomi Valkeinen , Ben Skeggs , nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Daniel Vetter , Nathan Chancellor , Jiri Slaby , Peter Rosin List-Id: nouveau.vger.kernel.org Hi Daniel. On Wed, Oct 28, 2020 at 05:06:00PM +0100, Daniel Vetter wrote: > So ever since syzbot discovered fbcon, we have solid proof that it's > full of bugs. And often the solution is to just delete code and remove > features, e.g. 50145474f6ef ("fbcon: remove soft scrollback code"). > > Now the problem is that most modern-ish drivers really only treat > fbcon as an dumb kernel console until userspace takes over, and Oops > printer for some emergencies. Looking at drm drivers and the basic > vesa/efi fbdev drivers shows that only 3 drivers support any kind of > acceleration: > > - nouveau, seems to be enabled by default > - omapdrm, when a DMM remapper exists using remapper rewriting for > y/xpanning > - gma500, but that is getting deleted now for the GTT remapper trick, > and the accelerated copyarea never set the FBINFO_HWACCEL_COPYAREA > flag, so unused (and could be deleted already I think). > > No other driver supportes accelerated fbcon. And fbcon is the only > user of this accel code (it's not exposed as uapi through ioctls), > which means we could garbage collect fairly enormous amounts of code > if we kill this. > > Plus because syzbot only runs on virtual hardware, and none of the > drivers for that have acceleration, we'd remove a huge gap in testing. > And there's no other even remotely comprehensive testing aside from > syzbot. > > This patch here just disables the acceleration code by always > redrawing when scrolling. The plan is that once this has been merged > for well over a year in released kernels, we can start to go around > and delete a lot of code. See below for a warning fix. Some figures from trying to toss accel code out from a few fbdev drivers: drivers/video/fbdev/cirrusfb.c | 300 +---------------------------------------- 1 file changed, 4 insertions(+), 296 deletions(-) drivers/video/fbdev/aty/radeon_accel.c | 174 --------------------------------- drivers/video/fbdev/aty/radeon_base.c | 43 ++------ drivers/video/fbdev/aty/radeon_pm.c | 7 -- drivers/video/fbdev/aty/radeonfb.h | 3 - 4 files changed, 7 insertions(+), 220 deletions(-) This may open up the discussion if the right course of action would be to drop the drivers in favour of drm counterparts - but thats another story. Sam > @@ -1961,7 +1963,6 @@ static void updatescrollmode(struct fbcon_display *p, > { > struct fbcon_ops *ops = info->fbcon_par; > int fh = vc->vc_font.height; > - int cap = info->flags; > u16 t = 0; > int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, > info->fix.xpanstep); > @@ -1969,37 +1970,12 @@ static void updatescrollmode(struct fbcon_display *p, > int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); > int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, > info->var.xres_virtual); > - int good_pan = (cap & FBINFO_HWACCEL_YPAN) && > - divides(ypan, vc->vc_font.height) && vyres > yres; > - int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && > - divides(ywrap, vc->vc_font.height) && > - divides(vc->vc_font.height, vyres) && > - divides(vc->vc_font.height, yres); > - int reading_fast = cap & FBINFO_READS_FAST; > - int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && > - !(cap & FBINFO_HWACCEL_DISABLED); > - int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) && > - !(cap & FBINFO_HWACCEL_DISABLED); Some bot will likely tell you that this causes warnings. At least it did in my sparc64 build. Fix: diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 398914e035e9..e8b009c621d8 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2150,10 +2150,6 @@ static void updatescrollmode(struct fbcon_display *p, { struct fbcon_ops *ops = info->fbcon_par; int fh = vc->vc_font.height; - u16 t = 0; - int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, - info->fix.xpanstep); - int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t); int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, info->var.xres_virtual); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 260F9C4363A for ; Wed, 28 Oct 2020 18:50:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CA8224811 for ; Wed, 28 Oct 2020 18:50:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CA8224811 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65CA189E2B; Wed, 28 Oct 2020 18:50:37 +0000 (UTC) Received: from asavdk4.altibox.net (asavdk4.altibox.net [109.247.116.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3637D89E2B; Wed, 28 Oct 2020 18:50:36 +0000 (UTC) Received: from ravnborg.org (unknown [188.228.123.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id 21B6A80617; Wed, 28 Oct 2020 19:50:30 +0100 (CET) Date: Wed, 28 Oct 2020 19:50:29 +0100 From: Sam Ravnborg To: Daniel Vetter Subject: Re: [PATCH] fbcon: Disable accelerated scrolling Message-ID: <20201028185029.GA683411@ravnborg.org> References: <20201028160600.3752105-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201028160600.3752105-1-daniel.vetter@ffwll.ch> X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=fu7ymmwf c=1 sm=1 tr=0 a=S6zTFyMACwkrwXSdXUNehg==:117 a=S6zTFyMACwkrwXSdXUNehg==:17 a=kj9zAlcOel0A:10 a=kYlPfVeDKtV2c73IBp4A:9 a=CjuIK1q_8ugA:10 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , Tetsuo Handa , Greg Kroah-Hartman , Linus Torvalds , "Gustavo A. R. Silva" , DRI Development , Peilin Ye , George Kennedy , Tomi Valkeinen , Ben Skeggs , nouveau@lists.freedesktop.org, Daniel Vetter , Nathan Chancellor , Jiri Slaby , Peter Rosin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Daniel. On Wed, Oct 28, 2020 at 05:06:00PM +0100, Daniel Vetter wrote: > So ever since syzbot discovered fbcon, we have solid proof that it's > full of bugs. And often the solution is to just delete code and remove > features, e.g. 50145474f6ef ("fbcon: remove soft scrollback code"). > > Now the problem is that most modern-ish drivers really only treat > fbcon as an dumb kernel console until userspace takes over, and Oops > printer for some emergencies. Looking at drm drivers and the basic > vesa/efi fbdev drivers shows that only 3 drivers support any kind of > acceleration: > > - nouveau, seems to be enabled by default > - omapdrm, when a DMM remapper exists using remapper rewriting for > y/xpanning > - gma500, but that is getting deleted now for the GTT remapper trick, > and the accelerated copyarea never set the FBINFO_HWACCEL_COPYAREA > flag, so unused (and could be deleted already I think). > > No other driver supportes accelerated fbcon. And fbcon is the only > user of this accel code (it's not exposed as uapi through ioctls), > which means we could garbage collect fairly enormous amounts of code > if we kill this. > > Plus because syzbot only runs on virtual hardware, and none of the > drivers for that have acceleration, we'd remove a huge gap in testing. > And there's no other even remotely comprehensive testing aside from > syzbot. > > This patch here just disables the acceleration code by always > redrawing when scrolling. The plan is that once this has been merged > for well over a year in released kernels, we can start to go around > and delete a lot of code. See below for a warning fix. Some figures from trying to toss accel code out from a few fbdev drivers: drivers/video/fbdev/cirrusfb.c | 300 +---------------------------------------- 1 file changed, 4 insertions(+), 296 deletions(-) drivers/video/fbdev/aty/radeon_accel.c | 174 --------------------------------- drivers/video/fbdev/aty/radeon_base.c | 43 ++------ drivers/video/fbdev/aty/radeon_pm.c | 7 -- drivers/video/fbdev/aty/radeonfb.h | 3 - 4 files changed, 7 insertions(+), 220 deletions(-) This may open up the discussion if the right course of action would be to drop the drivers in favour of drm counterparts - but thats another story. Sam > @@ -1961,7 +1963,6 @@ static void updatescrollmode(struct fbcon_display *p, > { > struct fbcon_ops *ops = info->fbcon_par; > int fh = vc->vc_font.height; > - int cap = info->flags; > u16 t = 0; > int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, > info->fix.xpanstep); > @@ -1969,37 +1970,12 @@ static void updatescrollmode(struct fbcon_display *p, > int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); > int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, > info->var.xres_virtual); > - int good_pan = (cap & FBINFO_HWACCEL_YPAN) && > - divides(ypan, vc->vc_font.height) && vyres > yres; > - int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && > - divides(ywrap, vc->vc_font.height) && > - divides(vc->vc_font.height, vyres) && > - divides(vc->vc_font.height, yres); > - int reading_fast = cap & FBINFO_READS_FAST; > - int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && > - !(cap & FBINFO_HWACCEL_DISABLED); > - int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) && > - !(cap & FBINFO_HWACCEL_DISABLED); Some bot will likely tell you that this causes warnings. At least it did in my sparc64 build. Fix: diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 398914e035e9..e8b009c621d8 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2150,10 +2150,6 @@ static void updatescrollmode(struct fbcon_display *p, { struct fbcon_ops *ops = info->fbcon_par; int fh = vc->vc_font.height; - u16 t = 0; - int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, - info->fix.xpanstep); - int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t); int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, info->var.xres_virtual); _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel