From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: daniel@ffwll.ch, airlied@linux.ie, mripard@kernel.org,
maarten.lankhorst@linux.intel.com, kernel@amanoeldawod.com,
dirty.ice.hu@gmail.com, michael+lkml@stapelberg.ch,
dri-devel@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Maxime Ripard <maxime@cerno.tech>,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/fbdev: Clamp fbdev surface size if too large
Date: Mon, 4 Oct 2021 11:23:29 +0300 [thread overview]
Message-ID: <YVq6AffkPKB62aGF@intel.com> (raw)
In-Reply-To: <20211004081506.6791-1-tzimmermann@suse.de>
On Mon, Oct 04, 2021 at 10:15:06AM +0200, Thomas Zimmermann wrote:
> 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 <tzimmermann@suse.de>
> Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
> Reported-by: Amanoel Dawod <kernel@amanoeldawod.com>
> Reported-by: Zoltán Kővágó <dirty.ice.hu@gmail.com>
> Reported-by: Michael Stapelberg <michael+lkml@stapelberg.ch>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: dri-devel@lists.freedesktop.org
> Cc: <stable@vger.kernel.org> # v5.14+
> ---
> drivers/gpu/drm/drm_fb_helper.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 6860223f0068..364f11900b37 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -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);
drm_warn() seems a bit excessive. drm_info()?
Or could just have no printk and use a simple min() perhaps.
> + sizes.surface_height = config->max_height;
> + }
>
> /* push down into drivers */
> ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
> --
> 2.33.0
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2021-10-04 8:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 8:15 [PATCH] drm/fbdev: Clamp fbdev surface size if too large Thomas Zimmermann
2021-10-04 8:23 ` Ville Syrjälä [this message]
2021-10-05 6:52 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YVq6AffkPKB62aGF@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=dirty.ice.hu@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@amanoeldawod.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime@cerno.tech \
--cc=michael+lkml@stapelberg.ch \
--cc=mripard@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.