From patchwork Sun Jun 1 03:39:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 4277131 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7D0C1BEEA7 for ; Sun, 1 Jun 2014 03:39:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E47D20270 for ; Sun, 1 Jun 2014 03:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B84E2202E6 for ; Sun, 1 Jun 2014 03:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756654AbaFADjr (ORCPT ); Sat, 31 May 2014 23:39:47 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:59654 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756754AbaFADjc (ORCPT ); Sat, 31 May 2014 23:39:32 -0400 Received: from avalon.ideasonboard.com (8.26-200-80.adsl-dyn.isp.belgacom.be [80.200.26.8]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7CA2235ACB; Sun, 1 Jun 2014 05:39:03 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 17/18] v4l: vsp1: bru: Support non-premultiplied colors at the BRU output Date: Sun, 1 Jun 2014 05:39:36 +0200 Message-Id: <1401593977-30660-18-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1401593977-30660-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1401593977-30660-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/media/platform/vsp1/vsp1_bru.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index d8d49fb..86b32bc 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -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) { + struct vsp1_pipeline *pipe = to_vsp1_pipeline(&subdev->entity); struct vsp1_bru *bru = to_bru(subdev); struct v4l2_mbus_framefmt *format; + unsigned int flags; unsigned int i; if (!enable) @@ -58,8 +60,13 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable) * to sane default values for now. */ - /* Disable both color data normalization and dithering. */ - vsp1_bru_write(bru, VI6_BRU_INCTRL, 0); + /* Disable dithering and enable color data normalization unless the + * 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 its color to opaque black.