]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/simpledrm: Compute framebuffer stride if not set
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 1 Aug 2022 13:50:27 +0000 (15:50 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 5 Aug 2022 12:14:03 +0000 (14:14 +0200)
Compute the framebuffer's scanline stride length if not given by
the simplefb data.

v3:
* get pixel size from drm_format_info_bpp() (Geert, Javier)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220801135028.30647-5-tzimmermann@suse.de
drivers/gpu/drm/tiny/simpledrm.c

index 9d27608d7369706c8de9c4fd02b20b7660fcce03..11a7348ccf4dd6ad67c6a7fab24aeed41ad00f7e 100644 (file)
@@ -743,6 +743,9 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
                drm_err(dev, "no simplefb configuration found\n");
                return ERR_PTR(-ENODEV);
        }
+       if (!stride)
+               stride = DIV_ROUND_UP(drm_format_info_bpp(format, 0) * width, 8);
+
        sdev->mode = simpledrm_mode(width, height);
        sdev->format = format;
        sdev->pitch = stride;