summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tests
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javierm@redhat.com>2023-03-17 01:34:04 +0300
committerJavier Martinez Canillas <javierm@redhat.com>2023-03-17 18:59:54 +0300
commit705c870179ae57815d15a9e783442f22030d3a7d (patch)
treef0b92d00904780a8bd17ffca0c17179e18f26f09 /drivers/gpu/drm/tests
parent06bc8c80cba8347c3f459d276cfbd75ea0bbb6d1 (diff)
downloadlinux-705c870179ae57815d15a9e783442f22030d3a7d.tar.xz
drm/format-helper: Use drm_format_info_min_pitch() in tests helper
There's a nice macro to calculate the destination pitch that already takes into account sub-byte pixel formats. Use that instead of open coding it. Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230316223404.102806-1-javierm@redhat.com
Diffstat (limited to 'drivers/gpu/drm/tests')
-rw-r--r--drivers/gpu/drm/tests/drm_format_helper_test.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c
index bfa47f8ffd09..474bb7a1c4ee 100644
--- a/drivers/gpu/drm/tests/drm_format_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
@@ -440,15 +440,12 @@ static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch,
const struct drm_rect *clip)
{
const struct drm_format_info *dst_fi = drm_format_info(dst_format);
- unsigned int bpp;
if (!dst_fi)
return -EINVAL;
- if (!dst_pitch) {
- bpp = drm_format_info_bpp(dst_fi, 0);
- dst_pitch = DIV_ROUND_UP(drm_rect_width(clip) * bpp, 8);
- }
+ if (!dst_pitch)
+ dst_pitch = drm_format_info_min_pitch(dst_fi, 0, drm_rect_width(clip));
return dst_pitch * drm_rect_height(clip);
}