@@ -2002,6 +2002,9 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
*/
void drm_fb_helper_lastclose(struct drm_device *dev)
{
+ if (drm_has_active_plane(dev))
+ return;
+
drm_fb_helper_restore_fbdev_mode_unlocked(dev->fb_helper);
}
EXPORT_SYMBOL(drm_fb_helper_lastclose);
@@ -930,6 +930,27 @@ static int __setplane_check(struct drm_plane *plane,
return 0;
}
+/**
+ * drm_has_active_plane - check whether any planes are currently active
+ * @dev: the DRM device
+ *
+ * Return true if any planes are currently active
+ */
+bool drm_has_active_plane(struct drm_device *dev)
+{
+ struct drm_plane *plane;
+
+ drm_for_each_plane(plane, dev) {
+ if (plane->state && plane->state->crtc && plane->state->fb)
+ return true;
+ if (plane->crtc && plane->fb)
+ return true;
+ }
+
+ return false;
+}
+EXPORT_SYMBOL(drm_has_active_plane);
+
/**
* drm_any_plane_has_format - Check whether any plane supports this format and modifier combination
* @dev: DRM device
@@ -965,6 +965,8 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
#define drm_for_each_plane(plane, dev) \
list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
+bool drm_has_active_plane(struct drm_device *dev);
+
bool drm_any_plane_has_format(struct drm_device *dev,
u32 format, u64 modifier);