diff mbox

[3/5] drm: plane src coords are 16.16 fixed point

Message ID 1331513325-1554-3-git-send-email-rob.clark@linaro.org
State New
Headers show

Commit Message

Rob Clark March 12, 2012, 12:48 a.m. UTC
From: Rob Clark <rob@ti.com>

---
 src/compositor-drm.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

Comments

Jesse Barnes March 20, 2012, 5:48 p.m. UTC | #1
On Sun, 11 Mar 2012 19:48:43 -0500
Rob Clark <rob.clark@linaro.org> wrote:

> From: Rob Clark <rob@ti.com>
> 
> ---
>  src/compositor-drm.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 500ec15..cf9a937 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -538,13 +538,12 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base,
>  				  &output_base->region);
>  	pixman_region32_translate(&src_rect, -es->geometry.x, -es->geometry.y);
>  	box = pixman_region32_extents(&src_rect);
> -	s->src_x = box->x1;
> -	s->src_y = box->y1;
> -	s->src_w = box->x2 - box->x1;
> -	s->src_h = box->y2 - box->y1;
> +	s->src_x = box->x1 << 16;
> +	s->src_y = box->y1 << 16;
> +	s->src_w = (box->x2 - box->x1) << 16;
> +	s->src_h = (box->y2 - box->y1) << 16;
>  	pixman_region32_fini(&src_rect);
>  
> -
>  	wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
>  		       &s->pending_destroy_listener.link);
>  	return 0;

This is correct, but why hasn't testing shown this to be broken?  We've
tested windows with a nonzero width & height, and also partially
offscreen windows, and they worked...

Somewhere must be ignoring the shifts, but it looks like we honor them
in i915... ah no it looks like we don't treat src_w/src_h that way,
just x & y.

Guess we should fix the kernel driver before we have hardware that
actually supports alpha so this will work nicely!
Kristian Høgsberg March 22, 2012, 3:58 p.m. UTC | #2
On Tue, Mar 20, 2012 at 10:48:55AM -0700, Jesse Barnes wrote:
> On Sun, 11 Mar 2012 19:48:43 -0500
> Rob Clark <rob.clark@linaro.org> wrote:
> 
> > From: Rob Clark <rob@ti.com>
> > 
> > ---
> >  src/compositor-drm.c |    9 ++++-----
> >  1 files changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> > index 500ec15..cf9a937 100644
> > --- a/src/compositor-drm.c
> > +++ b/src/compositor-drm.c
> > @@ -538,13 +538,12 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base,
> >  				  &output_base->region);
> >  	pixman_region32_translate(&src_rect, -es->geometry.x, -es->geometry.y);
> >  	box = pixman_region32_extents(&src_rect);
> > -	s->src_x = box->x1;
> > -	s->src_y = box->y1;
> > -	s->src_w = box->x2 - box->x1;
> > -	s->src_h = box->y2 - box->y1;
> > +	s->src_x = box->x1 << 16;
> > +	s->src_y = box->y1 << 16;
> > +	s->src_w = (box->x2 - box->x1) << 16;
> > +	s->src_h = (box->y2 - box->y1) << 16;
> >  	pixman_region32_fini(&src_rect);
> >  
> > -
> >  	wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
> >  		       &s->pending_destroy_listener.link);
> >  	return 0;
> 
> This is correct, but why hasn't testing shown this to be broken?  We've
> tested windows with a nonzero width & height, and also partially
> offscreen windows, and they worked...
> 
> Somewhere must be ignoring the shifts, but it looks like we honor them
> in i915... ah no it looks like we don't treat src_w/src_h that way,
> just x & y.
> 
> Guess we should fix the kernel driver before we have hardware that
> actually supports alpha so this will work nicely!

Ok, that was the confirmation I was looking for, I'll grab the patch.

Kristian
diff mbox

Patch

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 500ec15..cf9a937 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -538,13 +538,12 @@  drm_output_prepare_overlay_surface(struct weston_output *output_base,
 				  &output_base->region);
 	pixman_region32_translate(&src_rect, -es->geometry.x, -es->geometry.y);
 	box = pixman_region32_extents(&src_rect);
-	s->src_x = box->x1;
-	s->src_y = box->y1;
-	s->src_w = box->x2 - box->x1;
-	s->src_h = box->y2 - box->y1;
+	s->src_x = box->x1 << 16;
+	s->src_y = box->y1 << 16;
+	s->src_w = (box->x2 - box->x1) << 16;
+	s->src_h = (box->y2 - box->y1) << 16;
 	pixman_region32_fini(&src_rect);
 
-
 	wl_list_insert(es->buffer->resource.destroy_listener_list.prev,
 		       &s->pending_destroy_listener.link);
 	return 0;