Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2405764ybp; Sat, 5 Oct 2019 11:32:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlVwsj9QpMfvQQaDi+rOKZPGdWbuXfF0UQBsAe09xs4WPIs6XvurVPAQIFDvgS4po9kE2x X-Received: by 2002:a17:906:3e96:: with SMTP id a22mr17637532ejj.268.1570300363229; Sat, 05 Oct 2019 11:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570300363; cv=none; d=google.com; s=arc-20160816; b=bmM9B7K2uqlXIt5jHKi8DunlmRJ4RiS8k1P/PxxRxExr1m2zfgdOhBbeug7abtOXzq E5H4i2aUFMoDrunlGZXsym24borslV/beoDfSjaHE/XfQ92dJowkv2StBJxxjtJHhS9Q QRuIBk9pFHdsh+szg9mq0WdAiaDLE8jNPtPpfsXrlIIF0PlzBiciMaNhYmlQIhQB2raU kLCsPgB1PjANVqwYO7NRxDwpoXFOKlGovtVOPq9hjg2ZnZShAW8+Pn6/0sTmKoFtT/EW dK/5800BSKiM0ysGh3cLQlrCU/ow9Nff3e9ou8NcpiuHGXkmA4gLvkFwYHd6vI3OCaer 6YtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:to:subject; bh=UqlZc/J7WTaej7Rap29JknxjoHIS0JTCIJZsHjEmgus=; b=RWcgF3v1ChAVbnDU0N8zjBhU+Y+06dm9clu/asiwUL2BwLeSTva2n0t9nvRe3L/qp+ Zrg4Jsbs5w+vkTnMkPuEYlyxH84htBu/FcD/n1YtK3Y7ciLFHyXqO6ZxgZ+Gsc9zO/LN 7zfYc8qCeW6YhUfdSV8mrWYfeb4LAis2zga/XHlzjfmLYviidojExtC5F3gJ7s++A6eg VH15boSj+niS/tZZAmS0UjCHsSjdkVHcCb6dBp67vsJ13FMWPJisQ9aZ7plHDwWRQW+1 KGlOoiSGYTxvbpEg6JH0cyuNKlyLNONJp4iTcdWsWi2KndkHVmVmP2p4G2rneD97K/i8 iFyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si4781649ejr.163.2019.10.05.11.32.19; Sat, 05 Oct 2019 11:32:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388028AbfJESbV (ORCPT + 99 others); Sat, 5 Oct 2019 14:31:21 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:40077 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387486AbfJESbU (ORCPT ); Sat, 5 Oct 2019 14:31:20 -0400 Received: by mail-qk1-f196.google.com with SMTP id y144so8935660qkb.7; Sat, 05 Oct 2019 11:31:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=UqlZc/J7WTaej7Rap29JknxjoHIS0JTCIJZsHjEmgus=; b=hlIzv+CI6hZUuNBJOf6E9rkacHbu8trpA3Ti/bN6Mb9yCAKdvIkvQrWQHLYkmzTTTd bNDU9zmsY86uM/gVFRJx5sp0jxF8kF3qNUCN49Abqs4VKKXAmJKKJUjFE+57Vuqd8j91 EziwXoUCCqVWKrojrGcIBg8LYBVkk75Gf3MJCJUPC7gvJw1Yw0bw2beAvEwAGyBKYU9N EdXt51uKuBNxb5K3kDMoOrWnVX/NlDu/QcTpYkS7fduXWLDJPTFVy10dScY+xLhjFXU6 ak+PxfIkhtEOdeo1jI5ZqEydlkS3yy4pyzO+pzXLIuhl4hVpd4+BVDdDiu6/7WB5jGfr 6/Aw== X-Gm-Message-State: APjAAAXlV+VMl9pKW4nSgY4j1wJ+UkBxP8NCv4ujci9oHFKqMpug2LpE D/V7ekCdJsosw/iomrDnxq8Xxh6ZLx8= X-Received: by 2002:ae9:e210:: with SMTP id c16mr8167608qkc.164.1570300278848; Sat, 05 Oct 2019 11:31:18 -0700 (PDT) Received: from [172.16.0.213] ([177.103.155.130]) by smtp.gmail.com with ESMTPSA id p199sm4944522qke.18.2019.10.05.11.31.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 05 Oct 2019 11:31:18 -0700 (PDT) Subject: Re: [Lkcamp] [PATCH v4] media: vimc: Implement debayer control for mean window size To: Arthur Moraes do Lago , lkcamp@lists.libreplanetbr.org, mchehab@kernel.org, skhan@linuxfoundation.org, hverkuil-cisco@xs4all.nl, andrealmeid@collabora.com, laispc19@gmail.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191002004633.21490-1-arthurmoraeslago@gmail.com> From: Helen Koike Openpgp: preference=signencrypt Autocrypt: addr=helen@koikeco.de; keydata= mQINBFmOMD4BEADb2nC8Oeyvklh+ataw2u/3mrl+hIHL4WSWtii4VxCapl9+zILuxFDrxw1p XgF3cfx7g9taWBrmLE9VEPwJA6MxaVnQuDL3GXxTxO/gqnOFgT3jT+skAt6qMvoWnhgurMGH wRaA3dO4cFrDlLsZIdDywTYcy7V2bou81ItR5Ed6c5UVX7uTTzeiD/tUi8oIf0XN4takyFuV Rf09nOhi24bn9fFN5xWHJooFaFf/k2Y+5UTkofANUp8nn4jhBUrIr6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FiXQUCXEz31QUJ BKaOuQAKCRDAfqwo9yFiXUvnEACBWe8wSnIvSX+9k4LxuLq6GQTOt+RNfliZQkCW5lT3KL1I JyzzOm4x+/slHRBl8bF7KEZyOPinXQXyJ/vgIdgSYxDqoZ7YZn3SvuNe4aT6kGwLEYYEV8Ec j4ets15FR2jSUNnVv5YHWtZ7bP/oUzr2LT54fjRcstYxgwzoj8AREtHQ4EJWAWCOZuEHTSm5 clMFoi41CmG4DlJbzbo4YfilKYm69vwh50Y8WebcRN31jh0g8ufjOJnBldYYBLwNObymhlfy /HKBDIbyCGBuwYoAkoJ6LR/cqzl/FuhwhuDocCGlXyYaJOwXgHaCvVXI3PLQPxWZ+vPsD+TS VHc9m/YWrOiYDnZn6aO0Uk1Zv/m9+BBkWAwsreLJ/evn3SsJV1omNBTITG+uxXcfJkgmmesI Aw8mpI6EeLmReUJLasz8QkzhZIC7t5rGlQI94GQG3Jg2dC+kpaGWOaT5G4FVMcBjiR1nXfMx ENVYnM5ag7mBZyD/kru5W1Uj34L6AFaDMXFPwedSCpzzqUiHb0f+nYkfOodf5xy046+3THy/ NUS/ZZp/rI4F7Y77+MQPVg7vARfHHX1AxYUKfRVW5j88QUB70txn8Vgi1tDrOr4JeD+xr0Cv IGa5lKqgQacQtGkpOpJ8zY4ObSvpNubey/qYUE3DCXD0n2Xxk4muTvqlkFpOYA== Message-ID: Date: Sat, 5 Oct 2019 15:31:14 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20191002004633.21490-1-arthurmoraeslago@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/19 9:46 PM, Arthur Moraes do Lago wrote: > Add mean window size parameter for debayer filter as a control in > vimc-debayer. > > vimc-debayer was patched to allow changing mean window parameter > of the filter without needing to reload the driver. The parameter > can now be set using a v4l2-ctl control(mean_window_size). > > Co-developed-by: Laís Pessine do Carmo > Signed-off-by: Laís Pessine do Carmo > Signed-off-by: Arthur Moraes do Lago Now the right one. lgtm Acked-by: Helen Koike > --- > Changes in V2: > - Updated documentation > - Added v4l2_subev_core_ops to solve errors in v4l2-ctl compliance test > - Changed control naming to follow English capitalization rules > - Rebased to Shuah Khan's newest patch series 171283 > ("Collapse vimc single monolithic driver") > - Change maximum value for mean window size > Changes in V3: > - Renamed debayer control > - Fixed typo in documentation > - Freed control handler in vimc_deb_release > Changes in V4: > - Removed unecessary function and checking for setting the control > > We had originally intended to leave that bit of code checking if the > value is being set to make it similar to what's done in vimc-sensor, > and in case some extra caution is needed when chaging control in the > future. But I guess they really were not necessary. > > Thanks! > > --- > Documentation/media/v4l-drivers/vimc.rst | 10 +-- > drivers/media/platform/vimc/vimc-common.h | 1 + > drivers/media/platform/vimc/vimc-debayer.c | 81 ++++++++++++++++++---- > 3 files changed, 71 insertions(+), 21 deletions(-) > > diff --git a/Documentation/media/v4l-drivers/vimc.rst b/Documentation/media/v4l-drivers/vimc.rst > index a582af0509ee..28646c76dad5 100644 > --- a/Documentation/media/v4l-drivers/vimc.rst > +++ b/Documentation/media/v4l-drivers/vimc.rst > @@ -80,9 +80,7 @@ vimc-capture: > Module options > --------------- > > -Vimc has a few module parameters to configure the driver. > - > - param=value > +Vimc has a module parameter to configure the driver. > > * ``sca_mult=`` > > @@ -91,12 +89,6 @@ Vimc has a few module parameters to configure the driver. > original one. Currently, only supports scaling up (the default value > is 3). > > -* ``deb_mean_win_size=`` > - > - Window size to calculate the mean. Note: the window size needs to be an > - odd number, as the main pixel stays in the center of the window, > - otherwise the next odd number is considered (the default value is 3). > - > Source code documentation > ------------------------- > > diff --git a/drivers/media/platform/vimc/vimc-common.h b/drivers/media/platform/vimc/vimc-common.h > index 236412ad7548..3a5102ddf794 100644 > --- a/drivers/media/platform/vimc/vimc-common.h > +++ b/drivers/media/platform/vimc/vimc-common.h > @@ -19,6 +19,7 @@ > #define VIMC_CID_VIMC_BASE (0x00f00000 | 0xf000) > #define VIMC_CID_VIMC_CLASS (0x00f00000 | 1) > #define VIMC_CID_TEST_PATTERN (VIMC_CID_VIMC_BASE + 0) > +#define VIMC_CID_MEAN_WIN_SIZE (VIMC_CID_VIMC_BASE + 1) > > #define VIMC_FRAME_MAX_WIDTH 4096 > #define VIMC_FRAME_MAX_HEIGHT 2160 > diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c > index 37f3767db469..ba0af4b2fb9b 100644 > --- a/drivers/media/platform/vimc/vimc-debayer.c > +++ b/drivers/media/platform/vimc/vimc-debayer.c > @@ -11,17 +11,12 @@ > #include > #include > #include > +#include > +#include > #include > > #include "vimc-common.h" > > -static unsigned int deb_mean_win_size = 3; > -module_param(deb_mean_win_size, uint, 0000); > -MODULE_PARM_DESC(deb_mean_win_size, " the window size to calculate the mean.\n" > - "NOTE: the window size needs to be an odd number, as the main pixel " > - "stays in the center of the window, otherwise the next odd number " > - "is considered"); > - > enum vimc_deb_rgb_colors { > VIMC_DEB_RED = 0, > VIMC_DEB_GREEN = 1, > @@ -46,6 +41,8 @@ struct vimc_deb_device { > u8 *src_frame; > const struct vimc_deb_pix_map *sink_pix_map; > unsigned int sink_bpp; > + unsigned int mean_win_size; > + struct v4l2_ctrl_handler hdl; > }; > > static const struct v4l2_mbus_framefmt sink_fmt_default = { > @@ -346,11 +343,18 @@ static int vimc_deb_s_stream(struct v4l2_subdev *sd, int enable) > return 0; > } > > +static const struct v4l2_subdev_core_ops vimc_deb_core_ops = { > + .log_status = v4l2_ctrl_subdev_log_status, > + .subscribe_event = v4l2_ctrl_subdev_subscribe_event, > + .unsubscribe_event = v4l2_event_subdev_unsubscribe, > +}; > + > static const struct v4l2_subdev_video_ops vimc_deb_video_ops = { > .s_stream = vimc_deb_s_stream, > }; > > static const struct v4l2_subdev_ops vimc_deb_ops = { > + .core = &vimc_deb_core_ops, > .pad = &vimc_deb_pad_ops, > .video = &vimc_deb_video_ops, > }; > @@ -384,7 +388,7 @@ static void vimc_deb_calc_rgb_sink(struct vimc_deb_device *vdeb, > * the top left corner of the mean window (considering the current > * pixel as the center) > */ > - seek = deb_mean_win_size / 2; > + seek = vdeb->mean_win_size / 2; > > /* Sum the values of the colors in the mean window */ > > @@ -471,14 +475,33 @@ static void *vimc_deb_process_frame(struct vimc_ent_device *ved, > } > > return vdeb->src_frame; > +} > + > +static int vimc_deb_s_ctrl(struct v4l2_ctrl *ctrl) > +{ > + struct vimc_deb_device *vdeb = > + container_of(ctrl->handler, struct vimc_deb_device, hdl); > > + switch (ctrl->id) { > + case VIMC_CID_MEAN_WIN_SIZE: > + vdeb->mean_win_size = ctrl->val; > + break; > + default: > + return -EINVAL; > + } > + return 0; > } > > +static const struct v4l2_ctrl_ops vimc_deb_ctrl_ops = { > + .s_ctrl = vimc_deb_s_ctrl, > +}; > + > static void vimc_deb_release(struct v4l2_subdev *sd) > { > struct vimc_deb_device *vdeb = > container_of(sd, struct vimc_deb_device, sd); > > + v4l2_ctrl_handler_free(&vdeb->hdl); > vimc_pads_cleanup(vdeb->ved.pads); > kfree(vdeb); > } > @@ -495,6 +518,24 @@ void vimc_deb_rm(struct vimc_device *vimc, struct vimc_ent_device *ved) > vimc_ent_sd_unregister(ved, &vdeb->sd); > } > > +static const struct v4l2_ctrl_config vimc_deb_ctrl_class = { > + .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY, > + .id = VIMC_CID_VIMC_CLASS, > + .name = "VIMC Controls", > + .type = V4L2_CTRL_TYPE_CTRL_CLASS, > +}; > + > +static const struct v4l2_ctrl_config vimc_deb_ctrl_mean_win_size = { > + .ops = &vimc_deb_ctrl_ops, > + .id = VIMC_CID_MEAN_WIN_SIZE, > + .name = "Debayer Mean Window Size", > + .type = V4L2_CTRL_TYPE_INTEGER, > + .min = 1, > + .max = 25, > + .step = 2, > + .def = 3, > +}; > + > struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc, > const char *vcfg_name) > { > @@ -507,6 +548,16 @@ struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc, > if (!vdeb) > return NULL; > > + /* Create controls: */ > + v4l2_ctrl_handler_init(&vdeb->hdl, 2); > + v4l2_ctrl_new_custom(&vdeb->hdl, &vimc_deb_ctrl_class, NULL); > + v4l2_ctrl_new_custom(&vdeb->hdl, &vimc_deb_ctrl_mean_win_size, NULL); > + vdeb->sd.ctrl_handler = &vdeb->hdl; > + if (vdeb->hdl.error) { > + ret = vdeb->hdl.error; > + goto err_free_vdeb; > + } > + > /* Initialize ved and sd */ > ret = vimc_ent_sd_register(&vdeb->ved, &vdeb->sd, v4l2_dev, > vcfg_name, > @@ -514,13 +565,12 @@ struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc, > (const unsigned long[2]) {MEDIA_PAD_FL_SINK, > MEDIA_PAD_FL_SOURCE}, > &vimc_deb_int_ops, &vimc_deb_ops); > - if (ret) { > - kfree(vdeb); > - return NULL; > - } > + if (ret) > + goto err_free_hdl; > > vdeb->ved.process_frame = vimc_deb_process_frame; > vdeb->dev = &vimc->pdev.dev; > + vdeb->mean_win_size = vimc_deb_ctrl_mean_win_size.def; > > /* Initialize the frame format */ > vdeb->sink_fmt = sink_fmt_default; > @@ -534,4 +584,11 @@ struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc, > vdeb->set_rgb_src = vimc_deb_set_rgb_mbus_fmt_rgb888_1x24; > > return &vdeb->ved; > + > +err_free_hdl: > + v4l2_ctrl_handler_free(&vdeb->hdl); > +err_free_vdeb: > + kfree(vdeb); > + > + return NULL; > } >