All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Allow higher sink pad resolutions for the RkISP1
@ 2021-03-25 19:26 Sebastian Fricke
  2021-03-25 19:27 ` [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit Sebastian Fricke
  2021-03-25 19:27 ` [PATCH 2/2] media: rkisp1: Limit the sink pad crop size Sebastian Fricke
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Fricke @ 2021-03-25 19:26 UTC (permalink / raw)
  To: linux-media
  Cc: dafna.hirschfeld, laurent.pinchart, helen.koike, heiko, Sebastian Fricke

The current implementation limits the maximum sink pad resolution to
4032x3024, which is mentioned by the Rockchip TRM as the maximum size
to handle black level calibration. But the ISP can actually set it's
sink pad format to a size of 4416x3312.
Allow higher sink pad resolutions in order to allow a bigger range of
sensor modes to be used with the RkISP1.
This patch was tested with a NanoPC-T4 and a OV13850, which provides a
resolution of 4224x3136.

Sebastian Fricke (2):
  media: rkisp1: Increase ISP input resolution limit
  media: rkisp1: Limit the sink pad crop size

 drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 10 ++++++----
 drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c    |  8 ++++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit
  2021-03-25 19:26 [PATCH 0/2] Allow higher sink pad resolutions for the RkISP1 Sebastian Fricke
@ 2021-03-25 19:27 ` Sebastian Fricke
  2021-03-26  4:14   ` Laurent Pinchart
  2021-03-25 19:27 ` [PATCH 2/2] media: rkisp1: Limit the sink pad crop size Sebastian Fricke
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Fricke @ 2021-03-25 19:27 UTC (permalink / raw)
  To: linux-media
  Cc: dafna.hirschfeld, laurent.pinchart, helen.koike, heiko, Sebastian Fricke

The incentive for this patch was to overcome the inability of the
ISP device to work with resolutions greater than 4032x3024.
Increase the limit to 4416x3312 to allow higher input resolutions.
Use the old resolution to crop the input resolution down to the maximum
size for the ISP to process frames.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
---
 drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 038c303a8aed..553effda4d5e 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -30,10 +30,12 @@
 #define RKISP1_ISP_SD_SINK BIT(1)
 
 /* min and max values for the widths and heights of the entities */
-#define RKISP1_ISP_MAX_WIDTH		4032
-#define RKISP1_ISP_MAX_HEIGHT		3024
-#define RKISP1_ISP_MIN_WIDTH		32
-#define RKISP1_ISP_MIN_HEIGHT		32
+#define RKISP1_ISP_MAX_WIDTH			4416
+#define RKISP1_ISP_MAX_HEIGHT			3312
+#define RKISP1_ISP_MAX_WIDTH_PROCESSING		4032
+#define RKISP1_ISP_MAX_HEIGHT_PROCESSING	3024
+#define RKISP1_ISP_MIN_WIDTH			32
+#define RKISP1_ISP_MIN_HEIGHT			32
 
 #define RKISP1_RSZ_MP_SRC_MAX_WIDTH		4416
 #define RKISP1_RSZ_MP_SRC_MAX_HEIGHT		3312
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] media: rkisp1: Limit the sink pad crop size
  2021-03-25 19:26 [PATCH 0/2] Allow higher sink pad resolutions for the RkISP1 Sebastian Fricke
  2021-03-25 19:27 ` [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit Sebastian Fricke
@ 2021-03-25 19:27 ` Sebastian Fricke
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Fricke @ 2021-03-25 19:27 UTC (permalink / raw)
  To: linux-media
  Cc: dafna.hirschfeld, laurent.pinchart, helen.koike, heiko, Sebastian Fricke

The RkISP can take higher input resolutions than 4032x3024, but the TRM
declares this size as the maximum size for handling black level calibration.
Crop the input resolution down to the expected size.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
---
 drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index 2e5b57e3aedc..06d3cca0c00c 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -758,9 +758,13 @@ static void rkisp1_isp_set_sink_crop(struct rkisp1_isp *isp,
 					  which);
 
 	sink_crop->left = ALIGN(r->left, 2);
-	sink_crop->width = ALIGN(r->width, 2);
+	sink_crop->width = clamp_t(u32, ALIGN(r->width, 2),
+				   RKISP1_ISP_MIN_WIDTH,
+				   RKISP1_ISP_MAX_WIDTH_PROCESSING);
 	sink_crop->top = r->top;
-	sink_crop->height = r->height;
+	sink_crop->height = clamp_t(u32, r->height,
+				    RKISP1_ISP_MIN_HEIGHT,
+				    RKISP1_ISP_MAX_HEIGHT_PROCESSING);
 	rkisp1_sd_adjust_crop(sink_crop, sink_fmt);
 
 	*r = *sink_crop;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit
  2021-03-25 19:27 ` [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit Sebastian Fricke
@ 2021-03-26  4:14   ` Laurent Pinchart
  2021-03-26  5:55     ` Sebastian Fricke
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2021-03-26  4:14 UTC (permalink / raw)
  To: Sebastian Fricke; +Cc: linux-media, dafna.hirschfeld, helen.koike, heiko

Hi Sebastian,

Thank you for the patch.

On Thu, Mar 25, 2021 at 08:27:01PM +0100, Sebastian Fricke wrote:
> The incentive for this patch was to overcome the inability of the
> ISP device to work with resolutions greater than 4032x3024.
> Increase the limit to 4416x3312 to allow higher input resolutions.
> Use the old resolution to crop the input resolution down to the maximum
> size for the ISP to process frames.
> 
> Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
> ---
>  drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index 038c303a8aed..553effda4d5e 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -30,10 +30,12 @@
>  #define RKISP1_ISP_SD_SINK BIT(1)
>  
>  /* min and max values for the widths and heights of the entities */
> -#define RKISP1_ISP_MAX_WIDTH		4032
> -#define RKISP1_ISP_MAX_HEIGHT		3024
> -#define RKISP1_ISP_MIN_WIDTH		32
> -#define RKISP1_ISP_MIN_HEIGHT		32
> +#define RKISP1_ISP_MAX_WIDTH			4416
> +#define RKISP1_ISP_MAX_HEIGHT			3312
> +#define RKISP1_ISP_MAX_WIDTH_PROCESSING		4032
> +#define RKISP1_ISP_MAX_HEIGHT_PROCESSING	3024

Maybe s/_PROCESSING/_CROP/, or a name more descriptive ?

I would also squash this patch with 2/2, as otherwise you'll introduce a
bisection breakage (applying 1/2 only will leave the driver in an
incorrect state).

> +#define RKISP1_ISP_MIN_WIDTH			32
> +#define RKISP1_ISP_MIN_HEIGHT			32
>  
>  #define RKISP1_RSZ_MP_SRC_MAX_WIDTH		4416
>  #define RKISP1_RSZ_MP_SRC_MAX_HEIGHT		3312

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit
  2021-03-26  4:14   ` Laurent Pinchart
@ 2021-03-26  5:55     ` Sebastian Fricke
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Fricke @ 2021-03-26  5:55 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, dafna.hirschfeld, helen.koike, heiko

Hey Laurent,

On 26.03.2021 06:14, Laurent Pinchart wrote:
>Hi Sebastian,
>
>Thank you for the patch.

Thank you for your review.

>
>On Thu, Mar 25, 2021 at 08:27:01PM +0100, Sebastian Fricke wrote:
>> The incentive for this patch was to overcome the inability of the
>> ISP device to work with resolutions greater than 4032x3024.
>> Increase the limit to 4416x3312 to allow higher input resolutions.
>> Use the old resolution to crop the input resolution down to the maximum
>> size for the ISP to process frames.
>>
>> Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
>> ---
>>  drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
>> index 038c303a8aed..553effda4d5e 100644
>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
>> @@ -30,10 +30,12 @@
>>  #define RKISP1_ISP_SD_SINK BIT(1)
>>
>>  /* min and max values for the widths and heights of the entities */
>> -#define RKISP1_ISP_MAX_WIDTH		4032
>> -#define RKISP1_ISP_MAX_HEIGHT		3024
>> -#define RKISP1_ISP_MIN_WIDTH		32
>> -#define RKISP1_ISP_MIN_HEIGHT		32
>> +#define RKISP1_ISP_MAX_WIDTH			4416
>> +#define RKISP1_ISP_MAX_HEIGHT			3312
>> +#define RKISP1_ISP_MAX_WIDTH_PROCESSING		4032
>> +#define RKISP1_ISP_MAX_HEIGHT_PROCESSING	3024
>
>Maybe s/_PROCESSING/_CROP/, or a name more descriptive ?

My thought behind this name was the difference between the maximum size
that the ISP accepts as an input and the maximum size that it can
actually process. So more descriptive in that case would be:
`RKISP1_ISP_MAX_HEIGHT_FOR_PROCESSING` but this is way too long.
I guess `RKISP1_ISP_MAX_HEIGHT_CROP` is a good short name, that also
makes sense at the place where it is used. I guess I should add a
comment though, to explain why the crop has that limitation.

>
>I would also squash this patch with 2/2, as otherwise you'll introduce a
>bisection breakage (applying 1/2 only will leave the driver in an
>incorrect state).

Oh yes, I will do that.

>
>> +#define RKISP1_ISP_MIN_WIDTH			32
>> +#define RKISP1_ISP_MIN_HEIGHT			32
>>
>>  #define RKISP1_RSZ_MP_SRC_MAX_WIDTH		4416
>>  #define RKISP1_RSZ_MP_SRC_MAX_HEIGHT		3312
>
>-- 
>Regards,
>
>Laurent Pinchart

Greetings,

Sebastian Fricke

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-26  5:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 19:26 [PATCH 0/2] Allow higher sink pad resolutions for the RkISP1 Sebastian Fricke
2021-03-25 19:27 ` [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit Sebastian Fricke
2021-03-26  4:14   ` Laurent Pinchart
2021-03-26  5:55     ` Sebastian Fricke
2021-03-25 19:27 ` [PATCH 2/2] media: rkisp1: Limit the sink pad crop size Sebastian Fricke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.