From patchwork Sat Jul 15 06:58:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Chen X-Patchwork-Id: 9842109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 93A2D602BD for ; Sat, 15 Jul 2017 06:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8013228712 for ; Sat, 15 Jul 2017 06:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 718A82872B; Sat, 15 Jul 2017 06:59:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB0A328712 for ; Sat, 15 Jul 2017 06:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KgUmmkotuEYM7dF8SCXwq9xNiZpgHybLBD7zw+3sHo4=; b=dueRCvJ6NlPl2KjVx41Z1Y376E rcCffVKvNAt0MtTvHbGFdZQFnhJqlk4oZ3ChUU5K+I+2P6RevH0V/iTj7GEfeFKc/SAs5bEcEmqUa j3t2W1umx1TMlzUbH9fwYfQQuKXF1xNvFtcEJ/OBUTLuF9ZNRKQgt8W2NONxoSZGWR+bQ0ShrbH/q Dack+kLxFgHKyK8cuL9fu9TIugmuzy9QPR87O/hkVWDIf8n7xTufdU1ck2NSd6PqMlpzta9M/0FkY iEZYiHK+wpx8FtZEnBMcz8M/HvFnHTtfVX7FqcIo/RtiBUHzw+prITNm1I/7S5PwJf2yJBeLMPxc9 kQ3AXWZQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dWH3U-0001s8-FP; Sat, 15 Jul 2017 06:59:56 +0000 Received: from mail-pg0-f66.google.com ([74.125.83.66]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dWH2w-0001Yc-0V; Sat, 15 Jul 2017 06:59:24 +0000 Received: by mail-pg0-f66.google.com with SMTP id j186so12978214pge.1; Fri, 14 Jul 2017 23:59:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=30Gq+w8AaUI40Fpq4DvNfp4+1Vf3+s35h5R/qHidCTo=; b=U7AR+qbcE7UVCBga1B37vqbxG/WOiZ610iXAloUx2fMJ/6m5oFs7JXGBgRW9zX1dGY NSFxADJtQItRdZPUbhQn3QK6G8BIc9vupk3c3z4d2a2dloaE+eIG3UannEsilpaKtT+B B0UEKjAkDzQHtoVlvMnOvURkSIMkXAzdbjl6xolr10TP2IWizyL33GXOwNG9fz5v5L4I X2zhhoQ5nZoogn4lVbdOUvim2vnQOrHq/ZeKZps1MtN3tLIVoxSAW47Mbmxej3L+/vI5 9lSTPpsSmRrNjOJwbojzfCMldiykbAlIMYeTaUXBVHnk+K5nMtQFSeTas2s6Ve9pJhRg LEmw== X-Gm-Message-State: AIVw112fsnMwXpXQydSiBtWlDyI+yhHIwqKUNy0jc6AbnQWDGjJNIxDh J6Iqy4PxfCSRbjFO X-Received: by 10.98.201.75 with SMTP id k72mr8843448pfg.99.1500101940638; Fri, 14 Jul 2017 23:59:00 -0700 (PDT) Received: from chen-MacBookAir.lan ([27.155.139.217]) by smtp.gmail.com with ESMTPSA id q29sm27680076pfg.11.2017.07.14.23.58.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jul 2017 23:59:00 -0700 (PDT) From: Jacob Chen To: linux-rockchip@lists.infradead.org Subject: [PATCH v2 1/6] [media] v4l: add blend modes controls Date: Sat, 15 Jul 2017 14:58:35 +0800 Message-Id: <1500101920-24039-2-git-send-email-jacob-chen@iotwrt.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500101920-24039-1-git-send-email-jacob-chen@iotwrt.com> References: <1500101920-24039-1-git-send-email-jacob-chen@iotwrt.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170714_235922_077497_BAE916E0 X-CRM114-Status: UNSURE ( 8.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, laurent.pinchart+renesas@ideasonboard.com, heiko@sntech.de, Jacob Chen , linux-kernel@vger.kernel.org, tfiga@chromium.org, robh+dt@kernel.org, hans.verkuil@cisco.com, nicolas@ndufresne.ca, s.nawrocki@samsung.com, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP At peresent, we don't have a control for Compositing and Blend. All drivers are just doing copies while actually many hardwares supports more functions. So Adding V4L2 controls for Compositing and Blend, used for for composting streams. The values are based on porter duff operations. Defined in below links. https://developer.xamarin.com/api/type/Android.Graphics.PorterDuff+Mode/ Signed-off-by: Jacob Chen Suggested-by: Nicolas Dufresne --- drivers/media/v4l2-core/v4l2-ctrls.c | 19 +++++++++++++++++++ include/uapi/linux/v4l2-controls.h | 18 +++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index b9e08e3..8a235fd 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -216,6 +216,21 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "Private Packet, IVTV Format", NULL }; + static const char * const blend_modes[] = { + "Source", + "Source Top", + "Source In", + "Source Out", + "Source Over", + "Destination", + "Destination Top", + "Destination In", + "Destination Out", + "Destination Over", + "Add", + "Clear", + NULL + }; static const char * const camera_power_line_frequency[] = { "Disabled", "50 Hz", @@ -522,6 +537,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return camera_exposure_metering; case V4L2_CID_AUTO_FOCUS_RANGE: return camera_auto_focus_range; + case V4L2_CID_BLEND: + return blend_modes; case V4L2_CID_COLORFX: return colorfx; case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: @@ -655,6 +672,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: return "Min Number of Output Buffers"; case V4L2_CID_ALPHA_COMPONENT: return "Alpha Component"; case V4L2_CID_COLORFX_CBCR: return "Color Effects, CbCr"; + case V4L2_CID_BLEND: return "Compositing and Blend Modes"; /* Codec controls */ /* The MPEG controls are applicable to all codec controls @@ -1033,6 +1051,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_STREAM_VBI_FMT: case V4L2_CID_EXPOSURE_AUTO: case V4L2_CID_AUTO_FOCUS_RANGE: + case V4L2_CID_BLEND: case V4L2_CID_COLORFX: case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: case V4L2_CID_TUNE_PREEMPHASIS: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e0..019fdca 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -140,8 +140,24 @@ enum v4l2_colorfx { #define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) #define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42) +#define V4L2_CID_BLEND (V4L2_CID_BASE+43) +enum v4l2_blend_mode { + V4L2_BLEND_SRC = 0, + V4L2_BLEND_SRCATOP = 1, + V4L2_BLEND_SRCIN = 2, + V4L2_BLEND_SRCOUT = 3, + V4L2_BLEND_SRCOVER = 4, + V4L2_BLEND_DST = 5, + V4L2_BLEND_DSTATOP = 6, + V4L2_BLEND_DSTIN = 7, + V4L2_BLEND_DSTOUT = 8, + V4L2_BLEND_DSTOVER = 9, + V4L2_BLEND_ADD = 10, + V4L2_BLEND_CLEAR = 11, +}; + /* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+44) /* USER-class private control IDs */