drm/draw: fix color truncation in drm_draw_fill24
Subsystems (3)
PATCH 1/1 drm/draw: fix color truncation in drm_draw_fill24
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.
--- drivers/gpu/drm/drm_draw.c | 2 +- drivers/gpu/drm/drm_draw_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_draw.c +1 -1
@@ -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;
drivers/gpu/drm/drm_draw_internal.h +1 -1
@@ -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,
Signature · 1 line
Francesco Valla <[email protected]>
Quoted 4 lines · Francesco Valla
The color parameter passed to
drm_draw_fill24()was truncated to 16 bits, leading to an incorrect color drawn to the targetiosys_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?
Best regards,
Signature · 1 line
Jocelyn
Quoted 40 lines
Fixes 31fa2c1ca0b2 ("drm/panic: Move drawing functions to drm_draw")Signed-off-by Francesco Valla <[email protected]>--- drivers/gpu/drm/drm_draw.c | 2 +- drivers/gpu/drm/drm_draw_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_draw.c +1
-1@@ -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;drivers/gpu/drm/drm_draw_internal.h +1
-2@@ -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-ea52d32a933dBest regards,
Hi Jocelyn,
Quoted 5 lines · On Friday, 3 October 2025 at 14:48:03 Jocelyn Falempe <[email protected]>…
Quoted 4 lines · Francesco Valla
The color parameter passed to
drm_draw_fill24()was truncated to 16 bits, leading to an incorrect color drawn to the targetiosys_map. Fix this behavior, widening the parameter to 32 bits.
Quoted 7 lines
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 <[email protected]>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
Jocelyn Falempe
maintainerQuoted 13 lines · Francesco Valla
Hi Jocelyn,
Quoted 10 lines · On Friday, 3 October 2025 at 14:48:03 Jocelyn Falempe <[email protected]>…
Quoted 4 lines · Francesco Valla
The color parameter passed to
drm_draw_fill24()was truncated to 16 bits, leading to an incorrect color drawn to the targetiosys_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 <[email protected]>
Quoted 8 lines
Quoted 2 lines
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,
Signature · 1 line
Jocelyn
Quoted 10 lines
Best regards,
Francesco
Quoted 3 lines · Francesco Valla
The color parameter passed to
drm_draw_fill24()was truncated to 16 bits, leading to an incorrect color drawn to the targetiosys_map. Fix this behavior, widening the parameter to 32 bits.
Merged to drm-misc-fixes.
Thanks for your contribution.
Signature · 1 line
Jocelyn
Quoted 41 lines
Fixes 31fa2c1ca0b2 ("drm/panic: Move drawing functions to drm_draw")Signed-off-by Francesco Valla <[email protected]>--- drivers/gpu/drm/drm_draw.c | 2 +- drivers/gpu/drm/drm_draw_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_draw.c +1
-1@@ -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;drivers/gpu/drm/drm_draw_internal.h +1
-2@@ -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-ea52d32a933dBest regards,