From 8fbc9af55de0b274745e70118e20e0964e98bb05 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 20 Mar 2023 16:07:48 +0100 Subject: [PATCH] drm/fbdev-generic: Set screen size to size of GEM buffer The size of the screen memory should be equivalent to the size of the screen's GEM buffer. Don't recalculate the value. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas Tested-by: Sui Jingfeng Link: https://patchwork.freedesktop.org/patch/msgid/20230320150751.20399-6-tzimmermann@suse.de --- drivers/gpu/drm/drm_fbdev_generic.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c index e48a8e82378d2b..73834a3cc6b0ff 100644 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -74,8 +75,8 @@ static int drm_fbdev_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_client_buffer *buffer; - struct drm_framebuffer *fb; struct fb_info *info; + size_t screen_size; u32 format; int ret; @@ -91,20 +92,20 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper, fb_helper->buffer = buffer; fb_helper->fb = buffer->fb; - fb = buffer->fb; + screen_size = buffer->gem->size; info = drm_fb_helper_alloc_info(fb_helper); if (IS_ERR(info)) return PTR_ERR(info); info->fbops = &drm_fbdev_fb_ops; - info->screen_size = sizes->surface_height * fb->pitches[0]; - info->fix.smem_len = info->screen_size; + info->screen_size = screen_size; + info->fix.smem_len = screen_size; info->flags = FBINFO_DEFAULT; drm_fb_helper_fill_info(info, fb_helper, sizes); - info->screen_buffer = vzalloc(info->screen_size); + info->screen_buffer = vzalloc(screen_size); if (!info->screen_buffer) return -ENOMEM; info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;