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: 9842123 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 EA8CA60212 for ; Sat, 15 Jul 2017 07:00:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB5232876E for ; Sat, 15 Jul 2017 07:00:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D01912878C; Sat, 15 Jul 2017 07:00:39 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 416A42876E for ; Sat, 15 Jul 2017 07:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751185AbdGOG7D (ORCPT ); Sat, 15 Jul 2017 02:59:03 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33409 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbdGOG7B (ORCPT ); Sat, 15 Jul 2017 02:59:01 -0400 Received: by mail-pg0-f66.google.com with SMTP id 123so1299520pgd.0; Fri, 14 Jul 2017 23:59:00 -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=I+4dOIfaYor6dDu0eStsZSugpYDo6Rk6a+On8ovb2blxZul59EpwmwUPeJaOnJA0B0 fcedqiq83dAkm/4TBNzs57R+Vo5sxXSepkmNtsO4L1wyqFG1QTZAqpjnW8cCI433HJLE 9Rxkd127aztaAJAkPwwjkxplvhxHC/Z3NuhAgJakaN6roUUlJzaRUW3+RJeN70LIagOY RQu1sevM7rpAbTszexSD9Znu2pGyRA7C9dLCs2jrXOpa3WAr3961LiVRr4AnE2FkknFd vUNCYh+/oluNllLHGvkyxlHWfRbdQ4UrzB8g5ipS35m0qFM+euGkEIv+NArE8QxKMQmH L++A== X-Gm-Message-State: AIVw111/TwR5JOl1MdOJwF404ebj4LhSuPSmeM2Qw80H8l0H0kce4e/H 44AXHtQl8s6dIw== 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 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, heiko@sntech.de, robh+dt@kernel.org, mchehab@kernel.org, linux-media@vger.kernel.org, laurent.pinchart+renesas@ideasonboard.com, hans.verkuil@cisco.com, s.nawrocki@samsung.com, tfiga@chromium.org, nicolas@ndufresne.ca, Jacob Chen 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> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 */