From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Drew Davenport <ddavenport@chromium.org>, stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Reject < 1x1 pixel plane source size
Date: Thu, 12 Jan 2023 20:29:15 +0200 [thread overview]
Message-ID: <Y8BRe4DUUsRou4uN@intel.com> (raw)
In-Reply-To: <20230112152145.1117-1-ville.syrjala@linux.intel.com>
On Thu, Jan 12, 2023 at 05:21:45PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We don't have proper sub-pixel coordinate support (some platforms
> simply can't do it, for others we've not implemented it). This
> can cause us to treat a < 1 pixel source width/height as zero
> which is not valid for the hardware, and can also cause a div
> by zero in some cases.
>
> Refuse < 1x1 plane source size to avoid these problems.
>
> Cc: stable@vger.kernel.org
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> Reported-by: Drew Davenport <ddavenport@chromium.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> The other option would be to clamp the source size to >=1x1 pixels,
> but dunno if that has any real benefits.
>
> drivers/gpu/drm/i915/display/intel_atomic_plane.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 10e1fc9d0698..c6e43d684458 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -921,6 +921,21 @@ int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
> */
> plane_state->uapi.visible = drm_rect_clip_scaled(src, dst, clip);
>
> + /*
> + * Avoid zero source size when we later
> + * discard the fractional coords.
> + *
> + * FIXME add proper sub-pixel coordinate handling
> + * for platforms/planes that support it.
> + */
> + if (plane_state->uapi.visible &&
> + (drm_rect_width(src) < 0x10000 || drm_rect_height(src) < 0x10000)) {
> + drm_dbg_kms(&i915->drm, "Plane source must be at least 1x1 pixels\n");
> + drm_rect_debug_print("src: ", src, true);
> + drm_rect_debug_print("dst: ", dst, false);
> + return -EINVAL;
> + }
Scratch that. Went with Drew's original patch instead.
> +
> drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
>
> if (!can_position && plane_state->uapi.visible &&
> --
> 2.38.2
--
Ville Syrjälä
Intel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: stable@vger.kernel.org,
Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
Drew Davenport <ddavenport@chromium.org>
Subject: Re: [PATCH] drm/i915: Reject < 1x1 pixel plane source size
Date: Thu, 12 Jan 2023 20:29:15 +0200 [thread overview]
Message-ID: <Y8BRe4DUUsRou4uN@intel.com> (raw)
In-Reply-To: <20230112152145.1117-1-ville.syrjala@linux.intel.com>
On Thu, Jan 12, 2023 at 05:21:45PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We don't have proper sub-pixel coordinate support (some platforms
> simply can't do it, for others we've not implemented it). This
> can cause us to treat a < 1 pixel source width/height as zero
> which is not valid for the hardware, and can also cause a div
> by zero in some cases.
>
> Refuse < 1x1 plane source size to avoid these problems.
>
> Cc: stable@vger.kernel.org
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> Reported-by: Drew Davenport <ddavenport@chromium.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> The other option would be to clamp the source size to >=1x1 pixels,
> but dunno if that has any real benefits.
>
> drivers/gpu/drm/i915/display/intel_atomic_plane.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 10e1fc9d0698..c6e43d684458 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -921,6 +921,21 @@ int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
> */
> plane_state->uapi.visible = drm_rect_clip_scaled(src, dst, clip);
>
> + /*
> + * Avoid zero source size when we later
> + * discard the fractional coords.
> + *
> + * FIXME add proper sub-pixel coordinate handling
> + * for platforms/planes that support it.
> + */
> + if (plane_state->uapi.visible &&
> + (drm_rect_width(src) < 0x10000 || drm_rect_height(src) < 0x10000)) {
> + drm_dbg_kms(&i915->drm, "Plane source must be at least 1x1 pixels\n");
> + drm_rect_debug_print("src: ", src, true);
> + drm_rect_debug_print("dst: ", dst, false);
> + return -EINVAL;
> + }
Scratch that. Went with Drew's original patch instead.
> +
> drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
>
> if (!can_position && plane_state->uapi.visible &&
> --
> 2.38.2
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-01-12 18:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 15:21 [Intel-gfx] [PATCH] drm/i915: Reject < 1x1 pixel plane source size Ville Syrjala
2023-01-12 15:21 ` Ville Syrjala
2023-01-12 16:56 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-01-12 18:29 ` Ville Syrjälä [this message]
2023-01-12 18:29 ` [PATCH] " Ville Syrjälä
2023-01-13 5:46 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork
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=Y8BRe4DUUsRou4uN@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=ddavenport@chromium.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stable@vger.kernel.org \
/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.