Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l: vsp1: bru: Support non-premultiplied colors at the BRU output

The BRU outputs premultiplied colors, enable color data normalization
when the format configured at the output of the pipeline isn't
premultiplied.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
9aca813e 6418b4d6

+9 -2
+9 -2
drivers/media/platform/vsp1/vsp1_bru.c
··· 43 43 44 44 static int bru_s_stream(struct v4l2_subdev *subdev, int enable) 45 45 { 46 + struct vsp1_pipeline *pipe = to_vsp1_pipeline(&subdev->entity); 46 47 struct vsp1_bru *bru = to_bru(subdev); 47 48 struct v4l2_mbus_framefmt *format; 49 + unsigned int flags; 48 50 unsigned int i; 49 51 50 52 if (!enable) ··· 60 58 * to sane default values for now. 61 59 */ 62 60 63 - /* Disable both color data normalization and dithering. */ 64 - vsp1_bru_write(bru, VI6_BRU_INCTRL, 0); 61 + /* Disable dithering and enable color data normalization unless the 62 + * format at the pipeline output is premultiplied. 63 + */ 64 + flags = pipe->output ? pipe->output->video.format.flags : 0; 65 + vsp1_bru_write(bru, VI6_BRU_INCTRL, 66 + flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ? 67 + 0 : VI6_BRU_INCTRL_NRM); 65 68 66 69 /* Set the background position to cover the whole output image and 67 70 * set its color to opaque black.