From patchwork Mon Oct 18 05:04:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dillon Min X-Patchwork-Id: 12565075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADAFBC43219 for ; Mon, 18 Oct 2021 05:05:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 975836135A for ; Mon, 18 Oct 2021 05:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbhJRFH4 (ORCPT ); Mon, 18 Oct 2021 01:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbhJRFHt (ORCPT ); Mon, 18 Oct 2021 01:07:49 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9291AC061774; Sun, 17 Oct 2021 22:05:35 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id oa4so11386008pjb.2; Sun, 17 Oct 2021 22:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XJwjsX3RToov9Z4nOYrIEZtpjBwYPXRGpAMPohzdNNE=; b=QDO75htsjXYqb2DAxHbfdQNR5AVNA4CaaoRmQbelPnXbVU41R0aByOajJcUb4tUz3T iOe9rI7fsBKcL4QQF7469J4Oi3+M0C9TE5Dl0vFZ5/ljJxqw03jzcsO6bLL+zSImS9vu iPZ/UXopwkA2K7ePh5Aev155pjIOupnaDl/tO3FXCymLREz1D+obyoi04zsdV4uf/MlN DiM2w90xhF4YxClEXD9+cztWLtthcuc2uiLjfZteGgrsYo6Zo3nNBhIbs4piexet8V0S ro9b3cxtbJsYXP7MQ+WuJU4AGZdJsEhZFYbkp0SYqWFt57Ek5jBmVMJUnly+4mLqzHpQ xPrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XJwjsX3RToov9Z4nOYrIEZtpjBwYPXRGpAMPohzdNNE=; b=m77gK/G+0tYkWGyoVKwRe7fgN+INg3AsFzf3om82krTkHyOUC8PUGMN5ViTT3+en50 u+6QnhrkRttOuvzJ6QItDdQo2BxDw6CYHsTUaEGgdyuhfWrTIvr75izc2UoGbUu+n5NB lJoJn2tG3LttVOsOen1qxJjI2/OJEhTSZYr8FIiw1mmBbGbjF00doqtdhTAht8b8rjoa j/IjBDb05iw1W+qzGgDAZettGhXwSXGYQebQmo4o11NAVsG/1veS2QVbzac80aNUknJO Gzm2mZH/iioIEf8OlN3l4eo3/bqSdSy7edBCKWwNdCTSB979NBtS/QsetMf/TjrYtDpl 4uaA== X-Gm-Message-State: AOAM5304YGpt/J90ctQBskQFHe7rO94pRxzVAdlGXiwGCbjPLjho0xmv jrcBUQvvzKWsmhZ8xVQvG8o= X-Google-Smtp-Source: ABdhPJxG7B2LQToCmjWowQRf1ZtWcWDVKj1aUKxTsPkOKJ9r7NKhFR0NPcAowEQ8nY6V3wxdOw2LvA== X-Received: by 2002:a17:90b:354a:: with SMTP id lt10mr31448599pjb.3.1634533535183; Sun, 17 Oct 2021 22:05:35 -0700 (PDT) Received: from fmin-OptiPlex-7060.nreal.work ([137.59.103.165]) by smtp.gmail.com with ESMTPSA id c205sm11416625pfc.43.2021.10.17.22.05.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Oct 2021 22:05:34 -0700 (PDT) From: dillon.minfei@gmail.com To: mchehab@kernel.org, mchehab+huawei@kernel.org, hverkuil-cisco@xs4all.nl, ezequiel@collabora.com, gnurou@gmail.com, pihsun@chromium.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, gabriel.fernandez@st.com, gabriel.fernandez@foss.st.com Cc: patrice.chotard@foss.st.com, hugues.fruchet@foss.st.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Dillon Min Subject: [PATCH v5 08/10] media: v4l2-ctrls: Add RGB color effects control Date: Mon, 18 Oct 2021 13:04:46 +0800 Message-Id: <1634533488-25334-9-git-send-email-dillon.minfei@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1634533488-25334-1-git-send-email-dillon.minfei@gmail.com> References: <1634533488-25334-1-git-send-email-dillon.minfei@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dillon Min Add V4L2_COLORFX_SET_RGB color effects control, V4L2_CID_COLORFX_RGB for RGB color setting. with two mirror changes: - change 0xFFFFFF to 0xffffff - fix comments 2^24 to 2^24 - 1 Signed-off-by: Dillon Min --- v5: - change 0xFFFFFF to 0xffffff. - change 2^24 to 2^24 -1. Documentation/userspace-api/media/v4l/control.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 6 ++++-- include/uapi/linux/v4l2-controls.h | 4 +++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/control.rst b/Documentation/userspace-api/media/v4l/control.rst index f8d0b923da20..3eec65174260 100644 --- a/Documentation/userspace-api/media/v4l/control.rst +++ b/Documentation/userspace-api/media/v4l/control.rst @@ -242,8 +242,17 @@ Control IDs * - ``V4L2_COLORFX_SET_CBCR`` - The Cb and Cr chroma components are replaced by fixed coefficients determined by ``V4L2_CID_COLORFX_CBCR`` control. + * - ``V4L2_COLORFX_SET_RGB`` + - The RGB components are replaced by the fixed RGB components determined + by ``V4L2_CID_COLORFX_RGB`` control. +``V4L2_CID_COLORFX_RGB`` ``(integer)`` + Determines the Red, Green, and Blue coefficients for + ``V4L2_COLORFX_SET_RGB`` color effect. + Bits [7:0] of the supplied 32 bit value are interpreted as Blue component, + bits [15:8] as Green component, bits [23:16] as Red component, and + bits [31:24] must be zero. ``V4L2_CID_COLORFX_CBCR`` ``(integer)`` Determines the Cb and Cr coefficients for ``V4L2_COLORFX_SET_CBCR`` diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 0cb6c0f18b39..6f00f8e4b4a6 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -785,6 +785,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_COLORFX_RGB: return "Color Effects, RGB"; /* * Codec controls @@ -1394,11 +1395,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, *min = *max = *step = *def = 0; break; case V4L2_CID_BG_COLOR: + case V4L2_CID_COLORFX_RGB: *type = V4L2_CTRL_TYPE_INTEGER; *step = 1; *min = 0; - /* Max is calculated as RGB888 that is 2^24 */ - *max = 0xFFFFFF; + /* Max is calculated as RGB888 that is 2^24 -1 */ + *max = 0xffffff; break; case V4L2_CID_COLORFX_CBCR: *type = V4L2_CTRL_TYPE_INTEGER; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 133e20444939..00bb181b56cc 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -128,6 +128,7 @@ enum v4l2_colorfx { V4L2_COLORFX_SOLARIZATION = 13, V4L2_COLORFX_ANTIQUE = 14, V4L2_COLORFX_SET_CBCR = 15, + V4L2_COLORFX_SET_RGB = 16, }; #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) @@ -145,9 +146,10 @@ enum v4l2_colorfx { #define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) #define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42) +#define V4L2_CID_COLORFX_RGB (V4L2_CID_BASE+43) /* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+44) /* USER-class private control IDs */