#include <drm/i915_drm.h>
 #include "i915_drv.h"
 
+static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
+{
+       struct drm_i915_gem_object *obj = ifbdev->fb->obj;
+       unsigned int origin = ifbdev->vma->fence ? ORIGIN_GTT : ORIGIN_CPU;
+
+       intel_fb_obj_invalidate(obj, origin);
+}
+
 static int intel_fbdev_set_par(struct fb_info *info)
 {
        struct drm_fb_helper *fb_helper = info->par;
        int ret;
 
        ret = drm_fb_helper_set_par(info);
-
-       if (ret == 0) {
-               mutex_lock(&fb_helper->dev->struct_mutex);
-               intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
-               mutex_unlock(&fb_helper->dev->struct_mutex);
-       }
+       if (ret == 0)
+               intel_fbdev_invalidate(ifbdev);
 
        return ret;
 }
        int ret;
 
        ret = drm_fb_helper_blank(blank, info);
-
-       if (ret == 0) {
-               mutex_lock(&fb_helper->dev->struct_mutex);
-               intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
-               mutex_unlock(&fb_helper->dev->struct_mutex);
-       }
+       if (ret == 0)
+               intel_fbdev_invalidate(ifbdev);
 
        return ret;
 }
        struct drm_fb_helper *fb_helper = info->par;
        struct intel_fbdev *ifbdev =
                container_of(fb_helper, struct intel_fbdev, helper);
-
        int ret;
-       ret = drm_fb_helper_pan_display(var, info);
 
-       if (ret == 0) {
-               mutex_lock(&fb_helper->dev->struct_mutex);
-               intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
-               mutex_unlock(&fb_helper->dev->struct_mutex);
-       }
+       ret = drm_fb_helper_pan_display(var, info);
+       if (ret == 0)
+               intel_fbdev_invalidate(ifbdev);
 
        return ret;
 }
        if (!ifbdev->fb)
                return;
 
-       if (drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper)) {
-               DRM_DEBUG("failed to restore crtc mode\n");
-       } else {
-               mutex_lock(&dev->struct_mutex);
-               intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
-               mutex_unlock(&dev->struct_mutex);
-       }
+       if (drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper) == 0)
+               intel_fbdev_invalidate(ifbdev);
 }