will be in the maintainance mode on Wednesday June 29th 01:00 - 10:00 (UTC+1). Repositories is read only during the maintainance.

Commit b693e429 authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Dave Airlie
Browse files

drm/fbdev: Clamp fbdev surface size if too large

Clamp the fbdev surface size of the available maximumi height to avoid
failing to init console emulation. An example error is shown below.

  bad framebuffer height 2304, should be >= 768 && <= 768
  [drm] Initialized simpledrm 1.0.0 20200625 for simple-framebuffer.0 on minor 0
  simple-framebuffer simple-framebuffer.0: [drm] *ERROR* fbdev: Failed to setup generic emulation (ret=-22)

This is especially a problem with drivers that have very small screen
sizes and cannot over-allocate at all.

	* reduce warning level (Ville)
Signed-off-by: default avatarThomas Zimmermann <>
Fixes: 11e8f5fd

 ("drm: Add simpledrm driver")
Reviewed-by: default avatarVille Syrjälä <>
Reviewed-by: default avatarAlex Deucher <>
Reported-by: default avatarAmanoel Dawod <>
Reported-by: default avatarZoltán Kővágó <>
Reported-by: default avatarMichael Stapelberg <>
Cc: Daniel Vetter <>
Cc: Maxime Ripard <>
Cc: <> # v5.14+

Signed-off-by: default avatarDave Airlie <>
parent 97794170
......@@ -1506,6 +1506,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
struct drm_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev;
struct drm_mode_config *config = &dev->mode_config;
int ret = 0;
int crtc_count = 0;
struct drm_connector_list_iter conn_iter;
......@@ -1663,6 +1664,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
/* Handle our overallocation */
sizes.surface_height *= drm_fbdev_overalloc;
sizes.surface_height /= 100;
if (sizes.surface_height > config->max_height) {
drm_dbg_kms(dev, "Fbdev over-allocation too large; clamping height to %d\n",
sizes.surface_height = config->max_height;
/* push down into drivers */
ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
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