drm/fbdev: Clamp fbdev surface size if too large
Subsystems (3)
Thomas Zimmermann
maintainerPATCH 1/1 drm/fbdev: Clamp fbdev surface size if too large
Clamp the fbdev surface size of the available maximum 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.
--- drivers/gpu/drm/drm_fb_helper.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +6 -0
@@ -1508,6 +1508,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;
@@ -1665,6 +1666,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_warn (dev,"Fbdev over-allocation too large; clamping height to %d\n" , + config->max_height); + sizes.surface_height = config->max_height; + }/* push down into drivers */ ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
--
2.33.0
Quoted 36 lines · Thomas Zimmermann
Clamp the fbdev surface size of the available maximum 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.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes 11e8f5fd223b ("drm: Add simpledrm driver")Reported-by Amanoel Dawod <[email protected]>Reported-by Zoltán Kővágó <[email protected]>Reported-by Michael Stapelberg <[email protected]>Cc Daniel Vetter <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v5.14+--- drivers/gpu/drm/drm_fb_helper.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/drm_fb_helper.c +1
-0@@ -1508,6 +1508,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;
drivers/gpu/drm/drm_fb_helper.c static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, · line 1671
Quoted 6 lines
drivers/gpu/drm/drm_fb_helper.c +3
-0@@ -1665,6 +1666,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_warn (dev,"Fbdev over-allocation too large; clamping height to %d\n" , + config->max_height);
drm_warn() seems a bit excessive. drm_info()?
Or could just have no printk and use a simple min() perhaps.
Quoted 7 lines
drivers/gpu/drm/drm_fb_helper.c +2
-1+ sizes.surface_height = config->max_height; + }/* push down into drivers */ ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes); --2.33.0
Signature · 2 lines
Ville Syrjälä Intel
Thomas Zimmermann
maintainerHi
Am 04.10.21 um 10:23 schrieb Ville Syrjälä:
Quoted 46 lines · Thomas Zimmermann
Quoted 36 lines
Clamp the fbdev surface size of the available maximum 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.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes 11e8f5fd223b ("drm: Add simpledrm driver")Reported-by Amanoel Dawod <[email protected]>Reported-by Zoltán Kővágó <[email protected]>Reported-by Michael Stapelberg <[email protected]>Cc Daniel Vetter <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v5.14+--- drivers/gpu/drm/drm_fb_helper.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/drm_fb_helper.c +1
-0@@ -1508,6 +1508,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;drivers/gpu/drm/drm_fb_helper.c static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, · line 1671
Quoted 6 lines
drivers/gpu/drm/drm_fb_helper.c +3
-0@@ -1665,6 +1666,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_warn (dev,"Fbdev over-allocation too large; clamping height to %d\n" , + config->max_height);
drm_warn()seems a bit excessive.drm_info()?
Quoted 1 line
Or could just have no printk and use a simple
min()perhaps.
The framebuffer code uses debug_kms for this kind of message. I guess, I'll go with that.
Best regards
Thamas
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/drm_fb_helper.c +2
-1+ sizes.surface_height = config->max_height; + }/* push down into drivers */ ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes); --2.33.0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer