drm/format-helper: Fix dst computation in drm_fb_xrgb8888_to_rgb888_dstclip()
Subsystems (3)
PATCH 1/1 drm/format-helper: Fix dst computation in drm_fb_xrgb8888_to_rgb888_dstclip()
The dst pointer was being advanced by the clip width, not the full line stride, resulting in corruption. The clip offset was also calculated incorrectly.
--- drivers/gpu/drm/drm_format_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_format_helper.c +2 -2
@@ -366,12 +366,12 @@ void drm_fb_xrgb8888_to_rgb888_dstclip(void __iomem *dst, unsigned int dst_pitchreturn ; vaddr +=clip_offset (clip, fb->pitches[0 ],sizeof (u32)); - dst +=clip_offset (clip, dst_pitch,sizeof (u16)); + dst +=clip_offset (clip, dst_pitch,3 );for (y =0 ; y < lines; y++) {drm_fb_xrgb8888_to_rgb888_line (dbuf, vaddr, linepixels);memcpy_toio (dst, dbuf, dst_len); vaddr += fb->pitches[0 ]; - dst += dst_len; + dst += dst_pitch; }kfree (dbuf);
Signature · 1 line
2.33.0
Hi
Am 17.11.21 um 15:22 schrieb Hector Martin:
Quoted 6 lines
The dst pointer was being advanced by the clip width, not the full line stride, resulting in corruption. The clip offset was also calculated incorrectly.
Signed-off-by Hector Martin <[email protected]>
Thanks for your patch, but you're probably on the wrong branch. We rewrote this code recently and fixed the issue in drm-misc-next. [1][2]
If anything, this patch could go into stable. If anyone wants to merge it there, then
Best regards
Thomas
[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://cgit.freedesktop.org/drm/drm-misc/commit/?id=53bc2098d2b6ccff25fe13f9345cbb5c0ef34a99
Quoted 24 lines
--- drivers/gpu/drm/drm_format_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_format_helper.c +2
-2@@ -366,12 +366,12 @@ void drm_fb_xrgb8888_to_rgb888_dstclip(void __iomem *dst, unsigned int dst_pitchreturn ; vaddr +=clip_offset (clip, fb->pitches[0 ],sizeof (u32)); - dst +=clip_offset (clip, dst_pitch,sizeof (u16)); + dst +=clip_offset (clip, dst_pitch,3 );for (y =0 ; y < lines; y++) {drm_fb_xrgb8888_to_rgb888_line (dbuf, vaddr, linepixels);memcpy_toio (dst, dbuf, dst_len); vaddr += fb->pitches[0 ]; - dst += dst_len; + dst += dst_pitch; }kfree (dbuf);
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 7 lines · Thomas Zimmermann
Hi
Am 17.11.21 um 15:22 schrieb Hector Martin:
Quoted 4 lines
The dst pointer was being advanced by the clip width, not the full line stride, resulting in corruption. The clip offset was also calculated incorrectly.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Hector Martin <[email protected]>Thanks for your patch, but you're probably on the wrong branch. We rewrote this code recently and fixed the issue in drm-misc-next. [1][2]
Oops. I was on linux-next as of Nov 1. Looks like I missed it by a week!
Sounds like I'm going to have to rebase/rewrite the other series I just sent too...
Signature · 2 lines
Hector Martin ([email protected]) Public Key: https://mrcn.st/pub