Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp2708485rdb; Wed, 6 Sep 2023 12:19:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZ+TgOOf9K1MepbT9SXB4ZdhEYVa2jQ28eXkR+R2KDczclT9Vj0IfJXWfNCu/BDpHoPdH8 X-Received: by 2002:a17:906:1050:b0:9a5:d876:c37 with SMTP id j16-20020a170906105000b009a5d8760c37mr3106354ejj.74.1694027993654; Wed, 06 Sep 2023 12:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694027993; cv=none; d=google.com; s=arc-20160816; b=DLgBMk7Kd6hmzAH3+wr4D7kaYXHj5Y+ERrMEK3T9hlawJ6HjnXIKaRMTG0EfgG2Z3Q 0nabHtq84K/qO9sjHpzejp4C5rLQCLUqgu1mHp01C0YT5PDatsT9SKSHLgMDckZV4IrP 2RV74FxyUTT46aNLfgzDEe98JEwtd4Uw9+nyeshNaRelYzlaETMX2bQVsIz7MG67CsQa NSLu+r8CEIBW6tEwge1pvzSrPoE55F1BzJ2REekjSpA8lc0aRhmWji4fT/Jz2ss8t4BG 5Dy7a1NSCfGc4+ft1O0diLTBhIQZ3/7PsifXDkHGU8zzQoCTjI103cbel41WK59luezz c/1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:from:message-id:subject :cc:to:date:dkim-signature; bh=HLIzlICH1AEBXsOcnTKaQYc1rfqXxa0S8CLXQRxHefk=; fh=8WmbPjoIwQmLcY4+6NB2ytAz/JX0jfJitVk0RYldoZ0=; b=vhXva4qcalFfXQ4qYVRyiy9koKFrjPqqFUMuefnOJgcxQBNrDMoa6uuVmF/CfmRjgx JhZGqkCo4xW3zrBhQFESuY3Gey84MiP6mmsYckfd/NIJISNvV0zRh+OfO7FA/GSr+HNQ 2u2Br1r4XVHx6A3+zJTVCDaGP4IPiZbAMu1RX0MNMY9GLwKmdp3PCoNHpLP4J6J7TLEc 1xbTpazNntiozJtXHoZ+48vGU9oIZpvYNoKzeKT+0BUb8v7vQmNjnkdGSPnYBvuWDx7u Tj0SIS79XmNM6a0TL+iLn3n/VjzDXIl2gQrqemw9yt/i6SqixMgANKaO5FAyJj2tRNeY UBfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F1TQMwP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a1709067f0a00b009a189b0bbc9si9365643ejr.568.2023.09.06.12.19.13; Wed, 06 Sep 2023 12:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F1TQMwP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239559AbjIFLza (ORCPT + 99 others); Wed, 6 Sep 2023 07:55:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbjIFLza (ORCPT ); Wed, 6 Sep 2023 07:55:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE544BF for ; Wed, 6 Sep 2023 04:55:26 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 457DFC433C7; Wed, 6 Sep 2023 11:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694001326; bh=Lr1hk8T14jyQD38Co71l4i6tLkHZSpTmtLre5Xwotpw=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=F1TQMwP7zK7EbTFHLI/A+Q9F0qlDYSwYUD6m0/owxKcqalTaALjoE1bG5L9g3HXdC k5NHYRX5MyPfxpODxMasofmqxRhUUR3xbGmCoJXyq0G5hmal6Wh0fv1eh9A3BpNXn2 Ar/U5uEuA6fmtbqkRirgjcEvZ01sOTphBx6/ywhYzbPVTFZLyCF1/noLsuGwmGzzbO U2GHwtvWXkgNbo0HO9DP394lgBIZsQaZPMmB0DHPTVZ073VA8/hVCJiaAmhEbJN4sj /KFuzhZR6qP5Wsl4aeImzGwoYQNSaO9xEEnK66HlLw365VUEwvB5vUg+sCVXTC76Sk 9Kqn4oeuFmWvQ== Date: Mon, 4 Sep 2023 10:04:29 +0200 To: Geert Uytterhoeven Cc: Javier Martinez Canillas , linux-kernel@vger.kernel.org, Thomas Zimmermann , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org Subject: Re: [RFC PATCH] drm/ssd130x: Allocate buffer in the CRTC's .atomic_check() callback Message-ID: From: Maxime Ripard References: <20230830062546.720679-1-javierm@redhat.com> <4zfgmvfstyjfo5slggfmfuvnirrhrq773el52gkav2r6jxliub@7qjbyy7rkj3g> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 01, 2023 at 02:08:11PM +0200, Geert Uytterhoeven wrote: > Hi Maxime, >=20 > On Fri, Sep 1, 2023 at 2:00=E2=80=AFPM Maxime Ripard = wrote: > > On Fri, Sep 01, 2023 at 10:36:17AM +0200, Geert Uytterhoeven wrote: > > > On Fri, Sep 1, 2023 at 10:22=E2=80=AFAM Maxime Ripard wrote: > > > > On Wed, Aug 30, 2023 at 08:25:08AM +0200, Javier Martinez Canillas = wrote: > > > > > The commit 45b58669e532 ("drm/ssd130x: Allocate buffer in the pla= ne's > > > > > .atomic_check() callback") moved the allocation of the intermedia= te and > > > > > HW buffers from the encoder's .atomic_enable callback to primary = plane's > > > > > .atomic_check callback. > > > > > > > > > > This was suggested by Maxime Ripard because drivers aren't allowe= d to fail > > > > > after drm_atomic_helper_swap_state() has been called, and the enc= oder's > > > > > .atomic_enable happens after the new atomic state has been swappe= d. > > > > > > > > > > But that change caused a performance regression in very slow plat= forms, > > > > > since now the allocation happens for every plane's atomic state c= ommit. > > > > > For example, Geert Uytterhoeven reports that is the case on a Vex= RiscV > > > > > softcore (RISC-V CPU implementation on an FPGA). > > > > > > > > I'd like to have numbers on that. It's a bit surprising to me that, > > > > given how many objects we already allocate during a commit, two sma= ll > > > > additional allocations affect performances so dramatically, even on= a > > > > slow platform. > > > > > > To be fair, I didn't benchmark that. Perhaps it's just too slow due = to > > > all these other allocations (and whatever else happens). > > > > > > I just find it extremely silly to allocate a buffer over and over aga= in, > > > while we know that buffer is needed for each and every display update. > > > > Maybe it's silly, but I guess it depends on what you want to optimize > > for. You won't know the size of that buffer before you're in > > atomic_check. So it's a different trade-off than you would like, but I > > wouldn't call it extremely silly. >=20 > The size of ssd130x_plane_state.data_array[] is fixed, and depends > on the actual display connected. That one can be tied to the CRTC state if needed. It would only be allocated on each modeset, so probably once for that kind of device. > The size of ssd130x_plane_state.buffer[] is also fixed, and depends > on the plane's size (which is currently fixed to the display size). Doesn't it depend on the format as well? Maxime