Commit 3465c580 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Don't pass plane+plane_state to intel_pin_and_fence_fb_obj()

intel_pin_and_fence_fb_obj() only needs the framebuffer, and the desird
rotation (to find the right GTT view for it), so no need to pass all
kinds of plane stuff.

The main motivation is to get rid of the uggy NULL plane_state handling
due to fbdev.

v2: Add a note why I really want this
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Grumpily-Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1455569699-27905-6-git-send-email-ville.syrjala@linux.intel.com
parent 29cf9491
...@@ -2297,8 +2297,9 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height, ...@@ -2297,8 +2297,9 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,
} }
static void static void
intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
const struct drm_plane_state *plane_state) const struct drm_framebuffer *fb,
unsigned int rotation)
{ {
struct drm_i915_private *dev_priv = to_i915(fb->dev); struct drm_i915_private *dev_priv = to_i915(fb->dev);
struct intel_rotation_info *info = &view->params.rotated; struct intel_rotation_info *info = &view->params.rotated;
...@@ -2306,10 +2307,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, ...@@ -2306,10 +2307,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb,
*view = i915_ggtt_view_normal; *view = i915_ggtt_view_normal;
if (!plane_state) if (!intel_rotation_90_or_270(rotation))
return;
if (!intel_rotation_90_or_270(plane_state->rotation))
return; return;
*view = i915_ggtt_view_rotated; *view = i915_ggtt_view_rotated;
...@@ -2374,9 +2372,8 @@ static unsigned int intel_surf_alignment(const struct drm_i915_private *dev_priv ...@@ -2374,9 +2372,8 @@ static unsigned int intel_surf_alignment(const struct drm_i915_private *dev_priv
} }
int int
intel_pin_and_fence_fb_obj(struct drm_plane *plane, intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
struct drm_framebuffer *fb, unsigned int rotation)
const struct drm_plane_state *plane_state)
{ {
struct drm_device *dev = fb->dev; struct drm_device *dev = fb->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
...@@ -2389,7 +2386,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, ...@@ -2389,7 +2386,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
alignment = intel_surf_alignment(dev_priv, fb->modifier[0]); alignment = intel_surf_alignment(dev_priv, fb->modifier[0]);
intel_fill_fb_ggtt_view(&view, fb, plane_state); intel_fill_fb_ggtt_view(&view, fb, rotation);
/* Note that the w/a also requires 64 PTE of padding following the /* Note that the w/a also requires 64 PTE of padding following the
* bo. We currently fill all unused PTE with the shadow page and so * bo. We currently fill all unused PTE with the shadow page and so
...@@ -2447,15 +2444,14 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, ...@@ -2447,15 +2444,14 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
return ret; return ret;
} }
static void intel_unpin_fb_obj(struct drm_framebuffer *fb, static void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)
const struct drm_plane_state *plane_state)
{ {
struct drm_i915_gem_object *obj = intel_fb_obj(fb); struct drm_i915_gem_object *obj = intel_fb_obj(fb);
struct i915_ggtt_view view; struct i915_ggtt_view view;
WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex)); WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
intel_fill_fb_ggtt_view(&view, fb, plane_state); intel_fill_fb_ggtt_view(&view, fb, rotation);
if (view.type == I915_GGTT_VIEW_NORMAL) if (view.type == I915_GGTT_VIEW_NORMAL)
i915_gem_object_unpin_fence(obj); i915_gem_object_unpin_fence(obj);
...@@ -3014,7 +3010,7 @@ u32 intel_plane_obj_offset(struct intel_plane *intel_plane, ...@@ -3014,7 +3010,7 @@ u32 intel_plane_obj_offset(struct intel_plane *intel_plane,
u64 offset; u64 offset;
intel_fill_fb_ggtt_view(&view, intel_plane->base.state->fb, intel_fill_fb_ggtt_view(&view, intel_plane->base.state->fb,
intel_plane->base.state); intel_plane->base.state->rotation);
vma = i915_gem_obj_to_ggtt_view(obj, &view); vma = i915_gem_obj_to_ggtt_view(obj, &view);
if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n", if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",
...@@ -10959,7 +10955,7 @@ static void intel_unpin_work_fn(struct work_struct *__work) ...@@ -10959,7 +10955,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
struct drm_plane *primary = crtc->base.primary; struct drm_plane *primary = crtc->base.primary;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
intel_unpin_fb_obj(work->old_fb, primary->state); intel_unpin_fb_obj(work->old_fb, primary->state->rotation);
drm_gem_object_unreference(&work->pending_flip_obj->base); drm_gem_object_unreference(&work->pending_flip_obj->base);
if (work->flip_queued_req) if (work->flip_queued_req)
...@@ -11731,8 +11727,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -11731,8 +11727,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
goto cleanup_pending; goto cleanup_pending;
} }
ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, ret = intel_pin_and_fence_fb_obj(fb, primary->state->rotation);
crtc->primary->state);
if (ret) if (ret)
goto cleanup_pending; goto cleanup_pending;
...@@ -11782,7 +11777,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -11782,7 +11777,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
return 0; return 0;
cleanup_unpin: cleanup_unpin:
intel_unpin_fb_obj(fb, crtc->primary->state); intel_unpin_fb_obj(fb, crtc->primary->state->rotation);
cleanup_pending: cleanup_pending:
if (!IS_ERR_OR_NULL(request)) if (!IS_ERR_OR_NULL(request))
i915_gem_request_cancel(request); i915_gem_request_cancel(request);
...@@ -14004,7 +13999,7 @@ intel_prepare_plane_fb(struct drm_plane *plane, ...@@ -14004,7 +13999,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
if (ret) if (ret)
DRM_DEBUG_KMS("failed to attach phys object\n"); DRM_DEBUG_KMS("failed to attach phys object\n");
} else { } else {
ret = intel_pin_and_fence_fb_obj(plane, fb, new_state); ret = intel_pin_and_fence_fb_obj(fb, new_state->rotation);
} }
if (ret == 0) { if (ret == 0) {
...@@ -14048,7 +14043,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane, ...@@ -14048,7 +14043,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR || if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
!INTEL_INFO(dev)->cursor_needs_physical)) !INTEL_INFO(dev)->cursor_needs_physical))
intel_unpin_fb_obj(old_state->fb, old_state); intel_unpin_fb_obj(old_state->fb, old_state->rotation);
/* prepare_fb aborted? */ /* prepare_fb aborted? */
if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) || if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) ||
...@@ -14056,7 +14051,6 @@ intel_cleanup_plane_fb(struct drm_plane *plane, ...@@ -14056,7 +14051,6 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit); i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
i915_gem_request_assign(&old_intel_state->wait_req, NULL); i915_gem_request_assign(&old_intel_state->wait_req, NULL);
} }
int int
...@@ -16179,9 +16173,8 @@ void intel_modeset_gem_init(struct drm_device *dev) ...@@ -16179,9 +16173,8 @@ void intel_modeset_gem_init(struct drm_device *dev)
continue; continue;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = intel_pin_and_fence_fb_obj(c->primary, ret = intel_pin_and_fence_fb_obj(c->primary->fb,
c->primary->fb, c->primary->state->rotation);
c->primary->state);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (ret) { if (ret) {
DRM_ERROR("failed to pin boot fb on pipe %d\n", DRM_ERROR("failed to pin boot fb on pipe %d\n",
......
...@@ -1129,9 +1129,8 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, ...@@ -1129,9 +1129,8 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector,
void intel_release_load_detect_pipe(struct drm_connector *connector, void intel_release_load_detect_pipe(struct drm_connector *connector,
struct intel_load_detect_pipe *old, struct intel_load_detect_pipe *old,
struct drm_modeset_acquire_ctx *ctx); struct drm_modeset_acquire_ctx *ctx);
int intel_pin_and_fence_fb_obj(struct drm_plane *plane, int intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
struct drm_framebuffer *fb, unsigned int rotation);
const struct drm_plane_state *plane_state);
struct drm_framebuffer * struct drm_framebuffer *
__intel_framebuffer_create(struct drm_device *dev, __intel_framebuffer_create(struct drm_device *dev,
struct drm_mode_fb_cmd2 *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
......
...@@ -220,7 +220,7 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -220,7 +220,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
* This also validates that any existing fb inherited from the * This also validates that any existing fb inherited from the
* BIOS is suitable for own access. * BIOS is suitable for own access.
*/ */
ret = intel_pin_and_fence_fb_obj(NULL, &ifbdev->fb->base, NULL); ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
if (ret) if (ret)
goto out_unlock; goto out_unlock;
......
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