* [PATCH 2/4] drm/rect: Add drm_rect_init()
2019-09-30 13:42 [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Ville Syrjala
@ 2019-09-30 13:42 ` Ville Syrjala
2019-09-30 13:42 ` [PATCH 3/4] drm/i915: Use drm_rect_translate_to() Ville Syrjala
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjala @ 2019-09-30 13:42 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Add a helper to initialize a rectangle from x/y/w/h information.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
include/drm/drm_rect.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index fc7c14627ee2..cd0106135b6a 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -69,6 +69,23 @@ struct drm_rect {
(r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
(r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
+/**
+ * drm_rect_init - initialize the rectangle from x/y/w/h
+ * @r: rectangle
+ * @x: x coordinate
+ * @y: y coordinate
+ * @width: width
+ * @height: height
+ */
+static inline void drm_rect_init(struct drm_rect *r, int x, int y,
+ int width, int height)
+{
+ r->x1 = x;
+ r->y1 = y;
+ r->x2 = x + width;
+ r->y2 = y + height;
+}
+
/**
* drm_rect_adjust_size - adjust the size of the rectangle
* @r: rectangle to be adjusted
--
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/4] drm/i915: Use drm_rect_translate_to()
2019-09-30 13:42 [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Ville Syrjala
2019-09-30 13:42 ` [PATCH 2/4] drm/rect: Add drm_rect_init() Ville Syrjala
@ 2019-09-30 13:42 ` Ville Syrjala
2019-09-30 13:42 ` [PATCH 4/4] drm/i915: Use drm_rect_init() Ville Syrjala
2019-10-01 9:26 ` [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Jani Nikula
3 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjala @ 2019-09-30 13:42 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Use the newly introduced drm_rect_translate_to() instead
of hand rolling it.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index f1328c08f4ad..7e031b76694a 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3485,9 +3485,8 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
* Put the final coordinates back so that the src
* coordinate checks will see the right values.
*/
- drm_rect_translate(&plane_state->base.src,
- (x << 16) - plane_state->base.src.x1,
- (y << 16) - plane_state->base.src.y1);
+ drm_rect_translate_to(&plane_state->base.src,
+ x << 16, y << 16);
return 0;
}
@@ -3709,9 +3708,8 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
* Put the final coordinates back so that the src
* coordinate checks will see the right values.
*/
- drm_rect_translate(&plane_state->base.src,
- (src_x << 16) - plane_state->base.src.x1,
- (src_y << 16) - plane_state->base.src.y1);
+ drm_rect_translate_to(&plane_state->base.src,
+ src_x << 16, src_y << 16);
/* HSW/BDW do this automagically in hardware */
if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) {
--
2.21.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/4] drm/i915: Use drm_rect_init()
2019-09-30 13:42 [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Ville Syrjala
2019-09-30 13:42 ` [PATCH 2/4] drm/rect: Add drm_rect_init() Ville Syrjala
2019-09-30 13:42 ` [PATCH 3/4] drm/i915: Use drm_rect_translate_to() Ville Syrjala
@ 2019-09-30 13:42 ` Ville Syrjala
2019-10-01 9:26 ` [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Jani Nikula
3 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjala @ 2019-09-30 13:42 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Use the new drm_rect_init() helper where appropriate.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 10 ++--------
drivers/gpu/drm/i915/display/intel_sprite.c | 6 ++----
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 7e031b76694a..3ddd8a940bfa 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2738,10 +2738,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
size++;
/* rotate the x/y offsets to match the GTT view */
- r.x1 = x;
- r.y1 = y;
- r.x2 = x + width;
- r.y2 = y + height;
+ drm_rect_init(&r, x, y, width, height);
drm_rect_rotate(&r,
rot_info->plane[i].width * tile_width,
rot_info->plane[i].height * tile_height,
@@ -2863,10 +2860,7 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state)
struct drm_rect r;
/* rotate the x/y offsets to match the GTT view */
- r.x1 = x;
- r.y1 = y;
- r.x2 = x + width;
- r.y2 = y + height;
+ drm_rect_init(&r, x, y, width, height);
drm_rect_rotate(&r,
info->plane[i].width * tile_width,
info->plane[i].height * tile_height,
diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index 3d56db32291b..8d5854d54045 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -287,10 +287,8 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
src_y = src->y1 >> 16;
src_h = drm_rect_height(src) >> 16;
- src->x1 = src_x << 16;
- src->x2 = (src_x + src_w) << 16;
- src->y1 = src_y << 16;
- src->y2 = (src_y + src_h) << 16;
+ drm_rect_init(src, src_x << 16, src_y << 16,
+ src_w << 16, src_h << 16);
if (!fb->format->is_yuv)
return 0;
--
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] drm/rect: Add drm_rect_translate_to()
2019-09-30 13:42 [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Ville Syrjala
` (2 preceding siblings ...)
2019-09-30 13:42 ` [PATCH 4/4] drm/i915: Use drm_rect_init() Ville Syrjala
@ 2019-10-01 9:26 ` Jani Nikula
2019-10-01 14:56 ` [Intel-gfx] " Ville Syrjälä
3 siblings, 1 reply; 6+ messages in thread
From: Jani Nikula @ 2019-10-01 9:26 UTC (permalink / raw)
To: Ville Syrjala, dri-devel; +Cc: intel-gfx
On Mon, 30 Sep 2019, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Add a helper to translate a rectangle to an absolute position.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
The series is
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> include/drm/drm_rect.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> index 6195820aa5c5..fc7c14627ee2 100644
> --- a/include/drm/drm_rect.h
> +++ b/include/drm/drm_rect.h
> @@ -106,6 +106,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy)
> r->y2 += dy;
> }
>
> +/**
> + * drm_rect_translate_to - translate the rectangle to an absolute position
> + * @r: rectangle to be tranlated
> + * @x: horizontal position
> + * @y: vertical position
> + *
> + * Move rectangle @r to @x in the horizontal direction,
> + * and to @y in the vertical direction.
> + */
> +static inline void drm_rect_translate_to(struct drm_rect *r, int x, int y)
> +{
> + drm_rect_translate(r, x - r->x1, y - r->y1);
> +}
> +
> /**
> * drm_rect_downscale - downscale a rectangle
> * @r: rectangle to be downscaled
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Intel-gfx] [PATCH 1/4] drm/rect: Add drm_rect_translate_to()
2019-10-01 9:26 ` [PATCH 1/4] drm/rect: Add drm_rect_translate_to() Jani Nikula
@ 2019-10-01 14:56 ` Ville Syrjälä
0 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjälä @ 2019-10-01 14:56 UTC (permalink / raw)
To: Jani Nikula; +Cc: intel-gfx, dri-devel
On Tue, Oct 01, 2019 at 12:26:52PM +0300, Jani Nikula wrote:
> On Mon, 30 Sep 2019, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Add a helper to translate a rectangle to an absolute position.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The series is
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
Thanks. 1-2 pushed to drm-misc-next.
>
>
> > ---
> > include/drm/drm_rect.h | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> > index 6195820aa5c5..fc7c14627ee2 100644
> > --- a/include/drm/drm_rect.h
> > +++ b/include/drm/drm_rect.h
> > @@ -106,6 +106,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy)
> > r->y2 += dy;
> > }
> >
> > +/**
> > + * drm_rect_translate_to - translate the rectangle to an absolute position
> > + * @r: rectangle to be tranlated
> > + * @x: horizontal position
> > + * @y: vertical position
> > + *
> > + * Move rectangle @r to @x in the horizontal direction,
> > + * and to @y in the vertical direction.
> > + */
> > +static inline void drm_rect_translate_to(struct drm_rect *r, int x, int y)
> > +{
> > + drm_rect_translate(r, x - r->x1, y - r->y1);
> > +}
> > +
> > /**
> > * drm_rect_downscale - downscale a rectangle
> > * @r: rectangle to be downscaled
>
> --
> Jani Nikula, Intel Open Source Graphics Center
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread