Commit be6c1dd5 authored by Imre Deak's avatar Imre Deak
Browse files

drm/i915/fb: Rename i915_color_plane_view::stride to mapping_stride



The next patch needs to distinguish between a view's mapping and scanout
stride. Rename the current stride parameter to mapping_stride with the
script below. mapping_stride will keep the same meaning as stride had
on all platforms so far, while the meaning of it will change on ADLP.

No functional changes.

@@
identifier intel_fb_view;
identifier i915_color_plane_view;
identifier color_plane;
expression e;
type T;
@@
struct intel_fb_view {
...
struct i915_color_plane_view {
...
- T stride;
+ T mapping_stride;
...
} color_plane[e];
...
};

@@
struct i915_color_plane_view pv;
@@
  pv.
-    stride
+    mapping_stride

@@
struct i915_color_plane_view *pvp;
@@
  pvp->
-     stride
+     mapping_stride

Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026225105.2783797-6-imre.deak@intel.com
parent 96837e8b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
		u32 alignment = intel_surf_alignment(fb, 0);
		int cpp = fb->format->cpp[0];

		while ((src_x + src_w) * cpp > plane_state->view.color_plane[0].stride) {
		while ((src_x + src_w) * cpp > plane_state->view.color_plane[0].mapping_stride) {
			if (offset == 0) {
				drm_dbg_kms(&dev_priv->drm,
					    "Unable to find suitable display surface offset due to X-tiling\n");
@@ -431,7 +431,7 @@ static void i9xx_update_plane(struct intel_plane *plane,
	spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);

	intel_de_write_fw(dev_priv, DSPSTRIDE(i9xx_plane),
			  plane_state->view.color_plane[0].stride);
			  plane_state->view.color_plane[0].mapping_stride);

	if (DISPLAY_VER(dev_priv) < 4) {
		/*
+3 −3
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state,
{
	return CURSOR_ENABLE |
		CURSOR_FORMAT_ARGB |
		CURSOR_STRIDE(plane_state->view.color_plane[0].stride);
		CURSOR_STRIDE(plane_state->view.color_plane[0].mapping_stride);
}

static bool i845_cursor_size_ok(const struct intel_plane_state *plane_state)
@@ -229,7 +229,7 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state,
	}

	drm_WARN_ON(&i915->drm, plane_state->uapi.visible &&
		    plane_state->view.color_plane[0].stride != fb->pitches[0]);
		    plane_state->view.color_plane[0].mapping_stride != fb->pitches[0]);

	switch (fb->pitches[0]) {
	case 256:
@@ -450,7 +450,7 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
	}

	drm_WARN_ON(&dev_priv->drm, plane_state->uapi.visible &&
		    plane_state->view.color_plane[0].stride != fb->pitches[0]);
		    plane_state->view.color_plane[0].mapping_stride != fb->pitches[0]);

	if (fb->pitches[0] !=
	    drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
+3 −3
Original line number Diff line number Diff line
@@ -661,7 +661,7 @@ u32 intel_fb_xy_to_linear(int x, int y,
{
	const struct drm_framebuffer *fb = state->hw.fb;
	unsigned int cpp = fb->format->cpp[color_plane];
	unsigned int pitch = state->view.color_plane[color_plane].stride;
	unsigned int pitch = state->view.color_plane[color_plane].mapping_stride;

	return y * pitch + x * cpp;
}
@@ -7775,8 +7775,8 @@ static int intel_atomic_check_async(struct intel_atomic_state *state, struct int
			return -EINVAL;
		}

		if (old_plane_state->view.color_plane[0].stride !=
		    new_plane_state->view.color_plane[0].stride) {
		if (old_plane_state->view.color_plane[0].mapping_stride !=
		    new_plane_state->view.color_plane[0].mapping_stride) {
			drm_dbg_kms(&i915->drm, "Stride cannot be changed in async flip\n");
			return -EINVAL;
		}
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ struct intel_fb_view {
		 *   bytes for 0/180 degree rotation
		 *   pixels for 90/270 degree rotation
		 */
		unsigned int stride;
		unsigned int mapping_stride;
	} color_plane[4];
};

+13 −12
Original line number Diff line number Diff line
@@ -915,7 +915,7 @@ u32 intel_plane_adjust_aligned_offset(int *x, int *y,
{
	return intel_adjust_aligned_offset(x, y, state->hw.fb, color_plane,
					   state->hw.rotation,
					   state->view.color_plane[color_plane].stride,
					   state->view.color_plane[color_plane].mapping_stride,
					   old_offset, new_offset);
}

@@ -996,7 +996,7 @@ u32 intel_plane_compute_aligned_offset(int *x, int *y,
	struct drm_i915_private *i915 = to_i915(intel_plane->base.dev);
	const struct drm_framebuffer *fb = state->hw.fb;
	unsigned int rotation = state->hw.rotation;
	int pitch = state->view.color_plane[color_plane].stride;
	int pitch = state->view.color_plane[color_plane].mapping_stride;
	u32 alignment;

	if (intel_plane->id == PLANE_CURSOR)
@@ -1155,11 +1155,11 @@ bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb)
static int intel_fb_pitch(const struct intel_framebuffer *fb, int color_plane, unsigned int rotation)
{
	if (drm_rotation_90_or_270(rotation))
		return fb->rotated_view.color_plane[color_plane].stride;
		return fb->rotated_view.color_plane[color_plane].mapping_stride;
	else if (intel_fb_needs_pot_stride_remap(fb))
		return fb->remapped_view.color_plane[color_plane].stride;
		return fb->remapped_view.color_plane[color_plane].mapping_stride;
	else
		return fb->normal_view.color_plane[color_plane].stride;
		return fb->normal_view.color_plane[color_plane].mapping_stride;
}

static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
@@ -1370,7 +1370,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
		color_plane_info->x = r.x1;
		color_plane_info->y = r.y1;

		color_plane_info->stride = remap_info->dst_stride * tile_height;
		color_plane_info->mapping_stride = remap_info->dst_stride * tile_height;

		size += remap_info->dst_stride * remap_info->width;

@@ -1393,7 +1393,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
		color_plane_info->y = y;

		if (remap_info->linear) {
			color_plane_info->stride = fb->base.pitches[color_plane];
			color_plane_info->mapping_stride = fb->base.pitches[color_plane];

			size += remap_info->size;
		} else {
@@ -1401,8 +1401,9 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
									      remap_info->width);

			assign_chk_ovf(i915, remap_info->dst_stride, dst_stride);
			color_plane_info->stride = dst_stride *
						   tile_width * fb->base.format->cpp[color_plane];
			color_plane_info->mapping_stride = dst_stride *
							   tile_width *
							   fb->base.format->cpp[color_plane];

			size += dst_stride * remap_info->height;
		}
@@ -1416,7 +1417,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
	if (remap_info->linear)
		intel_adjust_linear_offset(&color_plane_info->x, &color_plane_info->y,
					   fb->base.format->cpp[color_plane],
					   color_plane_info->stride,
					   color_plane_info->mapping_stride,
					   gtt_offset * tile_size, 0);
	else
		intel_adjust_tile_offset(&color_plane_info->x, &color_plane_info->y,
@@ -1527,7 +1528,7 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *
		 */
		fb->normal_view.color_plane[i].x = x;
		fb->normal_view.color_plane[i].y = y;
		fb->normal_view.color_plane[i].stride = fb->base.pitches[i];
		fb->normal_view.color_plane[i].mapping_stride = fb->base.pitches[i];

		offset = calc_plane_aligned_offset(fb, i, &x, &y);

@@ -1721,7 +1722,7 @@ static int intel_plane_check_stride(const struct intel_plane_state *plane_state)
		return 0;

	/* FIXME other color planes? */
	stride = plane_state->view.color_plane[0].stride;
	stride = plane_state->view.color_plane[0].mapping_stride;
	max_stride = plane->max_stride(plane, fb->format->format,
				       fb->modifier, rotation);

Loading