[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664~GEGlfPEp_2913429134epcas5p1v@epcas5p1.samsung.com>
Date: Mon, 30 Jul 2018 11:35:58 +0530
From: Satendra Singh Thakur <satendra.t@...sung.com>
To: Gustavo Padovan <gustavo@...ovan.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Sean Paul <seanpaul@...omium.org>,
David Airlie <airlied@...ux.ie>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: vineet.j@...sung.com, hemanshu.s@...sung.com,
nishant.y08@...sung.com, sst2005@...il.com,
Satendra Singh Thakur <satendra.t@...sung.com>
Subject: [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer
instead of dereferencing it every time.
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 <satendra.t@...sung.com>
---
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
Powered by blists - more mailing lists