From: "Amanoel Dawod" <kernel@amanoeldawod.com>
To: "Thomas Zimmermann" <tzimmermann@suse.de>,
daniel@ffwll.ch, airlied@linux.ie, mripard@kernel.org,
maarten.lankhorst@linux.intel.com, noralf@tronnes.org,
drawat.floss@gmail.com, airlied@redhat.com, kraxel@redhat.com,
david@lechnology.com, sam@ravnborg.org, javierm@redhat.com,
dirty.ice.hu@gmail.com, michael+lkml@stapelberg.ch, aros@gmx.com,
joshua@stroblindustries.com, arnd@arndb.de
Cc: dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v2 3/9] drm/format-helper: Add destination-buffer pitch to drm_fb_swab()
Date: Mon, 08 Nov 2021 13:57:42 -0500 [thread overview]
Message-ID: <944752ef-ad6a-4e42-8754-54a58c7f50ef@www.fastmail.com> (raw)
In-Reply-To: <20211101141532.26655-4-tzimmermann@suse.de>
Hi,
On Mon, Nov 1, 2021, at 10:15 AM, Thomas Zimmermann wrote:
> Add destination-buffer pitch as argument to drm_fb_swab(). Done for
> consistency with the rest of the interface.
>
> v2:
> * update documentation (Noralf)
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Tested-by: Noralf Trønnes <noralf@tronnes.org>
> Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
> ---
> drivers/gpu/drm/drm_format_helper.c | 21 ++++++++++++++++-----
> drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
> drivers/gpu/drm/gud/gud_pipe.c | 2 +-
> include/drm/drm_format_helper.h | 5 +++--
> 4 files changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_format_helper.c
> b/drivers/gpu/drm/drm_format_helper.c
> index fac37c697d8b..dac355320287 100644
> --- a/drivers/gpu/drm/drm_format_helper.c
> +++ b/drivers/gpu/drm/drm_format_helper.c
> @@ -101,6 +101,7 @@ EXPORT_SYMBOL(drm_fb_memcpy_toio);
> /**
> * drm_fb_swab - Swap bytes into clip buffer
> * @dst: Destination buffer
> + * @dst_pitch: Number of bytes between two consecutive scanlines
> within dst
> * @src: Source buffer
> * @fb: DRM framebuffer
> * @clip: Clip rectangle area to copy
> @@ -110,21 +111,27 @@ EXPORT_SYMBOL(drm_fb_memcpy_toio);
> * time to speed up slow uncached reads.
> *
> * This function does not apply clipping on dst, i.e. the destination
> - * is a small buffer containing the clip rect only.
> + * is at the top-left corner.
> */
> -void drm_fb_swab(void *dst, void *src, struct drm_framebuffer *fb,
> - struct drm_rect *clip, bool cached)
> +void drm_fb_swab(void *dst, unsigned int dst_pitch, const void *src,
> + const struct drm_framebuffer *fb, const struct drm_rect *clip,
> + bool cached)
> {
> u8 cpp = fb->format->cpp[0];
> size_t len = drm_rect_width(clip) * cpp;
> - u16 *src16, *dst16 = dst;
> - u32 *src32, *dst32 = dst;
> + const u16 *src16;
> + const u32 *src32;
> + u16 *dst16;
> + u32 *dst32;
> unsigned int x, y;
> void *buf = NULL;
>
> if (WARN_ON_ONCE(cpp != 2 && cpp != 4))
> return;
>
> + if (!dst_pitch)
> + dst_pitch = len;
> +
> if (!cached)
> buf = kmalloc(len, GFP_KERNEL);
>
> @@ -140,6 +147,9 @@ void drm_fb_swab(void *dst, void *src, struct
> drm_framebuffer *fb,
> src32 = src;
> }
>
> + dst16 = dst;
> + dst32 = dst;
> +
> for (x = clip->x1; x < clip->x2; x++) {
> if (cpp == 4)
> *dst32++ = swab32(*src32++);
> @@ -148,6 +158,7 @@ void drm_fb_swab(void *dst, void *src, struct
> drm_framebuffer *fb,
> }
>
> src += fb->pitches[0];
> + dst += dst_pitch;
> }
>
> kfree(buf);
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c
> b/drivers/gpu/drm/drm_mipi_dbi.c
> index c09df8b06c7a..7ce89917d761 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -211,7 +211,7 @@ int mipi_dbi_buf_copy(void *dst, struct
> drm_framebuffer *fb,
> switch (fb->format->format) {
> case DRM_FORMAT_RGB565:
> if (swap)
> - drm_fb_swab(dst, src, fb, clip, !gem->import_attach);
> + drm_fb_swab(dst, 0, src, fb, clip, !gem->import_attach);
> else
> drm_fb_memcpy(dst, 0, src, fb, clip);
> break;
> diff --git a/drivers/gpu/drm/gud/gud_pipe.c
> b/drivers/gpu/drm/gud/gud_pipe.c
> index a92112ffd37a..e0b117b2559f 100644
> --- a/drivers/gpu/drm/gud/gud_pipe.c
> +++ b/drivers/gpu/drm/gud/gud_pipe.c
> @@ -201,7 +201,7 @@ static int gud_prep_flush(struct gud_device *gdrm,
> struct drm_framebuffer *fb,
> len = gud_xrgb8888_to_color(buf, format, vaddr, fb, rect);
> }
> } else if (gud_is_big_endian() && format->cpp[0] > 1) {
> - drm_fb_swab(buf, vaddr, fb, rect, !import_attach);
> + drm_fb_swab(buf, 0, vaddr, fb, rect, !import_attach);
> } else if (compression && !import_attach && pitch == fb->pitches[0]) {
> /* can compress directly from the framebuffer */
> buf = vaddr + rect->y1 * pitch;
> diff --git a/include/drm/drm_format_helper.h
> b/include/drm/drm_format_helper.h
> index 1fc3ba7b6060..ddcba5abe306 100644
> --- a/include/drm/drm_format_helper.h
> +++ b/include/drm/drm_format_helper.h
> @@ -17,8 +17,9 @@ void drm_fb_memcpy(void *dst, unsigned int dst_pitch,
> const void *vaddr,
> const struct drm_framebuffer *fb, const struct drm_rect *clip);
> void drm_fb_memcpy_toio(void __iomem *dst, unsigned int dst_pitch,
> const void *vaddr,
> const struct drm_framebuffer *fb, const struct drm_rect *clip);
> -void drm_fb_swab(void *dst, void *src, struct drm_framebuffer *fb,
> - struct drm_rect *clip, bool cached);
> +void drm_fb_swab(void *dst, unsigned int dst_pitch, const void *src,
> + const struct drm_framebuffer *fb, const struct drm_rect *clip,
> + bool cached);
> void drm_fb_xrgb8888_to_rgb332(void *dst, void *vaddr, struct
> drm_framebuffer *fb,
> struct drm_rect *clip);
> void drm_fb_xrgb8888_to_rgb565(void *dst, void *vaddr,
> --
> 2.33.1
Applying this fails for me (tested against 5.14 and 5.15 trees).
Example:
patching file include/drm/drm_format_helper.h
Hunk #1 FAILED at 17.
--
thanks,
Amanoel
next prev parent reply other threads:[~2021-11-08 18:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 14:15 [PATCH v2 0/9] drm/simpledrm: Enable damage clips and virtual screens Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 1/9] drm/format-helper: Export drm_fb_clip_offset() Thomas Zimmermann
2021-11-05 20:48 ` Noralf Trønnes
2021-11-08 8:50 ` Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 2/9] drm/format-helper: Rework format-helper memcpy functions Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 3/9] drm/format-helper: Add destination-buffer pitch to drm_fb_swab() Thomas Zimmermann
2021-11-08 18:57 ` Amanoel Dawod [this message]
2021-11-10 9:17 ` Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 4/9] drm/format-helper: Rework format-helper conversion functions Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 5/9] drm/format-helper: Streamline blit-helper interface Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 6/9] drm/fb-helper: Allocate shadow buffer of surface height Thomas Zimmermann
2021-11-01 14:15 ` [PATCH v2 7/9] drm/simpledrm: Enable FB_DAMAGE_CLIPS property Thomas Zimmermann
2021-11-08 18:57 ` Noralf Trønnes
2021-11-09 9:43 ` Thomas Zimmermann
2021-11-08 20:55 ` Noralf Trønnes
2021-11-09 12:38 ` Thomas Zimmermann
2021-11-09 13:04 ` Noralf Trønnes
2021-11-09 14:56 ` Thomas Zimmermann
2021-11-09 15:52 ` Noralf Trønnes
2021-11-01 14:15 ` [PATCH v2 8/9] drm/simpledrm: Support virtual screen sizes Thomas Zimmermann
2021-11-08 21:01 ` Noralf Trønnes
2021-11-09 9:06 ` Thomas Zimmermann
2021-11-09 13:05 ` Noralf Trønnes
2021-11-01 14:15 ` [PATCH v2 9/9] drm: Clarify semantics of struct drm_mode_config.{min,max}_{width,height} Thomas Zimmermann
2021-11-08 21:02 ` Noralf Trønnes
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=944752ef-ad6a-4e42-8754-54a58c7f50ef@www.fastmail.com \
--to=kernel@amanoeldawod.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=arnd@arndb.de \
--cc=aros@gmx.com \
--cc=daniel@ffwll.ch \
--cc=david@lechnology.com \
--cc=dirty.ice.hu@gmail.com \
--cc=drawat.floss@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=joshua@stroblindustries.com \
--cc=kraxel@redhat.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michael+lkml@stapelberg.ch \
--cc=mripard@kernel.org \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).