All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Subject: Re: [PATCH v6 1/5] drm: Add function to convert rect in 16.16 fixed format to regular format
Date: Tue, 15 Dec 2020 16:44:07 +0200	[thread overview]
Message-ID: <X9jLt5p62uJ38cE7@intel.com> (raw)
In-Reply-To: <20201214174912.174065-1-jose.souza@intel.com>

On Mon, Dec 14, 2020 at 09:49:08AM -0800, José Roberto de Souza wrote:
> Much more clear to read one function call than four lines doing this
> conversion.
> 
> Cc: dri-devel@lists.freedesktop.org
> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
>  include/drm/drm_rect.h     |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index 0460e874896e..24345704b353 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -373,3 +373,18 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  	}
>  }
>  EXPORT_SYMBOL(drm_rect_rotate_inv);
> +
> +/**
> + * drm_rect_convert_16_16_to_regular - Convert a rect in 16.16 fixed point form
> + * to regular form.
> + * @in: rect in 16.16 fixed point form
> + * @out: rect to be stored the converted value
> + */
> +void drm_rect_convert_16_16_to_regular(struct drm_rect *in, struct drm_rect *out)
> +{
> +	out->x1 = in->x1 >> 16;
> +	out->y1 = in->y1 >> 16;
> +	out->x2 = in->x2 >> 16;
> +	out->y2 = in->y2 >> 16;
> +}

That's not the same as what we do in most places. We truncate
the width/height, not x2/y2. Doing it on x2/y2 may increase
the width/height.

So I suggest something more like:

static inline void drm_rect_fp_to_int(struct drm_rect *r)
{
	drm_rect_init(r, r->x1 >> 16, r->y1 >> 16,
		      drm_rect_width(r) >> 16,
		      drm_rect_height(r) >> 16);
}

to match the current way of doing things.

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v6 1/5] drm: Add function to convert rect in 16.16 fixed format to regular format
Date: Tue, 15 Dec 2020 16:44:07 +0200	[thread overview]
Message-ID: <X9jLt5p62uJ38cE7@intel.com> (raw)
In-Reply-To: <20201214174912.174065-1-jose.souza@intel.com>

On Mon, Dec 14, 2020 at 09:49:08AM -0800, José Roberto de Souza wrote:
> Much more clear to read one function call than four lines doing this
> conversion.
> 
> Cc: dri-devel@lists.freedesktop.org
> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
>  include/drm/drm_rect.h     |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index 0460e874896e..24345704b353 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -373,3 +373,18 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  	}
>  }
>  EXPORT_SYMBOL(drm_rect_rotate_inv);
> +
> +/**
> + * drm_rect_convert_16_16_to_regular - Convert a rect in 16.16 fixed point form
> + * to regular form.
> + * @in: rect in 16.16 fixed point form
> + * @out: rect to be stored the converted value
> + */
> +void drm_rect_convert_16_16_to_regular(struct drm_rect *in, struct drm_rect *out)
> +{
> +	out->x1 = in->x1 >> 16;
> +	out->y1 = in->y1 >> 16;
> +	out->x2 = in->x2 >> 16;
> +	out->y2 = in->y2 >> 16;
> +}

That's not the same as what we do in most places. We truncate
the width/height, not x2/y2. Doing it on x2/y2 may increase
the width/height.

So I suggest something more like:

static inline void drm_rect_fp_to_int(struct drm_rect *r)
{
	drm_rect_init(r, r->x1 >> 16, r->y1 >> 16,
		      drm_rect_width(r) >> 16,
		      drm_rect_height(r) >> 16);
}

to match the current way of doing things.

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

  parent reply	other threads:[~2020-12-15 14:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 17:49 [PATCH v6 1/5] drm: Add function to convert rect in 16.16 fixed format to regular format José Roberto de Souza
2020-12-14 17:49 ` [Intel-gfx] " José Roberto de Souza
2020-12-14 17:49 ` [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area José Roberto de Souza
2020-12-15 13:02   ` Mun, Gwan-gyeong
2020-12-15 13:14     ` Souza, Jose
2020-12-16 10:29       ` Mun, Gwan-gyeong
2020-12-16 13:17         ` Souza, Jose
2020-12-16 14:10           ` Mun, Gwan-gyeong
2020-12-16 14:40             ` Souza, Jose
2020-12-17 11:51               ` Mun, Gwan-gyeong
2020-12-17 13:34                 ` Souza, Jose
2020-12-17 16:04                   ` Mun, Gwan-gyeong
2020-12-14 17:49 ` [Intel-gfx] [PATCH v6 3/5] drm/i915/display: Split and export main surface calculation from skl_check_main_surface() José Roberto de Souza
2020-12-14 17:49 ` [Intel-gfx] [PATCH v6 4/5] drm/i915/display/psr: Program plane's calculated offset to plane SF register José Roberto de Souza
2020-12-14 17:49 ` [Intel-gfx] [PATCH v6 5/5] HAX/DO_NOT_MERGE_IT: drm/i915/display: Enable PSR2 selective fetch for testing José Roberto de Souza
2020-12-14 18:39 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v6,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format Patchwork
2020-12-14 18:42 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2020-12-14 19:07 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-12-15 12:52 ` [PATCH v6 1/5] " Mun, Gwan-gyeong
2020-12-15 12:52   ` [Intel-gfx] " Mun, Gwan-gyeong
2020-12-15 13:25   ` Souza, Jose
2020-12-15 13:25     ` [Intel-gfx] " Souza, Jose
2020-12-15 14:44 ` Ville Syrjälä [this message]
2020-12-15 14:44   ` Ville Syrjälä
2020-12-15 15:43   ` Souza, Jose
2020-12-15 15:43     ` [Intel-gfx] " Souza, Jose
2020-12-15 15:50     ` Ville Syrjälä
2020-12-15 15:50       ` [Intel-gfx] " Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X9jLt5p62uJ38cE7@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jose.souza@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.