Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751701AbdGaIMp (ORCPT ); Mon, 31 Jul 2017 04:12:45 -0400 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:46921 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbdGaIMn (ORCPT ); Mon, 31 Jul 2017 04:12:43 -0400 Subject: Re: [PATCH v3 1/5] [media] v4l: add porter duff blend controls To: Jacob Chen , 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 References: <1501470460-12014-1-git-send-email-jacob-chen@iotwrt.com> <1501470460-12014-2-git-send-email-jacob-chen@iotwrt.com> From: Hans Verkuil Message-ID: Date: Mon, 31 Jul 2017 10:12:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501470460-12014-2-git-send-email-jacob-chen@iotwrt.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfLwA9WvtC/oBL6vXN9X3MejLzT3F4tKePWmEeFWsfOasLADANywydHW4tssyBJdb7JnmvDucdU4p1yClTQgLOT2uLupnkg/lR6t8moO000p2QlnZwb43 2ZwsR6fxdDptNy5u1oxHPgnlNEm0fhJTXtRRugJ2Ko3aC5IIIEodKGE9pel2Hy/6qhFqLErT/EUOIFMoqfs8tFE5Kpz41bLWE8CSuQFJ5b0EJ5QY48Ld+5bR 4WROnk3pDb43iyBBOH1630Mm0BkdUKfH2o/CguO8VKSzSQ4FFhkWEVXzMgeHwry4FPdb1B7jk8QiKh07VtqIj3e5PVXC2py29aaIZScLp8uOoKWZ+yJGu7g/ m3IFwrkKExGk6T0kpbOYsf6Y562VGm1+Xu7StARSrT1dn/j08RjcPTaqpVhSa36l0BtStJBBctZwyxnTCk524mHvUbFdt+KuMvO+GGkvhyOzVYCI258agUYe vtXR6E4XpY0gR+AiO3eK/nsZkvN1dl2G7/9Vu5oFxMvehrbQpdcA01Tj7AoK7WmfpscN+uUU9O+2TU7O1Zs2NwExIOCAcTmMQlYKW0p74TbtiCYIlM8y5BFI H2fPTxFeiJsPw3BnYLArvJ50 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3900 Lines: 109 On 07/31/2017 05:07 AM, Jacob Chen wrote: > 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 | 20 +++++++++++++++++++- > include/uapi/linux/v4l2-controls.h | 16 +++++++++++++++- > 2 files changed, 34 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c > index b9e08e3..561d7d5 100644 > --- a/drivers/media/v4l2-core/v4l2-ctrls.c > +++ b/drivers/media/v4l2-core/v4l2-ctrls.c > @@ -478,7 +478,21 @@ const char * const *v4l2_ctrl_get_menu(u32 id) > "Region Grid", > NULL, > }; > - > + static const char * const porter_duff_modes[] = { > + "Source", > + "Source Top", > + "Source In", > + "Source Out", > + "Source Over", > + "Destination", > + "Destination Top", > + "Destination In", > + "Destination Out", > + "Destination Over", > + "Add", > + "Clear", > + NULL > + }; > > switch (id) { > case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: > @@ -564,6 +578,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) > return vpx_golden_frame_sel; > case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: > return jpeg_chroma_subsampling; > + case V4L2_CID_PORTER_DUFF_MODE: > + return porter_duff_modes; > case V4L2_CID_DV_TX_MODE: > return dv_tx_mode; > case V4L2_CID_DV_TX_RGB_RANGE: > @@ -886,6 +902,7 @@ const char *v4l2_ctrl_get_name(u32 id) > case V4L2_CID_PIXEL_RATE: return "Pixel Rate"; > case V4L2_CID_TEST_PATTERN: return "Test Pattern"; > case V4L2_CID_DEINTERLACING_MODE: return "Deinterlacing Mode"; > + case V4L2_CID_PORTER_DUFF_MODE: return "PorterDuff Blend Modes"; > > /* DV controls */ > /* Keep the order of the 'case's the same as in v4l2-controls.h! */ > @@ -1060,6 +1077,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, > case V4L2_CID_DV_RX_IT_CONTENT_TYPE: > case V4L2_CID_TEST_PATTERN: > case V4L2_CID_DEINTERLACING_MODE: > + case V4L2_CID_PORTER_DUFF_MODE: > case V4L2_CID_TUNE_DEEMPHASIS: > case V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL: > case V4L2_CID_DETECT_MD_MODE: > diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h > index 0d2e1e0..9543b4b 100644 > --- a/include/uapi/linux/v4l2-controls.h > +++ b/include/uapi/linux/v4l2-controls.h > @@ -893,7 +893,21 @@ enum v4l2_jpeg_chroma_subsampling { > #define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2) > #define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3) > #define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4) > - > +#define V4L2_CID_PORTER_DUFF_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) I recommend that you add a link to e.g. https://en.wikipedia.org/wiki/Alpha_compositing as a comment here. > +enum v4l2_porter_duff_mode { > + V4L2_PORTER_DUFF_SRC = 0, > + V4L2_PORTER_DUFF_SRCATOP = 1, > + V4L2_PORTER_DUFF_SRCIN = 2, > + V4L2_PORTER_DUFF_SRCOUT = 3, > + V4L2_PORTER_DUFF_SRCOVER = 4, > + V4L2_PORTER_DUFF_DST = 5, > + V4L2_PORTER_DUFF_DSTATOP = 6, > + V4L2_PORTER_DUFF_DSTIN = 7, > + V4L2_PORTER_DUFF_DSTOUT = 8, > + V4L2_PORTER_DUFF_DSTOVER = 9, > + V4L2_PORTER_DUFF_ADD = 10, > + V4L2_PORTER_DUFF_CLEAR = 11, > +}; > > /* DV-class control IDs defined by V4L2 */ > #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) > This control also has to be documented in Documentation/media/uapi/v4l/extended-controls.rst. Regards, Hans