summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorMatt Roper2014-12-02 16:45:25 +0100
committerDaniel Vetter2014-12-06 01:46:24 +0100
commit38f3ce3af5742eb5a3e9b01997f5ab85109c5762 (patch)
tree648044c772c841d916f1a4cc191ba823b6dbc08d /drivers/gpu/drm/i915/intel_display.c
parentdrm/i915: Consolidate plane 'prepare' functions (v2) (diff)
downloadkernel-qcow2-linux-38f3ce3af5742eb5a3e9b01997f5ab85109c5762.tar.gz
kernel-qcow2-linux-38f3ce3af5742eb5a3e9b01997f5ab85109c5762.tar.xz
kernel-qcow2-linux-38f3ce3af5742eb5a3e9b01997f5ab85109c5762.zip
drm/i915: Consolidate plane 'cleanup' operations (v3)
All plane update functions need to unpin the old framebuffer when flipping to a new one. Pull this logic into a separate function to ease the integration with atomic plane helpers. v2: Don't wait for vblank if we don't have an old fb to cleanup (Ander) v3: Really don't wait for vblank if we don't have an old fb to cleanup. Previous version only handled this for primary planes; we need the same change on cursors/sprites too! (Ander) Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 262e8904769e..0488700b10f7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11748,6 +11748,31 @@ intel_prepare_plane_fb(struct drm_plane *plane,
return ret;
}
+/**
+ * intel_cleanup_plane_fb - Cleans up an fb after plane use
+ * @plane: drm plane to clean up for
+ * @fb: old framebuffer that was on plane
+ *
+ * Cleans up a framebuffer that has just been removed from a plane.
+ */
+void
+intel_cleanup_plane_fb(struct drm_plane *plane,
+ struct drm_framebuffer *fb)
+{
+ struct drm_device *dev = plane->dev;
+ struct drm_i915_gem_object *obj = intel_fb_obj(fb);
+
+ if (WARN_ON(!obj))
+ return;
+
+ if (plane->type != DRM_PLANE_TYPE_CURSOR ||
+ !INTEL_INFO(dev)->cursor_needs_physical) {
+ mutex_lock(&dev->struct_mutex);
+ intel_unpin_fb_obj(obj);
+ mutex_unlock(&dev->struct_mutex);
+ }
+}
+
static int
intel_check_primary_plane(struct drm_plane *plane,
struct intel_plane_state *state)
@@ -11775,9 +11800,7 @@ intel_commit_primary_plane(struct drm_plane *plane,
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
enum pipe pipe = intel_crtc->pipe;
- struct drm_framebuffer *old_fb = plane->fb;
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
- struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);
struct intel_plane *intel_plane = to_intel_plane(plane);
struct drm_rect *src = &state->src;
@@ -11848,15 +11871,6 @@ intel_commit_primary_plane(struct drm_plane *plane,
intel_update_fbc(dev);
mutex_unlock(&dev->struct_mutex);
}
-
- if (old_fb && old_fb != fb) {
- if (intel_crtc->active)
- intel_wait_for_vblank(dev, intel_crtc->pipe);
-
- mutex_lock(&dev->struct_mutex);
- intel_unpin_fb_obj(old_obj);
- mutex_unlock(&dev->struct_mutex);
- }
}
static int
@@ -11866,6 +11880,7 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
+ struct drm_device *dev = plane->dev;
struct drm_framebuffer *old_fb = plane->fb;
struct intel_plane_state state;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
@@ -11913,6 +11928,12 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
intel_commit_primary_plane(plane, &state);
+ if (fb != old_fb && old_fb) {
+ if (intel_crtc->active)
+ intel_wait_for_vblank(dev, intel_crtc->pipe);
+ intel_cleanup_plane_fb(plane, old_fb);
+ }
+
return 0;
}
@@ -12095,14 +12116,6 @@ intel_commit_cursor_plane(struct drm_plane *plane,
else
addr = obj->phys_handle->busaddr;
- if (intel_crtc->cursor_bo) {
- if (!INTEL_INFO(dev)->cursor_needs_physical) {
- mutex_lock(&dev->struct_mutex);
- intel_unpin_fb_obj(intel_crtc->cursor_bo);
- mutex_unlock(&dev->struct_mutex);
- }
- }
-
intel_crtc->cursor_addr = addr;
intel_crtc->cursor_bo = obj;
update:
@@ -12127,6 +12140,7 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
+ struct drm_device *dev = plane->dev;
struct drm_framebuffer *old_fb = plane->fb;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_plane_state state;
@@ -12167,6 +12181,12 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
intel_commit_cursor_plane(plane, &state);
+ if (fb != old_fb && old_fb) {
+ if (intel_crtc->active)
+ intel_wait_for_vblank(dev, intel_crtc->pipe);
+ intel_cleanup_plane_fb(plane, old_fb);
+ }
+
return 0;
}