* [PATCH] drm/draw: fix color truncation in drm_draw_fill24
@ 2025-10-03 10:33 Francesco Valla
2025-10-03 12:48 ` Jocelyn Falempe
2025-10-14 7:28 ` Jocelyn Falempe
0 siblings, 2 replies; 5+ messages in thread
From: Francesco Valla @ 2025-10-03 10:33 UTC (permalink / raw)
To: Jocelyn Falempe, Javier Martinez Canillas, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel, Francesco Valla
The color parameter passed to drm_draw_fill24() was truncated to 16
bits, leading to an incorrect color drawn to the target iosys_map.
Fix this behavior, widening the parameter to 32 bits.
Fixes: 31fa2c1ca0b2 ("drm/panic: Move drawing functions to drm_draw")
Signed-off-by: Francesco Valla <francesco@valla.it>
---
drivers/gpu/drm/drm_draw.c | 2 +-
drivers/gpu/drm/drm_draw_internal.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_draw.c b/drivers/gpu/drm/drm_draw.c
index 9dc0408fbbeadbe8282a2d6b210e0bfb0672967f..5b956229c82fb6e232e3342705a226c8e14c8568 100644
--- a/drivers/gpu/drm/drm_draw.c
+++ b/drivers/gpu/drm/drm_draw.c
@@ -127,7 +127,7 @@ EXPORT_SYMBOL(drm_draw_fill16);
void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
unsigned int height, unsigned int width,
- u16 color)
+ u32 color)
{
unsigned int y, x;
diff --git a/drivers/gpu/drm/drm_draw_internal.h b/drivers/gpu/drm/drm_draw_internal.h
index f121ee7339dc11537f677c833f0ee94fe0e799cd..20cb404e23ea6263b535ea2b81b25f84c37be8a2 100644
--- a/drivers/gpu/drm/drm_draw_internal.h
+++ b/drivers/gpu/drm/drm_draw_internal.h
@@ -47,7 +47,7 @@ void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
unsigned int height, unsigned int width,
- u16 color);
+ u32 color);
void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
unsigned int height, unsigned int width,
---
base-commit: e406d57be7bd2a4e73ea512c1ae36a40a44e499e
change-id: 20251003-drm_draw_fill24_fix-ea52d32a933d
Best regards,
--
Francesco Valla <francesco@valla.it>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/draw: fix color truncation in drm_draw_fill24
2025-10-03 10:33 [PATCH] drm/draw: fix color truncation in drm_draw_fill24 Francesco Valla
@ 2025-10-03 12:48 ` Jocelyn Falempe
2025-10-03 14:41 ` Francesco Valla
2025-10-14 7:28 ` Jocelyn Falempe
1 sibling, 1 reply; 5+ messages in thread
From: Jocelyn Falempe @ 2025-10-03 12:48 UTC (permalink / raw)
To: Francesco Valla, Javier Martinez Canillas, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel
On 10/3/25 12:33, Francesco Valla wrote:
> The color parameter passed to drm_draw_fill24() was truncated to 16
> bits, leading to an incorrect color drawn to the target iosys_map.
> Fix this behavior, widening the parameter to 32 bits.
>
Oh, you're right, my mistake.
Did you find this by using a 24bit hardware, or by looking at the code?
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Best regards,
--
Jocelyn
> Fixes: 31fa2c1ca0b2 ("drm/panic: Move drawing functions to drm_draw")
>
> Signed-off-by: Francesco Valla <francesco@valla.it>
> ---
> drivers/gpu/drm/drm_draw.c | 2 +-
> drivers/gpu/drm/drm_draw_internal.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_draw.c b/drivers/gpu/drm/drm_draw.c
> index 9dc0408fbbeadbe8282a2d6b210e0bfb0672967f..5b956229c82fb6e232e3342705a226c8e14c8568 100644
> --- a/drivers/gpu/drm/drm_draw.c
> +++ b/drivers/gpu/drm/drm_draw.c
> @@ -127,7 +127,7 @@ EXPORT_SYMBOL(drm_draw_fill16);
>
> void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
> unsigned int height, unsigned int width,
> - u16 color)
> + u32 color)
> {
> unsigned int y, x;
>
> diff --git a/drivers/gpu/drm/drm_draw_internal.h b/drivers/gpu/drm/drm_draw_internal.h
> index f121ee7339dc11537f677c833f0ee94fe0e799cd..20cb404e23ea6263b535ea2b81b25f84c37be8a2 100644
> --- a/drivers/gpu/drm/drm_draw_internal.h
> +++ b/drivers/gpu/drm/drm_draw_internal.h
> @@ -47,7 +47,7 @@ void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
>
> void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
> unsigned int height, unsigned int width,
> - u16 color);
> + u32 color);
>
> void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
> unsigned int height, unsigned int width,
>
> ---
> base-commit: e406d57be7bd2a4e73ea512c1ae36a40a44e499e
> change-id: 20251003-drm_draw_fill24_fix-ea52d32a933d
>
> Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/draw: fix color truncation in drm_draw_fill24
2025-10-03 12:48 ` Jocelyn Falempe
@ 2025-10-03 14:41 ` Francesco Valla
2025-10-03 15:15 ` Jocelyn Falempe
0 siblings, 1 reply; 5+ messages in thread
From: Francesco Valla @ 2025-10-03 14:41 UTC (permalink / raw)
To: Javier Martinez Canillas, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Jocelyn Falempe
Cc: dri-devel, linux-kernel
Hi Jocelyn,
On Friday, 3 October 2025 at 14:48:03 Jocelyn Falempe <jfalempe@redhat.com> wrote:
> On 10/3/25 12:33, Francesco Valla wrote:
> > The color parameter passed to drm_draw_fill24() was truncated to 16
> > bits, leading to an incorrect color drawn to the target iosys_map.
> > Fix this behavior, widening the parameter to 32 bits.
> >
> Oh, you're right, my mistake.
> Did you find this by using a 24bit hardware, or by looking at the code?
>
> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Best regards,
>
I am working on a graphical splash DRM client (which I hope I'll be
able to post soon) and testing it on a Beagleplay - which is
RG24-capable - I started to see a strange behavior with non-black
colors. After some investigation I found the cuplrit, and strangely
enough it wasn't me this time.
Best regards,
Francesco
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/draw: fix color truncation in drm_draw_fill24
2025-10-03 14:41 ` Francesco Valla
@ 2025-10-03 15:15 ` Jocelyn Falempe
0 siblings, 0 replies; 5+ messages in thread
From: Jocelyn Falempe @ 2025-10-03 15:15 UTC (permalink / raw)
To: Francesco Valla, Javier Martinez Canillas, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel
On 10/3/25 16:41, Francesco Valla wrote:
> Hi Jocelyn,
>
> On Friday, 3 October 2025 at 14:48:03 Jocelyn Falempe <jfalempe@redhat.com> wrote:
>> On 10/3/25 12:33, Francesco Valla wrote:
>>> The color parameter passed to drm_draw_fill24() was truncated to 16
>>> bits, leading to an incorrect color drawn to the target iosys_map.
>>> Fix this behavior, widening the parameter to 32 bits.
>>>
>> Oh, you're right, my mistake.
>> Did you find this by using a 24bit hardware, or by looking at the code?
>>
>> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>>
>> Best regards,
>>
>
> I am working on a graphical splash DRM client (which I hope I'll be
> able to post soon) and testing it on a Beagleplay - which is
> RG24-capable - I started to see a strange behavior with non-black
> colors. After some investigation I found the cuplrit, and strangely
> enough it wasn't me this time.
Thanks, I was wondering if this 24bit code would see a real usage, so it
looks like this is still a thing in 2025.
Best regards,
--
Jocelyn
>
> Best regards,
>
> Francesco
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/draw: fix color truncation in drm_draw_fill24
2025-10-03 10:33 [PATCH] drm/draw: fix color truncation in drm_draw_fill24 Francesco Valla
2025-10-03 12:48 ` Jocelyn Falempe
@ 2025-10-14 7:28 ` Jocelyn Falempe
1 sibling, 0 replies; 5+ messages in thread
From: Jocelyn Falempe @ 2025-10-14 7:28 UTC (permalink / raw)
To: Francesco Valla, Javier Martinez Canillas, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, linux-kernel
On 03/10/2025 12:33, Francesco Valla wrote:
> The color parameter passed to drm_draw_fill24() was truncated to 16
> bits, leading to an incorrect color drawn to the target iosys_map.
> Fix this behavior, widening the parameter to 32 bits.
Merged to drm-misc-fixes.
Thanks for your contribution.
--
Jocelyn
>
> Fixes: 31fa2c1ca0b2 ("drm/panic: Move drawing functions to drm_draw")
>
> Signed-off-by: Francesco Valla <francesco@valla.it>
> ---
> drivers/gpu/drm/drm_draw.c | 2 +-
> drivers/gpu/drm/drm_draw_internal.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_draw.c b/drivers/gpu/drm/drm_draw.c
> index 9dc0408fbbeadbe8282a2d6b210e0bfb0672967f..5b956229c82fb6e232e3342705a226c8e14c8568 100644
> --- a/drivers/gpu/drm/drm_draw.c
> +++ b/drivers/gpu/drm/drm_draw.c
> @@ -127,7 +127,7 @@ EXPORT_SYMBOL(drm_draw_fill16);
>
> void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
> unsigned int height, unsigned int width,
> - u16 color)
> + u32 color)
> {
> unsigned int y, x;
>
> diff --git a/drivers/gpu/drm/drm_draw_internal.h b/drivers/gpu/drm/drm_draw_internal.h
> index f121ee7339dc11537f677c833f0ee94fe0e799cd..20cb404e23ea6263b535ea2b81b25f84c37be8a2 100644
> --- a/drivers/gpu/drm/drm_draw_internal.h
> +++ b/drivers/gpu/drm/drm_draw_internal.h
> @@ -47,7 +47,7 @@ void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
>
> void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
> unsigned int height, unsigned int width,
> - u16 color);
> + u32 color);
>
> void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
> unsigned int height, unsigned int width,
>
> ---
> base-commit: e406d57be7bd2a4e73ea512c1ae36a40a44e499e
> change-id: 20251003-drm_draw_fill24_fix-ea52d32a933d
>
> Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-14 7:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-03 10:33 [PATCH] drm/draw: fix color truncation in drm_draw_fill24 Francesco Valla
2025-10-03 12:48 ` Jocelyn Falempe
2025-10-03 14:41 ` Francesco Valla
2025-10-03 15:15 ` Jocelyn Falempe
2025-10-14 7:28 ` Jocelyn Falempe
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®