linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer instead of dereferencing it every time.
       [not found] <CGME20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664@epcas5p1.samsung.com>
@ 2018-07-30  6:05 ` Satendra Singh Thakur
  2018-07-30 13:33   ` Sean Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Satendra Singh Thakur @ 2018-07-30  6:05 UTC (permalink / raw)
  To: Gustavo Padovan, Maarten Lankhorst, Sean Paul, David Airlie,
	dri-devel, linux-kernel
  Cc: vineet.j, hemanshu.s, nishant.y08, sst2005, Satendra Singh Thakur

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@samsung.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer instead of dereferencing it every time.
  2018-07-30  6:05 ` [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer instead of dereferencing it every time Satendra Singh Thakur
@ 2018-07-30 13:33   ` Sean Paul
       [not found]     ` <CGME20180804073234epcas5p4e3ed929df6b4d35c8831cb0fe3d98e58@epcas5p4.samsung.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Paul @ 2018-07-30 13:33 UTC (permalink / raw)
  To: Satendra Singh Thakur
  Cc: Gustavo Padovan, Maarten Lankhorst, Sean Paul, David Airlie,
	dri-devel, linux-kernel, vineet.j, hemanshu.s, nishant.y08,
	sst2005

On Mon, Jul 30, 2018 at 11:35:58AM +0530, Satendra Singh Thakur wrote:
> 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.

Maybe this is simpler, but not overwhelmingly so.

To be honest, I'm a bit concerned with the volume of no-op patches you're
sending to the list. I so appreciate and encourage your participation,
but perhaps we could redirect your efforts. 

A lot of the patches you send (not necessarily this one, it's pretty
straightforward), are changing core pieces of commit validation which have
already been proven to work. These types of changes require a lot of
context and scrutinization on the part of the reviewer, which takes time that
most of us don't have. If you introduce a bug with a no-op change, people are
not going to be happy.

So, in order to make everyone more productive, may I suggest the following:

- Every change you make sure have a purpose greater than "this code snippet
  is marginally more readable".
- If you want to make readability changes, do them in one patch series with
  a common theme (for example, the drm_crtc.h refactors).
- Spend your time on bug fixes, performance improvements, and features as
  opposed to readability.
- Make sure you test your code.

Again, *thank you* for your patches, it's great to have you here.

Sean


> 
> Signed-off-by: Satendra Singh Thakur <satendra.t@samsung.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
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer instead of dereferencing it every time.
       [not found]     ` <CGME20180804073234epcas5p4e3ed929df6b4d35c8831cb0fe3d98e58@epcas5p4.samsung.com>
@ 2018-08-04  7:32       ` Satendra Singh Thakur
  0 siblings, 0 replies; 3+ messages in thread
From: Satendra Singh Thakur @ 2018-08-04  7:32 UTC (permalink / raw)
  To: Gustavo Padovan, Maarten Lankhorst, Sean Paul, David Airlie,
	dri-devel, linux-kernel
  Cc: sst2005, Satendra Singh Thakur

On Mon, 30 Jul 2018 at 09:33:55 -0400 Sean Paul wrote:

>Maybe this is simpler, but not overwhelmingly so.

>To be honest, I'm a bit concerned with the volume of no-op patches you're
>sending to the list. I so appreciate and encourage your participation,
>but perhaps we could redirect your efforts. 
>Again, *thank you* for your patches, it's great to have you here.

>Sean


Hello Mr Sean,
Thanks for the comments , I will take care of this in future.
Thanks
-Satendra

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-04  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180730060607epcas5p18565ae86e1c88e82469554aa3c0e1664@epcas5p1.samsung.com>
2018-07-30  6:05 ` [PATCH] drm/kms/crtc: Saving crtc->primary into a drm_plane pointer instead of dereferencing it every time Satendra Singh Thakur
2018-07-30 13:33   ` Sean Paul
     [not found]     ` <CGME20180804073234epcas5p4e3ed929df6b4d35c8831cb0fe3d98e58@epcas5p4.samsung.com>
2018-08-04  7:32       ` Satendra Singh Thakur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).