Commit e8e7a2b8 authored by Dave Airlie's avatar Dave Airlie

drm/i915: restore only the mode of this driver on lastclose (v2)

i915 calls the panic handler function on last close to reset the modes,
however this is a really bad idea for multi-gpu machines, esp shareable
gpus machines. So add a new entry point for the driver to just restore
its own fbcon mode.

v2: move code into fb helper, fix panic code to block mode change on
powered off GPUs.

[airlied: this hits drm core and I wrote it and it was reviewed on intel-gfx
 so really I signed it off twice ;-).]
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6565945b
...@@ -342,9 +342,22 @@ int drm_fb_helper_debug_leave(struct fb_info *info) ...@@ -342,9 +342,22 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
} }
EXPORT_SYMBOL(drm_fb_helper_debug_leave); EXPORT_SYMBOL(drm_fb_helper_debug_leave);
bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
{
bool error = false;
int i, ret;
for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
ret = drm_crtc_helper_set_config(mode_set);
if (ret)
error = true;
}
return error;
}
EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode);
bool drm_fb_helper_force_kernel_mode(void) bool drm_fb_helper_force_kernel_mode(void)
{ {
int i = 0;
bool ret, error = false; bool ret, error = false;
struct drm_fb_helper *helper; struct drm_fb_helper *helper;
...@@ -352,13 +365,13 @@ bool drm_fb_helper_force_kernel_mode(void) ...@@ -352,13 +365,13 @@ bool drm_fb_helper_force_kernel_mode(void)
return false; return false;
list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) { list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
for (i = 0; i < helper->crtc_count; i++) { if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)
struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set; continue;
ret = drm_crtc_helper_set_config(mode_set);
ret = drm_fb_helper_restore_fbdev_mode(helper);
if (ret) if (ret)
error = true; error = true;
} }
}
return error; return error;
} }
......
...@@ -2207,7 +2207,7 @@ void i915_driver_lastclose(struct drm_device * dev) ...@@ -2207,7 +2207,7 @@ void i915_driver_lastclose(struct drm_device * dev)
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
if (!dev_priv || drm_core_check_feature(dev, DRIVER_MODESET)) { if (!dev_priv || drm_core_check_feature(dev, DRIVER_MODESET)) {
drm_fb_helper_restore(); intel_fb_restore_mode(dev);
vga_switcheroo_process_delayed_switch(); vga_switcheroo_process_delayed_switch();
return; return;
} }
......
...@@ -338,4 +338,5 @@ extern int intel_overlay_attrs(struct drm_device *dev, void *data, ...@@ -338,4 +338,5 @@ extern int intel_overlay_attrs(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern void intel_fb_output_poll_changed(struct drm_device *dev); extern void intel_fb_output_poll_changed(struct drm_device *dev);
extern void intel_fb_restore_mode(struct drm_device *dev);
#endif /* __INTEL_DRV_H__ */ #endif /* __INTEL_DRV_H__ */
...@@ -264,3 +264,13 @@ void intel_fb_output_poll_changed(struct drm_device *dev) ...@@ -264,3 +264,13 @@ void intel_fb_output_poll_changed(struct drm_device *dev)
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper); drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper);
} }
void intel_fb_restore_mode(struct drm_device *dev)
{
int ret;
drm_i915_private_t *dev_priv = dev->dev_private;
ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
if (ret)
DRM_DEBUG("failed to restore crtc mode\n");
}
...@@ -118,6 +118,7 @@ int drm_fb_helper_setcolreg(unsigned regno, ...@@ -118,6 +118,7 @@ int drm_fb_helper_setcolreg(unsigned regno,
unsigned transp, unsigned transp,
struct fb_info *info); struct fb_info *info);
bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
void drm_fb_helper_restore(void); void drm_fb_helper_restore(void);
void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
uint32_t fb_width, uint32_t fb_height); uint32_t fb_width, uint32_t fb_height);
......
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