Skip to contentSkip to conversation

media: staging: rkisp1: rsz: supported formats are the isp's src formats, not sink formats

PATCH Superseded Dafna Hirschfeld 2 participants 5 messages Jun 4, 2020 – Jun 8, 2020

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 media: staging: rkisp1: rsz: supported formats are the isp's src formats, not sink formats

The rkisp1_resizer's enum callback 'rkisp1_rsz_enum_mbus_code' calls the enum callback of the 'rkisp1_isp' on it's video sink pad. This is a bug, the resizer should support the same formats supported by the 'rkisp1_isp' on the source pad (not the sink pad).

---
 drivers/staging/media/rkisp1/rkisp1-resizer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-resizer.c +2 -2
index d049374413dc..d64c064bdb1d 100644
@@ -437,8 +437,8 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd,
 	u32 pad = code->pad;
 	int ret;
 
-	/* supported mbus codes are the same in isp sink pad */
-	code->pad = RKISP1_ISP_PAD_SINK_VIDEO;
+	/* supported mbus codes are the same in isp video src pad */
+	code->pad = RKISP1_ISP_PAD_SOURCE_VIDEO;
 	ret = v4l2_subdev_call(&rsz->rkisp1->isp.sd, pad, enum_mbus_code,
 			       &dummy_cfg, code);
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 media: staging: rkisp1: rsz: set default format if the given format is not RKISP1_DIR_SRC

When setting the sink format of the 'rkisp1_resizer' the format should be supported by 'rkisp1_isp' on the video source pad. This patch checks this condition and set the format to default if the condition is false.

---
 drivers/staging/media/rkisp1/rkisp1-common.h  | 4 ++++
 drivers/staging/media/rkisp1/rkisp1-isp.c     | 4 ----
 drivers/staging/media/rkisp1/rkisp1-resizer.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/rkisp1/rkisp1-common.h +4 -0
index 0c4fe503adc9..39d8e46d8d8a 100644
@@ -22,6 +22,10 @@
 #include "rkisp1-regs.h"
 #include "uapi/rkisp1-config.h"
 
+#define RKISP1_DIR_SRC BIT(0)
+#define RKISP1_DIR_SINK BIT(1)
+#define RKISP1_DIR_SINK_SRC (RKISP1_DIR_SINK | RKISP1_DIR_SRC)
+
 #define RKISP1_ISP_MAX_WIDTH		4032
 #define RKISP1_ISP_MAX_HEIGHT		3024
 #define RKISP1_ISP_MIN_WIDTH		32
drivers/staging/media/rkisp1/rkisp1-isp.c +0 -4
index dc2b59a0160a..e66e87d6ea8b 100644
@@ -23,10 +23,6 @@
 
 #define RKISP1_ISP_DEV_NAME	RKISP1_DRIVER_NAME "_isp"
 
-#define RKISP1_DIR_SRC BIT(0)
-#define RKISP1_DIR_SINK BIT(1)
-#define RKISP1_DIR_SINK_SRC (RKISP1_DIR_SINK | RKISP1_DIR_SRC)
-
 /*
  * NOTE: MIPI controller and input MUX are also configured in this file.
  * This is because ISP Subdev describes not only ISP submodule (input size,
drivers/staging/media/rkisp1/rkisp1-resizer.c +1 -1
index d64c064bdb1d..fa28f4bd65c0 100644
@@ -542,7 +542,7 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
 					    which);
 	sink_fmt->code = format->code;
 	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
-	if (!mbus_info) {
+	if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SRC)) {
 		sink_fmt->code = RKISP1_DEF_FMT;
 		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
 	}
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] media: staging: rkisp1: rsz: set default format if the given format is not RKISP1_DIR_SRC

Quoted 17 lines · Dafna Hirschfeld

When setting the sink format of the 'rkisp1_resizer' the format should be supported by 'rkisp1_isp' on the video source pad. This patch checks this condition and set the format to default if the condition is false.

---
 drivers/staging/media/rkisp1/rkisp1-common.h  | 4 ++++
 drivers/staging/media/rkisp1/rkisp1-isp.c     | 4 ----
 drivers/staging/media/rkisp1/rkisp1-resizer.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/rkisp1/rkisp1-common.h +0 -0
index 0c4fe503adc9..39d8e46d8d8a 100644

drivers/staging/media/rkisp1/rkisp1-common.h line 27

Quoted 6 lines
drivers/staging/media/rkisp1/rkisp1-common.h +3 -0
@@ -22,6 +22,10 @@
 #include "rkisp1-regs.h"
 #include "uapi/rkisp1-config.h"
 
+#define RKISP1_DIR_SRC BIT(0)
+#define RKISP1_DIR_SINK BIT(1)
+#define RKISP1_DIR_SINK_SRC (RKISP1_DIR_SINK | RKISP1_DIR_SRC)

I think we can rename this macro to state explicitly it is the direction from the rkisp1_isp subdevice node point of view.

Maybe prefix it with RKISP1_ISP_SD_ ?

Thanks
Helen

Quoted 33 lines
drivers/staging/media/rkisp1/rkisp1-common.h +1 -0
+
 #define RKISP1_ISP_MAX_WIDTH		4032
 #define RKISP1_ISP_MAX_HEIGHT		3024
 #define RKISP1_ISP_MIN_WIDTH		32
drivers/staging/media/rkisp1/rkisp1-isp.c +0 -4
index dc2b59a0160a..e66e87d6ea8b 100644
@@ -23,10 +23,6 @@
 
 #define RKISP1_ISP_DEV_NAME	RKISP1_DRIVER_NAME "_isp"
 
-#define RKISP1_DIR_SRC BIT(0)
-#define RKISP1_DIR_SINK BIT(1)
-#define RKISP1_DIR_SINK_SRC (RKISP1_DIR_SINK | RKISP1_DIR_SRC)
-
 /*
  * NOTE: MIPI controller and input MUX are also configured in this file.
  * This is because ISP Subdev describes not only ISP submodule (input size,
drivers/staging/media/rkisp1/rkisp1-resizer.c +1 -1
index d64c064bdb1d..fa28f4bd65c0 100644
@@ -542,7 +542,7 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
 					    which);
 	sink_fmt->code = format->code;
 	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
-	if (!mbus_info) {
+	if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SRC)) {
 		sink_fmt->code = RKISP1_DEF_FMT;
 		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
 	}
#3 lore raw

Re: [PATCH 2/2] media: staging: rkisp1: rsz: set default format if the given format is not RKISP1_DIR_SRC

Quoted 23 lines · Helen Koike
Quoted 20 lines · Dafna Hirschfeld

When setting the sink format of the 'rkisp1_resizer' the format should be supported by 'rkisp1_isp' on the video source pad. This patch checks this condition and set the format to default if the condition is false.

---
  drivers/staging/media/rkisp1/rkisp1-common.h  | 4 ++++
  drivers/staging/media/rkisp1/rkisp1-isp.c     | 4 ----
  drivers/staging/media/rkisp1/rkisp1-resizer.c | 2 +-
  3 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/rkisp1/rkisp1-common.h +0 -0
index 0c4fe503adc9..39d8e46d8d8a 100644
@@ -22,6 +22,10 @@
  #include "rkisp1-regs.h"
  #include "uapi/rkisp1-config.h"
 
Quoted 8 lines

drivers/staging/media/rkisp1/rkisp1-common.h line 27

Quoted 3 lines
drivers/staging/media/rkisp1/rkisp1-common.h +3 -0
+#define RKISP1_DIR_SRC BIT(0)
+#define RKISP1_DIR_SINK BIT(1)
+#define RKISP1_DIR_SINK_SRC (RKISP1_DIR_SINK | RKISP1_DIR_SRC)

I think we can rename this macro to state explicitly it is the direction from the rkisp1_isp subdevice node point of view.

Maybe prefix it with RKISP1_ISP_SD_ ?

yes, it's a better name.

Quoted 25 lines

Thanks
Helen

Quoted 21 lines
drivers/staging/media/rkisp1/rkisp1-common.h +1 -0
+
  #define RKISP1_ISP_MAX_WIDTH		4032
  #define RKISP1_ISP_MAX_HEIGHT		3024
  #define RKISP1_ISP_MIN_WIDTH		32
drivers/staging/media/rkisp1/rkisp1-isp.c +0 -4
index dc2b59a0160a..e66e87d6ea8b 100644
@@ -23,10 +23,6 @@
 
  #define RKISP1_ISP_DEV_NAME	RKISP1_DRIVER_NAME "_isp"
 
-#define RKISP1_DIR_SRC BIT(0)
-#define RKISP1_DIR_SINK BIT(1)
-#define RKISP1_DIR_SINK_SRC (RKISP1_DIR_SINK | RKISP1_DIR_SRC)
-
  /*
   * NOTE: MIPI controller and input MUX are also configured in this file.
   * This is because ISP Subdev describes not only ISP submodule (input size,
drivers/staging/media/rkisp1/rkisp1-resizer.c +0 -0
index d64c064bdb1d..fa28f4bd65c0 100644
Quoted 8 lines

drivers/staging/media/rkisp1/rkisp1-resizer.c static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz, · line 545

Quoted 8 lines
drivers/staging/media/rkisp1/rkisp1-resizer.c +1 -1
@@ -542,7 +542,7 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
  					    which);
  	sink_fmt->code = format->code;
  	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
-	if (!mbus_info) {
+	if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SRC)) {

I also think the field 'direction' better change to isp_pads_flags. It indicates better what this field is.

Thanks,
Dafna

Quoted 4 lines
Quoted 4 lines
drivers/staging/media/rkisp1/rkisp1-resizer.c +0 -0
  		sink_fmt->code = RKISP1_DEF_FMT;
  		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
  	}
Acked-by on v1 1/2
#4 lore raw
In reply to Dafna Hirschfeld

Hello,

Quoted 4 lines · Dafna Hirschfeld

The rkisp1_resizer's enum callback 'rkisp1_rsz_enum_mbus_code' calls the enum callback of the 'rkisp1_isp' on it's video sink pad. This is a bug, the resizer should support the same formats supported by the 'rkisp1_isp' on the source pad (not the sink pad).

Nice catch!

Quoted 2 lines

Thanks
Helen

Quoted 20 lines
---
 drivers/staging/media/rkisp1/rkisp1-resizer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-resizer.c +2 -2
index d049374413dc..d64c064bdb1d 100644
@@ -437,8 +437,8 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd,
 	u32 pad = code->pad;
 	int ret;
 
-	/* supported mbus codes are the same in isp sink pad */
-	code->pad = RKISP1_ISP_PAD_SINK_VIDEO;
+	/* supported mbus codes are the same in isp video src pad */
+	code->pad = RKISP1_ISP_PAD_SOURCE_VIDEO;
 	ret = v4l2_subdev_call(&rsz->rkisp1->isp.sd, pad, enum_mbus_code,
 			       &dummy_cfg, code);