Patch "drm/vkms: Fix RGB565 pixel conversion" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/vkms: Fix RGB565 pixel conversion

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-vkms-fix-rgb565-pixel-conversion.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit df272c3468a777c60816aa05aca63a03d7e31af9
Author: Maíra Canal <mcanal@xxxxxxxxxx>
Date:   Fri May 12 07:40:45 2023 -0300

    drm/vkms: Fix RGB565 pixel conversion
    
    [ Upstream commit ab87f558dcfb2562c3497e89600dec798a446665 ]
    
    Currently, the pixel conversion isn't rounding the fixed-point values
    before assigning it to the RGB coefficients, which is causing the IGT
    pixel-format tests to fail. So, use the drm_fixp2int_round() fixed-point
    helper to round the values when assigning it to the RGB coefficients.
    
    Tested with igt@kms_plane@pixel-format and igt@kms_plane@pixel-format-source-clamping.
    
    [v2]:
        * Use drm_fixp2int_round() to fix the pixel conversion instead of
          casting the values to s32 (Melissa Wen).
    
    Fixes: 89b03aeaef16 ("drm/vkms: fix 32bit compilation error by replacing macros")
    Signed-off-by: Maíra Canal <mcanal@xxxxxxxxxx>
    Reviewed-by: Arthur Grillo <arthurgrillo@xxxxxxxxxx>
    Signed-off-by: Maíra Canal <mairacanal@xxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230512104044.65034-2-mcanal@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 8d948c73741ef..b11342026485f 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -97,9 +97,9 @@ static void RGB565_to_argb_u16(u8 *src_pixels, struct pixel_argb_u16 *out_pixel)
 	s64 fp_b = drm_int2fixp(rgb_565 & 0x1f);
 
 	out_pixel->a = (u16)0xffff;
-	out_pixel->r = drm_fixp2int(drm_fixp_mul(fp_r, fp_rb_ratio));
-	out_pixel->g = drm_fixp2int(drm_fixp_mul(fp_g, fp_g_ratio));
-	out_pixel->b = drm_fixp2int(drm_fixp_mul(fp_b, fp_rb_ratio));
+	out_pixel->r = drm_fixp2int_round(drm_fixp_mul(fp_r, fp_rb_ratio));
+	out_pixel->g = drm_fixp2int_round(drm_fixp_mul(fp_g, fp_g_ratio));
+	out_pixel->b = drm_fixp2int_round(drm_fixp_mul(fp_b, fp_rb_ratio));
 }
 
 void vkms_compose_row(struct line_buffer *stage_buffer, struct vkms_plane_state *plane, int y)
@@ -216,9 +216,9 @@ static void argb_u16_to_RGB565(struct vkms_frame_info *frame_info,
 		s64 fp_g = drm_int2fixp(in_pixels[x].g);
 		s64 fp_b = drm_int2fixp(in_pixels[x].b);
 
-		u16 r = drm_fixp2int(drm_fixp_div(fp_r, fp_rb_ratio));
-		u16 g = drm_fixp2int(drm_fixp_div(fp_g, fp_g_ratio));
-		u16 b = drm_fixp2int(drm_fixp_div(fp_b, fp_rb_ratio));
+		u16 r = drm_fixp2int_round(drm_fixp_div(fp_r, fp_rb_ratio));
+		u16 g = drm_fixp2int_round(drm_fixp_div(fp_g, fp_g_ratio));
+		u16 b = drm_fixp2int_round(drm_fixp_div(fp_b, fp_rb_ratio));
 
 		*dst_pixels = cpu_to_le16(r << 11 | g << 5 | b);
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux