mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Todor Tomov <todor.tomov@linaro.org>
Cc: mchehab@kernel.org, hans.verkuil@cisco.com,
	javier@osg.samsung.com, s.nawrocki@samsung.com,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v3 17/23] camss: vfe: Add interface for scaling
Date: Fri, 4 Aug 2017 20:59:16 +0300	[thread overview]
Message-ID: <64a4dadd-3880-c170-d9fc-e194633c68f0@iki.fi> (raw)
In-Reply-To: <1025d572-a7cd-727e-4bf4-330a2b1fc7b8@linaro.org>

Hi Todor,

Todor Tomov wrote:
> Hi Sakari,
> 
> Thank you for review.
> 
> On 20.07.2017 18:20, Sakari Ailus wrote:
>> Hi Todor,
>>
>> On Mon, Jul 17, 2017 at 01:33:43PM +0300, Todor Tomov wrote:
>>> Add compose selection ioctls to handle scaling configuration.
>>>
>>> Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
>>> ---
>>>  drivers/media/platform/qcom/camss-8x16/camss-vfe.c | 189 ++++++++++++++++++++-
>>>  drivers/media/platform/qcom/camss-8x16/camss-vfe.h |   1 +
>>>  2 files changed, 188 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/media/platform/qcom/camss-8x16/camss-vfe.c b/drivers/media/platform/qcom/camss-8x16/camss-vfe.c
>>> index 327f158..8ec6ce7 100644
>>> --- a/drivers/media/platform/qcom/camss-8x16/camss-vfe.c
>>> +++ b/drivers/media/platform/qcom/camss-8x16/camss-vfe.c
>>> @@ -211,6 +211,8 @@
>>>  #define CAMIF_TIMEOUT_SLEEP_US 1000
>>>  #define CAMIF_TIMEOUT_ALL_US 1000000
>>>  
>>> +#define SCALER_RATIO_MAX 16
>>> +
>>>  static const u32 vfe_formats[] = {
>>>  	MEDIA_BUS_FMT_UYVY8_2X8,
>>>  	MEDIA_BUS_FMT_VYUY8_2X8,
>>> @@ -1905,6 +1907,25 @@ __vfe_get_format(struct vfe_line *line,
>>>  	return &line->fmt[pad];
>>>  }
>>>  
>>> +/*
>>> + * __vfe_get_compose - Get pointer to compose selection structure
>>> + * @line: VFE line
>>> + * @cfg: V4L2 subdev pad configuration
>>> + * @which: TRY or ACTIVE format
>>> + *
>>> + * Return pointer to TRY or ACTIVE compose rectangle structure
>>> + */
>>> +static struct v4l2_rect *
>>> +__vfe_get_compose(struct vfe_line *line,
>>> +		  struct v4l2_subdev_pad_config *cfg,
>>> +		  enum v4l2_subdev_format_whence which)
>>> +{
>>> +	if (which == V4L2_SUBDEV_FORMAT_TRY)
>>> +		return v4l2_subdev_get_try_compose(&line->subdev, cfg,
>>> +						   MSM_VFE_PAD_SINK);
>>> +
>>> +	return &line->compose;
>>> +}
>>>  
>>>  /*
>>>   * vfe_try_format - Handle try format by pad subdev method
>>> @@ -1951,7 +1972,14 @@ static void vfe_try_format(struct vfe_line *line,
>>>  		*fmt = *__vfe_get_format(line, cfg, MSM_VFE_PAD_SINK,
>>>  					 which);
>>>  
>>> -		if (line->id == VFE_LINE_PIX)
>>> +		if (line->id == VFE_LINE_PIX) {
>>> +			struct v4l2_rect *rect;
>>> +
>>> +			rect = __vfe_get_compose(line, cfg, which);
>>> +
>>> +			fmt->width = rect->width;
>>> +			fmt->height = rect->height;
>>> +
>>>  			switch (fmt->code) {
>>>  			case MEDIA_BUS_FMT_YUYV8_2X8:
>>>  				if (code == MEDIA_BUS_FMT_YUYV8_1_5X8)
>>> @@ -1979,6 +2007,7 @@ static void vfe_try_format(struct vfe_line *line,
>>>  					fmt->code = MEDIA_BUS_FMT_VYUY8_2X8;
>>>  				break;
>>>  			}
>>> +		}
>>>  
>>>  		break;
>>>  	}
>>> @@ -1987,6 +2016,50 @@ static void vfe_try_format(struct vfe_line *line,
>>>  }
>>>  
>>>  /*
>>> + * vfe_try_compose - Handle try compose selection by pad subdev method
>>> + * @line: VFE line
>>> + * @cfg: V4L2 subdev pad configuration
>>> + * @rect: pointer to v4l2 rect structure
>>> + * @which: wanted subdev format
>>> + */
>>> +static void vfe_try_compose(struct vfe_line *line,
>>> +			    struct v4l2_subdev_pad_config *cfg,
>>> +			    struct v4l2_rect *rect,
>>> +			    enum v4l2_subdev_format_whence which)
>>> +{
>>> +	struct v4l2_mbus_framefmt *fmt;
>>> +
>>> +	rect->width = rect->width - rect->left;
>>> +	rect->left = 0;
>>
>> This is the compose rectangle i.e. left and top should be zero (unless it's
>> about composing on e.g. a frame buffer). No need to decrement from width;
>> similarly for height below.
> 
> Yes, it is not composing, but does the user know that? If left and top are
> set, it makes sense to keep the rectangle size unchanged I think - actually
> decrement width and height (and then clear left and top).

The API documentation tells these values are zero. If the user specifies
non-zero values then I don't think that they should have an effect. This
behaviour is in line with other drivers AFAIK.

> 
>>
>>> +	rect->height = rect->height - rect->top;
>>> +	rect->top = 0;
>>> +
>>> +	fmt = __vfe_get_format(line, cfg, MSM_VFE_PAD_SINK, which);
>>> +
>>> +	if (rect->width > fmt->width)
>>> +		rect->width = fmt->width;
>>> +
>>> +	if (rect->height > fmt->height)
>>> +		rect->height = fmt->height;
>>> +
>>> +	if (fmt->width > rect->width * SCALER_RATIO_MAX)
>>> +		rect->width = (fmt->width + SCALER_RATIO_MAX - 1) /
>>> +							SCALER_RATIO_MAX;
>>> +
>>> +	rect->width &= ~0x1;
>>> +
>>> +	if (fmt->height > rect->height * SCALER_RATIO_MAX)
>>> +		rect->height = (fmt->height + SCALER_RATIO_MAX - 1) /
>>> +							SCALER_RATIO_MAX;
>>> +
>>> +	if (rect->width < 16)
>>> +		rect->width = 16;
>>> +
>>> +	if (rect->height < 4)
>>> +		rect->height = 4;
>>> +}
>>> +
> 
> <snip>
> 


-- 
Sakari Ailus
sakari.ailus@iki.fi

  reply	other threads:[~2017-08-05  8:01 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 10:33 [PATCH v3 00/23] Qualcomm 8x16 Camera Subsystem driver Todor Tomov
2017-07-17 10:33 ` [PATCH v3 01/23] [media] media: Make parameter of media_entity_remote_pad() const Todor Tomov
2017-07-17 10:33 ` [PATCH v3 02/23] [media] v4l2-mediabus: Add helper functions Todor Tomov
2017-07-17 10:33 ` [PATCH v3 03/23] v4l: Add packed Bayer raw12 pixel formats Todor Tomov
2017-07-17 10:33 ` [PATCH v3 04/23] dt-bindings: media: Binding document for Qualcomm Camera subsystem driver Todor Tomov
2017-07-20 10:13   ` Sakari Ailus
2017-08-04 11:54     ` Todor Tomov
2017-08-05  8:19       ` Sakari Ailus
2017-07-20 10:15   ` Sakari Ailus
2017-07-24 16:43   ` Rob Herring
2017-07-17 10:33 ` [PATCH v3 05/23] MAINTAINERS: Add " Todor Tomov
2017-07-17 10:33 ` [PATCH v3 06/23] doc: media/v4l-drivers: Add Qualcomm Camera Subsystem driver document Todor Tomov
2017-07-17 10:33 ` [PATCH v3 07/23] media: camss: Add CSIPHY files Todor Tomov
2017-07-20 12:15   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 08/23] media: camss: Add CSID files Todor Tomov
2017-07-20 14:13   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 09/23] media: camss: Add ISPIF files Todor Tomov
2017-07-20 14:51   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 10/23] media: camss: Add VFE files Todor Tomov
2017-07-20 14:59   ` Sakari Ailus
2017-07-25 14:02     ` Todor Tomov
2017-08-04 18:02       ` Sakari Ailus
2017-08-07  6:49         ` Todor Tomov
2017-07-17 10:33 ` [PATCH v3 11/23] media: camss: Add files which handle the video device nodes Todor Tomov
2017-07-17 10:33 ` [PATCH v3 12/23] media: camms: Add core files Todor Tomov
2017-07-19 10:44   ` Hans Verkuil
2017-07-17 10:33 ` [PATCH v3 13/23] media: camss: Enable building Todor Tomov
2017-07-19 13:17   ` kbuild test robot
2017-07-17 10:33 ` [PATCH v3 14/23] camss: vfe: Format conversion support using PIX interface Todor Tomov
2017-07-20 15:11   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 15/23] doc: media/v4l-drivers: Qualcomm Camera Subsystem - PIX Interface Todor Tomov
2017-07-20 15:13   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 16/23] camss: vfe: Support for frame padding Todor Tomov
2017-07-20 15:17   ` Sakari Ailus
2018-09-03 15:38     ` Todor Tomov
2018-09-13 15:04       ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 17/23] camss: vfe: Add interface for scaling Todor Tomov
2017-07-20 15:20   ` Sakari Ailus
2017-07-25 15:36     ` Todor Tomov
2017-08-04 17:59       ` Sakari Ailus [this message]
2017-07-17 10:33 ` [PATCH v3 18/23] camss: vfe: Configure scaler module in VFE Todor Tomov
2017-07-17 10:33 ` [PATCH v3 19/23] camss: vfe: Add interface for cropping Todor Tomov
2017-07-17 10:33 ` [PATCH v3 20/23] camss: vfe: Configure crop module in VFE Todor Tomov
2017-07-17 10:33 ` [PATCH v3 21/23] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Scale and crop Todor Tomov
2017-07-17 10:33 ` [PATCH v3 22/23] camss: Use optimal clock frequency rates Todor Tomov
2017-07-19 15:59   ` kbuild test robot
2017-07-21  7:55     ` Todor Tomov
2017-07-20 15:23   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 23/23] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Media graph Todor Tomov
2017-07-19 10:54 ` [PATCH v3 00/23] Qualcomm 8x16 Camera Subsystem driver Hans Verkuil
2017-07-21  7:39   ` Todor Tomov
2017-07-31  9:20   ` Hans Verkuil
2017-07-20 15:25 ` Sakari Ailus
2017-07-21  7:50   ` Todor Tomov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64a4dadd-3880-c170-d9fc-e194633c68f0@iki.fi \
    --to=sakari.ailus@iki.fi \
    --cc=hans.verkuil@cisco.com \
    --cc=javier@osg.samsung.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=todor.tomov@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®