drm/i915: Track frontbuffer invalidation/flushing
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / i915 / intel_sprite.c
index 1b66ddcdfb331cdcb83dd9558ce494041cebc2b3..0e3fd5c59e2814cc4874c49a2ac54c08d44f54db 100644 (file)
@@ -811,6 +811,7 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
        struct drm_device *dev = plane->dev;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        struct intel_plane *intel_plane = to_intel_plane(plane);
+       enum pipe pipe = intel_crtc->pipe;
        struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
        struct drm_i915_gem_object *obj = intel_fb->obj;
        struct drm_i915_gem_object *old_obj = intel_plane->obj;
@@ -998,6 +999,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
         */
        ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
 
+       i915_gem_track_fb(old_obj, obj,
+                         INTEL_FRONTBUFFER_SPRITE(pipe));
        mutex_unlock(&dev->struct_mutex);
 
        if (ret)
@@ -1031,6 +1034,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                else
                        intel_plane->disable_plane(plane, crtc);
 
+               intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_SPRITE(pipe));
+
                if (!primary_was_enabled && primary_enabled)
                        intel_post_enable_primary(crtc);
        }
@@ -1060,6 +1065,7 @@ intel_disable_plane(struct drm_plane *plane)
        struct drm_device *dev = plane->dev;
        struct intel_plane *intel_plane = to_intel_plane(plane);
        struct intel_crtc *intel_crtc;
+       enum pipe pipe;
 
        if (!plane->fb)
                return 0;
@@ -1068,6 +1074,7 @@ intel_disable_plane(struct drm_plane *plane)
                return -EINVAL;
 
        intel_crtc = to_intel_crtc(plane->crtc);
+       pipe = intel_crtc->pipe;
 
        if (intel_crtc->active) {
                bool primary_was_enabled = intel_crtc->primary_enabled;
@@ -1086,6 +1093,8 @@ intel_disable_plane(struct drm_plane *plane)
 
                mutex_lock(&dev->struct_mutex);
                intel_unpin_fb_obj(intel_plane->obj);
+               i915_gem_track_fb(intel_plane->obj, NULL,
+                                 INTEL_FRONTBUFFER_SPRITE(pipe));
                mutex_unlock(&dev->struct_mutex);
 
                intel_plane->obj = NULL;