Commit 959086ec authored by Imre Deak's avatar Imre Deak

drm/i915: Pass intel_framebuffer instad of drm_framebuffer to intel_fill_fb_info()

Make one step to pass intel_framebuffer to all intel_fb functions.
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210414155208.3161335-2-imre.deak@intel.com
parent 31824c03
......@@ -11253,7 +11253,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
fb->obj[i] = &obj->base;
}
ret = intel_fill_fb_info(dev_priv, fb);
ret = intel_fill_fb_info(dev_priv, intel_fb);
if (ret)
goto err;
......
......@@ -163,17 +163,17 @@ void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
*vsub = 32;
}
static void intel_fb_plane_dims(int *w, int *h, struct drm_framebuffer *fb, int color_plane)
static void intel_fb_plane_dims(const struct intel_framebuffer *fb, int color_plane, int *w, int *h)
{
int main_plane = is_ccs_plane(fb, color_plane) ?
skl_ccs_to_main_plane(fb, color_plane) : 0;
int main_plane = is_ccs_plane(&fb->base, color_plane) ?
skl_ccs_to_main_plane(&fb->base, color_plane) : 0;
int main_hsub, main_vsub;
int hsub, vsub;
intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, fb, main_plane);
intel_fb_plane_get_subsampling(&hsub, &vsub, fb, color_plane);
*w = fb->width / main_hsub / hsub;
*h = fb->height / main_vsub / vsub;
intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, &fb->base, main_plane);
intel_fb_plane_get_subsampling(&hsub, &vsub, &fb->base, color_plane);
*w = fb->base.width / main_hsub / hsub;
*h = fb->base.height / main_vsub / vsub;
}
static u32 intel_adjust_tile_offset(int *x, int *y,
......@@ -735,19 +735,18 @@ static void intel_fb_view_init(struct intel_fb_view *view, enum i915_ggtt_view_t
view->gtt.type = view_type;
}
int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb)
int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *fb)
{
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
struct drm_i915_gem_object *obj = intel_fb_obj(&fb->base);
u32 gtt_offset_rotated = 0;
u32 gtt_offset_remapped = 0;
unsigned int max_size = 0;
int i, num_planes = fb->format->num_planes;
int i, num_planes = fb->base.format->num_planes;
unsigned int tile_size = intel_tile_size(i915);
intel_fb_view_init(&intel_fb->normal_view, I915_GGTT_VIEW_NORMAL);
intel_fb_view_init(&intel_fb->rotated_view, I915_GGTT_VIEW_ROTATED);
intel_fb_view_init(&intel_fb->remapped_view, I915_GGTT_VIEW_REMAPPED);
intel_fb_view_init(&fb->normal_view, I915_GGTT_VIEW_NORMAL);
intel_fb_view_init(&fb->rotated_view, I915_GGTT_VIEW_ROTATED);
intel_fb_view_init(&fb->remapped_view, I915_GGTT_VIEW_REMAPPED);
for (i = 0; i < num_planes; i++) {
struct fb_plane_view_dims view_dims;
......@@ -762,45 +761,45 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb
* is consumed by the driver and not passed to DE. Skip the
* arithmetic related to alignment and offset calculation.
*/
if (is_gen12_ccs_cc_plane(fb, i)) {
if (IS_ALIGNED(fb->offsets[i], PAGE_SIZE))
if (is_gen12_ccs_cc_plane(&fb->base, i)) {
if (IS_ALIGNED(fb->base.offsets[i], PAGE_SIZE))
continue;
else
return -EINVAL;
}
cpp = fb->format->cpp[i];
intel_fb_plane_dims(&width, &height, fb, i);
cpp = fb->base.format->cpp[i];
intel_fb_plane_dims(fb, i, &width, &height);
ret = convert_plane_offset_to_xy(intel_fb, i, width, &x, &y);
ret = convert_plane_offset_to_xy(fb, i, width, &x, &y);
if (ret)
return ret;
init_plane_view_dims(intel_fb, i, width, height, &view_dims);
init_plane_view_dims(fb, i, width, height, &view_dims);
/*
* First pixel of the framebuffer from
* the start of the normal gtt mapping.
*/
intel_fb->normal_view.color_plane[i].x = x;
intel_fb->normal_view.color_plane[i].y = y;
intel_fb->normal_view.color_plane[i].stride = intel_fb->base.pitches[i];
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];
offset = calc_plane_aligned_offset(intel_fb, i, &x, &y);
offset = calc_plane_aligned_offset(fb, i, &x, &y);
/* Y or Yf modifiers required for 90/270 rotation */
if (fb->modifier == I915_FORMAT_MOD_Y_TILED ||
fb->modifier == I915_FORMAT_MOD_Yf_TILED)
gtt_offset_rotated += calc_plane_remap_info(intel_fb, i, &view_dims,
if (fb->base.modifier == I915_FORMAT_MOD_Y_TILED ||
fb->base.modifier == I915_FORMAT_MOD_Yf_TILED)
gtt_offset_rotated += calc_plane_remap_info(fb, i, &view_dims,
offset, gtt_offset_rotated, x, y,
&intel_fb->rotated_view);
&fb->rotated_view);
if (intel_fb_needs_pot_stride_remap(intel_fb))
gtt_offset_remapped += calc_plane_remap_info(intel_fb, i, &view_dims,
if (intel_fb_needs_pot_stride_remap(fb))
gtt_offset_remapped += calc_plane_remap_info(fb, i, &view_dims,
offset, gtt_offset_remapped, x, y,
&intel_fb->remapped_view);
&fb->remapped_view);
size = calc_plane_normal_size(intel_fb, i, &view_dims, x, y);
size = calc_plane_normal_size(fb, i, &view_dims, x, y);
/* how many tiles in total needed in the bo */
max_size = max(max_size, offset + size);
}
......
......@@ -45,7 +45,7 @@ u32 intel_plane_compute_aligned_offset(int *x, int *y,
const struct intel_plane_state *state,
int color_plane);
int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb);
int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *fb);
void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
struct intel_fb_view *view);
int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment