Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d3cc311 authored by Anatolij Gustschin's avatar Anatolij Gustschin
Browse files

drivers/video: fsl-diu-fb: fix pixel formats for 24 and 16 bpp



Framebuffer colors for 24 and 16 bpp are currently wrong. The order
of the color component arguments in the MAKE_PF() is not natural
and causes some confusion. The generated pixel format values for 24
and 16 bpp depths do not much the values in the comments.

Fix the macro arguments to be in the natural RGB order and adjust
the arguments for all depths to generate correct pixel format values
(equal to the values mentioned in the comments).

Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
Cc: Timur Tabi <timur@tabi.org>
Acked-by: default avatarTimur Tabi <timur@freescale.com>
Cc: stable@vger.kernel.org
parent f29bc0a4
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -944,7 +944,7 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel)
#define PF_COMP_0_MASK		0x0000000F
#define PF_COMP_0_MASK		0x0000000F
#define PF_COMP_0_SHIFT		0
#define PF_COMP_0_SHIFT		0


#define MAKE_PF(alpha, red, blue, green, size, c0, c1, c2, c3) \
#define MAKE_PF(alpha, red, green, blue, size, c0, c1, c2, c3) \
	cpu_to_le32(PF_BYTE_F | (alpha << PF_ALPHA_C_SHIFT) | \
	cpu_to_le32(PF_BYTE_F | (alpha << PF_ALPHA_C_SHIFT) | \
	(blue << PF_BLUE_C_SHIFT) | (green << PF_GREEN_C_SHIFT) | \
	(blue << PF_BLUE_C_SHIFT) | (green << PF_GREEN_C_SHIFT) | \
	(red << PF_RED_C_SHIFT) | (c3 << PF_COMP_3_SHIFT) | \
	(red << PF_RED_C_SHIFT) | (c3 << PF_COMP_3_SHIFT) | \
@@ -954,10 +954,10 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel)
	switch (bits_per_pixel) {
	switch (bits_per_pixel) {
	case 32:
	case 32:
		/* 0x88883316 */
		/* 0x88883316 */
		return MAKE_PF(3, 2, 0, 1, 3, 8, 8, 8, 8);
		return MAKE_PF(3, 2, 1, 0, 3, 8, 8, 8, 8);
	case 24:
	case 24:
		/* 0x88082219 */
		/* 0x88082219 */
		return MAKE_PF(4, 0, 1, 2, 2, 0, 8, 8, 8);
		return MAKE_PF(4, 0, 1, 2, 2, 8, 8, 8, 0);
	case 16:
	case 16:
		/* 0x65053118 */
		/* 0x65053118 */
		return MAKE_PF(4, 2, 1, 0, 1, 5, 6, 5, 0);
		return MAKE_PF(4, 2, 1, 0, 1, 5, 6, 5, 0);