summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_fbdev_generic.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-03-20 16:07:48 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2023-03-22 13:32:51 +0100
commit8fbc9af55de0b274745e70118e20e0964e98bb05 (patch)
treede91b1fe5cee9df6ffbcdeb28c0ab08aedf98ed5 /drivers/gpu/drm/drm_fbdev_generic.c
parent24dc4f4c2a5cc97e340f440bb01f5f30fb4704f8 (diff)
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 <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Tested-by: Sui Jingfeng <suijingfeng@loongson.cn> Link: https://patchwork.freedesktop.org/patch/msgid/20230320150751.20399-6-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/drm_fbdev_generic.c')
-rw-r--r--drivers/gpu/drm/drm_fbdev_generic.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
index e48a8e82378d..73834a3cc6b0 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -7,6 +7,7 @@
#include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
#include <drm/drm_print.h>
#include <drm/drm_fbdev_generic.h>
@@ -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;