Skip to contentSkip to conversation

drm: Add function to convert rect in 16.16 fixed format to regular format

PATCH Superseded José Roberto de Souza 4 participants 22 messages Dec 14, 2020 – Dec 17, 2020

Subsystems (4)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/5 drm: Add function to convert rect in 16.16 fixed format to regular format

Much more clear to read one function call than four lines doing this conversion.

---
 drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
 include/drm/drm_rect.h     |  2 ++
 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_rect.c +15 -0
index 0460e874896e..24345704b353 100644
@@ -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;
+}
+EXPORT_SYMBOL(drm_rect_convert_16_16_to_regular);
include/drm/drm_rect.h +2 -0
index e7f4d24cdd00..2ef8180416cd 100644
@@ -223,5 +223,7 @@ void drm_rect_rotate(struct drm_rect *r,
 void drm_rect_rotate_inv(struct drm_rect *r,
 			 int width, int height,
 			 unsigned int rotation);
+void drm_rect_convert_16_16_to_regular(struct drm_rect *in,
+				       struct drm_rect *out);
 
 #endif
Signature · 6 lines
2.29.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v6 2/5 drm/i915/display/psr: Use plane damage clips to calculate damaged area

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.

Now that we are not complete fetching each plane, there is another loop needed as all the plane areas that intersect with the pipe damaged area needs to be fetched from memory so the complete blending of all planes can happen.

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16 format

v4:
- setting plane selective fetch area using the whole pipe damage area
- mark the whole plane area damaged if plane visibility or alpha changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but are invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or it moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 98 +++++++++++++++++++++---
 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +86 -12
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 				struct intel_crtc *crtc)
 {
 	struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = -1 };
 	struct intel_plane_state *new_plane_state, *old_plane_state;
-	struct drm_rect pipe_clip = { .y1 = -1 };
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 	if (ret)
 		return ret;
 
+	/*
+	 * Calculate minimal selective fetch area of each plane and calculate
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will actually be set
+	 * using whole pipe damaged area.
+	 */
 	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_rect src, damaged_area = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = -1 };
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;
 
 		if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc)
 			continue;
@@ -1300,23 +1308,89 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 			break;
 		}
 
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_state->uapi.src, &src);
+		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 visibility or plane moved, mark the whole plane area as
+		 * damaged as it needs to be complete redraw in the new and old
+		 * position.
 		 */
+		if (new_plane_state->uapi.visible != old_plane_state->uapi.visible ||
+		    !drm_rect_equals(&new_plane_state->uapi.dst,
+				     &old_plane_state->uapi.dst)) {
+			damaged_area.y1 = old_plane_state->uapi.src.y1 >> 16;
+			damaged_area.y1 = old_plane_state->uapi.src.y2 >> 16;
+			damaged_area.y1 += old_plane_state->uapi.dst.y1;
+			damaged_area.y2 += old_plane_state->uapi.dst.y1;
+			clip_area_update(&pipe_clip, &damaged_area);
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		} else if (new_plane_state->uapi.alpha != old_plane_state->uapi.alpha) {
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		} 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.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state->uapi.dst.y1;
+		damaged_area.y2 += new_plane_state->uapi.dst.y1;
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it intersect with
+	 * every plane, if it does set the plane selective fetch area.
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
+					     new_plane_state, i) {
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc ||
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter, &new_plane_state->uapi.dst))
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_state->uapi.src, &src);
+
 		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;
+		sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1;
+		sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1;
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;
 
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);
 	}
 
+skip_sel_fetch_set_loop:
 	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update);
 	return 0;
 }
Signature · 6 lines
2.29.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 9 lines · José Roberto de Souza

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.

Now that we are not complete fetching each plane, there is another loop needed as all the plane areas that intersect with the pipe damaged area needs to be fetched from memory so the complete blending of all planes can happen.

Hi,

Quoted 2 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16

Typo on commit message. shifthing -> shifting

Quoted 104 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage area
- mark the whole plane area damaged if plane visibility or alpha changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but are invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or it moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 98 +++++++++++++++++++++-
--
 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +1 -1
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 				struct intel_crtc *crtc)
 {
 	struct intel_crtc_state *crtc_state =
 intel_atomic_get_new_crtc_state(state, crtc);
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,
 .y2 = -1 };
 	struct intel_plane_state *new_plane_state, *old_plane_state;
-	struct drm_rect pipe_clip = { .y1 = -1 };
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 	if (ret)
 		return ret;
 
+	/*
+	 * Calculate minimal selective fetch area of each plane and

calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */
 	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +3 -2
 					     new_plane_state, i) {
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0, .y1 =
-1, .x2 = INT_MAX, .y2 = -1 };
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;
 
 		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc)

drivers/gpu/drm/i915/display/intel_psr.c +4 -4
 			continue;
@@ -1300,23 +1308,89 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 			break;
 		}
 
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
 >uapi.src, &src);
+		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 visibility or plane moved, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in the new

and old

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		 * position.
 		 */
+		if (new_plane_state->uapi.visible != old_plane_state-
Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		    !drm_rect_equals(&new_plane_state->uapi.dst,
+				     &old_plane_state->uapi.dst)) {
+			damaged_area.y1 = old_plane_state->uapi.src.y1
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state->uapi.src.y2
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+			clip_area_update(&pipe_clip, &damaged_area);
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
The pipe damaged area (The Selective Update region) needs to
accumulate being visible plane's dst between old and new plane's dst.

if you are implementing this scenario, the code shoule be like this,

if (new_plane_state->uapi.visible != old_plane_state->uapi.visible) {

   if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1;
      damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1;
      damaged_area.y2 = old_plane_state->uapi.dst.y2;

}
clip_area_update(&pipe_clip, &damaged_area);
continue;
}

2. Move case
The pipe damaged area (The Selective Update region) needs to
accumulate both old and new plane's dst

if you are implementing this scenario, the code shoule be like this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not optimized, it can be treated with the move section)

else if (new_plane_state->uapi.alpha != old_plane_state->uapi.alpha) {
damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb != old_plane_state-
Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			/*
+			 * If the plane don't have damage areas but the
+			 * framebuffer changed, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

/*
* If the plane don't have damage areas but the
* framebuffer changed, mark the whole plane area as
* damaged.
*/
damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1362

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +10 -0
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state->uapi.dst.y1;
+		damaged_area.y2 += new_plane_state->uapi.dst.y1;
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+

else if (num_clips) {
struct drm_rect plane_damaged_area;
plane_damaged_area.x1 = src.x1;
plane_damaged_area.x2 = src.x2;
plane_damaged_area.y1 = 0;
plane_damaged_area.y2 = 0;

   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;
      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

      if (drm_rect_intersect(&clip, &src)) {
         clip_area_update(&plane_damaged_area, &clip);
      }

}

if (drm_rect_visible(plane_damaged_area)) {
plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 +
new_plane_state->uapi.dst.y1;
plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 +
new_plane_state->uapi.dst.y1;

     clip_area_update(&pipe_clip, &plane_damaged_area);
     continue;

}
}
the calculation and translating cooridinates is alreay implemented here ( https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
it has commetns which explains scenarios.)

Quoted 34 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it intersect

with

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+	 * every plane, if it does set the plane selective fetch area.
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+					     new_plane_state, i) {
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc 

||

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter, &new_plane_state-
Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
+
 		sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;
-		sel_fetch_area->y1 = new_plane_state->uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state->uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 - new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 - new_plane_state-
Quoted 1 line
Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1 + src.y1; sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1 + src.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1390

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_psr.c +3 -4
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;
 
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1396

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
 	}
 
+skip_sel_fetch_set_loop:
 	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update);
 	return 0;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 141 lines · Gwan-gyeong
Quoted 9 lines · José Roberto de Souza

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.

Now that we are not complete fetching each plane, there is another loop needed as all the plane areas that intersect with the pipe damaged area needs to be fetched from memory so the complete blending of all planes can happen.

Hi,

Quoted 2 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16

Typo on commit message. shifthing -> shifting

Quoted 116 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage area
- mark the whole plane area damaged if plane visibility or alpha changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but are invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or it moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>

---
 drivers/gpu/drm/i915/display/intel_psr.c | 98 +++++++++++++++++++++- --

 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  				struct intel_crtc *crtc)
  {

  struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,

.y2 = -1 };
  struct intel_plane_state *new_plane_state, *old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };

  struct intel_plane *plane;
  bool full_update = false;
  int i, ret;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  	if (ret)
  		return ret;

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	/*
+	 * Calculate minimal selective fetch area of each plane and

calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */

  for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
  new_plane_state, i) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -2
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0, .y1 =
-1, .x2 = INT_MAX, .y2 = -1 };
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;

  if (new_plane_state->uapi.crtc != crtc_state-

Quoted 1 line

uapi.crtc)

  continue;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1300,23 +1308,89 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  			break;
  		}

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state->uapi);

  /*

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		 * For now doing a selective fetch in the whole plane

area,

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		 * optimizations will come in the future.
+		 * If visibility or plane moved, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in the new

and old

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * position.

  */

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		if (new_plane_state->uapi.visible != old_plane_state-
Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		    !drm_rect_equals(&new_plane_state->uapi.dst,
+				     &old_plane_state->uapi.dst)) {
+			damaged_area.y1 = old_plane_state->uapi.src.y1
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state->uapi.src.y2
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+			clip_area_update(&pipe_clip, &damaged_area);
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
 The pipe damaged area (The Selective Update region) needs to accumulate being visible plane's dst between old and new plane's dst.

if you are implementing this scenario, the code shoule be like this,

Quoted 11 lines

if (new_plane_state->uapi.visible != old_plane_state->uapi.visible) { if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2;
   }
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}

The current code does exactly above but discards the clipped in uapi.src.

Quoted 4 lines

2. Move case
 The pipe damaged area (The Selective Update region) needs to accumulate both old and new plane's dst

same

Quoted 30 lines

if you are implementing this scenario, the code shoule be like this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not optimized, it can be treated with the move section)

no need to handle like this for alpha, if the plane moved if will be handled in the "if" above with or without alpha change, if it did not moved but alpha change no need to add the old state coordinate to the pipe clip.

Quoted 126 lines

else if (new_plane_state->uapi.alpha != old_plane_state->uapi.alpha) { damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb != old_plane_state-
Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			/*
+			 * If the plane don't have damage areas but the
+			 * framebuffer changed, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

   /*
    * If the plane don't have damage areas but the
    * framebuffer changed, mark the whole plane area as
    * damaged.
    */
   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1362

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +10 -0
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state->uapi.dst.y1;
+		damaged_area.y2 += new_plane_state->uapi.dst.y1;
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+

else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;

   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

Quoted 8 lines

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

      if (drm_rect_intersect(&clip, &src)) { clip_area_update(&plane_damaged_area, &clip); }

Call intersect at every clip? that don't look optimized.

Quoted 8 lines

   }

  if (drm_rect_visible(plane_damaged_area)) { plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 + new_plane_state->uapi.dst.y1;
     plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 + new_plane_state->uapi.dst.y1;

Quoted 4 lines

     clip_area_update(&pipe_clip, &plane_damaged_area); continue;
  }
}

Current code sum all the damage clips, if the sum of the damage clips insect with the src area it is translated to pipe coordinates and called clip_area_update() to update pipe_clip.

Quoted 35 lines

the calculation and translating cooridinates is alreay implemented here ( https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
  it has commetns which explains scenarios.)

Quoted 32 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it intersect

with

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+	 * every plane, if it does set the plane selective fetch area.
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+					     new_plane_state, i) {
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc 
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter, &new_plane_state-
Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
Quoted 1 line

uapi.src, &src);

+
  sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state->uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state->uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 - new_plane_state-
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 - new_plane_state-
Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1 + src.y1; sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1 + src.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; + drm_rect_intersect(sel_fetch_area, &src); does a the same job and is easier to understand(translation + clip)

Quoted 130 lines
Quoted 130 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;

Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1390

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 129 lines
Quoted 129 lines

  }

Quoted 4 lines
Quoted 4 lines

+skip_sel_fetch_set_loop:
  psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update); return 0;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 166 lines · Jose
Quoted 153 lines · Gwan-gyeong
Quoted 6 lines · José Roberto de Souza

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.

Quoted 7 lines

Now that we are not complete fetching each plane, there is another
loop needed as all the plane areas that intersect with the pipe damaged area needs to be fetched from memory so the complete blending
of all planes can happen.

Hi,

Quoted 3 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16

Typo on commit message. shifthing -> shifting

Quoted 120 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage area
- mark the whole plane area damaged if plane visibility or alpha changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--
 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +1 -1
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 				struct intel_crtc *crtc)
 {
 	struct intel_crtc_state *crtc_state =
 intel_atomic_get_new_crtc_state(state, crtc);
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,
 .y2 = -1 };
 	struct intel_plane_state *new_plane_state, *old_plane_state;
-	struct drm_rect pipe_clip = { .y1 = -1 };
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 	if (ret)
 		return ret;
 
 
 
 
+	/*
+	 * Calculate minimal selective fetch area of each plane and

calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */
 	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +3 -2
 					     new_plane_state, i) {
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0, .y1 =
-1, .x2 = INT_MAX, .y2 = -1 };
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;
 
 
 
 
 		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc)

drivers/gpu/drm/i915/display/intel_psr.c +4 -4
 			continue;
@@ -1300,23 +1308,89 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 			break;
 		}
 
 
 
 
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
 > uapi.src, &src);
+		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 visibility or plane moved, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in the new

and old

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		 * position.
 		 */
+		if (new_plane_state->uapi.visible != old_plane_state-
Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		    !drm_rect_equals(&new_plane_state->uapi.dst,
+				     &old_plane_state->uapi.dst)) {
+			damaged_area.y1 = old_plane_state->uapi.src.y1
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state->uapi.src.y2
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+			clip_area_update(&pipe_clip, &damaged_area);
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
The pipe damaged area (The Selective Update region) needs to
accumulate being visible plane's dst between old and new plane's dst.

if you are implementing this scenario, the code shoule be like this,

if (new_plane_state->uapi.visible != old_plane_state->uapi.visible)

Quoted 11 lines
{
   if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1;
      damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1;
      damaged_area.y2 = old_plane_state->uapi.dst.y2;
   }
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 3 lines

The current code does exactly above but discards the clipped in uapi.src.

in order to accumlate the pipe damage area, we don't need to use and calculate src coordinates on move and visibility change scenarios. we can easily accumalates than additional calculation.

Quoted 4 lines
Quoted 3 lines

2. Move case
The pipe damaged area (The Selective Update region) needs to
accumulate both old and new plane's dst

Quoted 42 lines

same

Quoted 39 lines

if you are implementing this scenario, the code shoule be like this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   















   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha scenario of me.

Quoted 137 lines

no need to handle like this for alpha, if the plane moved if will be handled in the "if" above with or without alpha change, if it did not moved but
alpha change no need to add the old state coordinate to the pipe clip.

Quoted 131 lines

else if (new_plane_state->uapi.alpha != old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   































































   continue;
} 

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb != old_plane_state-
Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			/*
+			 * If the plane don't have damage areas but the
+			 * framebuffer changed, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

/*
* If the plane don't have damage areas but the
* framebuffer changed, mark the whole plane area as
* damaged.
*/

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1362

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +10 -0
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state->uapi.dst.y1;
+		damaged_area.y2 += new_plane_state->uapi.dst.y1;
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+
else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;
	        
   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;
Quoted 6 lines
Quoted 3 lines
      if (drm_rect_intersect(&clip, &src)) {
         clip_area_update(&plane_damaged_area, &clip);
      }

Call intersect at every clip? that don't look optimized.

when the clip_area_update() is called it just accumulates the input rects to one output rect.
it might lead to accumulating unneeded excessive update rect region

Quoted 59 lines
Quoted 9 lines
   }

if (drm_rect_visible(plane_damaged_area)) {
plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 +
new_plane_state->uapi.dst.y1;
plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 +
new_plane_state->uapi.dst.y1;

Quoted 4 lines
     clip_area_update(&pipe_clip, &plane_damaged_area);
     continue;

}
}

Current code sum all the damage clips, if the sum of the damage clips insect with the src area it is translated to pipe coordinates and called
clip_area_update() to update pipe_clip.

Quoted 40 lines

the calculation and translating cooridinates is alreay implemented here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
it has commetns which explains scenarios.)

Quoted 35 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it intersect

with

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+	 * every plane, if it does set the plane selective fetch area.
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+					     new_plane_state, i) {
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter, &new_plane_state-
Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
+
 		sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;
-		sel_fetch_area->y1 = new_plane_state->uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state->uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 - new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 - new_plane_state-
Quoted 1 line

uapi.dst.y1;

Quoted 9 lines
Quoted 4 lines

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1 + src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1 + src.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; + drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to understand(translation + clip)

when the src's x1 and y1 indicates over than 0, does it work?

Quoted 130 lines
Quoted 130 lines
Quoted 130 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;
Quoted 143 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1390

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 133 lines
Quoted 133 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
 	}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
+skip_sel_fetch_set_loop:
 	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update);
 	return 0;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 179 lines · Gwan-gyeong
Quoted 178 lines · Jose
Quoted 176 lines · Gwan-gyeong
Quoted 6 lines · José Roberto de Souza

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.

Quoted 7 lines

Now that we are not complete fetching each plane, there is another
loop needed as all the plane areas that intersect with the pipe damaged area needs to be fetched from memory so the complete blending
of all planes can happen.

Hi,

Quoted 3 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16

Typo on commit message. shifthing -> shifting

Quoted 132 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage area
- mark the whole plane area damaged if plane visibility or alpha changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>

---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--

 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  				struct intel_crtc *crtc)
  {

  struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX,

.y2 = -1 };
  struct intel_plane_state *new_plane_state, *old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };

  struct intel_plane *plane;
  bool full_update = false;
  int i, ret;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  	if (ret)
  		return ret;

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	/*
+	 * Calculate minimal selective fetch area of each plane and

calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */

  for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
  new_plane_state, i) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -2
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0, .y1 =
-1, .x2 = INT_MAX, .y2 = -1 };
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;

  if (new_plane_state->uapi.crtc != crtc_state-

Quoted 1 line

uapi.crtc)

  continue;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1300,23 +1308,89 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  			break;
  		}

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state->uapi);

  /*

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		 * For now doing a selective fetch in the whole plane

area,

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		 * optimizations will come in the future.
+		 * If visibility or plane moved, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in the new

and old

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * position.

  */

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		if (new_plane_state->uapi.visible != old_plane_state-
Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		    !drm_rect_equals(&new_plane_state->uapi.dst,
+				     &old_plane_state->uapi.dst)) {
+			damaged_area.y1 = old_plane_state->uapi.src.y1
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state->uapi.src.y2
Quoted 1 line
Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+			clip_area_update(&pipe_clip, &damaged_area);
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
 The pipe damaged area (The Selective Update region) needs to accumulate being visible plane's dst between old and new plane's dst.

if you are implementing this scenario, the code shoule be like this,

if (new_plane_state->uapi.visible != old_plane_state->uapi.visible) {
   if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2;
   }
   clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 6 lines
Quoted 3 lines

The current code does exactly above but discards the clipped in uapi.src.

in order to accumlate the pipe damage area, we don't need to use and calculate src coordinates on move and visibility change scenarios. we can easily accumalates than additional calculation.

Using uapi.dst will cause additional and unnecessary area be included to the pipe damaged area, imagine that a plane have src.x1 = 50, src.y1 = 100, ... the plane invisible/cropped area don't need to be added to the pipe damaged area.

Quoted 203 lines
Quoted 4 lines
Quoted 3 lines

2. Move case
 The pipe damaged area (The Selective Update region) needs to accumulate both old and new plane's dst

Quoted 49 lines

same

Quoted 46 lines

if you are implementing this scenario, the code shoule be like this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha scenario of me.

Quoted 148 lines

no need to handle like this for alpha, if the plane moved if will be handled in the "if" above with or without alpha change, if it did not moved but
alpha change no need to add the old state coordinate to the pipe clip.

Quoted 141 lines

else if (new_plane_state->uapi.alpha != old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb != old_plane_state-
Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			/*
+			 * If the plane don't have damage areas but the
+			 * framebuffer changed, mark the whole plane

area as

drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

   /*
    * If the plane don't have damage areas but the
    * framebuffer changed, mark the whole plane area as
    * damaged.
    */
   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1362

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +10 -0
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state->uapi.dst.y1;
+		damaged_area.y2 += new_plane_state->uapi.dst.y1;
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+

else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;

   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

      if (drm_rect_intersect(&clip, &src)) { clip_area_update(&plane_damaged_area, &clip); }

Quoted 5 lines
Quoted 2 lines

Call intersect at every clip? that don't look optimized.

when the clip_area_update() is called it just accumulates the input rects to one output rect.
it might lead to accumulating unneeded excessive update rect region

The excessive rect region will be removed once after sum all clips in the current approach.

Quoted 64 lines
Quoted 64 lines
Quoted 9 lines

   }

  if (drm_rect_visible(plane_damaged_area)) { plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 + new_plane_state->uapi.dst.y1;
     plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 + new_plane_state->uapi.dst.y1;

Quoted 4 lines

     clip_area_update(&pipe_clip, &plane_damaged_area); continue;
  }
}

Current code sum all the damage clips, if the sum of the damage clips insect with the src area it is translated to pipe coordinates and called
clip_area_update() to update pipe_clip.

Quoted 44 lines

the calculation and translating cooridinates is alreay implemented here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
  it has commetns which explains scenarios.)

Quoted 34 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it intersect

with

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+	 * every plane, if it does set the plane selective fetch area.
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+					     new_plane_state, i) {
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter, &new_plane_state-
Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_state-
Quoted 1 line

uapi.src, &src);

+
  sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state->uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state->uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 - new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 - new_plane_state-
Quoted 1 line
Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1 + src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1 + src.y1;

Quoted 5 lines
Quoted 4 lines

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; + drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to understand(translation + clip)

when the src's x1 and y1 indicates over than 0, does it work?

It will, we use it for scenarios like that in this function.

Quoted 299 lines
Quoted 299 lines
Quoted 145 lines
Quoted 145 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;

Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1390

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 144 lines
Quoted 144 lines

  }

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

+skip_sel_fetch_set_loop:
  psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update); return 0;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 212 lines · Jose
Quoted 203 lines · Gwan-gyeong
Quoted 202 lines · Jose
Quoted 200 lines · Gwan-gyeong
Quoted 7 lines · José Roberto de Souza

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.

Quoted 8 lines

Now that we are not complete fetching each plane, there is another
loop needed as all the plane areas that intersect with the pipe
damaged area needs to be fetched from memory so the complete blending
of all planes can happen.

Hi,

Quoted 3 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16

Typo on commit message. shifthing -> shifting

Quoted 153 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage
area
- mark the whole plane area damaged if plane visibility or alpha
changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but
are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or
it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--
 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 				struct intel_crtc *crtc)
 {
 	struct intel_crtc_state *crtc_state =
 intel_atomic_get_new_crtc_state(state, crtc);
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 =
 INT_MAX,
 .y2 = -1 };
 	struct intel_plane_state *new_plane_state,

*old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +2 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
 	if (ret)
 		return ret;
 
 
 
 
 
 
 
+	/*
+	 * Calculate minimal selective fetch area of each plane

and
calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */
 	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,
new_plane_state,
i) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0,

.y1 =
-1, .x2 = INT_MAX, .y2 = -1 };

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;
 
 
 
 
 
 
 
 		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc)

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
 			continue;
@@ -1300,23 +1308,89 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
 			break;
 		}
 
 
 
 
 
 
 
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
 		/*
-		 * For now doing a selective fetch in the whole

plane
area,

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		 * optimizations will come in the future.
+		 * If visibility or plane moved, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in

the new
and old

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		 * position.
 		 */
+		if (new_plane_state->uapi.visible !=

old_plane_state-

Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		    !drm_rect_equals(&new_plane_state-
Quoted 1 line

uapi.dst,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+				     &old_plane_state-
Quoted 1 line

uapi.dst)) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y1

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y2

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			clip_area_update(&pipe_clip,

&damaged_area);

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
The pipe damaged area (The Selective Update region) needs to
accumulate being visible plane's dst between old and new plane's
dst.

if you are implementing this scenario, the code shoule be like this,

if (new_plane_state->uapi.visible != old_plane_state-

Quoted 1 line

uapi.visible)

{
   if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1;
      damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1;
      damaged_area.y2 = old_plane_state->uapi.dst.y2;
   }
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 7 lines
Quoted 3 lines

The current code does exactly above but discards the clipped in uapi.src.

in order to accumlate the pipe damage area, we don't need to use and
calculate src coordinates on move and visibility change scenarios. we can easily accumalates than additional calculation.

Quoted 6 lines

Using uapi.dst will cause additional and unnecessary area be included to the pipe damaged area, imagine that a plane have src.x1 = 50, src.y1 = 100,
... the plane invisible/cropped area don't need to be added to the pipe damaged area.

easist way to get damaged area for crtc is just using uapi.dst but because fb damage clip follows uapi.src coordinates, we have to translate fb damage clip's coordinates to dst coordinates for accumulating crtc damage region.

therefore can you explain what is the exact burden of using uapi.dst for calculating crtc damage area?

Quoted 212 lines
Quoted 212 lines
Quoted 53 lines
Quoted 4 lines

2. Move case
The pipe damaged area (The Selective Update region) needs to
accumulate both old and new plane's dst

same

Quoted 46 lines

if you are implementing this scenario, the code shoule be like this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   






















   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha scenario
of me.

Quoted 156 lines

no need to handle like this for alpha, if the plane moved if will be
handled in the "if" above with or without alpha change, if it did not
moved but
alpha change no need to add the old state coordinate to the pipe clip.

Quoted 147 lines

else if (new_plane_state->uapi.alpha != old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   






































































   continue;
} 
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb !=

old_plane_state-

Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+			/*
+			 * If the plane don't have damage areas

but the

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			 * framebuffer changed, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

/*
* If the plane don't have damage areas but the
* framebuffer changed, mark the whole plane area as
* damaged.
*/

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_psr.c +12 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_area.y2 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+
else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;
	        
   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

      if (drm_rect_intersect(&clip, &src)) {
         clip_area_update(&plane_damaged_area, &clip);
      }
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Call intersect at every clip? that don't look optimized.

when the clip_area_update() is called it just accumulates the input rects to one output rect.
it might lead to accumulating unneeded excessive update rect region

The excessive rect region will be removed once after sum all clips in the current approach.

on the link's 2nd page,
we only need a red Selective Fetch area, but your patch seems Selective Fetch area as green rect.
https://docs.google.com/presentation/d/1gOKE4JnC97RzRg15ZM8IaQzHnifIxwvwP_UbOoGFE9E/edit?usp=sharing

Quoted 75 lines
Quoted 75 lines
Quoted 75 lines
Quoted 8 lines
   }

if (drm_rect_visible(plane_damaged_area)) {
plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 +
new_plane_state->uapi.dst.y1;
plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 +
new_plane_state->uapi.dst.y1;

Quoted 4 lines
     clip_area_update(&pipe_clip, &plane_damaged_area);
     continue;

}
}

Current code sum all the damage clips, if the sum of the damage clips
insect with the src area it is translated to pipe coordinates and called
clip_area_update() to update pipe_clip.

Quoted 55 lines

the calculation and translating cooridinates is alreay implemented
here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
it has commetns which explains scenarios.)

Quoted 43 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it

intersect
with

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	 * every plane, if it does set the plane selective

fetch area.

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+					     new_plane_state,

i) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter,

&new_plane_state-

Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+
 		sel_fetch_area = &new_plane_state-
Quoted 1 line

psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state-
Quoted 1 line

uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state-
Quoted 1 line

uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 -

new_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 -
Quoted 2 lines

new_plane_state-

Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1 + src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1 + src.y1;

Quoted 10 lines
Quoted 6 lines
Quoted 5 lines

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; + drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to understand(translation + clip)

when the src's x1 and y1 indicates over than 0, does it work?

It will, we use it for scenarios like that in this function.

here is the problematic case,
if we assume src indicates 50 x 50 +10 +10
,fb damage rect indicates 5 x 5 +55 +55
and dst indicates 50 x 50 +100 +100

1) if whole plane src area needs to be updated
inter: 50 x 50 +100 +100
sel_fetch_area->y1 = 100 - 100 => 0
sel_fetch_area->y2 = 100 - 100 => 0

drm_rect_intersect(sel_fetch_area, &src);
=> sel_fetch_area does not fit whole src area.

2) if only the plane fb damage needs to be updated translate fb damage's coordinates to crtc coordinates 5 x 5 +55 +55 => 5 x 5 +105 +105
inter: 5 x 5 +105 +105
sel_fetch_area->y1 = 105 - 100 => 5 sel_fetch_area->y2 = 105 - 100 => 5

drm_rect_intersect(sel_fetch_area, &src);
=> sel_fetch_area does not fit to src's damage area.

Quoted 299 lines
Quoted 299 lines
Quoted 299 lines
Quoted 145 lines
Quoted 145 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1390

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 144 lines
Quoted 144 lines

}

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+skip_sel_fetch_set_loop:
 	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip,

full_update);
return 0;
}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 231 lines · Gwan-gyeong
Quoted 224 lines · Jose
Quoted 215 lines · Gwan-gyeong
Quoted 214 lines · Jose
Quoted 212 lines · Gwan-gyeong
Quoted 7 lines · José Roberto de Souza

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.

Quoted 8 lines

Now that we are not complete fetching each plane, there is another
loop needed as all the plane areas that intersect with the pipe
damaged area needs to be fetched from memory so the complete blending
of all planes can happen.

Hi,

Quoted 3 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in 16.16

Typo on commit message. shifthing -> shifting

Quoted 165 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage
area
- mark the whole plane area damaged if plane visibility or alpha
changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible but
are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or
it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc Ville Syrjälä <[email protected]>
Cc Gwan-gyeong Mun <[email protected]>

---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--

 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  				struct intel_crtc *crtc)
  {

  struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 =

INT_MAX,
.y2 = -1 };
  struct intel_plane_state *new_plane_state, *old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };

  struct intel_plane *plane;
  bool full_update = false;
  int i, ret;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1282,9 +1282,17 @@ int intel_psr2_sel_fetch_update(struct
 intel_atomic_state *state,
  	if (ret)
  		return ret;

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	/*
+	 * Calculate minimal selective fetch area of each plane

and
calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */

  for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
  new_plane_state,
i) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0,

.y1 =
-1, .x2 = INT_MAX, .y2 = -1 };

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;

  if (new_plane_state->uapi.crtc != crtc_state-

Quoted 1 line

uapi.crtc)

  continue;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1300,23 +1308,89 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,
  break;
  }

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state->uapi);

  /*

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		 * For now doing a selective fetch in the whole

plane
area,

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		 * optimizations will come in the future.
+		 * If visibility or plane moved, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in

the new
and old

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * position.

  */

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		if (new_plane_state->uapi.visible !=

old_plane_state-

Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		    !drm_rect_equals(&new_plane_state-
Quoted 1 line

uapi.dst,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+				     &old_plane_state-
Quoted 1 line

uapi.dst)) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y1

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y2

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			clip_area_update(&pipe_clip,

&damaged_area);

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
 The pipe damaged area (The Selective Update region) needs to accumulate being visible plane's dst between old and new plane's
dst.

if you are implementing this scenario, the code shoule be like this,

if (new_plane_state->uapi.visible != old_plane_state-

Quoted 1 line

uapi.visible)

{
   if (new_plane_state->uapi.visible) { damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; }
   clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 7 lines
Quoted 3 lines

The current code does exactly above but discards the clipped in uapi.src.

in order to accumlate the pipe damage area, we don't need to use and
calculate src coordinates on move and visibility change scenarios. we can easily accumalates than additional calculation.

Quoted 6 lines

Using uapi.dst will cause additional and unnecessary area be included to the pipe damaged area, imagine that a plane have src.x1 = 50, src.y1 = 100,
... the plane invisible/cropped area don't need to be added to the pipe damaged area.

Quoted 8 lines

easist way to get damaged area for crtc is just using uapi.dst but because fb damage clip follows uapi.src coordinates, we have to translate fb damage clip's coordinates to dst coordinates for accumulating crtc damage region.

therefore can you explain what is the exact burden of using uapi.dst for calculating crtc damage area?

I hope this ASCI drawing do not break :P

|----------------------|
|                      |
|   Pipe area          |
|----------------|     |
| whole plane A  |     |
|     |----------|     |
|     |   src    |     |
|     | visible  |     |

------------------------

Using dst would add the whole plane A area to the pipe damaged area while using src will only add the visible area.

Quoted 233 lines
Quoted 233 lines
Quoted 232 lines
Quoted 61 lines
Quoted 5 lines

2. Move case
 The pipe damaged area (The Selective Update region) needs to accumulate both old and new plane's dst

same

Quoted 53 lines

if you are implementing this scenario, the code shoule be like this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha scenario
of me.

Quoted 159 lines

no need to handle like this for alpha, if the plane moved if will be
handled in the "if" above with or without alpha change, if it did not
moved but
alpha change no need to add the old state coordinate to the pipe clip.

Quoted 151 lines

else if (new_plane_state->uapi.alpha != old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb !=

old_plane_state-

Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+			/*
+			 * If the plane don't have damage areas

but the

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			 * framebuffer changed, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

   /*
    * If the plane don't have damage areas but the
    * framebuffer changed, mark the whole plane area as
    * damaged.
    */
   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_psr.c +12 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_area.y2 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1346

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+

else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;

   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

Quoted 6 lines
Quoted 3 lines

      if (drm_rect_intersect(&clip, &src)) { clip_area_update(&plane_damaged_area, &clip); }

Call intersect at every clip? that don't look optimized.

when the clip_area_update() is called it just accumulates the input rects to one output rect.
it might lead to accumulating unneeded excessive update rect region

Quoted 7 lines
Quoted 3 lines

The excessive rect region will be removed once after sum all clips in the current approach.

on the link's 2nd page,
we only need a red Selective Fetch area, but your patch seems Selective Fetch area as green rect.
https://docs.google.com/presentation/d/1gOKE4JnC97RzRg15ZM8IaQzHnifIxwvwP_UbOoGFE9E/edit?usp=sharing

Okay, now I got it.
Will update this but please take a look to the other answers so we do only one more version.

Quoted 90 lines
Quoted 75 lines
Quoted 75 lines
Quoted 75 lines
Quoted 8 lines

   }

  if (drm_rect_visible(plane_damaged_area)) { plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 + new_plane_state->uapi.dst.y1;
     plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 + new_plane_state->uapi.dst.y1;

Quoted 4 lines

     clip_area_update(&pipe_clip, &plane_damaged_area); continue;
  }
}

Current code sum all the damage clips, if the sum of the damage clips
insect with the src area it is translated to pipe coordinates and called
clip_area_update() to update pipe_clip.

Quoted 55 lines

the calculation and translating cooridinates is alreay implemented
here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
  it has commetns which explains scenarios.)

Quoted 43 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it

intersect
with

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	 * every plane, if it does set the plane selective

fetch area.

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+					     new_plane_state,

i) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter,

&new_plane_state-

Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

+
  sel_fetch_area = &new_plane_state-

Quoted 1 line

psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state-
Quoted 1 line

uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state-
Quoted 1 line

uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 -

new_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 -
Quoted 2 lines

new_plane_state-

Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1 + src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1 + src.y1;

Quoted 10 lines
Quoted 6 lines
Quoted 5 lines

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; + drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to understand(translation + clip)

when the src's x1 and y1 indicates over than 0, does it work?

It will, we use it for scenarios like that in this function.

here is the problematic case,
if we assume src indicates 50 x 50 +10 +10
,fb damage rect indicates 5 x 5 +55 +55
and dst indicates 50 x 50 +100 +100

Quoted 8 lines

1) if whole plane src area needs to be updated
inter: 50 x 50 +100 +100
sel_fetch_area->y1 = 100 - 100 => 0
sel_fetch_area->y2 = 100 - 100 => 0

drm_rect_intersect(sel_fetch_area, &src);
 => sel_fetch_area does not fit whole src area.

Your values are wrong.

# 50 x 50 +10 +10

src.x1 = 50
src.y1 = 50
src.x2 = 60
src.y2 = 60

# 5 x 5 +55 +55. * not used in example 1 damaged.x1 = 5
damaged.y1 = 5
damaged.x2 = 60
damaged.y2 = 60

# 50 x 50 +100 +100
dst.x1 = 50
dst.y1 = 50
dst.x2 = 150
dst.y2 = 150

####

1) if whole plane src are needs to be updated pipe_clip.x1 = src.x1 + dst.x1 = 100 pipe_clip.y2 = src.y1 + dst.y1 = 100 pipe_clip.x2 = src.x2 + dst.y1 = 110 pipe_clip.y2 = src.y2 + dst.y2 = 110

# drm_rect_intersect(&inter, &new_plane_state->uapi.dst) iter.x1 = 100
iter.y1 = 100
iter.x2 = 110
iter.y2 = 110

# sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area.y1 = 100 - 50 = 50
sel_fetch_area.y2 = 110 - 50 = 60

drm_rect_intersect(sel_fetch_area, &src);

sel_fetch_area.y1 = 50
sel_fetch_area.y2 = 60

Quoted 10 lines

2) if only the plane fb damage needs to be updated translate fb damage's coordinates to crtc coordinates 5 x 5 +55 +55 => 5 x 5 +105 +105
inter: 5 x 5 +105 +105
sel_fetch_area->y1 = 105 - 100 => 5 sel_fetch_area->y2 = 105 - 100 => 5

drm_rect_intersect(sel_fetch_area, &src);
 => sel_fetch_area does not fit to src's damage area.

Let me know if this case is broken after use the right values.

Quoted 362 lines
Quoted 362 lines
Quoted 362 lines
Quoted 362 lines
Quoted 177 lines
Quoted 177 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;

Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · line 1390

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 175 lines
Quoted 175 lines

  }

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

+skip_sel_fetch_set_loop:
  psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update);
  return 0;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 271 lines · Jose
Quoted 250 lines · Gwan-gyeong
Quoted 241 lines · Jose
Quoted 233 lines · Gwan-gyeong
Quoted 228 lines · Jose
Quoted 215 lines · Gwan-gyeong
Quoted 8 lines · José Roberto de Souza

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.

Quoted 11 lines

Now that we are not complete fetching each plane, there is
another
loop needed as all the plane areas that intersect with the
pipe
damaged area needs to be fetched from memory so the complete
blending
of all planes can happen.

Hi,

Quoted 4 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in
16.16

Typo on commit message. shifthing -> shifting

Quoted 171 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage
area
- mark the whole plane area damaged if plane visibility or
alpha
changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible
but
are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or
it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc: Ville Syrjälä <[email protected]>
Cc: Gwan-gyeong Mun <[email protected]>
Signed-off-by: José Roberto de Souza <
[email protected]>

---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--
 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
 				struct intel_crtc *crtc)
 {
 	struct intel_crtc_state *crtc_state =

intel_atomic_get_new_crtc_state(state, crtc);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 =

INT_MAX,
.y2 = -1 };
struct intel_plane_state *new_plane_state,
*old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -1282,9 +1282,17 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	if (ret)
 		return ret;
 
 
 
 
 
 
 
 
 
 
+	/*
+	 * Calculate minimal selective fetch area of each plane

and
calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */
 	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,
new_plane_state,
i) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0,

.y1 =
-1, .x2 = INT_MAX, .y2 = -1 };

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;
 
 
 
 
 
 
 
 
 
 
 		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc)

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
 			continue;
@@ -1300,23 +1308,89 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
 			break;
 		}
 
 
 
 
 
 
 
 
 
 
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
 		/*
-		 * For now doing a selective fetch in the whole

plane
area,

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		 * optimizations will come in the future.
+		 * If visibility or plane moved, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in

the new
and old

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		 * position.
 		 */
+		if (new_plane_state->uapi.visible !=

old_plane_state-

Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		    !drm_rect_equals(&new_plane_state-
Quoted 1 line

uapi.dst,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+				     &old_plane_state-
Quoted 1 line

uapi.dst)) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y1

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y2

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			clip_area_update(&pipe_clip,

&damaged_area);

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
The pipe damaged area (The Selective Update region) needs
to
accumulate being visible plane's dst between old and new plane's
dst.

if you are implementing this scenario, the code shoule be like
this,

if (new_plane_state->uapi.visible != old_plane_state-

Quoted 1 line

uapi.visible)

Quoted 11 lines
{
   if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1;
      damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1;
      damaged_area.y2 = old_plane_state->uapi.dst.y2;
   }
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 4 lines

The current code does exactly above but discards the clipped in
uapi.src.

Quoted 6 lines

in order to accumlate the pipe damage area, we don't need to use
and
calculate src coordinates on move and visibility change scenarios.
we can easily accumalates than additional calculation.

Quoted 8 lines

Using uapi.dst will cause additional and unnecessary area be included
to the pipe damaged area, imagine that a plane have src.x1 = 50, src.y1 = 100,
... the plane invisible/cropped area don't need to be added to the
pipe damaged area.

Quoted 9 lines

easist way to get damaged area for crtc is just using uapi.dst but because fb damage clip follows uapi.src coordinates, we have to translate fb damage clip's coordinates to dst coordinates for accumulating crtc damage region.

therefore can you explain what is the exact burden of using uapi.dst
for calculating crtc damage area?

I hope this ASCI drawing do not break :P

Quoted 8 lines

----------------------|

                     |
  Pipe area          |
----------------|     |
whole plane A  |     |
    |----------|     |
    |   src    |     |
    | visible  |     |
Quoted 5 lines

------------------------

Using dst would add the whole plane A area to the pipe damaged area while using src will only add the visible area.

if you expect to be shown the src visible area to pipe area, (that means the dst area has the same width and height, but the x1, y1 will be based on crtc coordinates.)
in the crte point of view, the src visible area is the dst area. (but because the src area use fb based coordinates, we should use dst)

and if you are expecting handling obscured area by other planes, (for optimizing)
we should use dst too.

we only need to use src for handling fb damaged clip rects. but after accumulating the fb damaged clip rects, it also has to be translated to crtc coordinates from fb (src ) coordinates.

Quoted 358 lines
Quoted 244 lines
Quoted 240 lines
Quoted 232 lines
Quoted 63 lines
Quoted 5 lines

2. Move case
The pipe damaged area (The Selective Update region) needs
to
accumulate both old and new plane's dst

same

Quoted 55 lines

if you are implementing this scenario, the code shoule be like
this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   





























   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not
optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha scenario
of me.

Quoted 166 lines

no need to handle like this for alpha, if the plane moved if will
be
handled in the "if" above with or without alpha change, if it did
not
moved but
alpha change no need to add the old state coordinate to the pipe
clip.

Quoted 154 lines

else if (new_plane_state->uapi.alpha != old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   













































































   continue;
} 
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb !=

old_plane_state-

Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+			/*
+			 * If the plane don't have damage areas

but the

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			 * framebuffer changed, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

/*
* If the plane don't have damage areas but the
* framebuffer changed, mark the whole plane area as
* damaged.
*/

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_psr.c +12 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_area.y2 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+
else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;
	        
   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

      if (drm_rect_intersect(&clip, &src)) {
         clip_area_update(&plane_damaged_area, &clip);
      }
Quoted 7 lines
Quoted 2 lines

Call intersect at every clip? that don't look optimized.

when the clip_area_update() is called it just accumulates the input
rects to one output rect.
it might lead to accumulating unneeded excessive update rect region

Quoted 4 lines

The excessive rect region will be removed once after sum all clips in
the current approach.

Quoted 5 lines

on the link's 2nd page,
we only need a red Selective Fetch area, but your patch seems Selective
Fetch area as green rect.
https://docs.google.com/presentation/d/1gOKE4JnC97RzRg15ZM8IaQzHnifIxwvwP_UbOoGFE9E/edit?usp=sharing

Okay, now I got it.
Will update this but please take a look to the other answers so we do only one more version.

Quoted 103 lines
Quoted 87 lines
Quoted 87 lines
Quoted 87 lines
Quoted 10 lines
   }

if (drm_rect_visible(plane_damaged_area)) {
plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1
+
new_plane_state->uapi.dst.y1;
plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1
+
new_plane_state->uapi.dst.y1;

Quoted 4 lines
     clip_area_update(&pipe_clip, &plane_damaged_area);
     continue;

}
}

Current code sum all the damage clips, if the sum of the damage
clips
insect with the src area it is translated to pipe coordinates and
called
clip_area_update() to update pipe_clip.

Quoted 50 lines

the calculation and translating cooridinates is alreay implemented
here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
it has commetns which explains scenarios.)

Quoted 44 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it

intersect
with

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	 * every plane, if it does set the plane selective

fetch area.

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+					     new_plane_state,

i) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter,

&new_plane_state-

Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+
 		sel_fetch_area = &new_plane_state-
Quoted 1 line

psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state-
Quoted 1 line

uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state-
Quoted 1 line

uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 -

new_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 -

new_plane_state-

Quoted 7 lines
Quoted 1 line
Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state-

Quoted 1 line

uapi.dst.y1 +

src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state-

Quoted 1 line

uapi.dst.y1 +

src.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; +
drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to understand(translation + clip)

Quoted 5 lines
Quoted 1 line

when the src's x1 and y1 indicates over than 0, does it work?

It will, we use it for scenarios like that in this function.

here is the problematic case,
if we assume src indicates 50 x 50 +10 +10
,fb damage rect indicates 5 x 5 +55 +55
and dst indicates 50 x 50 +100 +100

1) if whole plane src area needs to be updated
inter: 50 x 50 +100 +100
sel_fetch_area->y1 = 100 - 100 => 0
sel_fetch_area->y2 = 100 - 100 => 0

Quoted 5 lines
Quoted 2 lines

drm_rect_intersect(sel_fetch_area, &src);
=> sel_fetch_area does not fit whole src area.

Your values are wrong.

I used DRM_RECT_FMT style.

#define DRM_RECT_FMT "%dx%d%+d%+d"
#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1

Quoted 7 lines

# 50 x 50 +10 +10

src.x1 = 50
src.y1 = 50
src.x2 = 60
src.y2 = 60

src.x1 = 10
src.y1 = 10
src.x2 = 60
src.y2 = 60

Quoted 6 lines

# 5 x 5 +55 +55. * not used in example 1
damaged.x1 = 5
damaged.y1 = 5
damaged.x2 = 60
damaged.y2 = 60

damaged.x1 = 55
damaged.y1 = 55
damaged.x2 = 60
damaged.y2 = 60

Quoted 6 lines

# 50 x 50 +100 +100
dst.x1 = 50
dst.y1 = 50
dst.x2 = 150
dst.y2 = 150

dst.x1 = 100
dst.y1 = 100
dst.x2 = 150
dst.y2 = 150

therefore below result seems to wrong result.

Quoted 30 lines

####

1) if whole plane src are needs to be updated
pipe_clip.x1 = src.x1 + dst.x1 = 100
pipe_clip.y2 = src.y1 + dst.y1 = 100
pipe_clip.x2 = src.x2 + dst.y1 = 110
pipe_clip.y2 = src.y2 + dst.y2 = 110

# drm_rect_intersect(&inter, &new_plane_state->uapi.dst) iter.x1 = 100
iter.y1 = 100
iter.x2 = 110
iter.y2 = 110

# sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area.y1 = 100 - 50 = 50
sel_fetch_area.y2 = 110 - 50 = 60

drm_rect_intersect(sel_fetch_area, &src);

sel_fetch_area.y1 = 50
sel_fetch_area.y2 = 60

Quoted 7 lines

2) if only the plane fb damage needs to be updated translate fb damage's coordinates to crtc coordinates 5 x 5 +55 +55 => 5 x 5 +105 +105
inter: 5 x 5 +105 +105
sel_fetch_area->y1 = 105 - 100 => 5 sel_fetch_area->y2 = 105 - 100 => 5

Quoted 371 lines
Quoted 2 lines

drm_rect_intersect(sel_fetch_area, &src);
=> sel_fetch_area does not fit to src's damage area.

Let me know if this case is broken after use the right values.

Quoted 366 lines
Quoted 366 lines
Quoted 366 lines
Quoted 366 lines
Quoted 176 lines
Quoted 176 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 180 lines
Quoted 180 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
 	}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
+skip_sel_fetch_set_loop:
 	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip,

full_update);
return 0;
}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 296 lines · Gwan-gyeong
Quoted 283 lines · Jose
Quoted 262 lines · Gwan-gyeong
Quoted 253 lines · Jose
Quoted 245 lines · Gwan-gyeong
Quoted 240 lines · Jose
Quoted 227 lines · Gwan-gyeong
Quoted 8 lines · José Roberto de Souza

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.

Quoted 11 lines

Now that we are not complete fetching each plane, there is
another
loop needed as all the plane areas that intersect with the
pipe
damaged area needs to be fetched from memory so the complete
blending
of all planes can happen.

Hi,

Quoted 4 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is in
16.16

Typo on commit message. shifthing -> shifting

Quoted 183 lines

format

v4:
- setting plane selective fetch area using the whole pipe damage
area
- mark the whole plane area damaged if plane visibility or
alpha
changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible
but
are
invisible in the new state

v6:
- consider old state plane coordinates when visibility changes or
it
moved to calculate damaged area
- remove from damaged area the portion not in src clip

Cc: Ville Syrjälä <[email protected]>
Cc: Gwan-gyeong Mun <[email protected]>
Signed-off-by: José Roberto de Souza <
[email protected]>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--

 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int

intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
  struct intel_crtc *crtc) {
  struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 =

INT_MAX,
.y2 = -1 };
  struct intel_plane_state *new_plane_state, *old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };

  struct intel_plane *plane;
  bool full_update = false;
  int i, ret;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1282,9 +1282,17 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,
  if (ret)
  return ret;

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	/*
+	 * Calculate minimal selective fetch area of each plane

and
calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch area will

actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */

  for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
  new_plane_state,
i) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = { .x1 = 0,

.y1 =
-1, .x2 = INT_MAX, .y2 = -1 };

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;

  if (new_plane_state->uapi.crtc != crtc_state-

Quoted 1 line

uapi.crtc)

  continue;

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
@@ -1300,23 +1308,89 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,
  break;
  }

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state->uapi);

  /*

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		 * For now doing a selective fetch in the whole

plane
area,

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		 * optimizations will come in the future.
+		 * If visibility or plane moved, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete redraw in

the new
and old

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * position.

  */

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		if (new_plane_state->uapi.visible !=

old_plane_state-

Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		    !drm_rect_equals(&new_plane_state-
Quoted 1 line

uapi.dst,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+				     &old_plane_state-
Quoted 1 line

uapi.dst)) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y1

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 = old_plane_state-
Quoted 2 lines

uapi.src.y2

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 += old_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			clip_area_update(&pipe_clip,

&damaged_area);

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
 The pipe damaged area (The Selective Update region) needs to
accumulate being visible plane's dst between old and new plane's
dst.

if you are implementing this scenario, the code shoule be like
this,

if (new_plane_state->uapi.visible != old_plane_state-

Quoted 1 line

uapi.visible)

Quoted 11 lines

{
   if (new_plane_state->uapi.visible) { damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; }
   clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 4 lines

The current code does exactly above but discards the clipped in
uapi.src.

Quoted 6 lines

in order to accumlate the pipe damage area, we don't need to use
and
calculate src coordinates on move and visibility change scenarios.
we can easily accumalates than additional calculation.

Quoted 8 lines

Using uapi.dst will cause additional and unnecessary area be included
to the pipe damaged area, imagine that a plane have src.x1 = 50, src.y1 = 100,
... the plane invisible/cropped area don't need to be added to the
pipe damaged area.

Quoted 9 lines

easist way to get damaged area for crtc is just using uapi.dst but because fb damage clip follows uapi.src coordinates, we have to translate fb damage clip's coordinates to dst coordinates for accumulating crtc damage region.

therefore can you explain what is the exact burden of using uapi.dst
for calculating crtc damage area?

I hope this ASCI drawing do not break :P

Quoted 8 lines

----------------------|
                     |
  Pipe area |
----------------| |
whole plane A | |

    |----------|     |
    |   src    |     |
    | visible  |     |
Quoted 5 lines

------------------------

Using dst would add the whole plane A area to the pipe damaged area while using src will only add the visible area.

if you expect to be shown the src visible area to pipe area, (that means the dst area has the same width and height, but the x1, y1 will be based on crtc coordinates.)
in the crte point of view, the src visible area is the dst area. (but because the src area use fb based coordinates, we should use dst)

Quoted 7 lines

and if you are expecting handling obscured area by other planes, (for optimizing)
we should use dst too.

we only need to use src for handling fb damaged clip rects. but after accumulating the fb damaged clip rects, it also has to be translated to crtc coordinates from fb (src ) coordinates.

That is being done, src are then translated to CRTC coordinates using dst but only using dst is not a optimized solution.

damaged_area.y1 = old_plane_state->uapi.src.y1 >> 16; damaged_area.y1 = old_plane_state->uapi.src.y2 >> 16; damaged_area.y1 += old_plane_state->uapi.dst.y1; damaged_area.y2 += old_plane_state->uapi.dst.y1; clip_area_update(&pipe_clip, &damaged_area);

num_clips = 0;
damaged_area.y1 = src.y1;
damaged_area.y2 = src.y2;
...

damaged_area.y1 += new_plane_state->uapi.dst.y1;
damaged_area.y2 += new_plane_state->uapi.dst.y1;
clip_area_update(&pipe_clip, &damaged_area);

Quoted 398 lines
Quoted 380 lines
Quoted 266 lines

Quoted 253 lines
Quoted 245 lines
Quoted 5 lines
Quoted 4 lines

2. Move case
 The pipe damaged area (The Selective Update region) needs to
accumulate both old and new plane's dst

Quoted 64 lines

same

Quoted 62 lines

if you are implementing this scenario, the code shoule be like
this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha !=

old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is not
optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha scenario
of me.

Quoted 173 lines

no need to handle like this for alpha, if the plane moved if will
be
handled in the "if" above with or without alpha change, if it did
not
moved but
alpha change no need to add the old state coordinate to the pipe
clip.

Quoted 161 lines

else if (new_plane_state->uapi.alpha != old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area);

   continue;
}

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb !=

old_plane_state-

Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+			/*
+			 * If the plane don't have damage areas

but the

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			 * framebuffer changed, mark the whole

plane
area as

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

   /*
    * If the plane don't have damage areas but the
    * framebuffer changed, mark the whole plane area as
    * damaged.
    */
   damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2; clip_area_update(&pipe_clip, &damaged_area); continue;
}

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_psr.c +12 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area, &clip);
+		}
+
+		if (!drm_rect_intersect(&damaged_area, &src))
+			continue;
+
+		damaged_area.y1 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_area.y2 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		clip_area_update(&pipe_clip, &damaged_area);
+	}
+

else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;

   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;

      if (drm_rect_intersect(&clip, &src)) { clip_area_update(&plane_damaged_area, &clip); }

Quoted 7 lines
Quoted 2 lines

Call intersect at every clip? that don't look optimized.

when the clip_area_update() is called it just accumulates the input
rects to one output rect.
it might lead to accumulating unneeded excessive update rect region

Quoted 4 lines

The excessive rect region will be removed once after sum all clips in
the current approach.

Quoted 5 lines

on the link's 2nd page,
we only need a red Selective Fetch area, but your patch seems Selective
Fetch area as green rect.
https://docs.google.com/presentation/d/1gOKE4JnC97RzRg15ZM8IaQzHnifIxwvwP_UbOoGFE9E/edit?usp=sharing

Okay, now I got it.
Will update this but please take a look to the other answers so we do only one more version.

Quoted 103 lines
Quoted 87 lines
Quoted 87 lines
Quoted 87 lines
Quoted 10 lines

   }

  if (drm_rect_visible(plane_damaged_area)) { plane_damaged_area.y1 = plane_damaged_area.y1 - src.y1 +
new_plane_state->uapi.dst.y1; plane_damaged_area.y2 = plane_damaged_area.y2 - src.y1 +
new_plane_state->uapi.dst.y1;

Quoted 4 lines

     clip_area_update(&pipe_clip, &plane_damaged_area); continue;
  }
}

Current code sum all the damage clips, if the sum of the damage
clips
insect with the src area it is translated to pipe coordinates and
called
clip_area_update() to update pipe_clip.

Quoted 50 lines

the calculation and translating cooridinates is alreay implemented
here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
  it has commetns which explains scenarios.)

Quoted 44 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check if it

intersect
with

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	 * every plane, if it does set the plane selective

fetch area.

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 */
+	for_each_oldnew_intel_plane_in_state(state, plane,

old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+					     new_plane_state,

i) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		struct drm_rect *sel_fetch_area, inter, src;
+
+		if (new_plane_state->uapi.crtc != crtc_state-
Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter,

&new_plane_state-

Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_plane_st

ate-

Quoted 1 line

uapi.src, &src);

+
  sel_fetch_area = &new_plane_state-

Quoted 1 line

psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state-
Quoted 1 line

uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state-
Quoted 1 line

uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 -

new_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 -

new_plane_state-

Quoted 7 lines
Quoted 1 line
Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state-

Quoted 1 line

uapi.dst.y1 +

src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state-

Quoted 1 line

uapi.dst.y1 +

src.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; +
drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to understand(translation + clip)

Quoted 5 lines
Quoted 1 line

when the src's x1 and y1 indicates over than 0, does it work?

It will, we use it for scenarios like that in this function.

here is the problematic case,
if we assume src indicates 50 x 50 +10 +10
,fb damage rect indicates 5 x 5 +55 +55
and dst indicates 50 x 50 +100 +100

1) if whole plane src area needs to be updated
inter: 50 x 50 +100 +100
sel_fetch_area->y1 = 100 - 100 => 0
sel_fetch_area->y2 = 100 - 100 => 0

Quoted 5 lines
Quoted 2 lines

drm_rect_intersect(sel_fetch_area, &src);
 => sel_fetch_area does not fit whole src area.

Your values are wrong.

I used DRM_RECT_FMT style.

#define DRM_RECT_FMT "%dx%d%+d%+d"
#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1

Quoted 7 lines

# 50 x 50 +10 +10

src.x1 = 50
src.y1 = 50
src.x2 = 60
src.y2 = 60

Quoted 4 lines

src.x1 = 10
src.y1 = 10
src.x2 = 60
src.y2 = 60

If plane dst has 50px of width and height the src above is not possible. Adjusting it to:

src.x2 = 50
src.y2 = 50

src.x1 = 10
src.y1 = 10
src.x2 = 50
src.y2 = 50

damaged.x1 = 55
damaged.y1 = 55
damaged.x2 = 60
damaged.y2 = 60

dst.x1 = 100
dst.y1 = 100
dst.x2 = 150
dst.y2 = 150

1) if whole plane src are needs to be updated
pipe_clip.y1 = src.y1 + dst.y1 = 110
pipe_clip.y2 = src.y2 + dst.y1 = 150

# drm_rect_intersect(&inter, &new_plane_state->uapi.dst) iter.y1 = 110
iter.y2 = 150

# sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area.y1 = 110 - 100 = 10
sel_fetch_area.y2 = 150 - 100 = 50

drm_rect_intersect(sel_fetch_area, &src);
sel_fetch_area.y1 = 10
sel_fetch_area.y2 = 50

Quoted 18 lines
Quoted 7 lines

# 5 x 5 +55 +55. * not used in example 1
damaged.x1 = 5
damaged.y1 = 5
damaged.x2 = 60
damaged.y2 = 60

damaged.x1 = 55
damaged.y1 = 55
damaged.x2 = 60
damaged.y2 = 60

Quoted 6 lines

# 50 x 50 +100 +100
dst.x1 = 50
dst.y1 = 50
dst.x2 = 150
dst.y2 = 150

Quoted 422 lines

dst.x1 = 100
dst.y1 = 100
dst.x2 = 150
dst.y2 = 150

therefore below result seems to wrong result.

Quoted 415 lines

####

1) if whole plane src are needs to be updated
pipe_clip.x1 = src.x1 + dst.x1 = 100
pipe_clip.y2 = src.y1 + dst.y1 = 100
pipe_clip.x2 = src.x2 + dst.y1 = 110
pipe_clip.y2 = src.y2 + dst.y2 = 110

# drm_rect_intersect(&inter, &new_plane_state->uapi.dst) iter.x1 = 100
iter.y1 = 100
iter.x2 = 110
iter.y2 = 110

# sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area.y1 = 100 - 50 = 50
sel_fetch_area.y2 = 110 - 50 = 60

drm_rect_intersect(sel_fetch_area, &src);

sel_fetch_area.y1 = 50
sel_fetch_area.y2 = 60

Quoted 9 lines

2) if only the plane fb damage needs to be updated translate fb damage's coordinates to crtc coordinates 5 x 5 +55 +55 => 5 x 5 +105 +105
inter: 5 x 5 +105 +105
sel_fetch_area->y1 = 105 - 100 => 5 sel_fetch_area->y2 = 105 - 100 => 5

drm_rect_intersect(sel_fetch_area, &src);
 => sel_fetch_area does not fit to src's damage area.

Let me know if this case is broken after use the right values.

Quoted 380 lines
Quoted 380 lines
Quoted 380 lines
Quoted 380 lines
Quoted 183 lines
Quoted 183 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;

Quoted 6 lines

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -4
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state->uapi.dst.y1;
-		temp.y2 += new_plane_state->uapi.dst.y2;
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area, &src);

why this line is needed?

explained above.

Quoted 187 lines
Quoted 187 lines

  }

+skip_sel_fetch_set_loop:
  psr2_man_trk_ctl_calc(crtc_state, &pipe_clip, full_update);
  return 0;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

Re: [Intel-gfx] [PATCH v6 2/5] drm/i915/display/psr: Use plane damage clips to calculate damaged area

Quoted 346 lines · Jose
Quoted 336 lines · Gwan-gyeong
Quoted 320 lines · Jose
Quoted 304 lines · Gwan-gyeong
Quoted 287 lines · Jose
Quoted 278 lines · Gwan-gyeong
Quoted 272 lines · Jose
Quoted 258 lines · Gwan-gyeong
Quoted 10 lines · José Roberto de Souza

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.

Quoted 13 lines

Now that we are not complete fetching each plane, there
is
another
loop needed as all the plane areas that intersect with
the
pipe
damaged area needs to be fetched from memory so the complete
blending
of all planes can happen.

Hi,

Quoted 5 lines

v2:
- do not shifthing new_plane_state->uapi.dst only src is
in
16.16

Typo on commit message. shifthing -> shifting

Quoted 205 lines

format

v4:
- setting plane selective fetch area using the whole pipe
damage
area
- mark the whole plane area damaged if plane visibility
or
alpha
changed

v5:
- taking in consideration src.y1 in the damage coordinates
- adding to the pipe damaged area planes that were visible
but
are
invisible in the new state

v6:
- consider old state plane coordinates when
visibility
changes or
it
moved to calculate damaged area
- remove from damaged area the portion not in src
clip

Cc: Ville Syrjälä <[email protected]>
Cc: Gwan-gyeong Mun <[email protected]>
Signed-off-by: José Roberto de Souza <
[email protected]>

---
 drivers/gpu/drm/i915/display/intel_psr.c | 98
+++++++++++++++++++++-
--
 1 file changed, 86 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index d9a395c486d3..7daed098fa74 100644
@@ -1269,8 +1269,8 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,
struct intel_crtc
*crtc)
{
struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
+	struct drm_rect pipe_clip = { .x1 = 0, .y1 =
-1, .x2 =

INT_MAX,
.y2 = -1 };
struct intel_plane_state *new_plane_state,
*old_plane_state;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	struct drm_rect pipe_clip = { .y1 = -1 };
 	struct intel_plane *plane;
 	bool full_update = false;
 	int i, ret;
@@ -1282,9 +1282,17 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	if (ret)
 		return ret;
 
 
 
 
 
 
 
 
 
 
 
 
 
+	/*
+	 * Calculate minimal selective fetch area of

each plane
and
calculate

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * the pipe damaged area.
+	 * In the next loop the plane selective fetch

area will
actually be set

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 * using whole pipe damaged area.
+	 */
 	for_each_oldnew_intel_plane_in_state(state,

plane,
old_plane_state,
new_plane_
state,
i) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		struct drm_rect *sel_fetch_area, temp;
+		struct drm_rect src, damaged_area = {

.x1 = 0,
.y1 =
-1, .x2 = INT_MAX, .y2 = -1 };

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		struct drm_mode_rect *damaged_clips;
+		u32 num_clips, j;
 
 
 
 
 
 
 
 
 
 
 
 
 
 		if (new_plane_state->uapi.crtc !=

crtc_state-

Quoted 1 line

uapi.crtc)

drivers/gpu/drm/i915/display/intel_psr.c +0 -0
 			continue;
@@ -1300,23 +1308,89 @@ int

intel_psr2_sel_fetch_update(struct
intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -2
 			break;
 		}
 
 
 
 
 
 
 
 
 
 
 
 
 
-		if (!new_plane_state->uapi.visible)
-			continue;
+		drm_rect_convert_16_16_to_regular(&new_

plane_st
ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_clips =

drm_plane_get_damage_clips(&new_plane_state->uapi);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		num_clips =

drm_plane_get_damage_clips_count(&new_plane_state-

Quoted 1 line

uapi);

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
 		/*
-		 * For now doing a selective fetch in

the whole
plane
area,

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		 * optimizations will come in the

future.

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * If visibility or plane moved, mark

the whole
plane
area as

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		 * damaged as it needs to be complete

redraw in
the new
and old

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		 * position.
 		 */
+		if (new_plane_state->uapi.visible !=

old_plane_state-

Quoted 1 line

uapi.visible ||

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		    !drm_rect_equals(&new_plane_state-
Quoted 1 line

uapi.dst,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+				     &old_plane_state-
Quoted 1 line

uapi.dst)) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 =

old_plane_state-

Quoted 2 lines

uapi.src.y1

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 =

old_plane_state-

Quoted 2 lines

uapi.src.y2

Quoted 1 line

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y1 +=

old_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			damaged_area.y2 +=

old_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			clip_area_update(&pipe_clip,

&damaged_area);

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -0
+
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

1. Visibility change case
The pipe damaged area (The Selective Update region)
needs
to
accumulate being visible plane's dst between old and new
plane's
dst.

if you are implementing this scenario, the code shoule be
like
this,

if (new_plane_state->uapi.visible != old_plane_state-

Quoted 1 line

uapi.visible)

Quoted 11 lines
{
   if (new_plane_state->uapi.visible) {
      damaged_area.y1 = new_plane_state->uapi.dst.y1;
      damaged_area.y2 = new_plane_state->uapi.dst.y2;
   } else {
      damaged_area.y1 = old_plane_state->uapi.dst.y1;
      damaged_area.y2 = old_plane_state->uapi.dst.y2;
   }
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 5 lines

The current code does exactly above but discards the clipped
in
uapi.src.

Quoted 7 lines

in order to accumlate the pipe damage area, we don't need to
use
and
calculate src coordinates on move and visibility change scenarios.
we can easily accumalates than additional calculation.

Quoted 10 lines

Using uapi.dst will cause additional and unnecessary area be included
to the pipe damaged area, imagine that a plane have src.x1 = 50,
src.y1 = 100,
... the plane invisible/cropped area don't need to be added to
the
pipe damaged area.

easist way to get damaged area for crtc is just using uapi.dst but because fb damage clip follows uapi.src coordinates, we have to
translate fb damage clip's coordinates to dst coordinates for accumulating crtc damage region.

Quoted 4 lines

therefore can you explain what is the exact burden of using uapi.dst
for calculating crtc damage area?

I hope this ASCI drawing do not break :P

Quoted 8 lines

----------------------|

                     |
  Pipe area          |
----------------|     |
whole plane A  |     |
    |----------|     |
    |   src    |     |
    | visible  |     |
Quoted 6 lines

------------------------

Using dst would add the whole plane A area to the pipe damaged area
while using src will only add the visible area.

if you expect to be shown the src visible area to pipe area, (that means the dst area has the same width and height, but the x1, y1
will be based on crtc coordinates.)
in the crte point of view, the src visible area is the dst area. (but because the src area use fb based coordinates, we should use dst)

Quoted 8 lines

and if you are expecting handling obscured area by other planes, (for
optimizing)
we should use dst too.

we only need to use src for handling fb damaged clip rects. but after accumulating the fb damaged clip rects, it also has to be translated to crtc coordinates from fb (src ) coordinates.

Quoted 6 lines

That is being done, src are then translated to CRTC coordinates using dst but only using dst is not a optimized solution.

damaged_area.y1 = old_plane_state->uapi.src.y1 >> 16; damaged_area.y1 = old_plane_state->uapi.src.y2 >> 16;

why do you save it to damaged_area.y1 twice?

Quoted 2 lines

damaged_area.y1 += old_plane_state->uapi.dst.y1;
damaged_area.y2 += old_plane_state->uapi.dst.y1;

and if we just want to accumulate pipe_clip for the move or visibility. we should just use dst. (if src.y1 is over 0, your result leads to wrong geometry.)

Quoted 441 lines

clip_area_update(&pipe_clip, &damaged_area);

num_clips = 0;
damaged_area.y1 = src.y1;
damaged_area.y2 = src.y2;
...

damaged_area.y1 += new_plane_state->uapi.dst.y1;
damaged_area.y2 += new_plane_state->uapi.dst.y1;
clip_area_update(&pipe_clip, &damaged_area);

Quoted 428 lines
Quoted 409 lines
Quoted 281 lines
Quoted 277 lines
Quoted 269 lines
Quoted 8 lines
Quoted 73 lines
Quoted 5 lines

2. Move case
The pipe damaged area (The Selective Update region)
needs
to
accumulate both old and new plane's dst

same

Quoted 65 lines

if you are implementing this scenario, the code shoule be
like
this,

else if (!drm_rect_equals(&new_plane_state->uapi.dst, &old_plane_state-

Quoted 1 line

uapi.dst)) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   




































   continue;
}

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		} else if (new_plane_state->uapi.alpha

!=
old_plane_state->uapi.alpha) {

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			num_clips = 0;
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;

3. alpha has changed ( because alpha handling section is
not
optimized,
it can be treated with the move section)

Yes, you are right, there was a misunderstanding of the alpha
scenario
of me.

Quoted 178 lines

no need to handle like this for alpha, if the plane moved if
will
be
handled in the "if" above with or without alpha change, if it
did
not
moved but
alpha change no need to add the old state coordinate to the
pipe
clip.

Quoted 164 lines

else if (new_plane_state->uapi.alpha !=
old_plane_state-

Quoted 1 line

uapi.alpha) {

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);

   damaged_area.y1 = old_plane_state->uapi.dst.y1;
   damaged_area.y2 = old_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   




















































































   continue;
} 
Quoted 12 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+		} else if (!num_clips &&
+			   new_plane_state->uapi.fb !=

old_plane_state-

Quoted 1 line

uapi.fb) {

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+			/*
+			 * If the plane don't have

damage areas
but the

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+			 * framebuffer changed, mark

the whole
plane
area as

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+			 * damaged.
+			 */
+			damaged_area.y1 = src.y1;
+			damaged_area.y2 = src.y2;
+		}
+

else if (!num_clips && new_plane_state->uapi.fb != old_plane_state-

Quoted 1 line

uapi.fb) {

/*
* If the plane don't have damage areas but the
* framebuffer changed, mark the whole plane area as
* damaged.
*/

   damaged_area.y1 = new_plane_state->uapi.dst.y1;
   damaged_area.y2 = new_plane_state->uapi.dst.y2;
   clip_area_update(&pipe_clip, &damaged_area);
   continue;
}
Quoted 19 lines
drivers/gpu/drm/i915/display/intel_psr.c +6 -0
+		for (j = 0; j < num_clips; j++) {
+			struct drm_rect clip;
+
+			clip.y1 = damaged_clips[j].y1;
+			clip.y2 = damaged_clips[j].y2;
+			clip_area_update(&damaged_area,

&clip);

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+		}
+
+		if (!drm_rect_intersect(&damaged_area,

&src))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		damaged_area.y1 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		damaged_area.y2 += new_plane_state-
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		clip_area_update(&pipe_clip,

&damaged_area);

drivers/gpu/drm/i915/display/intel_psr.c

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	}
+
else if (num_clips) {
   struct drm_rect plane_damaged_area;
   plane_damaged_area.x1 = src.x1;
   plane_damaged_area.x2 = src.x2;
   plane_damaged_area.y1 = 0;
   plane_damaged_area.y2 = 0;
	        
   for (j = 0; j < num_clips; j++) {
      struct drm_rect clip;

      clip.x1 = damaged_clips[j].x1;
      clip.x2 = damaged_clips[j].x2;
      clip.y1 = damaged_clips[j].y1;
      clip.y2 = damaged_clips[j].y2;
Quoted 6 lines
Quoted 3 lines
      if (drm_rect_intersect(&clip, &src)) {
         clip_area_update(&plane_damaged_area, &clip);
      }

Call intersect at every clip? that don't look optimized.

Quoted 7 lines

when the clip_area_update() is called it just accumulates the
input
rects to one output rect.
it might lead to accumulating unneeded excessive update rect
region

Quoted 4 lines

The excessive rect region will be removed once after sum all clips in
the current approach.

Quoted 5 lines

on the link's 2nd page,
we only need a red Selective Fetch area, but your patch seems Selective
Fetch area as green rect.
https://docs.google.com/presentation/d/1gOKE4JnC97RzRg15ZM8IaQzHnifIxwvwP_UbOoGFE9E/edit?usp=sharing

Okay, now I got it.
Will update this but please take a look to the other answers so we do
only one more version.

Quoted 116 lines
Quoted 99 lines
Quoted 99 lines
Quoted 99 lines
Quoted 12 lines
   }

if (drm_rect_visible(plane_damaged_area)) {
plane_damaged_area.y1 = plane_damaged_area.y1 -
src.y1
+
new_plane_state->uapi.dst.y1;
plane_damaged_area.y2 = plane_damaged_area.y2 -
src.y1
+
new_plane_state->uapi.dst.y1;

Quoted 4 lines
     clip_area_update(&pipe_clip, &plane_damaged_area);
     continue;

}
}

Current code sum all the damage clips, if the sum of the damage
clips
insect with the src area it is translated to pipe coordinates
and
called
clip_area_update() to update pipe_clip.

Quoted 57 lines

the calculation and translating cooridinates is alreay implemented
here
(
https://patchwork.freedesktop.org/patch/404264/?series=84340&rev=1
it has commetns which explains scenarios.)

Quoted 51 lines
drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+	if (full_update)
+		goto skip_sel_fetch_set_loop;
+
+	/*
+	 * Now that we have the pipe damaged area check

if it
intersect
with

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+	 * every plane, if it does set the plane

selective
fetch area.

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+	 */
+	for_each_oldnew_intel_plane_in_state(state,

plane,
old_plane_state,

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+					     new_plane_

state,
i) {

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		struct drm_rect *sel_fetch_area, inter,

src;

drivers/gpu/drm/i915/display/intel_psr.c +2 -0
+
+		if (new_plane_state->uapi.crtc !=

crtc_state-

Quoted 1 line

uapi.crtc

drivers/gpu/drm/i915/display/intel_psr.c +5 -0
+		    !new_plane_state->uapi.visible)
+			continue;
+
+		inter = pipe_clip;
+		if (!drm_rect_intersect(&inter,

&new_plane_state-

Quoted 1 line

uapi.dst))

drivers/gpu/drm/i915/display/intel_psr.c +3 -0
+			continue;
+
+		drm_rect_convert_16_16_to_regular(&new_

plane_st
ate-

Quoted 1 line

uapi.src, &src);

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+
 		sel_fetch_area = &new_plane_state-
Quoted 1 line

psr2_sel_fetch_area;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y1 = new_plane_state-
Quoted 1 line

uapi.src.y1 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		sel_fetch_area->y2 = new_plane_state-
Quoted 1 line

uapi.src.y2 >>

16;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y1 = inter.y1 -

new_plane_state-

Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +1 -0
+		sel_fetch_area->y2 = inter.y2 -

new_plane_state-

Quoted 7 lines
Quoted 1 line
Quoted 1 line

uapi.dst.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state-

Quoted 1 line

uapi.dst.y1 +

src.y1;
sel_fetch_area->y2 = inter.y2 - new_plane_state-

Quoted 1 line

uapi.dst.y1 +

src.y1;

sel_fetch_area->y1 = inter.y1 - new_plane_state-

Quoted 1 line

uapi.dst.y1;

+
drm_rect_intersect(sel_fetch_area, &src);
does a the same job and is easier to
understand(translation +
clip)

Quoted 6 lines
Quoted 2 lines

when the src's x1 and y1 indicates over than 0, does it work?

It will, we use it for scenarios like that in this function.

here is the problematic case,
if we assume src indicates 50 x 50 +10 +10
,fb damage rect indicates 5 x 5 +55 +55
and dst indicates 50 x 50 +100 +100

1) if whole plane src area needs to be updated
inter: 50 x 50 +100 +100
sel_fetch_area->y1 = 100 - 100 => 0
sel_fetch_area->y2 = 100 - 100 => 0

Quoted 5 lines
Quoted 2 lines

drm_rect_intersect(sel_fetch_area, &src);
=> sel_fetch_area does not fit whole src area.

Your values are wrong.

I used DRM_RECT_FMT style.

#define DRM_RECT_FMT "%dx%d%+d%+d"
#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)-

Quoted 1 line

x1,

(r)->y1

Quoted 7 lines

# 50 x 50 +10 +10

src.x1 = 50
src.y1 = 50
src.x2 = 60
src.y2 = 60

Quoted 7 lines
Quoted 4 lines

src.x1 = 10
src.y1 = 10
src.x2 = 60
src.y2 = 60

If plane dst has 50px of width and height the src above is not possible.

if src width and height has 50x50, the dst can have 50 x 50 too.

Quoted 8 lines

Adjusting it to:

src.x2 = 50
src.y2 = 50

src.x1 = 10
src.y1 = 10
src.x2 = 50

src.x2 = 60

Quoted 1 line

src.y2 = 50

src.y2 = 60

Quoted 6 lines

damaged.x1 = 55
damaged.y1 = 55
damaged.x2 = 60
damaged.y2 = 60

Quoted 8 lines

dst.x1 = 100
dst.y1 = 100
dst.x2 = 150
dst.y2 = 150

1) if whole plane src are needs to be updated
pipe_clip.y1 = src.y1 + dst.y1 = 110
pipe_clip.y2 = src.y2 + dst.y1 = 150

pipe_clip.y2 = src.y2 + dst.y1 = 160

Quoted 5 lines

# drm_rect_intersect(&inter, &new_plane_state->uapi.dst) iter.y1 = 110
iter.y2 = 150

inter = pipe_clip;
pipe_clip.x1 = 0
pipe_clip.y1 = 110
=> in the crtc point of view, the pipe_clip.y1 shoule be 100. but the middle of value is wrong.

pipe_clip.x2 = INT_MAX
pipe_clip.y2 = 160
=> in the crtc point of view, the pipe_clip.y1 shoule be 150. but the
middle of value is wrong.

dst.x1 = 100
dst.y1 = 100
dst.x2 = 150
dst.y2 = 150

drm_rect_intersect(&inter, &new_plane_state->uapi.dst) =>
iter.x1 = 100
iter.y1 = 110
iter.x2 = 150
iter.y2 = 150

because we only add one dst,
the inter should be same to dst.
but the result of iter does not have same geometry to dst.

wrong pipe_clip region leads wrong SelectiveUpdate region.

Quoted 450 lines

# sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area.y1 = 110 - 100 = 10
sel_fetch_area.y2 = 150 - 100 = 50 drm_rect_intersect(sel_fetch_area, &src); sel_fetch_area.y1 = 10
sel_fetch_area.y2 = 50

Quoted 443 lines
Quoted 6 lines

# 5 x 5 +55 +55. * not used in example 1 damaged.x1 = 5
damaged.y1 = 5
damaged.x2 = 60
damaged.y2 = 60

damaged.x1 = 55
damaged.y1 = 55
damaged.x2 = 60
damaged.y2 = 60

Quoted 6 lines

# 50 x 50 +100 +100
dst.x1 = 50
dst.y1 = 50
dst.x2 = 150
dst.y2 = 150

dst.x1 = 100
dst.y1 = 100
dst.x2 = 150
dst.y2 = 150

therefore below result seems to wrong result.

Quoted 419 lines

####

1) if whole plane src are needs to be updated pipe_clip.x1 = src.x1 + dst.x1 = 100 pipe_clip.y2 = src.y1 + dst.y1 = 100 pipe_clip.x2 = src.x2 + dst.y1 = 110 pipe_clip.y2 = src.y2 + dst.y2 = 110

# drm_rect_intersect(&inter, &new_plane_state->uapi.dst) iter.x1 = 100
iter.y1 = 100
iter.x2 = 110
iter.y2 = 110

# sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area.y1 = 100 - 50 = 50
sel_fetch_area.y2 = 110 - 50 = 60

drm_rect_intersect(sel_fetch_area, &src);

sel_fetch_area.y1 = 50
sel_fetch_area.y2 = 60

Quoted 10 lines

2) if only the plane fb damage needs to be updated translate fb damage's coordinates to crtc coordinates 5 x 5 +55 +55 => 5 x 5 +105 +105
inter: 5 x 5 +105 +105
sel_fetch_area->y1 = 105 - 100 => 5 sel_fetch_area->y2 = 105 - 100 => 5

drm_rect_intersect(sel_fetch_area, &src);
=> sel_fetch_area does not fit to src's damage area.

Let me know if this case is broken after use the right values.

Quoted 383 lines
Quoted 383 lines
Quoted 383 lines
Quoted 383 lines
Quoted 185 lines
Quoted 185 lines
drivers/gpu/drm/i915/display/intel_psr.c +2 -2
+		sel_fetch_area->x1 = src.x1;
+		sel_fetch_area->x2 = src.x2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-		temp = *sel_fetch_area;
-		temp.y1 += new_plane_state-
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

uapi.dst.y1;

drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-		temp.y2 += new_plane_state-
Quoted 1 line

uapi.dst.y2;

drivers/gpu/drm/i915/display/intel_psr.c +1 -1
-		clip_area_update(&pipe_clip, &temp);
+		drm_rect_intersect(sel_fetch_area,

&src);

why this line is needed?

explained above.

Quoted 187 lines
Quoted 187 lines
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
 	}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
+skip_sel_fetch_set_loop:
 	psr2_man_trk_ctl_calc(crtc_state, &pipe_clip,

full_update);
return 0;
}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

PATCH v6 3/5 drm/i915/display: Split and export main surface calculation from skl_check_main_surface()

In reply to José Roberto de Souza

The calculation the offsets of the main surface will be needed by PSR2 selective fetch code so here splitting and exporting it.
No functional changes were done here.

v3: Rebased

---
 drivers/gpu/drm/i915/display/intel_display.c | 78 ++++++++++++--------
 drivers/gpu/drm/i915/display/intel_display.h |  2 +
 2 files changed, 51 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +49 -29
index 761be8deaa9b..411b9f3c9dc7 100644
@@ -3821,33 +3821,19 @@ static int intel_plane_max_height(struct intel_plane *plane,
 		return INT_MAX;
 }
 
-static int skl_check_main_surface(struct intel_plane_state *plane_state)
+int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
+				 int *x, int *y, u32 *offset)
 {
 	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
-	unsigned int rotation = plane_state->hw.rotation;
-	int x = plane_state->uapi.src.x1 >> 16;
-	int y = plane_state->uapi.src.y1 >> 16;
-	int w = drm_rect_width(&plane_state->uapi.src) >> 16;
-	int h = drm_rect_height(&plane_state->uapi.src) >> 16;
-	int min_width = intel_plane_min_width(plane, fb, 0, rotation);
-	int max_width = intel_plane_max_width(plane, fb, 0, rotation);
-	int max_height = intel_plane_max_height(plane, fb, 0, rotation);
-	int aux_plane = intel_main_to_aux_plane(fb, 0);
-	u32 aux_offset = plane_state->color_plane[aux_plane].offset;
-	u32 alignment, offset;
+	const int aux_plane = intel_main_to_aux_plane(fb, 0);
+	const u32 aux_offset = plane_state->color_plane[aux_plane].offset;
+	const u32 alignment = intel_surf_alignment(fb, 0);
+	const int w = drm_rect_width(&plane_state->uapi.src) >> 16;
 
-	if (w > max_width || w < min_width || h > max_height) {
-		drm_dbg_kms(&dev_priv->drm,
-			    "requested Y/RGB source size %dx%d outside limits (min: %dx1 max: %dx%d)\n",
-			    w, h, min_width, max_width, max_height);
-		return -EINVAL;
-	}
-
-	intel_add_fb_offsets(&x, &y, plane_state, 0);
-	offset = intel_plane_compute_aligned_offset(&x, &y, plane_state, 0);
-	alignment = intel_surf_alignment(fb, 0);
+	intel_add_fb_offsets(x, y, plane_state, 0);
+	*offset = intel_plane_compute_aligned_offset(x, y, plane_state, 0);
 	if (drm_WARN_ON(&dev_priv->drm, alignment && !is_power_of_2(alignment)))
 		return -EINVAL;
 
@@ -3856,9 +3842,10 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
 	 * main surface offset, and it must be non-negative. Make
 	 * sure that is what we will get.
 	 */
-	if (aux_plane && offset > aux_offset)
-		offset = intel_plane_adjust_aligned_offset(&x, &y, plane_state, 0,
-							   offset, aux_offset & ~(alignment - 1));
+	if (aux_plane && *offset > aux_offset)
+		*offset = intel_plane_adjust_aligned_offset(x, y, plane_state, 0,
+							    *offset,
+							    aux_offset & ~(alignment - 1));
 
 	/*
 	 * When using an X-tiled surface, the plane blows up
@@ -3869,18 +3856,51 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
 	if (fb->modifier == I915_FORMAT_MOD_X_TILED) {
 		int cpp = fb->format->cpp[0];
 
-		while ((x + w) * cpp > plane_state->color_plane[0].stride) {
-			if (offset == 0) {
+		while ((*x + w) * cpp > plane_state->color_plane[0].stride) {
+			if (*offset == 0) {
 				drm_dbg_kms(&dev_priv->drm,
 					    "Unable to find suitable display surface offset due to X-tiling\n");
 				return -EINVAL;
 			}
 
-			offset = intel_plane_adjust_aligned_offset(&x, &y, plane_state, 0,
-								   offset, offset - alignment);
+			*offset = intel_plane_adjust_aligned_offset(x, y, plane_state, 0,
+								    *offset,
+								    *offset - alignment);
 		}
 	}
 
+	return 0;
+}
+
+static int skl_check_main_surface(struct intel_plane_state *plane_state)
+{
+	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
+	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+	const struct drm_framebuffer *fb = plane_state->hw.fb;
+	const unsigned int rotation = plane_state->hw.rotation;
+	int x = plane_state->uapi.src.x1 >> 16;
+	int y = plane_state->uapi.src.y1 >> 16;
+	const int w = drm_rect_width(&plane_state->uapi.src) >> 16;
+	const int h = drm_rect_height(&plane_state->uapi.src) >> 16;
+	const int min_width = intel_plane_min_width(plane, fb, 0, rotation);
+	const int max_width = intel_plane_max_width(plane, fb, 0, rotation);
+	const int max_height = intel_plane_max_height(plane, fb, 0, rotation);
+	const int aux_plane = intel_main_to_aux_plane(fb, 0);
+	const u32 alignment = intel_surf_alignment(fb, 0);
+	u32 offset;
+	int ret;
+
+	if (w > max_width || w < min_width || h > max_height) {
+		drm_dbg_kms(&dev_priv->drm,
+			    "requested Y/RGB source size %dx%d outside limits (min: %dx1 max: %dx%d)\n",
+			    w, h, min_width, max_width, max_height);
+		return -EINVAL;
+	}
+
+	ret = skl_calc_main_surface_offset(plane_state, &x, &y, &offset);
+	if (ret)
+		return ret;
+
 	/*
 	 * CCS AUX surface doesn't have its own x/y offsets, we must make sure
 	 * they match with the main surface x/y offsets.
drivers/gpu/drm/i915/display/intel_display.h +2 -0
index a5771bfecba6..eb263bf9314d 100644
@@ -630,6 +630,8 @@ u32 skl_plane_ctl_crtc(const struct intel_crtc_state *crtc_state);
 u32 skl_plane_stride(const struct intel_plane_state *plane_state,
 		     int plane);
 int skl_check_plane_surface(struct intel_plane_state *plane_state);
+int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
+				 int *x, int *y, u32 *offset);
 int i9xx_check_plane_surface(struct intel_plane_state *plane_state);
 int skl_format_to_fourcc(int format, bool rgb_order, bool alpha);
 unsigned int i9xx_plane_max_stride(struct intel_plane *plane,
Signature · 6 lines
2.29.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

PATCH v6 4/5 drm/i915/display/psr: Program plane's calculated offset to plane SF register

In reply to José Roberto de Souza

It programs Plane's calculated x, y, offset to Plane SF register. It does the calculation of x and y offsets using skl_calc_main_surface_offset().

v3: Update commit message

---
 drivers/gpu/drm/i915/display/intel_psr.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +10 -4
index 7daed098fa74..51a9bc2040ee 100644
@@ -1186,7 +1186,8 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane,
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	enum pipe pipe = plane->pipe;
 	const struct drm_rect *clip;
-	u32 val;
+	u32 val, offset;
+	int ret, x, y;
 
 	if (!crtc_state->enable_psr2_sel_fetch)
 		return;
@@ -1203,9 +1204,14 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane,
 	val |= plane_state->uapi.dst.x1;
 	intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_POS(pipe, plane->id), val);
 
-	/* TODO: consider tiling and auxiliary surfaces */
-	val = (clip->y1 + plane_state->color_plane[color_plane].y) << 16;
-	val |= plane_state->color_plane[color_plane].x;
+	/* TODO: consider auxiliary surfaces */
+	x = plane_state->uapi.src.x1 >> 16;
+	y = (plane_state->uapi.src.y1 >> 16) + clip->y1;
+	ret = skl_calc_main_surface_offset(plane_state, &x, &y, &offset);
+	if (ret)
+		drm_warn_once(&dev_priv->drm, "skl_calc_main_surface_offset() returned %i\n",
+			      ret);
+	val = y << 16 | x;
 	intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_OFFSET(pipe, plane->id),
 			  val);
 
Signature · 6 lines
2.29.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH v6 5/5 HAX/DO_NOT_MERGE_IT: drm/i915/display: Enable PSR2 selective fetch for testing

In reply to José Roberto de Souza

Enabling it to check if it causes regressions in CI but the feature is still not ready to be enabled by default.

---
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_params.h +1 -1
index 330c03e2b4f7..b8b19270c339 100644
@@ -54,7 +54,7 @@ struct drm_printer;
 	param(int, enable_fbc, -1, 0600) \
 	param(int, enable_psr, -1, 0600) \
 	param(bool, psr_safest_params, false, 0600) \
-	param(bool, enable_psr2_sel_fetch, false, 0600) \
+	param(bool, enable_psr2_sel_fetch, true, 0600) \
 	param(int, disable_power_well, -1, 0400) \
 	param(int, enable_ips, 1, 0600) \
 	param(int, invert_brightness, 0, 0600) \
Signature · 6 lines
2.29.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

[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

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [v6,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format
URL : https://patchwork.freedesktop.org/series/84910/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:261:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1398:25: error: incompatible types in comparison expression (different address spaces):
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1398:25:    struct dma_fence *
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1398:25:    struct dma_fence [noderef] __rcu *
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1399:17: error: incompatible types in comparison expression (different address spaces):
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1399:17:    struct dma_fence *
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1399:17:    struct dma_fence [noderef] __rcu *
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1458:17: error: incompatible types in comparison expression (different address spaces):
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1458:17:    struct dma_fence *
+drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1458:17:    struct dma_fence [noderef] __rcu *
+drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:268:16: error: incompatible types in comparison expression (different type sizes):
+drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:268:16:    unsigned long *
+drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:268:16:    unsigned long long *
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:276:25: error: incompatible types in comparison expression (different address spaces):
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:276:25:    struct dma_fence *
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:276:25:    struct dma_fence [noderef] __rcu *
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:277:17: error: incompatible types in comparison expression (different address spaces):
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:277:17:    struct dma_fence *
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:277:17:    struct dma_fence [noderef] __rcu *
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:331:17: error: incompatible types in comparison expression (different address spaces):
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:331:17:    struct dma_fence *
+drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:331:17:    struct dma_fence [noderef] __rcu *
+drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h:92:56: error: marked inline, but without a definition
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:257:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

[Intel-gfx] ✗ Fi.CI.DOCS: warning for series starting with [v6,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [v6,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format
URL : https://patchwork.freedesktop.org/series/84910/
State : warning

== Summary ==

$ make htmldocs 2>&1 > /dev/null | grep i915
Error: Cannot open file ./drivers/gpu/drm/i915/gt/intel_lrc.c
WARNING: kernel-doc './scripts/kernel-doc -rst -enable-lineno -sphinx-version 1.7.9 -function Logical Rings, Logical Ring Contexts and Execlists ./drivers/gpu/drm/i915/gt/intel_lrc.c' failed with return code 1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v6,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: series starting with [v6,1/5] drm: Add function to convert rect in 16.16 fixed format to regular format
URL : https://patchwork.freedesktop.org/series/84910/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9481 -> Patchwork_19139
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_19139 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_19139, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_19139:

### IGT changes ###

#### Possible regressions ####

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-y: [PASS][1] -> [FAIL][2] +3 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9481/fi-tgl-y/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-tgl-y/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_19139 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@read_all_entries:
- fi-tgl-y: [PASS][3] -> [DMESG-WARN][4] ([i915#402])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9481/fi-tgl-y/igt@debugfs_test@read_all_entries.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-tgl-y/igt@debugfs_test@read_all_entries.html

* igt@i915_module_load@reload:
- fi-tgl-u2: [PASS][5] -> [DMESG-WARN][6] ([i915#402] / [k.org#205379])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9481/fi-tgl-u2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-tgl-u2/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-tgl-u2: [PASS][7] -> [DMESG-WARN][8] ([i915#402]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9481/fi-tgl-u2/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-tgl-u2/igt@[email protected]

* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-snb-2600: NOTRUN -> [SKIP][9] ([fdo#109271]) +30 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-snb-2600/igt@[email protected]

* igt@kms_chamelium@hdmi-crc-fast:
- fi-snb-2600: NOTRUN -> [SKIP][10] ([fdo#109271] / [fdo#111827]) +8 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-snb-2600/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-tgl-u2: [PASS][11] -> [SKIP][12] ([i915#668]) +3 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9481/fi-tgl-u2/igt@kms_psr@primary_page_flip.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-tgl-u2/igt@kms_psr@primary_page_flip.html

* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][13] ([i915#2029] / [i915#2722])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-bdw-5557u/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s3:
- fi-snb-2600: [DMESG-WARN][14] -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9481/fi-snb-2600/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/fi-snb-2600/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#668]: https://gitlab.freedesktop.org/drm/intel/issues/668
[k.org#205379]: https://bugzilla.kernel.org/show_bug.cgi?id=205379

Participating hosts (44 -> 39)
------------------------------

Missing (5): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_9481 -> Patchwork_19139

CI-20190529: 20190529
CI_DRM_9481: 968d6b8835487575d68732a7c0a1588795900de4 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5893: ec4073d30b428aaf199c0f4de6c0a5ebdc1c1c65 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19139: 9adededf27e11a3dc0c76e0864afcab150f65c0b @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

9adededf27e1 HAX/DO_NOT_MERGE_IT: drm/i915/display: Enable PSR2 selective fetch for testing 6b6386a01742 drm/i915/display/psr: Program plane's calculated offset to plane SF register 0f58eeb423b2 drm/i915/display: Split and export main surface calculation from skl_check_main_surface() 749bf211b579 drm/i915/display/psr: Use plane damage clips to calculate damaged area 173e7e37d722 drm: Add function to convert rect in 16.16 fixed format to regular format

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19139/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw
In reply to José Roberto de Souza
Quoted 41 lines · José Roberto de Souza

Much more clear to read one function call than four lines doing this conversion.

---
 drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
 include/drm/drm_rect.h     |  2 ++
 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_rect.c +3 -0
index 0460e874896e..24345704b353 100644
@@ -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)

drivers/gpu/drm/drm_rect.c +7 -0
+{
+	out->x1 = in->x1 >> 16;
+	out->y1 = in->y1 >> 16;
+	out->x2 = in->x2 >> 16;
+	out->y2 = in->y2 >> 16;
+}
+EXPORT_SYMBOL(drm_rect_convert_16_16_to_regular);
include/drm/drm_rect.h +0 -0
index e7f4d24cdd00..2ef8180416cd 100644

include/drm/drm_rect.h void drm_rect_rotate(struct drm_rect *r, · line 228

Quoted 6 lines
include/drm/drm_rect.h +2 -0
@@ -223,5 +223,7 @@ void drm_rect_rotate(struct drm_rect *r,
 void drm_rect_rotate_inv(struct drm_rect *r,
 			 int width, int height,
 			 unsigned int rotation);
+void drm_rect_convert_16_16_to_regular(struct drm_rect *in,
+				       struct drm_rect *out);
 

Hi,
if it's purpose is just converting 16.16 fp to integer, how about you have function prototype like this?
extern inline struct drm_rect drm_rect_convert_16_16_fp_to_integer(struct drm_rect in)

And if there are no use case on drm core or other drivers except i915 display yet,
before adding this function to drm core, how about you add this function code to i915 first?

Br,
G.G.

include/drm/drm_rect.h void drm_rect_rotate(struct drm_rect *r, · line 229

Quoted 1 line
include/drm/drm_rect.h +0 -0
 #endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw
Quoted 45 lines · Gwan-gyeong
Quoted 44 lines · José Roberto de Souza

Much more clear to read one function call than four lines doing this conversion.

---
 drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
 include/drm/drm_rect.h | 2 ++

 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_rect.c +3 -0
index 0460e874896e..24345704b353 100644
@@ -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)

drivers/gpu/drm/drm_rect.c +7 -0
+{
+	out->x1 = in->x1 >> 16;
+	out->y1 = in->y1 >> 16;
+	out->x2 = in->x2 >> 16;
+	out->y2 = in->y2 >> 16;
+}
+EXPORT_SYMBOL(drm_rect_convert_16_16_to_regular);
include/drm/drm_rect.h +0 -0
index e7f4d24cdd00..2ef8180416cd 100644
@@ -223,5 +223,7 @@ void drm_rect_rotate(struct drm_rect *r,
  void drm_rect_rotate_inv(struct drm_rect *r,
  			 int width, int height,
  			 unsigned int rotation);
Quoted 8 lines

include/drm/drm_rect.h void drm_rect_rotate(struct drm_rect *r, · line 228

Quoted 3 lines
include/drm/drm_rect.h +2 -0
+void drm_rect_convert_16_16_to_regular(struct drm_rect *in,
+				       struct drm_rect *out);
 

Hi,
if it's purpose is just converting 16.16 fp to integer, how about you have function prototype like this?
extern inline struct drm_rect drm_rect_convert_16_16_fp_to_integer(struct drm_rect in)

I prefer have a function call as this can be reused in several places, so the binaries size can decrease a bit.
Also pointers are better, compiler can decide to not inline the function above and it would need to allocate in stack 2 drm_rects for every call.

Quoted 5 lines

And if there are no use case on drm core or other drivers except i915 display yet,
before adding this function to drm core, how about you add this function code to i915 first?

There is plenty of users in other drivers, just not doing in this series.

Quoted 4 lines

Br,
G.G.

Quoted 1 line
include/drm/drm_rect.h +0 -0
  #endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw
In reply to José Roberto de Souza
Quoted 23 lines · José Roberto de Souza

Much more clear to read one function call than four lines doing this conversion.

---
 drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
 include/drm/drm_rect.h     |  2 ++
 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_rect.c +4 -0
index 0460e874896e..24345704b353 100644
@@ -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.

drivers/gpu/drm/drm_rect.c void drm_rect_rotate_inv(struct drm_rect *r, · line 389

Quoted 10 lines
drivers/gpu/drm/drm_rect.c +10 -0
+ * @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.

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw
Quoted 41 lines · Ville Syrjälä
Quoted 23 lines · José Roberto de Souza

Much more clear to read one function call than four lines doing this conversion.

---
 drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
 include/drm/drm_rect.h | 2 ++

 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_rect.c +4 -0
index 0460e874896e..24345704b353 100644
@@ -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.

drivers/gpu/drm/drm_rect.c void drm_rect_rotate_inv(struct drm_rect *r, · line 389

Quoted 10 lines
drivers/gpu/drm/drm_rect.c +10 -0
+ * @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:

Quoted 8 lines

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.

Okay, but most use cases takes drm_plane_state.src and converts and sets it in another rect, so will modify it to have two parameters.

Quoted 1 line

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw
Quoted 49 lines · Jose
Quoted 48 lines · Ville Syrjälä
Quoted 23 lines · José Roberto de Souza

Much more clear to read one function call than four lines doing this conversion.

---
 drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++
 include/drm/drm_rect.h | 2 ++

 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_rect.c +4 -0
index 0460e874896e..24345704b353 100644
@@ -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.

drivers/gpu/drm/drm_rect.c void drm_rect_rotate_inv(struct drm_rect *r, · line 389

Quoted 10 lines
drivers/gpu/drm/drm_rect.c +10 -0
+ * @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);
}
Quoted 3 lines
Quoted 1 line

to match the current way of doing things.

Okay, but most use cases takes drm_plane_state.src and converts and sets it in another rect, so will modify it to have two parameters.

Would seem a bit more generic by having the caller make the copy if needed. But I guess not big deal either way.

At least make it follow the correct argument order as laid out by memcpy() ;) (+const for the input argument ofc).

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx