Received: by 10.213.65.68 with SMTP id h4csp3291001imn; Tue, 3 Apr 2018 02:12:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx480sxk/dN99SgbI/Zq4ILOmT1w9NKHQZgTAzJzTsMdNfKonv5cblgNdEuxeVeO+ySOEUPuu X-Received: by 2002:a17:902:2c43:: with SMTP id m61-v6mr130991plb.229.1522746737992; Tue, 03 Apr 2018 02:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522746737; cv=none; d=google.com; s=arc-20160816; b=UDycgZD1VS6FKbuu3bcNCNcWsmQBb/bWYp12k8+djOrIyZQUN74awNpwgreG5QqdCY nGKqYpDZyh1DJ4m3W2H2waol2KqI1xVEnU6apEP4hvWbt4touyAwVMfwW+BnLuJIaUDP ZXPlA46ALAjMZJZ/xbzkw6FVypUvcwifJXPQJzzuv4T/B9gEAkKZBWK945dSbCqe4eHT dcHv7P+0VGKT87f53oNfAtxIOdGBAHyjqkrJ15CwOPN5PAB1YfkQLhr2UbFHBe4E004l GsOWAyZdBbnvhAQo0gc/xE5FwEbT5MmOyeI+Lo+haH7//+N+1duzF35+ZttRyRhqpoFB gmqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=BZCPq8RZtEm4bXRRYigbAP6ao1N4P2agdKkvrhTjp1E=; b=IaH0CkYfiwh82ESXGjhsw/QpjJXRo2bcX1yiGuJXqLMYZTazlFFCsUMFiHHRXWa9OY /bcvPgVzHlxqagDr2Lm2TSjlrc5W0McCLRUkaMjEPgeVvewNDm1PXaMeYVif4PFzfQEM L/5FjMoRZUAMjvVQMIRL6+/gvFZb6UJOxm7YCZI9NaB4TqVSfK7nA3H617PgB+75Xpsm HQ9t4kGSBR8tXdAUu6SNgZLv4vxCbFKJl3TIGhkDoZrI06E6iJH1eAWjqdW0K9M9d6XZ wRBSl/pISeDShXfI+8+GDxUqrxbF9Hi18dhBUQjH28Gl9lF0XjTUpBCsAkZLyySw0V6K ZlGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=eR8ev5cL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si1657087pgn.185.2018.04.03.02.12.04; Tue, 03 Apr 2018 02:12:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=eR8ev5cL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755198AbeDCJKn (ORCPT + 99 others); Tue, 3 Apr 2018 05:10:43 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38245 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbeDCJKl (ORCPT ); Tue, 3 Apr 2018 05:10:41 -0400 Received: by mail-wm0-f65.google.com with SMTP id i3so9657609wmf.3 for ; Tue, 03 Apr 2018 02:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=BZCPq8RZtEm4bXRRYigbAP6ao1N4P2agdKkvrhTjp1E=; b=eR8ev5cLKaQjRk7FXgq0iQhQJvZ82gIPvybDQJirrrBTfMdKsamVlJ7bJjOYicY6Nx 6cQSDX941v25KOm5Tk8KM0peAg0zAMR6TSQ+0c5J+wRQ9fulPzPisSHZIfyB+RQfyNsP anPzFHZiB6cvXK1Tqemkyv6PJNrbOWNzqacBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=BZCPq8RZtEm4bXRRYigbAP6ao1N4P2agdKkvrhTjp1E=; b=N3qwESybYkHQuwUdQ0vTE9nzWDu6HwfmV+XbF/8Oiq3TvxsDq++0NQtBK/nkbd7YT+ XcI86W/oeeaZmfqVeTvCF+nr3rhjNf6bxhXta+YAk1Egpoho1yJi0PMGhFuXavkzhOCg KoBA/Nka6C3wx4E9iZOzQlVZE7s/hI2K7RiDrIMO4fZFoMgutKKiVgx/59l8b+ovwASb KMmMfPvylRF1eRAJ2vobrh8HuBJ2XNU5n3kJsSKGUmpQZlJTKuJc7+1JQGL5F5DxKt2E eMi2lbIZ8nJjPCpD1tZpJJoIyp5AR2YeVDYlNAgAZVcq4d9nrZqGUIfgGe5oQmeRiN6H AyEA== X-Gm-Message-State: AElRT7HwdsagkBL/GE7IadiFSMzhDiV+fba9CNIhH2VUfX3KhnoOCkl3 IfmPRfFSvoDb4Szyl9k9oo8nLg== X-Received: by 10.80.177.81 with SMTP id l17mr15751748edd.65.1522746640295; Tue, 03 Apr 2018 02:10:40 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id k8sm1377170edn.37.2018.04.03.02.10.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Apr 2018 02:10:39 -0700 (PDT) Date: Tue, 3 Apr 2018 11:10:37 +0200 From: Daniel Vetter To: Peter Rosin Cc: Boris Brezillon , Egbert Eich , Boris Brezillon , Alexandre Belloni , David Airlie , Nicolas Ferre , Takashi Iwai , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] drm/atmel-hlcdc: add command line option to specify preferred depth Message-ID: <20180403091037.GO3881@phenom.ffwll.local> Mail-Followup-To: Peter Rosin , Boris Brezillon , Egbert Eich , Boris Brezillon , Alexandre Belloni , David Airlie , Nicolas Ferre , Takashi Iwai , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20180326073502.19259-1-peda@axentia.se> <20180328093454.4149fa3b@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.15.0-1-amd64 User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 28, 2018 at 12:03:39PM +0200, Peter Rosin wrote: > On 2018-03-28 09:34, Boris Brezillon wrote: > > Hi Peter, > > > > On Mon, 26 Mar 2018 09:35:02 +0200 > > Peter Rosin wrote: > > > >> I have an sama5d31-based system with 64MB of memory and a 1920x1080 > >> LVDS display wired for 16-bpp. When I enable legacy fbdev support, > >> the contiguous memory allocator invariably fails with the order-11 > >> allocation for a 1920x1080@24-bpp buffer (~6MB). But this HW can never > >> make any good use of RGB888, so that is a wasted attempt anyway that > >> would also waste precious memory should it succeed. > >> > >> Sure, I could rewrite user-space to go directly to KMS etc, and that > >> makes the (attempted) order-11 allocation go away, replacing it with > >> one order-10 allocation per application restart for a 1920x1080@16-bpp > >> buffer (<4MB). But after a few restarts, order-10 allocations start to > >> fail as well, which is only to be expected AFAIU. > >> > >> So, I'd rather not change user-space (which was originally written > >> to target a smaller display) so that I at the same time get the > >> benefit of an early pre-allocated fbdev frame-buffer that can be > >> reused over and over. But to do that I need to tell the driver that > >> 16-bpp is the preferred depth. Add a module parameter to do just that. > >> > >> Signed-off-by: Peter Rosin > >> --- > >> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 18 +++++++++++++++++- > >> 1 file changed, 17 insertions(+), 1 deletion(-) > >> > >> I found some inspiration regarding naming and implementation here: > >> https://patchwork.kernel.org/patch/9848631/ > >> > >> I have found no feedback on that patch though, which makes me wonder if > >> I'm perhaps barking up the wronig tree? > > > > Hm, isn't that something you can already overload with the video= > > parameter? > > > > video=:[-] > > Heh, you are right... > > > AFAIR, encodes the color depth, so what is the benefit of adding > > this new property to overload the default depth? > > ...but hhhmmm, I think I will have to have to encode the display size > in the bootargs so I will have to use distinct barebox environments > depending on the panel, but that's no biggie. > > Splendid, please throw away the patch! I think we could fix the parsing to allow -bpp without the resolution ... Not sure how to best do that though. Maybe state that 0x0-bpp means to not change the resolution from the default? -Daniel > > Cheers, > Peter > > > Maybe I'm wrong and the default depth param is actually useful, but in > > this case we should probably make it generic since other drivers seems > > to need it too, and we might want to attach it to a specific display > > engine instance. > > > > Thanks, > > > > Boris > > > >> > >> Cheers, > >> Peter > >> > >> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > >> index c1ea5c36b006..f0148627c221 100644 > >> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > >> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > >> @@ -29,6 +29,11 @@ > >> > >> #define ATMEL_HLCDC_LAYER_IRQS_OFFSET 8 > >> > >> +static int atmel_hlcdc_preferred_depth __read_mostly; > >> + > >> +MODULE_PARM_DESC(preferreddepth, "Set preferred bpp"); > >> +module_param_named(preferreddepth, atmel_hlcdc_preferred_depth, int, 0400); > >> + > >> static const struct atmel_hlcdc_layer_desc atmel_hlcdc_at91sam9n12_layers[] = { > >> { > >> .name = "base", > >> @@ -590,6 +595,7 @@ static int atmel_hlcdc_dc_modeset_init(struct drm_device *dev) > >> dev->mode_config.min_height = dc->desc->min_height; > >> dev->mode_config.max_width = dc->desc->max_width; > >> dev->mode_config.max_height = dc->desc->max_height; > >> + dev->mode_config.preferred_depth = 24; > >> dev->mode_config.funcs = &mode_config_funcs; > >> > >> return 0; > >> @@ -658,7 +664,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) > >> > >> platform_set_drvdata(pdev, dev); > >> > >> - drm_fb_cma_fbdev_init(dev, 24, 0); > >> + drm_fb_cma_fbdev_init(dev, atmel_hlcdc_preferred_depth, 0); > >> > >> drm_kms_helper_poll_init(dev); > >> > >> @@ -756,6 +762,16 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev) > >> struct drm_device *ddev; > >> int ret; > >> > >> + switch (atmel_hlcdc_preferred_depth) { > >> + case 0: /* driver default */ > >> + case 8: > >> + case 16: > >> + case 24: > >> + break; > >> + default: > >> + return -EINVAL; > >> + } > >> + > >> ddev = drm_dev_alloc(&atmel_hlcdc_dc_driver, &pdev->dev); > >> if (IS_ERR(ddev)) > >> return PTR_ERR(ddev); > > > > > > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch