39,10 → 39,6 |
#include <drm/drm_fb_helper.h> |
#include <drm/drm_crtc_helper.h> |
|
MODULE_AUTHOR("David Airlie, Jesse Barnes"); |
MODULE_DESCRIPTION("DRM KMS helper"); |
MODULE_LICENSE("GPL and additional rights"); |
|
static LIST_HEAD(kernel_fb_helper_list); |
|
/** |
155,9 → 151,34 |
|
if (bound < crtcs_bound) |
return false; |
|
return true; |
} |
|
#ifdef CONFIG_MAGIC_SYSRQ |
static void drm_fb_helper_restore_work_fn(struct work_struct *ignored) |
{ |
bool ret; |
ret = drm_fb_helper_force_kernel_mode(); |
if (ret == true) |
DRM_ERROR("Failed to restore crtc configuration\n"); |
} |
static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); |
|
static void drm_fb_helper_sysrq(int dummy1) |
{ |
schedule_work(&drm_fb_helper_restore_work); |
} |
|
static struct sysrq_key_op sysrq_drm_fb_helper_restore_op = { |
.handler = drm_fb_helper_sysrq, |
.help_msg = "force-fb(V)", |
.action_msg = "Restore framebuffer console", |
}; |
#else |
|
#endif |
|
static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode) |
{ |
struct drm_fb_helper *fb_helper = info->par; |
584,7 → 605,6 |
struct drm_fb_helper *fb_helper = info->par; |
struct drm_device *dev = fb_helper->dev; |
struct drm_mode_set *modeset; |
struct drm_crtc *crtc; |
int ret = 0; |
int i; |
|
595,8 → 615,6 |
} |
|
for (i = 0; i < fb_helper->crtc_count; i++) { |
crtc = fb_helper->crtc_info[i].mode_set.crtc; |
|
modeset = &fb_helper->crtc_info[i].mode_set; |
|
modeset->x = var->xoffset; |
1080,7 → 1098,6 |
struct drm_connector *connector; |
struct drm_connector_helper_funcs *connector_funcs; |
struct drm_encoder *encoder; |
struct drm_fb_helper_crtc *best_crtc; |
int my_score, best_score, score; |
struct drm_fb_helper_crtc **crtcs, *crtc; |
struct drm_fb_helper_connector *fb_helper_conn; |
1092,7 → 1109,6 |
connector = fb_helper_conn->connector; |
|
best_crtcs[n] = NULL; |
best_crtc = NULL; |
best_score = drm_pick_crtcs(fb_helper, best_crtcs, modes, n+1, width, height); |
if (modes[n] == NULL) |
return best_score; |
1141,7 → 1157,6 |
score = my_score + drm_pick_crtcs(fb_helper, crtcs, modes, n + 1, |
width, height); |
if (score > best_score) { |
best_crtc = crtc; |
best_score = score; |
memcpy(best_crtcs, crtcs, |
dev->mode_config.num_connector * |
1308,8 → 1323,7 |
int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) |
{ |
struct drm_device *dev = fb_helper->dev; |
int count = 0; |
u32 max_width, max_height, bpp_sel; |
u32 max_width, max_height; |
|
if (!fb_helper->fb) |
return 0; |
1324,10 → 1338,8 |
|
max_width = fb_helper->fb->width; |
max_height = fb_helper->fb->height; |
bpp_sel = fb_helper->fb->bits_per_pixel; |
|
count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, |
max_height); |
drm_fb_helper_probe_connector_modes(fb_helper, max_width, max_height); |
mutex_unlock(&fb_helper->dev->mode_config.mutex); |
|
drm_modeset_lock_all(dev); |
1339,5 → 1351,24 |
} |
EXPORT_SYMBOL(drm_fb_helper_hotplug_event); |
|
/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT) |
* but the module doesn't depend on any fb console symbols. At least |
* attempt to load fbcon to avoid leaving the system without a usable console. |
*/ |
#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT) |
static int __init drm_fb_helper_modinit(void) |
{ |
const char *name = "fbcon"; |
struct module *fbcon; |
|
mutex_lock(&module_mutex); |
fbcon = find_module(name); |
mutex_unlock(&module_mutex); |
|
if (!fbcon) |
request_module_nowait(name); |
return 0; |
} |
|
module_init(drm_fb_helper_modinit); |
#endif |