Commit 9aca813e authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[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: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 6418b4d6
...@@ -43,8 +43,10 @@ static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data) ...@@ -43,8 +43,10 @@ static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
static int bru_s_stream(struct v4l2_subdev *subdev, int enable) static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
{ {
struct vsp1_pipeline *pipe = to_vsp1_pipeline(&subdev->entity);
struct vsp1_bru *bru = to_bru(subdev); struct vsp1_bru *bru = to_bru(subdev);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
unsigned int flags;
unsigned int i; unsigned int i;
if (!enable) if (!enable)
...@@ -58,8 +60,13 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -58,8 +60,13 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
* to sane default values for now. * to sane default values for now.
*/ */
/* Disable both color data normalization and dithering. */ /* Disable dithering and enable color data normalization unless the
vsp1_bru_write(bru, VI6_BRU_INCTRL, 0); * format at the pipeline output is premultiplied.
*/
flags = pipe->output ? pipe->output->video.format.flags : 0;
vsp1_bru_write(bru, VI6_BRU_INCTRL,
flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
0 : VI6_BRU_INCTRL_NRM);
/* Set the background position to cover the whole output image and /* Set the background position to cover the whole output image and
* set its color to opaque black. * set its color to opaque black.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment