Commit 82bc3b2d authored by Tvrtko Ursulin's avatar Tvrtko Ursulin Committed by Daniel Vetter

drm/i915: Pass in plane state when (un)pinning frame buffers

Plane state carries the rotation information which is needed for determining
the appropriate GGTT view type.

This just adds the parameter with the actual usage coming in future patches.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent e6617330
...@@ -2291,6 +2291,7 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height, ...@@ -2291,6 +2291,7 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,
int int
intel_pin_and_fence_fb_obj(struct drm_plane *plane, intel_pin_and_fence_fb_obj(struct drm_plane *plane,
struct drm_framebuffer *fb, struct drm_framebuffer *fb,
const struct drm_plane_state *plane_state,
struct intel_engine_cs *pipelined) struct intel_engine_cs *pipelined)
{ {
struct drm_device *dev = fb->dev; struct drm_device *dev = fb->dev;
...@@ -2378,8 +2379,11 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, ...@@ -2378,8 +2379,11 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
return ret; return ret;
} }
static void intel_unpin_fb_obj(struct drm_i915_gem_object *obj) static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
const struct drm_plane_state *plane_state)
{ {
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex)); WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
i915_gem_object_unpin_fence(obj); i915_gem_object_unpin_fence(obj);
...@@ -9318,7 +9322,7 @@ static void intel_unpin_work_fn(struct work_struct *__work) ...@@ -9318,7 +9322,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
enum pipe pipe = to_intel_crtc(work->crtc)->pipe; enum pipe pipe = to_intel_crtc(work->crtc)->pipe;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
intel_unpin_fb_obj(intel_fb_obj(work->old_fb)); intel_unpin_fb_obj(work->old_fb, work->crtc->primary->state);
drm_gem_object_unreference(&work->pending_flip_obj->base); drm_gem_object_unreference(&work->pending_flip_obj->base);
intel_fbc_update(dev); intel_fbc_update(dev);
...@@ -10026,7 +10030,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -10026,7 +10030,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
ring = &dev_priv->ring[RCS]; ring = &dev_priv->ring[RCS];
} }
ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, ring); ret = intel_pin_and_fence_fb_obj(crtc->primary, fb,
crtc->primary->state, ring);
if (ret) if (ret)
goto cleanup_pending; goto cleanup_pending;
...@@ -10066,7 +10071,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -10066,7 +10071,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
return 0; return 0;
cleanup_unpin: cleanup_unpin:
intel_unpin_fb_obj(obj); intel_unpin_fb_obj(fb, crtc->primary->state);
cleanup_pending: cleanup_pending:
atomic_dec(&intel_crtc->unpin_work_count); atomic_dec(&intel_crtc->unpin_work_count);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -12022,7 +12027,7 @@ intel_prepare_plane_fb(struct drm_plane *plane, ...@@ -12022,7 +12027,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, NULL); ret = intel_pin_and_fence_fb_obj(plane, fb, new_state, NULL);
} }
if (ret == 0) if (ret == 0)
...@@ -12054,7 +12059,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane, ...@@ -12054,7 +12059,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
if (plane->type != DRM_PLANE_TYPE_CURSOR || if (plane->type != DRM_PLANE_TYPE_CURSOR ||
!INTEL_INFO(dev)->cursor_needs_physical) { !INTEL_INFO(dev)->cursor_needs_physical) {
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
intel_unpin_fb_obj(obj); intel_unpin_fb_obj(fb, old_state);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
} }
} }
...@@ -13940,6 +13945,7 @@ void intel_modeset_gem_init(struct drm_device *dev) ...@@ -13940,6 +13945,7 @@ void intel_modeset_gem_init(struct drm_device *dev)
if (intel_pin_and_fence_fb_obj(c->primary, if (intel_pin_and_fence_fb_obj(c->primary,
c->primary->fb, c->primary->fb,
c->primary->state,
NULL)) { NULL)) {
DRM_ERROR("failed to pin boot fb on pipe %d\n", DRM_ERROR("failed to pin boot fb on pipe %d\n",
to_intel_crtc(c)->pipe); to_intel_crtc(c)->pipe);
......
...@@ -959,6 +959,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, ...@@ -959,6 +959,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
struct intel_load_detect_pipe *old); struct intel_load_detect_pipe *old);
int intel_pin_and_fence_fb_obj(struct drm_plane *plane, int intel_pin_and_fence_fb_obj(struct drm_plane *plane,
struct drm_framebuffer *fb, struct drm_framebuffer *fb,
const struct drm_plane_state *plane_state,
struct intel_engine_cs *pipelined); struct intel_engine_cs *pipelined);
struct drm_framebuffer * struct drm_framebuffer *
__intel_framebuffer_create(struct drm_device *dev, __intel_framebuffer_create(struct drm_device *dev,
......
...@@ -151,7 +151,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper, ...@@ -151,7 +151,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
} }
/* Flush everything out, we'll be doing GTT only from now on */ /* Flush everything out, we'll be doing GTT only from now on */
ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL); ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL, NULL);
if (ret) { if (ret) {
DRM_ERROR("failed to pin obj: %d\n", ret); DRM_ERROR("failed to pin obj: %d\n", ret);
goto out_fb; goto out_fb;
......
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