diff mbox

[i-g-t,2/4] igt_kms: Merge condition in igt_plane_set_fb

Message ID 1430819603-492-2-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin May 5, 2015, 9:53 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

There were two paths for fb and !fb.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: chandra konduru <chandra.konduru@intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_kms.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Chandra Konduru May 6, 2015, 8:56 p.m. UTC | #1
> @@ -1765,14 +1765,6 @@ void igt_plane_set_fb(igt_plane_t *plane, struct
> igt_fb *fb)
>  	plane->fb = fb;
>  	/* hack to keep tests working that don't call igt_plane_set_size() */
>  	if (fb) {
> -		plane->crtc_w = fb->width;
> -		plane->crtc_h = fb->height;
> -	} else {
> -		plane->crtc_w = 0;
> -		plane->crtc_h = 0;
> -	}
> -
> -	if (fb) {
>  		/* set default plane pos/size as fb size */
>  		plane->crtc_x = 0;
>  		plane->crtc_y = 0;
> @@ -1784,6 +1776,9 @@ void igt_plane_set_fb(igt_plane_t *plane, struct
> igt_fb *fb)
>  		fb->src_y = 0;
>  		fb->src_w = fb->width;
>  		fb->src_h = fb->height;
> +	} else {
> +		plane->crtc_w = 0;
> +		plane->crtc_h = 0;
>  	}
Existing code is simply setting fb src position and plane crtc position to 0s (top left)
and src size as fb size and crtc size as plane size to start a fb with a plane. Then individual
test can change them to whatever fb position/size and plane position/size as it wants.
As I commented to 3/4 patch, if these initializations are removed, then all tests to be
updated to explicitly set them.

As a side note, is there any reason for having two patches 2/4 and 3/4 modifying
same lines of code instead of a single patch?

> 
>  	plane->fb_changed = true;
> --
> 2.3.5
Tvrtko Ursulin May 7, 2015, 9:06 a.m. UTC | #2
On 05/06/2015 09:56 PM, Konduru, Chandra wrote:
>> @@ -1765,14 +1765,6 @@ void igt_plane_set_fb(igt_plane_t *plane, struct
>> igt_fb *fb)
>>   	plane->fb = fb;
>>   	/* hack to keep tests working that don't call igt_plane_set_size() */
>>   	if (fb) {
>> -		plane->crtc_w = fb->width;
>> -		plane->crtc_h = fb->height;
>> -	} else {
>> -		plane->crtc_w = 0;
>> -		plane->crtc_h = 0;
>> -	}
>> -
>> -	if (fb) {
>>   		/* set default plane pos/size as fb size */
>>   		plane->crtc_x = 0;
>>   		plane->crtc_y = 0;
>> @@ -1784,6 +1776,9 @@ void igt_plane_set_fb(igt_plane_t *plane, struct
>> igt_fb *fb)
>>   		fb->src_y = 0;
>>   		fb->src_w = fb->width;
>>   		fb->src_h = fb->height;
>> +	} else {
>> +		plane->crtc_w = 0;
>> +		plane->crtc_h = 0;
>>   	}
> Existing code is simply setting fb src position and plane crtc position to 0s (top left)
> and src size as fb size and crtc size as plane size to start a fb with a plane. Then individual
> test can change them to whatever fb position/size and plane position/size as it wants.
> As I commented to 3/4 patch, if these initializations are removed, then all tests to be
> updated to explicitly set them.

Not sure what you mean. I simply cleaned two "if (fb)" conditions one 
after another, into one. No functional changes.

> As a side note, is there any reason for having two patches 2/4 and 3/4 modifying
> same lines of code instead of a single patch?

Because this is just a code cleanup and the other was a functional 
change. And because it doesn't matter - lets not spend hours going back 
and forth on trivial IGT fixes.

Regards,

Tvrtko
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 33d437d..b5ba273 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1765,14 +1765,6 @@  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 	plane->fb = fb;
 	/* hack to keep tests working that don't call igt_plane_set_size() */
 	if (fb) {
-		plane->crtc_w = fb->width;
-		plane->crtc_h = fb->height;
-	} else {
-		plane->crtc_w = 0;
-		plane->crtc_h = 0;
-	}
-
-	if (fb) {
 		/* set default plane pos/size as fb size */
 		plane->crtc_x = 0;
 		plane->crtc_y = 0;
@@ -1784,6 +1776,9 @@  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 		fb->src_y = 0;
 		fb->src_w = fb->width;
 		fb->src_h = fb->height;
+	} else {
+		plane->crtc_w = 0;
+		plane->crtc_h = 0;
 	}
 
 	plane->fb_changed = true;