public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane
@ 2016-04-05 11:11 Lionel Landwerlin
  2016-04-05 11:48 ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Lionel Landwerlin @ 2016-04-05 11:11 UTC (permalink / raw)
  To: intel-gfx

This fixes potential crashes when the framebuffer is unset from a
given plane.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Marius Vlad <marius.c.vlad@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.h  |  4 ----
 lib/igt_kms.c | 32 ++++++++++++++++----------------
 lib/igt_kms.h |  8 ++++++++
 3 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index e8fe3ac..0a06899 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -55,10 +55,6 @@ struct igt_fb {
 	unsigned size;
 	cairo_surface_t *cairo_surface;
 	unsigned domain;
-	uint32_t src_x;
-	uint32_t src_y;
-	uint32_t src_w;
-	uint32_t src_h;
 };
 
 enum igt_text_align {
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 82257a6..b63a59d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1586,10 +1586,10 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_output_t *output,
 	}
 
 	if (plane->position_changed || plane->size_changed) {
-		uint32_t src_x = IGT_FIXED(plane->fb->src_x, 0); /* src_x */
-		uint32_t src_y = IGT_FIXED(plane->fb->src_y, 0); /* src_y */
-		uint32_t src_w = IGT_FIXED(plane->fb->src_w, 0); /* src_w */
-		uint32_t src_h = IGT_FIXED(plane->fb->src_h, 0); /* src_h */
+		uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
+		uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
+		uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
+		uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
 		int32_t crtc_x = plane->crtc_x;
 		int32_t crtc_y = plane->crtc_y;
 		uint32_t crtc_w = plane->crtc_w;
@@ -1677,10 +1677,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 		CHECK_RETURN(ret, fail_on_error);
 	} else if (plane->fb_changed || plane->position_changed ||
 		plane->size_changed) {
-		src_x = IGT_FIXED(plane->fb->src_x,0); /* src_x */
-		src_y = IGT_FIXED(plane->fb->src_y,0); /* src_y */
-		src_w = IGT_FIXED(plane->fb->src_w,0); /* src_w */
-		src_h = IGT_FIXED(plane->fb->src_h,0); /* src_h */
+		src_x = IGT_FIXED(plane->src_x,0); /* src_x */
+		src_y = IGT_FIXED(plane->src_y,0); /* src_y */
+		src_w = IGT_FIXED(plane->src_w,0); /* src_w */
+		src_h = IGT_FIXED(plane->src_h,0); /* src_h */
 		crtc_x = plane->crtc_x;
 		crtc_y = plane->crtc_y;
 		crtc_w = plane->crtc_w;
@@ -2201,10 +2201,10 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 		plane->crtc_h = fb->height;
 
 		/* set default src pos/size as fb size */
-		fb->src_x = 0;
-		fb->src_y = 0;
-		fb->src_w = fb->width;
-		fb->src_h = fb->height;
+		plane->src_x = 0;
+		plane->src_y = 0;
+		plane->src_w = fb->width;
+		plane->src_h = fb->height;
 	} else {
 		plane->crtc_w = 0;
 		plane->crtc_h = 0;
@@ -2271,8 +2271,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
 	LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
 	    kmstest_pipe_name(pipe->pipe), plane->index, x, y);
 
-	fb->src_x = x;
-	fb->src_y = y;
+	plane->src_x = x;
+	plane->src_y = y;
 
 	plane->fb_changed = true;
 }
@@ -2297,8 +2297,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
 	LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
 	    kmstest_pipe_name(pipe->pipe), plane->index, w, h);
 
-	fb->src_w = w;
-	fb->src_h = h;
+	plane->src_w = w;
+	plane->src_h = h;
 
 	plane->fb_changed = true;
 }
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8ae1192..aabe244 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -243,6 +243,14 @@ typedef struct {
 	int crtc_x, crtc_y;
 	/* size within pipe_src_w x pipe_src_h */
 	int crtc_w, crtc_h;
+
+	/* position with the framebuffer */
+	uint32_t src_x;
+	uint32_t src_y;
+	/* size within the framebuffer*/
+	uint32_t src_w;
+	uint32_t src_h;
+
 	/* panning offset within the fb */
 	unsigned int pan_x, pan_y;
 	igt_rotation_t rotation;
-- 
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane
  2016-04-05 11:11 [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane Lionel Landwerlin
@ 2016-04-05 11:48 ` Ville Syrjälä
  2016-04-05 13:12   ` Lionel Landwerlin
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2016-04-05 11:48 UTC (permalink / raw)
  To: Lionel Landwerlin; +Cc: intel-gfx

On Tue, Apr 05, 2016 at 12:11:19PM +0100, Lionel Landwerlin wrote:
> This fixes potential crashes when the framebuffer is unset from a
> given plane.
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Marius Vlad <marius.c.vlad@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_fb.h  |  4 ----
>  lib/igt_kms.c | 32 ++++++++++++++++----------------
>  lib/igt_kms.h |  8 ++++++++
>  3 files changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index e8fe3ac..0a06899 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -55,10 +55,6 @@ struct igt_fb {
>  	unsigned size;
>  	cairo_surface_t *cairo_surface;
>  	unsigned domain;
> -	uint32_t src_x;
> -	uint32_t src_y;
> -	uint32_t src_w;
> -	uint32_t src_h;
>  };
>  
>  enum igt_text_align {
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 82257a6..b63a59d 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1586,10 +1586,10 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_output_t *output,
>  	}
>  
>  	if (plane->position_changed || plane->size_changed) {
> -		uint32_t src_x = IGT_FIXED(plane->fb->src_x, 0); /* src_x */
> -		uint32_t src_y = IGT_FIXED(plane->fb->src_y, 0); /* src_y */
> -		uint32_t src_w = IGT_FIXED(plane->fb->src_w, 0); /* src_w */
> -		uint32_t src_h = IGT_FIXED(plane->fb->src_h, 0); /* src_h */
> +		uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
> +		uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
> +		uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
> +		uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
>  		int32_t crtc_x = plane->crtc_x;
>  		int32_t crtc_y = plane->crtc_y;
>  		uint32_t crtc_w = plane->crtc_w;
> @@ -1677,10 +1677,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
>  		CHECK_RETURN(ret, fail_on_error);
>  	} else if (plane->fb_changed || plane->position_changed ||
>  		plane->size_changed) {
> -		src_x = IGT_FIXED(plane->fb->src_x,0); /* src_x */
> -		src_y = IGT_FIXED(plane->fb->src_y,0); /* src_y */
> -		src_w = IGT_FIXED(plane->fb->src_w,0); /* src_w */
> -		src_h = IGT_FIXED(plane->fb->src_h,0); /* src_h */
> +		src_x = IGT_FIXED(plane->src_x,0); /* src_x */
> +		src_y = IGT_FIXED(plane->src_y,0); /* src_y */
> +		src_w = IGT_FIXED(plane->src_w,0); /* src_w */
> +		src_h = IGT_FIXED(plane->src_h,0); /* src_h */
>  		crtc_x = plane->crtc_x;
>  		crtc_y = plane->crtc_y;
>  		crtc_w = plane->crtc_w;
> @@ -2201,10 +2201,10 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
>  		plane->crtc_h = fb->height;
>  
>  		/* set default src pos/size as fb size */
> -		fb->src_x = 0;
> -		fb->src_y = 0;
> -		fb->src_w = fb->width;
> -		fb->src_h = fb->height;
> +		plane->src_x = 0;
> +		plane->src_y = 0;
> +		plane->src_w = fb->width;
> +		plane->src_h = fb->height;
>  	} else {
>  		plane->crtc_w = 0;
>  		plane->crtc_h = 0;
> @@ -2271,8 +2271,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
>  	LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
>  	    kmstest_pipe_name(pipe->pipe), plane->index, x, y);
>  
> -	fb->src_x = x;
> -	fb->src_y = y;
> +	plane->src_x = x;
> +	plane->src_y = y;
>  
>  	plane->fb_changed = true;
>  }
> @@ -2297,8 +2297,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
>  	LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
>  	    kmstest_pipe_name(pipe->pipe), plane->index, w, h);
>  
> -	fb->src_w = w;
> -	fb->src_h = h;
> +	plane->src_w = w;
> +	plane->src_h = h;
>  
>  	plane->fb_changed = true;
>  }
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8ae1192..aabe244 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -243,6 +243,14 @@ typedef struct {
>  	int crtc_x, crtc_y;
>  	/* size within pipe_src_w x pipe_src_h */
>  	int crtc_w, crtc_h;
> +
> +	/* position with the framebuffer */
> +	uint32_t src_x;
> +	uint32_t src_y;
> +	/* size within the framebuffer*/
> +	uint32_t src_w;
> +	uint32_t src_h;


Perhaps add a small note that these are 16.16

Patch looks good to me otherwise.

> +
>  	/* panning offset within the fb */
>  	unsigned int pan_x, pan_y;
>  	igt_rotation_t rotation;
> -- 
> 2.8.0.rc3

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane
  2016-04-05 11:48 ` Ville Syrjälä
@ 2016-04-05 13:12   ` Lionel Landwerlin
  2016-04-05 13:20     ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Lionel Landwerlin @ 2016-04-05 13:12 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On 05/04/16 12:48, Ville Syrjälä wrote:
> On Tue, Apr 05, 2016 at 12:11:19PM +0100, Lionel Landwerlin wrote:
>> This fixes potential crashes when the framebuffer is unset from a
>> given plane.
>>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Marius Vlad <marius.c.vlad@intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> ---
>>   lib/igt_fb.h  |  4 ----
>>   lib/igt_kms.c | 32 ++++++++++++++++----------------
>>   lib/igt_kms.h |  8 ++++++++
>>   3 files changed, 24 insertions(+), 20 deletions(-)
>>
>> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
>> index e8fe3ac..0a06899 100644
>> --- a/lib/igt_fb.h
>> +++ b/lib/igt_fb.h
>> @@ -55,10 +55,6 @@ struct igt_fb {
>>   	unsigned size;
>>   	cairo_surface_t *cairo_surface;
>>   	unsigned domain;
>> -	uint32_t src_x;
>> -	uint32_t src_y;
>> -	uint32_t src_w;
>> -	uint32_t src_h;
>>   };
>>   
>>   enum igt_text_align {
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 82257a6..b63a59d 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -1586,10 +1586,10 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_output_t *output,
>>   	}
>>   
>>   	if (plane->position_changed || plane->size_changed) {
>> -		uint32_t src_x = IGT_FIXED(plane->fb->src_x, 0); /* src_x */
>> -		uint32_t src_y = IGT_FIXED(plane->fb->src_y, 0); /* src_y */
>> -		uint32_t src_w = IGT_FIXED(plane->fb->src_w, 0); /* src_w */
>> -		uint32_t src_h = IGT_FIXED(plane->fb->src_h, 0); /* src_h */
>> +		uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
>> +		uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
>> +		uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
>> +		uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
>>   		int32_t crtc_x = plane->crtc_x;
>>   		int32_t crtc_y = plane->crtc_y;
>>   		uint32_t crtc_w = plane->crtc_w;
>> @@ -1677,10 +1677,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
>>   		CHECK_RETURN(ret, fail_on_error);
>>   	} else if (plane->fb_changed || plane->position_changed ||
>>   		plane->size_changed) {
>> -		src_x = IGT_FIXED(plane->fb->src_x,0); /* src_x */
>> -		src_y = IGT_FIXED(plane->fb->src_y,0); /* src_y */
>> -		src_w = IGT_FIXED(plane->fb->src_w,0); /* src_w */
>> -		src_h = IGT_FIXED(plane->fb->src_h,0); /* src_h */
>> +		src_x = IGT_FIXED(plane->src_x,0); /* src_x */
>> +		src_y = IGT_FIXED(plane->src_y,0); /* src_y */
>> +		src_w = IGT_FIXED(plane->src_w,0); /* src_w */
>> +		src_h = IGT_FIXED(plane->src_h,0); /* src_h */
>>   		crtc_x = plane->crtc_x;
>>   		crtc_y = plane->crtc_y;
>>   		crtc_w = plane->crtc_w;
>> @@ -2201,10 +2201,10 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
>>   		plane->crtc_h = fb->height;
>>   
>>   		/* set default src pos/size as fb size */
>> -		fb->src_x = 0;
>> -		fb->src_y = 0;
>> -		fb->src_w = fb->width;
>> -		fb->src_h = fb->height;
>> +		plane->src_x = 0;
>> +		plane->src_y = 0;
>> +		plane->src_w = fb->width;
>> +		plane->src_h = fb->height;
>>   	} else {
>>   		plane->crtc_w = 0;
>>   		plane->crtc_h = 0;
>> @@ -2271,8 +2271,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
>>   	LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
>>   	    kmstest_pipe_name(pipe->pipe), plane->index, x, y);
>>   
>> -	fb->src_x = x;
>> -	fb->src_y = y;
>> +	plane->src_x = x;
>> +	plane->src_y = y;
>>   
>>   	plane->fb_changed = true;
>>   }
>> @@ -2297,8 +2297,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
>>   	LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
>>   	    kmstest_pipe_name(pipe->pipe), plane->index, w, h);
>>   
>> -	fb->src_w = w;
>> -	fb->src_h = h;
>> +	plane->src_w = w;
>> +	plane->src_h = h;
>>   
>>   	plane->fb_changed = true;
>>   }
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> index 8ae1192..aabe244 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -243,6 +243,14 @@ typedef struct {
>>   	int crtc_x, crtc_y;
>>   	/* size within pipe_src_w x pipe_src_h */
>>   	int crtc_w, crtc_h;
>> +
>> +	/* position with the framebuffer */
>> +	uint32_t src_x;
>> +	uint32_t src_y;
>> +	/* size within the framebuffer*/
>> +	uint32_t src_w;
>> +	uint32_t src_h;
>
> Perhaps add a small note that these are 16.16
>
> Patch looks good to me otherwise.

I think we convert them to 16.16 at commit time.
The values stored there should be normal integers.

>
>> +
>>   	/* panning offset within the fb */
>>   	unsigned int pan_x, pan_y;
>>   	igt_rotation_t rotation;
>> -- 
>> 2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane
@ 2016-04-05 13:13 Lionel Landwerlin
  0 siblings, 0 replies; 5+ messages in thread
From: Lionel Landwerlin @ 2016-04-05 13:13 UTC (permalink / raw)
  To: intel-gfx

This fixes potential crashes when the framebuffer is unset from a
given plane.

v2: s/with/within/ typo in header

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Marius Vlad <marius.c.vlad@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.h  |  4 ----
 lib/igt_kms.c | 32 ++++++++++++++++----------------
 lib/igt_kms.h |  8 ++++++++
 3 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index e8fe3ac..0a06899 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -55,10 +55,6 @@ struct igt_fb {
 	unsigned size;
 	cairo_surface_t *cairo_surface;
 	unsigned domain;
-	uint32_t src_x;
-	uint32_t src_y;
-	uint32_t src_w;
-	uint32_t src_h;
 };
 
 enum igt_text_align {
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 82257a6..b63a59d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1586,10 +1586,10 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_output_t *output,
 	}
 
 	if (plane->position_changed || plane->size_changed) {
-		uint32_t src_x = IGT_FIXED(plane->fb->src_x, 0); /* src_x */
-		uint32_t src_y = IGT_FIXED(plane->fb->src_y, 0); /* src_y */
-		uint32_t src_w = IGT_FIXED(plane->fb->src_w, 0); /* src_w */
-		uint32_t src_h = IGT_FIXED(plane->fb->src_h, 0); /* src_h */
+		uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
+		uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
+		uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
+		uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
 		int32_t crtc_x = plane->crtc_x;
 		int32_t crtc_y = plane->crtc_y;
 		uint32_t crtc_w = plane->crtc_w;
@@ -1677,10 +1677,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 		CHECK_RETURN(ret, fail_on_error);
 	} else if (plane->fb_changed || plane->position_changed ||
 		plane->size_changed) {
-		src_x = IGT_FIXED(plane->fb->src_x,0); /* src_x */
-		src_y = IGT_FIXED(plane->fb->src_y,0); /* src_y */
-		src_w = IGT_FIXED(plane->fb->src_w,0); /* src_w */
-		src_h = IGT_FIXED(plane->fb->src_h,0); /* src_h */
+		src_x = IGT_FIXED(plane->src_x,0); /* src_x */
+		src_y = IGT_FIXED(plane->src_y,0); /* src_y */
+		src_w = IGT_FIXED(plane->src_w,0); /* src_w */
+		src_h = IGT_FIXED(plane->src_h,0); /* src_h */
 		crtc_x = plane->crtc_x;
 		crtc_y = plane->crtc_y;
 		crtc_w = plane->crtc_w;
@@ -2201,10 +2201,10 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 		plane->crtc_h = fb->height;
 
 		/* set default src pos/size as fb size */
-		fb->src_x = 0;
-		fb->src_y = 0;
-		fb->src_w = fb->width;
-		fb->src_h = fb->height;
+		plane->src_x = 0;
+		plane->src_y = 0;
+		plane->src_w = fb->width;
+		plane->src_h = fb->height;
 	} else {
 		plane->crtc_w = 0;
 		plane->crtc_h = 0;
@@ -2271,8 +2271,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
 	LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
 	    kmstest_pipe_name(pipe->pipe), plane->index, x, y);
 
-	fb->src_x = x;
-	fb->src_y = y;
+	plane->src_x = x;
+	plane->src_y = y;
 
 	plane->fb_changed = true;
 }
@@ -2297,8 +2297,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
 	LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
 	    kmstest_pipe_name(pipe->pipe), plane->index, w, h);
 
-	fb->src_w = w;
-	fb->src_h = h;
+	plane->src_w = w;
+	plane->src_h = h;
 
 	plane->fb_changed = true;
 }
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8ae1192..b763120 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -243,6 +243,14 @@ typedef struct {
 	int crtc_x, crtc_y;
 	/* size within pipe_src_w x pipe_src_h */
 	int crtc_w, crtc_h;
+
+	/* position within the framebuffer */
+	uint32_t src_x;
+	uint32_t src_y;
+	/* size within the framebuffer*/
+	uint32_t src_w;
+	uint32_t src_h;
+
 	/* panning offset within the fb */
 	unsigned int pan_x, pan_y;
 	igt_rotation_t rotation;
-- 
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane
  2016-04-05 13:12   ` Lionel Landwerlin
@ 2016-04-05 13:20     ` Ville Syrjälä
  0 siblings, 0 replies; 5+ messages in thread
From: Ville Syrjälä @ 2016-04-05 13:20 UTC (permalink / raw)
  To: Lionel Landwerlin; +Cc: intel-gfx

On Tue, Apr 05, 2016 at 02:12:43PM +0100, Lionel Landwerlin wrote:
> On 05/04/16 12:48, Ville Syrjälä wrote:
> > On Tue, Apr 05, 2016 at 12:11:19PM +0100, Lionel Landwerlin wrote:
> >> This fixes potential crashes when the framebuffer is unset from a
> >> given plane.
> >>
> >> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> >> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >> Cc: Marius Vlad <marius.c.vlad@intel.com>
> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> ---
> >>   lib/igt_fb.h  |  4 ----
> >>   lib/igt_kms.c | 32 ++++++++++++++++----------------
> >>   lib/igt_kms.h |  8 ++++++++
> >>   3 files changed, 24 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> >> index e8fe3ac..0a06899 100644
> >> --- a/lib/igt_fb.h
> >> +++ b/lib/igt_fb.h
> >> @@ -55,10 +55,6 @@ struct igt_fb {
> >>   	unsigned size;
> >>   	cairo_surface_t *cairo_surface;
> >>   	unsigned domain;
> >> -	uint32_t src_x;
> >> -	uint32_t src_y;
> >> -	uint32_t src_w;
> >> -	uint32_t src_h;
> >>   };
> >>   
> >>   enum igt_text_align {
> >> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> >> index 82257a6..b63a59d 100644
> >> --- a/lib/igt_kms.c
> >> +++ b/lib/igt_kms.c
> >> @@ -1586,10 +1586,10 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_output_t *output,
> >>   	}
> >>   
> >>   	if (plane->position_changed || plane->size_changed) {
> >> -		uint32_t src_x = IGT_FIXED(plane->fb->src_x, 0); /* src_x */
> >> -		uint32_t src_y = IGT_FIXED(plane->fb->src_y, 0); /* src_y */
> >> -		uint32_t src_w = IGT_FIXED(plane->fb->src_w, 0); /* src_w */
> >> -		uint32_t src_h = IGT_FIXED(plane->fb->src_h, 0); /* src_h */
> >> +		uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
> >> +		uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
> >> +		uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
> >> +		uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
> >>   		int32_t crtc_x = plane->crtc_x;
> >>   		int32_t crtc_y = plane->crtc_y;
> >>   		uint32_t crtc_w = plane->crtc_w;
> >> @@ -1677,10 +1677,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
> >>   		CHECK_RETURN(ret, fail_on_error);
> >>   	} else if (plane->fb_changed || plane->position_changed ||
> >>   		plane->size_changed) {
> >> -		src_x = IGT_FIXED(plane->fb->src_x,0); /* src_x */
> >> -		src_y = IGT_FIXED(plane->fb->src_y,0); /* src_y */
> >> -		src_w = IGT_FIXED(plane->fb->src_w,0); /* src_w */
> >> -		src_h = IGT_FIXED(plane->fb->src_h,0); /* src_h */
> >> +		src_x = IGT_FIXED(plane->src_x,0); /* src_x */
> >> +		src_y = IGT_FIXED(plane->src_y,0); /* src_y */
> >> +		src_w = IGT_FIXED(plane->src_w,0); /* src_w */
> >> +		src_h = IGT_FIXED(plane->src_h,0); /* src_h */
> >>   		crtc_x = plane->crtc_x;
> >>   		crtc_y = plane->crtc_y;
> >>   		crtc_w = plane->crtc_w;
> >> @@ -2201,10 +2201,10 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
> >>   		plane->crtc_h = fb->height;
> >>   
> >>   		/* set default src pos/size as fb size */
> >> -		fb->src_x = 0;
> >> -		fb->src_y = 0;
> >> -		fb->src_w = fb->width;
> >> -		fb->src_h = fb->height;
> >> +		plane->src_x = 0;
> >> +		plane->src_y = 0;
> >> +		plane->src_w = fb->width;
> >> +		plane->src_h = fb->height;
> >>   	} else {
> >>   		plane->crtc_w = 0;
> >>   		plane->crtc_h = 0;
> >> @@ -2271,8 +2271,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
> >>   	LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
> >>   	    kmstest_pipe_name(pipe->pipe), plane->index, x, y);
> >>   
> >> -	fb->src_x = x;
> >> -	fb->src_y = y;
> >> +	plane->src_x = x;
> >> +	plane->src_y = y;
> >>   
> >>   	plane->fb_changed = true;
> >>   }
> >> @@ -2297,8 +2297,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
> >>   	LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
> >>   	    kmstest_pipe_name(pipe->pipe), plane->index, w, h);
> >>   
> >> -	fb->src_w = w;
> >> -	fb->src_h = h;
> >> +	plane->src_w = w;
> >> +	plane->src_h = h;
> >>   
> >>   	plane->fb_changed = true;
> >>   }
> >> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> >> index 8ae1192..aabe244 100644
> >> --- a/lib/igt_kms.h
> >> +++ b/lib/igt_kms.h
> >> @@ -243,6 +243,14 @@ typedef struct {
> >>   	int crtc_x, crtc_y;
> >>   	/* size within pipe_src_w x pipe_src_h */
> >>   	int crtc_w, crtc_h;
> >> +
> >> +	/* position with the framebuffer */
> >> +	uint32_t src_x;
> >> +	uint32_t src_y;
> >> +	/* size within the framebuffer*/
> >> +	uint32_t src_w;
> >> +	uint32_t src_h;
> >
> > Perhaps add a small note that these are 16.16
> >
> > Patch looks good to me otherwise.
> 
> I think we convert them to 16.16 at commit time.
> The values stored there should be normal integers.

Oh indeed. That's rather surprising. Maybe send a patch to change that
as well?

> 
> >
> >> +
> >>   	/* panning offset within the fb */
> >>   	unsigned int pan_x, pan_y;
> >>   	igt_rotation_t rotation;
> >> -- 
> >> 2.8.0.rc3

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-04-05 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 11:11 [PATCH i-g-t] lib: kms: move framebuffer scanout offset/size to plane Lionel Landwerlin
2016-04-05 11:48 ` Ville Syrjälä
2016-04-05 13:12   ` Lionel Landwerlin
2016-04-05 13:20     ` Ville Syrjälä
  -- strict thread matches above, loose matches on Subject: below --
2016-04-05 13:13 Lionel Landwerlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox