From: "Mun, Gwan-gyeong" <gwan-gyeong.mun@intel.com>
To: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Souza, Jose" <jose.souza@intel.com>
Subject: Re: [Intel-gfx] [PATCH 2/6] drm/i915/display/psr: Use plane damage clips to calculate damaged area
Date: Mon, 26 Oct 2020 21:40:23 +0000 [thread overview]
Message-ID: <39fe2eb7bb30de6eed687592f70f6652ca12e24f.camel@intel.com> (raw)
In-Reply-To: <20201013230121.331595-2-jose.souza@intel.com>
On Tue, 2020-10-13 at 16:01 -0700, José Roberto de Souza wrote:
> Now using plane damage clips property to calcualte the damaged area.
> Selective fetch only supports one region to be fetched so software
> needs to calculate a bounding box around all damage clips.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_psr.c | 54 +++++++++++++++++++++-
> --
> 1 file changed, 49 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index 773a5b5fa078..0f1e9f0fa57f 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1273,6 +1273,9 @@ int intel_psr2_sel_fetch_update(struct
> intel_atomic_state *state,
> for_each_oldnew_intel_plane_in_state(state, plane,
> old_plane_state,
> new_plane_state, i) {
> struct drm_rect *sel_fetch_area, temp;
> + struct drm_mode_rect *damaged_clips;
> + u32 num_clips;
> + int j;
>
> if (new_plane_state->uapi.crtc != crtc_state-
> >uapi.crtc)
> continue;
> @@ -1291,13 +1294,54 @@ int intel_psr2_sel_fetch_update(struct
> intel_atomic_state *state,
> if (!new_plane_state->uapi.visible)
> continue;
>
> + sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;
> + sel_fetch_area->y1 = -1;
> +
> + damaged_clips =
> drm_plane_get_damage_clips(&new_plane_state->uapi);
> + num_clips =
> drm_plane_get_damage_clips_count(&new_plane_state->uapi);
> +
> /*
> - * For now doing a selective fetch in the whole plane
> area,
> - * optimizations will come in the future.
> + * If plane moved, mark the whole plane area as damaged
> as it
> + * needs to be complete redraw in the new position.
> */
> - sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;
> - sel_fetch_area->y1 = new_plane_state->uapi.src.y1 >>
> 16;
> - sel_fetch_area->y2 = new_plane_state->uapi.src.y2 >>
> 16;
> + if (!drm_rect_equals(&new_plane_state->uapi.dst,
> + &old_plane_state->uapi.dst)) {
> + num_clips = 0;
> + sel_fetch_area->y1 = new_plane_state-
> >uapi.src.y1 >> 16;
> + sel_fetch_area->y2 = new_plane_state-
> >uapi.src.y2 >> 16;
> + } else if (!num_clips && new_plane_state->uapi.fb !=
> + old_plane_state->uapi.fb) {
> + /*
> + * If the plane don't have damage areas but the
> + * framebuffer changed, mark the whole plane
> area as
> + * damaged.
> + */
> + sel_fetch_area->y1 = new_plane_state-
> >uapi.src.y1 >> 16;
> + sel_fetch_area->y2 = new_plane_state-
> >uapi.src.y2 >> 16;
> + }
> +
why don't you use drm_atomic_helper_damage_merged() function here?
> + for (j = 0; j < num_clips; j++) {
> + struct drm_rect damage_area;
> +
> + damage_area.y1 = damaged_clips[j].y1;
> + damage_area.y2 = damaged_clips[j].y2;
> + clip_area_update(sel_fetch_area, &damage_area);
> + }
> +
> + /*
> + * No page flip, no plane moviment or no damage areas,
> so don't
typo (moviment -> movement)
> + * fetch any pixel from memory for this plane
> + */
> + if (sel_fetch_area->y1 == -1) {
> + sel_fetch_area->y1 = 0;
> + sel_fetch_area->y2 = 0;
> + }
> +
> + /* Don't need to redraw plane damaged areas outside of
> screen */
> + j = sel_fetch_area->y2 + (new_plane_state->uapi.dst.y1
> >> 16);
src coordinates of the drm_plane_state are 16.16 fixed point but dst
coordinates are not 16.16 fixed point.
therefore we don't need to bit shift for dst.
Because the sel_fetch_area seems based on src coordinates, in order to
apply to dst coordinates here, it requires coordinate calculation.
> + j = crtc_state->uapi.adjusted_mode.crtc_vdisplay - j;
> + if (j < 0)
> + sel_fetch_area->y2 += j;
>
> temp = *sel_fetch_area;
> temp.y1 += new_plane_state->uapi.dst.y1 >> 16;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-10-26 21:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 23:01 [Intel-gfx] [PATCH 1/6] drm/i915/display/psr: Calculate selective fetch plane registers José Roberto de Souza
2020-10-13 23:01 ` [Intel-gfx] [PATCH 2/6] drm/i915/display/psr: Use plane damage clips to calculate damaged area José Roberto de Souza
2020-10-26 21:40 ` Mun, Gwan-gyeong [this message]
2020-10-27 1:04 ` Souza, Jose
2020-10-27 20:12 ` Souza, Jose
2020-12-01 17:26 ` Mun, Gwan-gyeong
2020-12-01 17:39 ` Souza, Jose
2020-12-01 19:40 ` Mun, Gwan-gyeong
2020-12-01 21:15 ` Souza, Jose
2020-12-02 10:22 ` Mun, Gwan-gyeong
2020-10-13 23:01 ` [Intel-gfx] [PATCH 3/6] drm/i915/display/psr: Consider other planes to damaged area calculation José Roberto de Souza
2020-10-27 13:34 ` Mun, Gwan-gyeong
2020-10-27 17:25 ` Souza, Jose
2020-12-01 17:33 ` Mun, Gwan-gyeong
2020-12-01 17:44 ` Souza, Jose
2020-12-01 19:44 ` Mun, Gwan-gyeong
2020-10-13 23:01 ` [Intel-gfx] [PATCH 4/6] drm/i915/display: Split and export main surface calculation from skl_check_main_surface() José Roberto de Souza
2020-10-13 23:01 ` [Intel-gfx] [PATCH 5/6] RFC/WIP: drm/i915/display/psr: Consider tiling when doing the plane offset calculation José Roberto de Souza
2020-10-13 23:01 ` [Intel-gfx] [PATCH 6/6] DEBUG: drm/i915/display: Add debug information to selective fetch José Roberto de Souza
2020-10-13 23:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] drm/i915/display/psr: Calculate selective fetch plane registers Patchwork
2020-10-13 23:06 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-10-13 23:31 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-10-14 15:36 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-10-26 21:13 ` [Intel-gfx] [PATCH 1/6] " Mun, Gwan-gyeong
2020-10-27 0:24 ` Souza, Jose
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=39fe2eb7bb30de6eed687592f70f6652ca12e24f.camel@intel.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).