On Thu, Mar 11, 2021 at 12:17:28AM +0200, Imre Deak wrote: > Factor out to a new function the logic to convert the FB plane x/y > values to a tile size based offset and new x/y relative to this offset. > This makes intel_fill_fb_info() and intel_plane_remap_gtt() somewhat > more readable. > > Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx> Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_fb.c | 26 ++++++++++++++++--------- > 1 file changed, 17 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c > index 806341c229f0..62a8e37dca38 100644 > --- a/drivers/gpu/drm/i915/display/intel_fb.c > +++ b/drivers/gpu/drm/i915/display/intel_fb.c > @@ -559,6 +559,21 @@ static int convert_plane_offset_to_xy(const struct intel_framebuffer *fb, int co > return 0; > } > > +static u32 calc_plane_aligned_offset(const struct intel_framebuffer *fb, int color_plane, int *x, int *y) > +{ > + const struct drm_framebuffer *drm_fb = &fb->base; > + struct drm_i915_private *i915 = to_i915(drm_fb->dev); > + unsigned int tile_size = intel_tile_size(i915); > + u32 offset; > + > + offset = intel_compute_aligned_offset(i915, x, y, drm_fb, color_plane, > + drm_fb->pitches[color_plane], > + DRM_MODE_ROTATE_0, > + tile_size); > + > + return offset / tile_size; > +} > + > /* > * Setup the rotated view for an FB plane and return the size the GTT mapping > * requires for this view. > @@ -661,11 +676,7 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb > intel_fb->normal[i].x = x; > intel_fb->normal[i].y = y; > > - offset = intel_compute_aligned_offset(i915, &x, &y, fb, i, > - fb->pitches[i], > - DRM_MODE_ROTATE_0, > - tile_size); > - offset /= tile_size; > + offset = calc_plane_aligned_offset(intel_fb, i, &x, &y); > > if (!is_surface_linear(fb, i)) { > struct intel_remapped_plane_info plane_info; > @@ -774,10 +785,7 @@ static void intel_plane_remap_gtt(struct intel_plane_state *plane_state) > x += intel_fb->normal[i].x; > y += intel_fb->normal[i].y; > > - offset = intel_compute_aligned_offset(i915, &x, &y, > - fb, i, fb->pitches[i], > - DRM_MODE_ROTATE_0, tile_size); > - offset /= tile_size; > + offset = calc_plane_aligned_offset(intel_fb, i, &x, &y); > > drm_WARN_ON(&i915->drm, i >= ARRAY_SIZE(info->plane)); > info->plane[i].offset = offset; > -- > 2.25.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx