Commit 8fbc9af5 authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Tested-by: default avatarSui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20230320150751.20399-6-tzimmermann@suse.de
parent 24dc4f4c
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <drm/drm_drv.h> #include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_framebuffer.h> #include <drm/drm_framebuffer.h>
#include <drm/drm_gem.h>
#include <drm/drm_print.h> #include <drm/drm_print.h>
#include <drm/drm_fbdev_generic.h> #include <drm/drm_fbdev_generic.h>
...@@ -74,8 +75,8 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper, ...@@ -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_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev; struct drm_device *dev = fb_helper->dev;
struct drm_client_buffer *buffer; struct drm_client_buffer *buffer;
struct drm_framebuffer *fb;
struct fb_info *info; struct fb_info *info;
size_t screen_size;
u32 format; u32 format;
int ret; int ret;
...@@ -91,20 +92,20 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper, ...@@ -91,20 +92,20 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper,
fb_helper->buffer = buffer; fb_helper->buffer = buffer;
fb_helper->fb = buffer->fb; fb_helper->fb = buffer->fb;
fb = buffer->fb; screen_size = buffer->gem->size;
info = drm_fb_helper_alloc_info(fb_helper); info = drm_fb_helper_alloc_info(fb_helper);
if (IS_ERR(info)) if (IS_ERR(info))
return PTR_ERR(info); return PTR_ERR(info);
info->fbops = &drm_fbdev_fb_ops; info->fbops = &drm_fbdev_fb_ops;
info->screen_size = sizes->surface_height * fb->pitches[0]; info->screen_size = screen_size;
info->fix.smem_len = info->screen_size; info->fix.smem_len = screen_size;
info->flags = FBINFO_DEFAULT; info->flags = FBINFO_DEFAULT;
drm_fb_helper_fill_info(info, fb_helper, sizes); 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) if (!info->screen_buffer)
return -ENOMEM; return -ENOMEM;
info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
......
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