Commit 2d7a215f authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Embed rotation_info under intel_framebuffer

Instead of repopulatin the rotation_info struct for the fb every time
we try to use the fb, we can just populate it once when creating the fb,
and later we can just copy the pre-populate struct into the gtt_view.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1455569699-27905-10-git-send-email-ville.syrjala@linux.intel.com
parent 11f20322
...@@ -2312,18 +2312,20 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, ...@@ -2312,18 +2312,20 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
const struct drm_framebuffer *fb, const struct drm_framebuffer *fb,
unsigned int rotation) unsigned int rotation)
{ {
struct drm_i915_private *dev_priv = to_i915(fb->dev); if (intel_rotation_90_or_270(rotation)) {
struct intel_rotation_info *info = &view->params.rotated;
unsigned int tile_size, tile_width, tile_height, cpp;
*view = i915_ggtt_view_normal;
if (!intel_rotation_90_or_270(rotation))
return;
*view = i915_ggtt_view_rotated; *view = i915_ggtt_view_rotated;
view->params.rotated = to_intel_framebuffer(fb)->rot_info;
} else {
*view = i915_ggtt_view_normal;
}
}
info->uv_offset = fb->offsets[1]; static void
intel_fill_fb_info(struct drm_i915_private *dev_priv,
struct drm_framebuffer *fb)
{
struct intel_rotation_info *info = &to_intel_framebuffer(fb)->rot_info;
unsigned int tile_size, tile_width, tile_height, cpp;
tile_size = intel_tile_size(dev_priv); tile_size = intel_tile_size(dev_priv);
...@@ -2339,6 +2341,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, ...@@ -2339,6 +2341,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
intel_tile_dims(dev_priv, &tile_width, &tile_height, intel_tile_dims(dev_priv, &tile_width, &tile_height,
fb->modifier[1], cpp); fb->modifier[1], cpp);
info->uv_offset = fb->offsets[1];
info->plane[1].width = DIV_ROUND_UP(fb->pitches[1], tile_width * cpp); info->plane[1].width = DIV_ROUND_UP(fb->pitches[1], tile_width * cpp);
info->plane[1].height = DIV_ROUND_UP(fb->height / 2, tile_height); info->plane[1].height = DIV_ROUND_UP(fb->height / 2, tile_height);
} }
...@@ -14986,6 +14989,8 @@ static int intel_framebuffer_init(struct drm_device *dev, ...@@ -14986,6 +14989,8 @@ static int intel_framebuffer_init(struct drm_device *dev,
drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
intel_fb->obj = obj; intel_fb->obj = obj;
intel_fill_fb_info(dev_priv, &intel_fb->base);
ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs); ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
if (ret) { if (ret) {
DRM_ERROR("framebuffer init failed %d\n", ret); DRM_ERROR("framebuffer init failed %d\n", ret);
......
...@@ -118,6 +118,7 @@ enum intel_output_type { ...@@ -118,6 +118,7 @@ enum intel_output_type {
struct intel_framebuffer { struct intel_framebuffer {
struct drm_framebuffer base; struct drm_framebuffer base;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct intel_rotation_info rot_info;
}; };
struct intel_fbdev { struct intel_fbdev {
......
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