Skip to content

Commit

Permalink
drm/simpledrm: Compute linestride with drm_format_info_min_pitch()
Browse files Browse the repository at this point in the history
If not given, compute the stride with drm_format_info_min_pitch(). It's
the standard helper for this purpose.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Fixes: fd9e316 ("drm/simpledrm: Compute framebuffer stride if not set")
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20220922130944.27138-2-tzimmermann@suse.de
  • Loading branch information
Thomas Zimmermann committed Sep 27, 2022
1 parent c7bcc10 commit 7bfa5c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/gpu/drm/tiny/simpledrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,11 @@ 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);
if (!stride) {
stride = drm_format_info_min_pitch(format, 0, width);
if (drm_WARN_ON(dev, !stride))
return ERR_PTR(-EINVAL);
}

sdev->mode = simpledrm_mode(width, height);
sdev->format = format;
Expand Down

0 comments on commit 7bfa5c7

Please sign in to comment.