[v2, 5/8] drm/fbdev-generic: Set screen size to size of GEM buffer

Sui Jingfeng 15330273260 at 189.cn
Wed Mar 22 07:28:18 UTC 2023


Tested-by: Sui Jingfeng <suijingfeng at loongson.cn>

On 2023/3/20 23:07, Thomas Zimmermann wrote:
> 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 at suse.de>
> Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>
> ---
>   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 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;


More information about the dri-devel mailing list