Commit 02f5eebb authored by Jesse Barnes's avatar Jesse Barnes Committed by Daniel Vetter

drm/i915: don't preserve inherited configs with nothing on v2

It can be corrected later and may be what was actually desired, but
generally isn't, so if we find nothing is enabled, let the core DRM fb
helper figure something out.

v2: free the array too (Jesse)

Note that this also undoes any changes in case we bail out due to hw
cloning.
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent b45a6715
...@@ -286,7 +286,17 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, ...@@ -286,7 +286,17 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
struct drm_display_mode **modes, struct drm_display_mode **modes,
bool *enabled, int width, int height) bool *enabled, int width, int height)
{ {
struct drm_device *dev = fb_helper->dev;
int i, j; int i, j;
bool *save_enabled;
bool any_enabled = false;
save_enabled = kcalloc(dev->mode_config.num_connector, sizeof(bool),
GFP_KERNEL);
if (!save_enabled)
return false;
memcpy(save_enabled, enabled, dev->mode_config.num_connector);
for (i = 0; i < fb_helper->connector_count; i++) { for (i = 0; i < fb_helper->connector_count; i++) {
struct drm_fb_helper_connector *fb_conn; struct drm_fb_helper_connector *fb_conn;
...@@ -318,8 +328,10 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, ...@@ -318,8 +328,10 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
* match the BIOS. * match the BIOS.
*/ */
for (j = 0; j < fb_helper->connector_count; j++) { for (j = 0; j < fb_helper->connector_count; j++) {
if (crtcs[j] == new_crtc) if (crtcs[j] == new_crtc) {
return false; any_enabled = false;
goto out;
}
} }
DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n", DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
...@@ -359,8 +371,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, ...@@ -359,8 +371,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
drm_get_connector_name(connector), drm_get_connector_name(connector),
encoder->crtc->base.id, encoder->crtc->base.id,
modes[i]->name); modes[i]->name);
any_enabled = true;
}
out:
if (!any_enabled) {
memcpy(enabled, save_enabled, dev->mode_config.num_connector);
kfree(save_enabled);
return false;
} }
kfree(save_enabled);
return true; return true;
} }
......
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