Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3585415imm; Sun, 29 Jul 2018 23:07:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeE+SSdFNYSu3fBiK00ePxqLD56aK0GOQr2kV/jLDfZ/7+rQyujRtFzJXDZPL6yjzV3YPcl X-Received: by 2002:a17:902:59da:: with SMTP id d26-v6mr15175834plj.42.1532930837061; Sun, 29 Jul 2018 23:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532930837; cv=none; d=google.com; s=arc-20160816; b=AYcRkoWF+DWQWwZr+DZI7BAoLfpmD81I3i+aLKXC7v0BNzjazbO7JuAMuvlVO1QMwO aGoaNPAECdY82IdDyklgT/wP5JPSBwqueVF3tyUr1CaDvTf++PH2YBbFLCg/Kw91qW1+ i95bQ/6ysAezRHH7/7KK3CxSyc1AbCmX3QPO3rGuTWMCKSUw4AbFLYBd3Uxw0gySDpof tniInY8OSM4eaVYofkLFV7whA5YpUfQG3vRjyRSb2WJP+yq5ztGEmcOFX8KZ4pwNLL6O KR5cy8Qr+n7BpEh+yZQ8s4K0+6DT/rc10NdT4ZI4DePCpEteJyluLsZ8zadvdmKDs2Zp Phhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=FQQwvZOT1XA5KFYuylI/WqlYAMUMm3Zab4Eq3q4xvwk=; b=xkTU9V6Gr1Q3xzDWAmECkM/KUwMiEjuExqSeCCPBE4iqQpMISA130/mcvqura0eiLy RBXGG+ruCbuj99sXaBMPd2IIj/9q4qfoZgYgeVpXOOj7rCQs8WCegahHPHO0HjCyrKTF qkT7o58v9SyVrrJ5+OBLNfxJNwIwrqPTIVwtJEokXqELiUB6DXcbZmytRc52B41w5Vs4 PVRx/T13qsSOhknT8SG8WpJr5YpkDP7wHLhfSRQNyR8C9MDE5HPD/PUddusu8OzHBi2t LbMTNU1yMRYAcxtAvevmQOBrTotoJacsXiC3pAI7Bb2FqLfIEZcGeDHxiiMAmGEdYgdv avVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ASzyShy4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38-v6si9543764pln.92.2018.07.29.23.07.02; Sun, 29 Jul 2018 23:07: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=pass header.i=@samsung.com header.s=mail20170921 header.b=ASzyShy4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbeG3Hjf (ORCPT + 99 others); Mon, 30 Jul 2018 03:39:35 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:48459 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726087AbeG3Hjf (ORCPT ); Mon, 30 Jul 2018 03:39:35 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20180730060610epoutp0450583a3e57f332e547cf1578243f7e10~GEGn0wLk02692726927epoutp04j for ; Mon, 30 Jul 2018 06:06:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20180730060610epoutp0450583a3e57f332e547cf1578243f7e10~GEGn0wLk02692726927epoutp04j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1532930770; bh=FQQwvZOT1XA5KFYuylI/WqlYAMUMm3Zab4Eq3q4xvwk=; h=From:To:Cc:Subject:Date:References:From; b=ASzyShy4b8f0KTU25Dgy3M4HNWINNO0hYanChGm00xzq+XwkmGQubACeSd4rvMq0D 7UJyb7SmpaZNX1iQXMRw9kt83aelyQ2Iyfm6CqaGYsfN/ekFO2y+r8E3u5kUSot8t7 +ccqofmeFK2nl9iJ9JybAbT4boUNKHl8bw3Zdywc= Received: from epsmges5p1new.samsung.com (unknown [182.195.40.195]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20180730060609epcas5p1b643651d922c033815919775b0a42bbb~GEGmygcV32461924619epcas5p1L; Mon, 30 Jul 2018 06:06:09 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B3.9B.04303.0DAAE5B5; Mon, 30 Jul 2018 15:06:08 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664~GEGlfPEp_2913429134epcas5p1v; Mon, 30 Jul 2018 06:06:07 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180730060607epsmtrp2eb4a0029dfeb048655e94c3ea0cb1f14~GEGldb5M92122621226epsmtrp2S; Mon, 30 Jul 2018 06:06:07 +0000 (GMT) X-AuditID: b6c32a49-94fff700000010cf-f8-5b5eaad084d7 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id BF.1B.03889.FCAAE5B5; Mon, 30 Jul 2018 15:06:07 +0900 (KST) Received: from localhost.localdomain (unknown [107.108.161.94]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180730060605epsmtip154f9b1390b20fc959c2333bf1b25a7fb~GEGjhh34V3252732527epsmtip14; Mon, 30 Jul 2018 06:06:05 +0000 (GMT) From: Satendra Singh Thakur To: Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: vineet.j@samsung.com, hemanshu.s@samsung.com, nishant.y08@samsung.com, sst2005@gmail.com, Satendra Singh Thakur Subject: [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer instead of dereferencing it every time. Date: Mon, 30 Jul 2018 11:35:58 +0530 X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEKsWRmVeSWpSXmKPExsWy7bCmpu6FVXHRBid/8Fr0njvJZHHl63s2 i50PdrFbvDr/htni8q45bBYLP25lseh7d5zNYu35VhaLuxvOMlosP32d2eLY1kvsDtwesxsu snjsnHWX3WP7twesHvNOBnrc7z7O5LFz0l4mj74tqxg9Pm+SC+CISrXJSE1MSS1SSM1Lzk/J zEu3VfIOjneONzUzMNQ1tLQwV1LIS8xNtVVy8QnQdcvMATpUSaEsMacUKBSQWFyspG9nU5Rf WpKqkJFfXGKrFG1oaKRnaGCuZ2QEpE1jrYxMgUoSUjOOtrxkLVjBX7Hx8gO2BsYtPF2MnBwS AiYScxr+sXQxcnEICexmlNg//SQThPOJUeJp12pWkCohgW+MEofuecJ0TGhbxAxRtJdRYsm8 R2wQzhdGiblPLoB1sAFVPZ8zgxUkISLwklHiZssZMIdZoI9R4mj/Y7AqYYEyiQkzHoDZLAKq EtvutTNC7JCTuHmuE2yHhMAONonul1NZQBK8QA2t91rZIYpcJHYsO8UGYQtLvDq+BSouJfH5 3V6o+GRGieazfhCDVjNKnL3YC1VkL9Ey5QDQUA6gkzQl1u/SBwkzC/BJ9P5+wgQSlhDgleho E4KoVpFY+eIwM8z4Pwu6WCFsD4mfe5qY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W7XlnOWHloYtMakpJQhsvOMufNKz+PVvlRhqz3k7hXUrJdXHtv//pbHj5/DvnCu60 dr7lBUfsfpa7Oi/btUa/bekqJZbijERDLeai4kQASovx7EMCAAA= Message-Id: <20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664~GEGlfPEp_2913429134epcas5p1v@epcas5p1.samsung.com> X-CMS-MailID: 20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the func __drm_mode_set_config_internal, objects (fb, old_fb, crtc) of crtc->primary are used at many places. To access the objects of primary, it is dereferenced from crtc every time. It's better to save it into drm_plane pointer. This will make the code look simple. Signed-off-by: Satendra Singh Thakur --- drivers/gpu/drm/drm_crtc.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 98a36e6..9644f5b 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -462,6 +462,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, struct drm_crtc *crtc = set->crtc; struct drm_framebuffer *fb; struct drm_crtc *tmp; + struct drm_plane *plane; int ret; /* @@ -469,23 +470,27 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, * connectors from it), hence we need to refcount the fbs across all * crtcs. Atomic modeset will have saner semantics ... */ - drm_for_each_crtc(tmp, crtc->dev) - tmp->primary->old_fb = tmp->primary->fb; + drm_for_each_crtc(tmp, crtc->dev) { + plane = tmp->primary; + plane->old_fb = plane->fb; + } fb = set->fb; - ret = crtc->funcs->set_config(set, ctx); if (ret == 0) { - crtc->primary->crtc = fb ? crtc : NULL; - crtc->primary->fb = fb; + plane = crtc->primary; + plane->crtc = fb ? crtc : NULL; + plane->fb = fb; } drm_for_each_crtc(tmp, crtc->dev) { - if (tmp->primary->fb) - drm_framebuffer_get(tmp->primary->fb); - if (tmp->primary->old_fb) - drm_framebuffer_put(tmp->primary->old_fb); - tmp->primary->old_fb = NULL; + plane = tmp->primary; + if (plane->fb) + drm_framebuffer_get(plane->fb); + if (plane->old_fb) { + drm_framebuffer_put(plane->old_fb); + plane->old_fb = NULL; + } } return ret; -- 2.7.4