From: Javier Martinez Canillas <javierm@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: "Javier Martinez Canillas" <javierm@redhat.com>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Arthur Grillo" <arthurgrillo@riseup.net>,
"Daniel Vetter" <daniel@ffwll.ch>,
"David Airlie" <airlied@gmail.com>,
"David Gow" <davidgow@google.com>,
"José Expósito" <jose.exposito89@gmail.com>,
"Maíra Canal" <mairacanal@riseup.net>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/format-helper: Use drm_format_info_min_pitch() in tests helper
Date: Thu, 16 Mar 2023 23:34:04 +0100 [thread overview]
Message-ID: <20230316223404.102806-1-javierm@redhat.com> (raw)
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>
---
drivers/gpu/drm/tests/drm_format_helper_test.c | 7 ++-----
1 file 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);
}
base-commit: 165d5133731a2e045abdd6d9d3c9221fdc2a556e
--
2.39.2
next reply other threads:[~2023-03-16 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 22:34 Javier Martinez Canillas [this message]
2023-03-17 8:08 ` Thomas Zimmermann
2023-03-17 17:38 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230316223404.102806-1-javierm@redhat.com \
--to=javierm@redhat.com \
--cc=airlied@gmail.com \
--cc=arthurgrillo@riseup.net \
--cc=daniel@ffwll.ch \
--cc=davidgow@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=jose.exposito89@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mairacanal@riseup.net \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®