From patchwork Fri Mar 3 13:27:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 735074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vZVNv0MYkz9rxw for ; Sat, 4 Mar 2017 00:27:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OsZkco3/"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tHt8HWPLG/Vd7G9hOOrFdNQG6mwMqv+/xWOEpRqS3q8=; b=OsZkco3/m73f0a F4kOjQRGnje+jV8moAgyjfLQDBC1GhiE604BqKFtg3BiiOJgSw72y2OM0uZatOyPqrhydjfvLDQD0 snwewb3jp4s4Rm1EAEi3dKppDe4FgdWLW9c0mW8YSyfRj2YkScXuSWhMhmGNjXyBjrXW496A5hTxB /4A+eZ5JyCnfS9a2bPWW+FQqJLMvIXtBZBSgd4qODmGEXQU6uZJet+C8eFKGDL1EsD4kS/VvsVdq2 J/32uvS+fnmB4Q2OArrzxpkPmy4bvAn7fcIQG8vEdbzoMYbBrKeHfvjJlXzZpnWlgM1UZYDn7Ryae nMQwsO9Xyk0At3dnyfsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cjnFV-0007p5-NH; Fri, 03 Mar 2017 13:27:57 +0000 Received: from smtprelay.synopsys.com ([198.182.60.111]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cjnFR-0007lg-E7 for linux-snps-arc@lists.infradead.org; Fri, 03 Mar 2017 13:27:56 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 4BE5110C1458; Fri, 3 Mar 2017 05:27:33 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 2DECE5B5; Fri, 3 Mar 2017 05:27:33 -0800 (PST) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 0FD015B1; Fri, 3 Mar 2017 05:27:33 -0800 (PST) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 3 Mar 2017 05:27:32 -0800 Received: from DE02WEMBXB.internal.synopsys.com ([fe80::95ce:118a:8321:a099]) by DE02WEHTCB.internal.synopsys.com ([::1]) with mapi id 14.03.0266.001; Fri, 3 Mar 2017 14:27:30 +0100 From: Alexey Brodkin To: "daniel@ffwll.ch" Subject: Re: [PATCH] drm/arcpgu: use .mode_fixup instead of .atomic_check Thread-Topic: [PATCH] drm/arcpgu: use .mode_fixup instead of .atomic_check Thread-Index: AQHSk3pbdSSv6ibt+0alj80EoRWJA6GB5e0AgAEmKoA= Date: Fri, 3 Mar 2017 13:27:30 +0000 Message-ID: <1488547649.2940.5.camel@synopsys.com> References: <1488475674-6694-1-git-send-email-abrodkin@synopsys.com> <20170302195437.mlhzia2q2oav27mr@phenom.ffwll.local> In-Reply-To: <20170302195437.mlhzia2q2oav27mr@phenom.ffwll.local> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.45] Content-ID: <2F560457E31F02458E7087E5AA1FAF02@internal.synopsys.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170303_052753_572829_D6A15898 X-CRM114-Status: GOOD ( 17.78 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.60.111 listed in wl.mailspike.net] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jose.Abreu@synopsys.com" , "airlied@linux.ie" , "daniel.vetter@ffwll.ch" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "linux-snps-arc@lists.infradead.org" Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi Daniel, On Thu, 2017-03-02 at 20:54 +0100, Daniel Vetter wrote: > On Thu, Mar 02, 2017 at 08:27:54PM +0300, Alexey Brodkin wrote: > > > > Since we cannot always generate exactly requested pixel clock > > there's not much sense in checking requested_clock == clk_round_rate(). > > In that case for quite some modes we'll be getting -EINVAL and no video > > output at all. > > > > But given there's some tolerance to real pixel clock in TVs/monitors > > we may still give it a try with the clock as close to requested one as > > PLL on the board may generate. So we just do a fixup to what current > > board may provide. > > > > Signed-off-by: Alexey Brodkin > > Cc: Daniel Vetter > > Cc: David Airlie > > Cc: Jose Abreu > > --- > >  drivers/gpu/drm/arc/arcpgu_crtc.c | 16 +++++++--------- > >  1 file changed, 7 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c > > index ad9a95916f1f..3f2823c1efc3 100644 > > --- a/drivers/gpu/drm/arc/arcpgu_crtc.c > > +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c > > @@ -129,18 +129,16 @@ static void arc_pgu_crtc_disable(struct drm_crtc *crtc) > >         ~ARCPGU_CTRL_ENABLE_MASK); > >  } > >   > > -static int arc_pgu_crtc_atomic_check(struct drm_crtc *crtc, > > -      struct drm_crtc_state *state) > > +static bool arc_pgu_crtc_mode_fixup(struct drm_crtc *crtc, > > +     const struct drm_display_mode *mode, > > +     struct drm_display_mode *adjusted_mode) > > This isn't required at all, see drm_crtc_state.adjusted_mode. Just update > that and you're good - .mode_fixup is the backwards compatibility function > for old kms drivers, atomic_check is strictly more powerful. So if I understood you correct here what I really need is just to get rid of existing check, right? I.e. the following is to be in v2 respin: ------------------------------->8------------------------------- > Please also make sure the documentation properly explains this, and if > not, please submit a patch to improve it. You mean explains what? That .mode_fixup is not meant to be used in new code? -Alexey diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index ad9a95916f1f..86f1555914e8 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -129,20 +129,6 @@ static void arc_pgu_crtc_disable(struct drm_crtc *crtc)                               ~ARCPGU_CTRL_ENABLE_MASK);  }   -static int arc_pgu_crtc_atomic_check(struct drm_crtc *crtc, -                                    struct drm_crtc_state *state) -{ -       struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); -       struct drm_display_mode *mode = &state->adjusted_mode; -       long rate, clk_rate = mode->clock * 1000; - -       rate = clk_round_rate(arcpgu->clk, clk_rate); -       if (rate != clk_rate) -               return -EINVAL; - -       return 0; -} -  static void arc_pgu_crtc_atomic_begin(struct drm_crtc *crtc,                                       struct drm_crtc_state *state)  { @@ -165,7 +151,6 @@ static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = {         .disable        = arc_pgu_crtc_disable,         .prepare        = arc_pgu_crtc_disable,         .commit         = arc_pgu_crtc_enable, -       .atomic_check   = arc_pgu_crtc_atomic_check,         .atomic_begin   = arc_pgu_crtc_atomic_begin,  }; ------------------------------->8-------------------------------