[PATCH 5/6] vivid-tpg: support the DCI-P3 colorspace

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

Add support to the test pattern generator for the DCI-P3 colorspace.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-tpg-colors.c | 148 +++-
 drivers/media/platform/vivid/vivid-tpg-colors.h |   4 +-
 2 files changed, 146 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-tpg-colors.c 
b/drivers/media/platform/vivid/vivid-tpg-colors.c
index 650d9c7..dee7b14 100644
--- a/drivers/media/platform/vivid/vivid-tpg-colors.c
+++ b/drivers/media/platform/vivid/vivid-tpg-colors.c
@@ -598,7 +598,7 @@ const unsigned short tpg_linear_to_rec709[255 * 16 + 1] = {
 };
 
 /* Generated table */
-const struct color16 tpg_csc_colors[V4L2_COLORSPACE_BT2020 + 
1][V4L2_XFER_FUNC_NONE + 1][TPG_COLOR_CSC_BLACK + 1] = {
+const struct color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 + 
1][V4L2_XFER_FUNC_DCI_P3 + 1][TPG_COLOR_CSC_BLACK + 1] = {
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 2939 
},
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_709][1] = { 2953, 2963, 586 
},
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_709][2] = { 0, 2967, 2937 },
@@ -639,6 +639,14 @@ const struct color16 tpg_csc_colors[V4L2_COLORSPACE_BT2020 
+ 1][V4L2_XFER_FUNC_N
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_NONE][5] = { 2256, 90, 133 },
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_NONE][6] = { 110, 96, 2113 },
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_NONE][7] = { 130, 130, 130 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][0] = { 3175, 3175, 
3175 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][1] = { 3186, 3194, 
1121 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][2] = { 0, 3197, 3173 
},
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][3] = { 523, 3216, 
1112 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][4] = { 3237, 792, 
3169 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][5] = { 3248, 944, 
1094 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][6] = { 1017, 967, 
3168 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][7] = { 1084, 1084, 
1084 },
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 2939 
},
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_709][1] = { 2953, 2963, 586 
},
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_709][2] = { 0, 2967, 2937 },
@@ -679,6 +687,14 @@ const struct color16 tpg_csc_colors[V4L2_COLORSPACE_BT2020 
+ 1][V4L2_XFER_FUNC_N
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_NONE][5] = { 2256, 90, 133 },
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_NONE][6] = { 110, 96, 2113 },
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_NONE][7] = { 130, 130, 130 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][0] = { 3175, 3175, 
3175 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][1] = { 3186, 3194, 
1121 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][2] = { 0, 3197, 3173 
},
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][3] = { 523, 3216, 
1112 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][4] = { 3237, 792, 
3169 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][5] = { 3248, 944, 
1094 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][6] = { 1017, 967, 
3168 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][7] = { 1084, 1084, 
1084 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 2939 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_709][1] = { 2939, 2939, 547 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_709][2] = { 547, 2939, 2939 },
@@ -719,6 +735,14 @@ const struct color16 tpg_csc_colors[V4L2_COLORSPACE_BT2020 
+ 1][V4L2_XFER_FUNC_N
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_NONE][5] = { 2125, 130, 130 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_NONE][6] = { 130, 130, 2125 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_NONE][7] = { 130, 130, 130 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][0] = { 3175, 3175, 3175 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][1] = { 3175, 3175, 1084 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][2] = { 1084, 3175, 3175 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][3] = { 1084, 3175, 1084 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][4] = { 3175, 1084, 3175 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][5] = { 3175, 1084, 1084 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][6] = { 1084, 1084, 3175 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][7] = { 1084, 1084, 1084 
},
[V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 
2939 },
[V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][1] = { 2892, 3034, 
910 },

[PATCH 6/6] vivid: add support for the DCI-P3 colorspace

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

Support this new colorspace in vivid.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-core.h  | 1 +
 drivers/media/platform/vivid/vivid-ctrls.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/media/platform/vivid/vivid-core.h 
b/drivers/media/platform/vivid/vivid-core.h
index c72349c..72c4cd3 100644
--- a/drivers/media/platform/vivid/vivid-core.h
+++ b/drivers/media/platform/vivid/vivid-core.h
@@ -123,6 +123,7 @@ enum vivid_colorspace {
VIVID_CS_SRGB,
VIVID_CS_ADOBERGB,
VIVID_CS_2020,
+   VIVID_CS_DCI_P3,
VIVID_CS_240M,
VIVID_CS_SYS_M,
VIVID_CS_SYS_BG,
diff --git a/drivers/media/platform/vivid/vivid-ctrls.c 
b/drivers/media/platform/vivid/vivid-ctrls.c
index 3d8e161..995e303 100644
--- a/drivers/media/platform/vivid/vivid-ctrls.c
+++ b/drivers/media/platform/vivid/vivid-ctrls.c
@@ -342,6 +342,7 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
V4L2_COLORSPACE_SRGB,
V4L2_COLORSPACE_ADOBERGB,
V4L2_COLORSPACE_BT2020,
+   V4L2_COLORSPACE_DCI_P3,
V4L2_COLORSPACE_SMPTE240M,
V4L2_COLORSPACE_470_SYSTEM_M,
V4L2_COLORSPACE_470_SYSTEM_BG,
@@ -701,6 +702,7 @@ static const char * const vivid_ctrl_colorspace_strings[] = 
{
"sRGB",
"AdobeRGB",
"BT.2020",
+   "DCI-P3",
"SMPTE 240M",
"470 System M",
"470 System BG",
@@ -724,6 +726,7 @@ static const char * const vivid_ctrl_xfer_func_strings[] = {
"AdobeRGB",
"SMPTE 240M",
"None",
+   "DCI-P3",
NULL,
 };
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] vivid: use ARRAY_SIZE to calculate max control value

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

The max value of various menu controls is hardcoded, and it is easy to forget
to update it after adding a new menu item.

So use ARRAY_SIZE instead to calculate this value.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-ctrls.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-ctrls.c 
b/drivers/media/platform/vivid/vivid-ctrls.c
index 339c8b7..3d8e161 100644
--- a/drivers/media/platform/vivid/vivid-ctrls.c
+++ b/drivers/media/platform/vivid/vivid-ctrls.c
@@ -548,7 +548,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_osd_mode = {
.id = VIVID_CID_OSD_TEXT_MODE,
.name = "OSD Text Mode",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 2,
+   .max = ARRAY_SIZE(vivid_ctrl_osd_mode_strings) - 2,
.qmenu = vivid_ctrl_osd_mode_strings,
 };
 
@@ -640,7 +640,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_tstamp_src 
= {
.id = VIVID_CID_TSTAMP_SRC,
.name = "Timestamp Source",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 1,
+   .max = ARRAY_SIZE(vivid_ctrl_tstamp_src_strings) - 2,
.qmenu = vivid_ctrl_tstamp_src_strings,
 };
 
@@ -712,7 +712,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_colorspace 
= {
.id = VIVID_CID_COLORSPACE,
.name = "Colorspace",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 7,
+   .max = ARRAY_SIZE(vivid_ctrl_colorspace_strings) - 2,
.def = 2,
.qmenu = vivid_ctrl_colorspace_strings,
 };
@@ -732,7 +732,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_xfer_func = 
{
.id = VIVID_CID_XFER_FUNC,
.name = "Transfer Function",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 5,
+   .max = ARRAY_SIZE(vivid_ctrl_xfer_func_strings) - 2,
.qmenu = vivid_ctrl_xfer_func_strings,
 };
 
@@ -754,7 +754,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_ycbcr_enc = 
{
.id = VIVID_CID_YCBCR_ENC,
.name = "Y'CbCr Encoding",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 8,
+   .max = ARRAY_SIZE(vivid_ctrl_ycbcr_enc_strings) - 2,
.qmenu = vivid_ctrl_ycbcr_enc_strings,
 };
 
@@ -770,7 +770,7 @@ static const struct v4l2_ctrl_config 
vivid_ctrl_quantization = {
.id = VIVID_CID_QUANTIZATION,
.name = "Quantization",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 2,
+   .max = ARRAY_SIZE(vivid_ctrl_quantization_strings) - 2,
.qmenu = vivid_ctrl_quantization_strings,
 };
 
@@ -1088,7 +1088,7 @@ static const struct v4l2_ctrl_config 
vivid_ctrl_std_signal_mode = {
.id = VIVID_CID_STD_SIGNAL_MODE,
.name = "Standard Signal Mode",
.type = V4L2_CTRL_TYPE_MENU,
-   .max = 5,
+   .max = ARRAY_SIZE(vivid_ctrl_std_signal_mode_strings) - 2,
.menu_skip_mask = 1 << 3,
.qmenu = vivid_ctrl_std_signal_mode_strings,
 };
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/6] v4l2: add support for the DCI-P3 colorspace

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

This patch series adds support for the DCI-P3 colorspace. This colorspace
is used by cinema projectors and is also support by the DisplayPort
standard.

The first patch is a cleanup patch for the vivid driver, the second
improves the colorspace handling of NTSC 1953 (it now compensates for the
different whitepoints between NTSC 1953 and Rec. 709).

The next two add support for DCI-P3 to the header and the documentation and
the last two support the new colorspace in the vivid driver.

Regards,

Hans

Hans Verkuil (6):
  vivid: use ARRAY_SIZE to calculate max control value
  vivid: use Bradford method when converting Rec. 709 to NTSC 1953
  videodev2.h: add support for the DCI-P3 colorspace
  DocBook media: document the new DCI-P3 colorspace
  vivid-tpg: support the DCI-P3 colorspace
  vivid: add support for the DCI-P3 colorspace

 Documentation/DocBook/media/v4l/biblio.xml  |   9 +
 Documentation/DocBook/media/v4l/pixfmt.xml  |  70 +++
 drivers/media/platform/vivid/vivid-core.h   |   1 +
 drivers/media/platform/vivid/vivid-ctrls.c  |  17 +-
 drivers/media/platform/vivid/vivid-tpg-colors.c | 238 +++-
 drivers/media/platform/vivid/vivid-tpg-colors.h |   4 +-
 include/uapi/linux/videodev2.h  |  18 +-
 7 files changed, 296 insertions(+), 61 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] videodev2.h: add support for the DCI-P3 colorspace

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

This colorspace is used for cinema projectors and is supported by
the DisplayPort standard.

Signed-off-by: Hans Verkuil 
---
 include/uapi/linux/videodev2.h | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 3228fbe..4900e15 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -229,6 +229,9 @@ enum v4l2_colorspace {
 
/* Raw colorspace: for RAW unprocessed images */
V4L2_COLORSPACE_RAW   = 11,
+
+   /* DCI-P3 colorspace, used by cinema projectors */
+   V4L2_COLORSPACE_DCI_P3= 12,
 };
 
 /*
@@ -256,6 +259,8 @@ enum v4l2_xfer_func {
 * V4L2_COLORSPACE_SMPTE240M: V4L2_XFER_FUNC_SMPTE240M
 *
 * V4L2_COLORSPACE_RAW: V4L2_XFER_FUNC_NONE
+*
+* V4L2_COLORSPACE_DCI_P3: V4L2_XFER_FUNC_DCI_P3
 */
V4L2_XFER_FUNC_DEFAULT = 0,
V4L2_XFER_FUNC_709 = 1,
@@ -263,6 +268,7 @@ enum v4l2_xfer_func {
V4L2_XFER_FUNC_ADOBERGB= 3,
V4L2_XFER_FUNC_SMPTE240M   = 4,
V4L2_XFER_FUNC_NONE= 5,
+   V4L2_XFER_FUNC_DCI_P3  = 6,
 };
 
 /*
@@ -272,9 +278,10 @@ enum v4l2_xfer_func {
 #define V4L2_MAP_XFER_FUNC_DEFAULT(colsp) \
((colsp) == V4L2_COLORSPACE_ADOBERGB ? V4L2_XFER_FUNC_ADOBERGB : \
 ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_XFER_FUNC_SMPTE240M : \
- ((colsp) == V4L2_COLORSPACE_RAW ? V4L2_XFER_FUNC_NONE : \
-  ((colsp) == V4L2_COLORSPACE_SRGB || (colsp) == V4L2_COLORSPACE_JPEG 
? \
-   V4L2_XFER_FUNC_SRGB : V4L2_XFER_FUNC_709
+ ((colsp) == V4L2_COLORSPACE_DCI_P3 ? V4L2_XFER_FUNC_DCI_P3 : \
+  ((colsp) == V4L2_COLORSPACE_RAW ? V4L2_XFER_FUNC_NONE : \
+   ((colsp) == V4L2_COLORSPACE_SRGB || (colsp) == V4L2_COLORSPACE_JPEG 
? \
+V4L2_XFER_FUNC_SRGB : V4L2_XFER_FUNC_709)
 
 enum v4l2_ycbcr_encoding {
/*
@@ -285,7 +292,7 @@ enum v4l2_ycbcr_encoding {
 * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
 * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
 *
-* V4L2_COLORSPACE_REC709: V4L2_YCBCR_ENC_709
+* V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709
 *
 * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC
 *
@@ -325,7 +332,8 @@ enum v4l2_ycbcr_encoding {
  * This depends on the colorspace.
  */
 #define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \
-   ((colsp) == V4L2_COLORSPACE_REC709 ? V4L2_YCBCR_ENC_709 : \
+   (((colsp) == V4L2_COLORSPACE_REC709 || \
+ (colsp) == V4L2_COLORSPACE_DCI_P3) ? V4L2_YCBCR_ENC_709 : \
 ((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \
  ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \
   V4L2_YCBCR_ENC_601)))
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] DocBook media: document the new DCI-P3 colorspace

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

Document this colorspace.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/biblio.xml |  9 
 Documentation/DocBook/media/v4l/pixfmt.xml | 70 ++
 2 files changed, 79 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/biblio.xml 
b/Documentation/DocBook/media/v4l/biblio.xml
index fdee6b3..f54db59 100644
--- a/Documentation/DocBook/media/v4l/biblio.xml
+++ b/Documentation/DocBook/media/v4l/biblio.xml
@@ -177,6 +177,15 @@ Signal - NTSC for Studio Applications"
 1125-Line High-Definition Production"
 
 
+
+  SMPTERP431-2
+  
+   Society of Motion Picture and Television Engineers
+(http://www.smpte.org;>http://www.smpte.org)
+  
+  SMPTE RP 431-2:2011 "D-Cinema Quality - Reference Projector and 
Environment"
+
+
 
   sRGB
   
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index 965ea91..417 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -540,6 +540,10 @@ colorspaces except for BT.2020 which uses limited range 
R'G'B' quantization.See .
  
  
+   V4L2_COLORSPACE_DCI_P3
+   See .
+ 
+ 
V4L2_COLORSPACE_SMPTE240M
See .
  
@@ -601,6 +605,10 @@ colorspaces except for BT.2020 which uses limited range 
R'G'B' quantization.V4L2_XFER_FUNC_NONE
Do not use a transfer function (i.e. use linear RGB 
values).
  
+ 
+   V4L2_XFER_FUNC_DCI_P3
+   Use the DCI-P3 transfer function.
+ 

   
 
@@ -1154,6 +1162,68 @@ clamped to the range [-0.50.5]. The Y'CbCr 
quantization is limited range
 clamped to the range [-0.50.5]. The Yc'CbcCrc quantization is limited 
range.
 
 
+
+  Colorspace DCI-P3 
(V4L2_COLORSPACE_DCI_P3)
+  The  standard defines the colorspace 
used by cinema
+projectors that use the DCI-P3 colorspace.
+The default transfer function is V4L2_XFER_FUNC_DCI_P3.
+The default Y'CbCr encoding is V4L2_YCBCR_ENC_709. Note 
that this
+colorspace does not specify a Y'CbCr encoding since it is not meant to be 
encoded
+to Y'CbCr. So this default Y'CbCr encoding was picked because it is the HDTV
+encoding. The default Y'CbCr quantization is limited range. The chromaticities 
of
+the primary colors and the white reference are:
+  
+DCI-P3 Chromaticities
+
+  
+   
+ 
+   Color
+   x
+   y
+ 
+   
+  
+
+  Red
+  0.6800
+  0.3200
+
+
+  Green
+  0.2650
+  0.6900
+
+
+  Blue
+  0.1500
+  0.0600
+
+
+  White Reference
+  0.3140
+  0.3510
+
+  
+
+  
+  
+   
+  Transfer function:
+ 
+L' = L1/2.6
+ 
+   
+   
+  Inverse Transfer function:
+ 
+L = L'2.6
+ 
+   
+  
+  Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.
+
+
 
   Colorspace SMPTE 240M 
(V4L2_COLORSPACE_SMPTE240M)
   The  standard was an interim standard 
used during
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] vivid: use Bradford method when converting Rec. 709 to NTSC 1953

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

The V4L2_COLORSPACE_470_SYSTEM_M (aka NTSC 1953) colorspace has a different
whitepoint (C) compared to Rec. 709 (D65). The Bradford method is the
recommended method to compensate for that when converting a Rec. 709 color
to an NTSC 1953 color.

See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for more
details on the Bradford method.

This patch updates the Rec. 709 to NTSC 1953 matrix so that it includes the
chromatic adaptation as calculated by the Bradford method, and it recalculates
the tpg_csc_colors table accordingly.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-tpg-colors.c | 90 +
 1 file changed, 47 insertions(+), 43 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-tpg-colors.c 
b/drivers/media/platform/vivid/vivid-tpg-colors.c
index 8f231a6..650d9c7 100644
--- a/drivers/media/platform/vivid/vivid-tpg-colors.c
+++ b/drivers/media/platform/vivid/vivid-tpg-colors.c
@@ -719,46 +719,46 @@ const struct color16 
tpg_csc_colors[V4L2_COLORSPACE_BT2020 + 1][V4L2_XFER_FUNC_N
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_NONE][5] = { 2125, 130, 130 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_NONE][6] = { 130, 130, 2125 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_NONE][7] = { 130, 130, 130 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][0] = { 2892, 2988, 
2807 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][1] = { 2846, 3070, 
843 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][2] = { 1656, 2962, 
2783 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][3] = { 1572, 3045, 
763 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][4] = { 2476, 229, 
2742 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][5] = { 2420, 672, 
614 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][6] = { 725, 63, 2718 
},
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][7] = { 534, 561, 509 
},
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][0] = { 3013, 3099, 
2935 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][1] = { 2970, 3174, 
1091 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][2] = { 1871, 3076, 
2913 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][3] = { 1791, 3152, 
1013 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][4] = { 2632, 468, 
2876 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][5] = { 2581, 924, 
866 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][6] = { 976, 180, 
2854 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SRGB][7] = { 786, 813, 
762 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][0] = { 2990, 
3077, 2912 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][1] = { 2947, 
3153, 1119 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][2] = { 1859, 
3053, 2889 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][3] = { 1782, 
3130, 1047 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][4] = { 2608, 
556, 2852 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][5] = { 2557, 
964, 912 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][6] = { 1013, 
309, 2830 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_ADOBERGB][7] = { 839, 
864, 817 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][0] = { 2879, 
2975, 2793 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][1] = { 2832, 
3059, 806 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][2] = { 1629, 
2949, 2768 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][3] = { 1543, 
3033, 725 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][4] = { 2457, 
203, 2727 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][5] = { 2401, 
633, 574 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][6] = { 687, 
56, 2702 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_SMPTE240M][7] = { 493, 
521, 469 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][0] = { 2060, 2194, 
1943 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][1] = { 1995, 2314, 
237 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][2] = { 725, 2157, 
1911 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][3] = { 660, 2278, 
205 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][4] = { 1525, 50, 
1857 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][5] = { 1461, 171, 
151 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][6] = { 190, 14, 
1825 },
-   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_NONE][7] = { 126, 134, 
118 },
+   [V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 
2939 },
+   

[PATCH 13/32] v4l: vsp1: Extract pipeline initialization code into a function

2015-09-13 Thread Laurent Pinchart
The code will be reused outside of vsp1_video.c.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_pipe.c  | 10 ++
 drivers/media/platform/vsp1/vsp1_pipe.h  |  1 +
 drivers/media/platform/vsp1/vsp1_video.c |  6 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
b/drivers/media/platform/vsp1/vsp1_pipe.c
index 199d57f1fe06..524420ed6333 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -48,6 +48,16 @@ void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
pipe->uds = NULL;
 }
 
+void vsp1_pipeline_init(struct vsp1_pipeline *pipe)
+{
+   mutex_init(>lock);
+   spin_lock_init(>irqlock);
+   init_waitqueue_head(>wq);
+
+   INIT_LIST_HEAD(>entities);
+   pipe->state = VSP1_PIPELINE_STOPPED;
+}
+
 void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
 {
struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h 
b/drivers/media/platform/vsp1/vsp1_pipe.h
index f8a099fba973..8553d5a03aa3 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.h
+++ b/drivers/media/platform/vsp1/vsp1_pipe.h
@@ -67,6 +67,7 @@ static inline struct vsp1_pipeline *to_vsp1_pipeline(struct 
media_entity *e)
 }
 
 void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
+void vsp1_pipeline_init(struct vsp1_pipeline *pipe);
 
 void vsp1_pipeline_run(struct vsp1_pipeline *pipe);
 bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe);
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 8569836ea51b..ec68890af14b 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -1009,11 +1009,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device 
*vsp1,
spin_lock_init(>irqlock);
INIT_LIST_HEAD(>irqqueue);
 
-   mutex_init(>pipe.lock);
-   spin_lock_init(>pipe.irqlock);
-   INIT_LIST_HEAD(>pipe.entities);
-   init_waitqueue_head(>pipe.wq);
-   video->pipe.state = VSP1_PIPELINE_STOPPED;
+   vsp1_pipeline_init(>pipe);
video->pipe.frame_end = vsp1_video_pipeline_frame_end;
 
/* Initialize the media entity... */
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/32] v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video

2015-09-13 Thread Laurent Pinchart
To make the pipeline structure and operations usable without video
devices the frame end processing must be decoupled from struct
vsp1_video. Implement this by calling the video frame end function
indirectly through a function pointer in struct vsp1_pipeline.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_video.c | 25 +
 drivers/media/platform/vsp1/vsp1_video.h |  2 ++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index c726d76bd570..c86a4065ea9c 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -617,8 +617,9 @@ vsp1_video_complete_buffer(struct vsp1_video *video)
 }
 
 static void vsp1_video_frame_end(struct vsp1_pipeline *pipe,
-struct vsp1_video *video)
+struct vsp1_rwpf *rwpf)
 {
+   struct vsp1_video *video = rwpf->video;
struct vsp1_vb2_buffer *buf;
unsigned long flags;
 
@@ -634,21 +635,28 @@ static void vsp1_video_frame_end(struct vsp1_pipeline 
*pipe,
spin_unlock_irqrestore(>irqlock, flags);
 }
 
+static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe)
+{
+   unsigned int i;
+
+   /* Complete buffers on all video nodes. */
+   for (i = 0; i < pipe->num_inputs; ++i)
+   vsp1_video_frame_end(pipe, pipe->inputs[i]);
+
+   if (!pipe->lif)
+   vsp1_video_frame_end(pipe, pipe->output);
+}
+
 void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
 {
enum vsp1_pipeline_state state;
unsigned long flags;
-   unsigned int i;
 
if (pipe == NULL)
return;
 
-   /* Complete buffers on all video nodes. */
-   for (i = 0; i < pipe->num_inputs; ++i)
-   vsp1_video_frame_end(pipe, pipe->inputs[i]->video);
-
-   if (!pipe->lif)
-   vsp1_video_frame_end(pipe, pipe->output->video);
+   /* Signal frame end to the pipeline handler. */
+   pipe->frame_end(pipe);
 
spin_lock_irqsave(>irqlock, flags);
 
@@ -1223,6 +1231,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device 
*vsp1,
INIT_LIST_HEAD(>pipe.entities);
init_waitqueue_head(>pipe.wq);
video->pipe.state = VSP1_PIPELINE_STOPPED;
+   video->pipe.frame_end = vsp1_video_pipeline_frame_end;
 
/* Initialize the media entity... */
ret = media_entity_init(>video.entity, 1, >pad, 0);
diff --git a/drivers/media/platform/vsp1/vsp1_video.h 
b/drivers/media/platform/vsp1/vsp1_video.h
index cea6d1f3f07b..d2d229ed8aa7 100644
--- a/drivers/media/platform/vsp1/vsp1_video.h
+++ b/drivers/media/platform/vsp1/vsp1_video.h
@@ -70,6 +70,8 @@ struct vsp1_pipeline {
enum vsp1_pipeline_state state;
wait_queue_head_t wq;
 
+   void (*frame_end)(struct vsp1_pipeline *pipe);
+
struct mutex lock;
unsigned int use_count;
unsigned int stream_count;
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 32/32] v4l: vsp1: Add display list support

2015-09-13 Thread Laurent Pinchart
From: Takashi Saito 

Display lists contain lists of registers and associated values to be
applied atomically by the hardware. They lower the pressure on interrupt
processing delays when reprogramming the device as settings can be
prepared well in advance and queued to the hardware without waiting for
the end of the current frame.

Display list support is currently limited to the DRM pipeline.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/Makefile  |   2 +-
 drivers/media/platform/vsp1/vsp1.h|  17 ++
 drivers/media/platform/vsp1/vsp1_bru.c|   2 +-
 drivers/media/platform/vsp1/vsp1_dl.c | 304 ++
 drivers/media/platform/vsp1/vsp1_dl.h |  42 +
 drivers/media/platform/vsp1/vsp1_drm.c| 105 ++-
 drivers/media/platform/vsp1/vsp1_drm.h|   5 +
 drivers/media/platform/vsp1/vsp1_drv.c|  76 +---
 drivers/media/platform/vsp1/vsp1_entity.c |   4 +-
 drivers/media/platform/vsp1/vsp1_lif.c|   4 +-
 drivers/media/platform/vsp1/vsp1_pipe.c   |  54 +-
 drivers/media/platform/vsp1/vsp1_pipe.h   |   5 +
 drivers/media/platform/vsp1/vsp1_rpf.c|   4 +-
 drivers/media/platform/vsp1/vsp1_wpf.c|  13 +-
 14 files changed, 542 insertions(+), 95 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_dl.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_dl.h

diff --git a/drivers/media/platform/vsp1/Makefile 
b/drivers/media/platform/vsp1/Makefile
index 447e72a2ef43..95b3ac2ea7ef 100644
--- a/drivers/media/platform/vsp1/Makefile
+++ b/drivers/media/platform/vsp1/Makefile
@@ -1,5 +1,5 @@
 vsp1-y := vsp1_drv.o vsp1_entity.o vsp1_pipe.o
-vsp1-y += vsp1_drm.o vsp1_video.o
+vsp1-y += vsp1_dl.o vsp1_drm.o vsp1_video.o
 vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o
 vsp1-y += vsp1_hsit.o vsp1_lif.o vsp1_lut.o
 vsp1-y += vsp1_bru.o vsp1_sru.o vsp1_uds.o
diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 61a24e4a0848..358018a97827 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -26,7 +26,9 @@
 struct clk;
 struct device;
 
+struct vsp1_dl;
 struct vsp1_drm;
+struct vsp1_entity;
 struct vsp1_platform_data;
 struct vsp1_bru;
 struct vsp1_hsit;
@@ -84,12 +86,17 @@ struct vsp1_device {
struct v4l2_device v4l2_dev;
struct media_device media_dev;
struct media_entity_operations media_ops;
+
struct vsp1_drm *drm;
+
+   bool use_dl;
 };
 
 int vsp1_device_get(struct vsp1_device *vsp1);
 void vsp1_device_put(struct vsp1_device *vsp1);
 
+int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index);
+
 static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
 {
return ioread32(vsp1->mmio + reg);
@@ -100,4 +107,14 @@ static inline void vsp1_write(struct vsp1_device *vsp1, 
u32 reg, u32 data)
iowrite32(data, vsp1->mmio + reg);
 }
 
+#include "vsp1_dl.h"
+
+static inline void vsp1_mod_write(struct vsp1_entity *e, u32 reg, u32 data)
+{
+   if (e->vsp1->use_dl)
+   vsp1_dl_add(e, reg, data);
+   else
+   vsp1_write(e->vsp1, reg, data);
+}
+
 #endif /* __VSP1_H__ */
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index 99b742ff53c9..cb0dbc15ddad 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -30,7 +30,7 @@
 
 static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
 {
-   vsp1_write(bru->entity.vsp1, reg, data);
+   vsp1_mod_write(>entity, reg, data);
 }
 
 /* 
-
diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
b/drivers/media/platform/vsp1/vsp1_dl.c
new file mode 100644
index ..a4dcccf0778b
--- /dev/null
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -0,0 +1,304 @@
+/*
+ * vsp1_dl.h  --  R-Car VSP1 Display List
+ *
+ * Copyright (C) 2015 Renesas Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+
+#include "vsp1.h"
+#include "vsp1_dl.h"
+#include "vsp1_pipe.h"
+
+/*
+ * Global resources
+ *
+ * - Display-related interrupts (can be used for vblank evasion ?)
+ * - Display-list enable
+ * - Header-less for WPF0
+ * - DL swap
+ */
+
+#define VSP1_DL_BODY_SIZE  (2 * 4 * 256)
+#define 

[PATCH 22/32] v4l: vsp1: Make the BRU optional

2015-09-13 Thread Laurent Pinchart
Not all VSP instances have a BRU on R-Car Gen3, make it optional. For
backward compatibility with older DT bindings default to BRU
availability on R-Car Gen2.

Cc: devicet...@vger.kernel.org
Signed-off-by: Laurent Pinchart 
---
 .../devicetree/bindings/media/renesas,vsp1.txt |  3 +++
 drivers/media/platform/vsp1/vsp1.h |  1 +
 drivers/media/platform/vsp1/vsp1_drv.c | 23 --
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt 
b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
index 674c8c30d046..766f034c1e45 100644
--- a/Documentation/devicetree/bindings/media/renesas,vsp1.txt
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -20,6 +20,9 @@ Optional properties:
 
   - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1. Defaults
 to 0 if not present.
+  - renesas,has-bru: Boolean, indicates that the Blending & ROP Unit (BRU)
+module is available. Defaults to true on R-Car Gen2 and false on R-Car Gen3
+if not present.
   - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
 available.
   - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 3b2b2387e085..173f9f830049 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -42,6 +42,7 @@ struct vsp1_uds;
 #define VSP1_HAS_LIF   (1 << 0)
 #define VSP1_HAS_LUT   (1 << 1)
 #define VSP1_HAS_SRU   (1 << 2)
+#define VSP1_HAS_BRU   (1 << 3)
 
 struct vsp1_platform_data {
unsigned int features;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index bd22457bf392..eccdacdf4f4c 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -223,13 +223,15 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
 
/* Instantiate all the entities. */
-   vsp1->bru = vsp1_bru_create(vsp1);
-   if (IS_ERR(vsp1->bru)) {
-   ret = PTR_ERR(vsp1->bru);
-   goto done;
-   }
+   if (vsp1->pdata.features & VSP1_HAS_BRU) {
+   vsp1->bru = vsp1_bru_create(vsp1);
+   if (IS_ERR(vsp1->bru)) {
+   ret = PTR_ERR(vsp1->bru);
+   goto done;
+   }
 
-   list_add_tail(>bru->entity.list_dev, >entities);
+   list_add_tail(>bru->entity.list_dev, >entities);
+   }
 
vsp1->hsi = vsp1_hsit_create(vsp1, true);
if (IS_ERR(vsp1->hsi)) {
@@ -513,6 +515,8 @@ static int vsp1_parse_dt(struct vsp1_device *vsp1)
 
vsp1->info = of_device_get_match_data(vsp1->dev);
 
+   if (of_property_read_bool(np, "renesas,has-bru"))
+   pdata->features |= VSP1_HAS_BRU;
if (of_property_read_bool(np, "renesas,has-lif"))
pdata->features |= VSP1_HAS_LIF;
if (of_property_read_bool(np, "renesas,has-lut"))
@@ -542,6 +546,13 @@ static int vsp1_parse_dt(struct vsp1_device *vsp1)
return -EINVAL;
}
 
+   /* Backward compatibility: all Gen2 VSP instances have a BRU, the
+* renesas,has-bru property was thus not available. Set the HAS_BRU
+* feature automatically in that case.
+*/
+   if (vsp1->info->num_bru_inputs == 4)
+   pdata->features |= VSP1_HAS_BRU;
+
return 0;
 }
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/32] v4l: vsp1: Move format info to vsp1_pipe.c

2015-09-13 Thread Laurent Pinchart
Format information and the related helper function are not specific to
the V4L2 API, move them from vsp1_video.c to vsp1_pipe.c.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_pipe.c  | 110 +++
 drivers/media/platform/vsp1/vsp1_pipe.h  |  29 
 drivers/media/platform/vsp1/vsp1_video.c | 107 --
 drivers/media/platform/vsp1/vsp1_video.h |  27 
 4 files changed, 139 insertions(+), 134 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
b/drivers/media/platform/vsp1/vsp1_pipe.c
index 524420ed6333..df11259dcc0a 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -25,6 +25,116 @@
 #include "vsp1_uds.h"
 
 /* 
-
+ * Helper Functions
+ */
+
+static const struct vsp1_format_info vsp1_video_formats[] = {
+   { V4L2_PIX_FMT_RGB332, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 8, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_ARGB444, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1, true },
+   { V4L2_PIX_FMT_XRGB444, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_XRGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1, true },
+   { V4L2_PIX_FMT_ARGB555, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1, true },
+   { V4L2_PIX_FMT_XRGB555, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_XRGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_RGB565, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_BGR24, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_BGR_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 24, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_RGB24, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_RGB_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 24, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_ABGR32, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
+ 1, { 32, 0, 0 }, false, false, 1, 1, true },
+   { V4L2_PIX_FMT_XBGR32, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
+ 1, { 32, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_ARGB32, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 32, 0, 0 }, false, false, 1, 1, true },
+   { V4L2_PIX_FMT_XRGB32, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 32, 0, 0 }, false, false, 1, 1, false },
+   { V4L2_PIX_FMT_UYVY, MEDIA_BUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 16, 0, 0 }, false, false, 2, 1, false },
+   { V4L2_PIX_FMT_VYUY, MEDIA_BUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 16, 0, 0 }, false, true, 2, 1, false },
+   { V4L2_PIX_FMT_YUYV, MEDIA_BUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 16, 0, 0 }, true, false, 2, 1, false },
+   { V4L2_PIX_FMT_YVYU, MEDIA_BUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 16, 0, 0 }, true, true, 2, 1, false },
+   { V4L2_PIX_FMT_NV12M, MEDIA_BUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_UV_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 2, { 8, 16, 0 }, false, false, 2, 2, false },
+   { V4L2_PIX_FMT_NV21M, MEDIA_BUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_UV_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | 

[PATCH 14/32] v4l: vsp1: Reuse local variable instead of recomputing it

2015-09-13 Thread Laurent Pinchart
No need to waste CPU cycles when the value we need is already available.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index ec68890af14b..c0afbf81d9aa 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -416,7 +416,7 @@ static int vsp1_video_pipeline_validate(struct 
vsp1_pipeline *pipe,
rwpf->video->pipe_index = pipe->num_inputs;
} else if (e->type == VSP1_ENTITY_WPF) {
rwpf = to_rwpf(subdev);
-   pipe->output = to_rwpf(subdev);
+   pipe->output = rwpf;
rwpf->video->pipe_index = 0;
} else if (e->type == VSP1_ENTITY_LIF) {
pipe->lif = e;
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/32] v4l: vsp1: Move entity route setup function to vsp1_entity.c

2015-09-13 Thread Laurent Pinchart
The function will be used by the DU code, move it out of vsp1_video.c.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_entity.c | 12 
 drivers/media/platform/vsp1/vsp1_entity.h |  2 ++
 drivers/media/platform/vsp1/vsp1_video.c  | 12 
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index 0c52e4b71a98..cb9d480d8ee5 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -58,6 +58,18 @@ int vsp1_entity_set_streaming(struct vsp1_entity *entity, 
bool streaming)
return ret;
 }
 
+void vsp1_entity_route_setup(struct vsp1_entity *source)
+{
+   struct vsp1_entity *sink;
+
+   if (source->route->reg == 0)
+   return;
+
+   sink = container_of(source->sink, struct vsp1_entity, subdev.entity);
+   vsp1_write(source->vsp1, source->route->reg,
+  sink->route->inputs[source->sink_pad]);
+}
+
 /* 
-
  * V4L2 Subdevice Operations
  */
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h 
b/drivers/media/platform/vsp1/vsp1_entity.h
index 9c95507ec762..9606d0d21263 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -96,4 +96,6 @@ void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
 bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
 int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
 
+void vsp1_entity_route_setup(struct vsp1_entity *source);
+
 #endif /* __VSP1_ENTITY_H__ */
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index c0afbf81d9aa..589ce49e8688 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -657,18 +657,6 @@ static void vsp1_video_buffer_queue(struct vb2_buffer *vb)
spin_unlock_irqrestore(>irqlock, flags);
 }
 
-static void vsp1_entity_route_setup(struct vsp1_entity *source)
-{
-   struct vsp1_entity *sink;
-
-   if (source->route->reg == 0)
-   return;
-
-   sink = container_of(source->sink, struct vsp1_entity, subdev.entity);
-   vsp1_write(source->vsp1, source->route->reg,
-  sink->route->inputs[source->sink_pad]);
-}
-
 static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
struct vsp1_video *video = vb2_get_drv_priv(vq);
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 26/32] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers

2015-09-13 Thread Laurent Pinchart
The RPF and WPF alpha values are set through V4L2 controls and applied
when starting the video stream by a call to v4l2_ctrl_handler_setup().
As that function uses the control handler mutex it can't be called in
interrupt context, where the VSP+DU pipeline handler might need to
reconfigure the pipeline.

Set the alpha value manually in the RPF and WPF s_stream handler to
ensure that the hardware is properly configured even when controlled
without the userspace API. If the userspace API is enabled protect that
with the control lock to avoid race conditions with userspace.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_rpf.c  | 16 ++--
 drivers/media/platform/vsp1/vsp1_rwpf.h |  2 ++
 drivers/media/platform/vsp1/vsp1_wpf.c  |  7 ---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index b9c39f9e4458..7ccec87b1139 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -68,7 +68,9 @@ static const struct v4l2_ctrl_ops rpf_ctrl_ops = {
 
 static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
 {
+   struct vsp1_pipeline *pipe = to_vsp1_pipeline(>entity);
struct vsp1_rwpf *rpf = to_rwpf(subdev);
+   struct vsp1_device *vsp1 = rpf->entity.vsp1;
const struct vsp1_format_info *fmtinfo = rpf->fmtinfo;
const struct v4l2_pix_format_mplane *format = >format;
const struct v4l2_rect *crop = >crop;
@@ -148,6 +150,15 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int 
enable)
vsp1_rpf_write(rpf, VI6_RPF_ALPH_SEL, VI6_RPF_ALPH_SEL_AEXT_EXT |
   (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED
   : VI6_RPF_ALPH_SEL_ASEL_FIXED));
+
+   if (vsp1->info->uapi)
+   mutex_lock(rpf->ctrls.lock);
+   vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
+  rpf->alpha->cur.val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
+   vsp1_pipeline_propagate_alpha(pipe, >entity, rpf->alpha->cur.val);
+   if (vsp1->info->uapi)
+   mutex_unlock(rpf->ctrls.lock);
+
vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0);
vsp1_rpf_write(rpf, VI6_RPF_CKEY_CTRL, 0);
 
@@ -245,8 +256,9 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, 
unsigned int index)
 
/* Initialize the control handler. */
v4l2_ctrl_handler_init(>ctrls, 1);
-   v4l2_ctrl_new_std(>ctrls, _ctrl_ops, V4L2_CID_ALPHA_COMPONENT,
- 0, 255, 1, 255);
+   rpf->alpha = v4l2_ctrl_new_std(>ctrls, _ctrl_ops,
+  V4L2_CID_ALPHA_COMPONENT,
+  0, 255, 1, 255);
 
rpf->entity.subdev.ctrl_handler = >ctrls;
 
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index 1a90c7c8e972..8e8235682ada 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -23,6 +23,7 @@
 #define RWPF_PAD_SINK  0
 #define RWPF_PAD_SOURCE1
 
+struct v4l2_ctrl;
 struct vsp1_rwpf;
 struct vsp1_video;
 
@@ -40,6 +41,7 @@ struct vsp1_rwpf_operations {
 struct vsp1_rwpf {
struct vsp1_entity entity;
struct v4l2_ctrl_handler ctrls;
+   struct v4l2_ctrl *alpha;
 
struct vsp1_video *video;
 
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
b/drivers/media/platform/vsp1/vsp1_wpf.c
index 5996a35143b8..6212fc714a7c 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -156,7 +156,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int 
enable)
 */
if (vsp1->info->uapi)
mutex_lock(wpf->ctrls.lock);
-   outfmt |= vsp1_wpf_read(wpf, VI6_WPF_OUTFMT) & VI6_WPF_OUTFMT_PDV_MASK;
+   outfmt |= wpf->alpha->cur.val << VI6_WPF_OUTFMT_PDV_SHIFT;
vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
if (vsp1->info->uapi)
mutex_unlock(wpf->ctrls.lock);
@@ -254,8 +254,9 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, 
unsigned int index)
 
/* Initialize the control handler. */
v4l2_ctrl_handler_init(>ctrls, 1);
-   v4l2_ctrl_new_std(>ctrls, _ctrl_ops, V4L2_CID_ALPHA_COMPONENT,
- 0, 255, 1, 255);
+   wpf->alpha = v4l2_ctrl_new_std(>ctrls, _ctrl_ops,
+  V4L2_CID_ALPHA_COMPONENT,
+  0, 255, 1, 255);
 
wpf->entity.subdev.ctrl_handler = >ctrls;
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 25/32] v4l: vsp1: Make pipeline inputs array index by RPF index

2015-09-13 Thread Laurent Pinchart
The pipeline inputs array stores pointers to all RPFs contained in the
pipeline. It's currently indexed contiguously by adding RPFs in the
order they are found during graph walk. This can't easily support
dynamic addition and removal of RPFs while streaming, which will be
required for combined VSP+DU support.

Make the array indexed by RPF index instead and skip NULL elements when
iterating over RPFs.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_pipe.c  |  6 +-
 drivers/media/platform/vsp1/vsp1_pipe.h  |  2 +-
 drivers/media/platform/vsp1/vsp1_video.c | 16 
 drivers/media/platform/vsp1/vsp1_wpf.c   |  5 -
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
b/drivers/media/platform/vsp1/vsp1_pipe.c
index df11259dcc0a..d41e4ca94a02 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -140,14 +140,18 @@ const struct vsp1_format_info *vsp1_get_format_info(u32 
fourcc)
 
 void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
 {
+   unsigned int i;
+
if (pipe->bru) {
struct vsp1_bru *bru = to_bru(>bru->subdev);
-   unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(bru->inputs); ++i)
bru->inputs[i].rpf = NULL;
}
 
+   for (i = 0; i < ARRAY_SIZE(pipe->inputs); ++i)
+   pipe->inputs[i] = NULL;
+
INIT_LIST_HEAD(>entities);
pipe->state = VSP1_PIPELINE_STOPPED;
pipe->buffers_ready = 0;
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h 
b/drivers/media/platform/vsp1/vsp1_pipe.h
index f9035c739e9a..c4c300561c5c 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.h
+++ b/drivers/media/platform/vsp1/vsp1_pipe.h
@@ -66,7 +66,7 @@ enum vsp1_pipeline_state {
  * @stream_count: number of streaming video nodes
  * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
  * @num_inputs: number of RPFs
- * @inputs: array of RPFs in the pipeline
+ * @inputs: array of RPFs in the pipeline (indexed by RPF index)
  * @output: WPF at the output of the pipeline
  * @bru: BRU entity, if present
  * @lif: LIF entity, if present
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index e0d4f84bc26d..78926c9f4125 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -305,8 +305,8 @@ static int vsp1_video_pipeline_validate(struct 
vsp1_pipeline *pipe,
 
if (e->type == VSP1_ENTITY_RPF) {
rwpf = to_rwpf(subdev);
-   pipe->inputs[pipe->num_inputs++] = rwpf;
-   rwpf->video->pipe_index = pipe->num_inputs;
+   pipe->inputs[rwpf->entity.index] = rwpf;
+   rwpf->video->pipe_index = ++pipe->num_inputs;
} else if (e->type == VSP1_ENTITY_WPF) {
rwpf = to_rwpf(subdev);
pipe->output = rwpf;
@@ -329,7 +329,10 @@ static int vsp1_video_pipeline_validate(struct 
vsp1_pipeline *pipe,
/* Follow links downstream for each input and make sure the graph
 * contains no loop and that all branches end at the output WPF.
 */
-   for (i = 0; i < pipe->num_inputs; ++i) {
+   for (i = 0; i < video->vsp1->pdata.rpf_count; ++i) {
+   if (!pipe->inputs[i])
+   continue;
+
ret = vsp1_video_pipeline_validate_branch(pipe, pipe->inputs[i],
  pipe->output);
if (ret < 0)
@@ -453,11 +456,16 @@ static void vsp1_video_frame_end(struct vsp1_pipeline 
*pipe,
 
 static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe)
 {
+   struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
unsigned int i;
 
/* Complete buffers on all video nodes. */
-   for (i = 0; i < pipe->num_inputs; ++i)
+   for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
+   if (!pipe->inputs[i])
+   continue;
+
vsp1_video_frame_end(pipe, pipe->inputs[i]);
+   }
 
if (!pipe->lif)
vsp1_video_frame_end(pipe, pipe->output);
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
b/drivers/media/platform/vsp1/vsp1_wpf.c
index 451ca37930e0..5996a35143b8 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -97,9 +97,12 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int 
enable)
 * inputs as sub-layers and select the virtual RPF as the master
 * layer.
 */
-   for (i = 0; i < pipe->num_inputs; ++i) {
+   for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
struct vsp1_rwpf *input = pipe->inputs[i];
 
+   if (!input)
+   continue;
+

[PATCH 05/32] v4l: vsp1: Move video device out of struct vsp1_rwpf

2015-09-13 Thread Laurent Pinchart
To make the video device nodes optional we need to decouple the [rw]pf
instances from the video devices. Move video devices out of struct
vsp1_rwpf and instantiate them dynamically in the core driver code.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1.h|  1 +
 drivers/media/platform/vsp1/vsp1_bru.c|  1 +
 drivers/media/platform/vsp1/vsp1_drv.c| 63 +--
 drivers/media/platform/vsp1/vsp1_entity.c |  3 --
 drivers/media/platform/vsp1/vsp1_rpf.c| 22 ---
 drivers/media/platform/vsp1/vsp1_rwpf.h   |  2 -
 drivers/media/platform/vsp1/vsp1_video.c  | 45 --
 drivers/media/platform/vsp1/vsp1_video.h  |  4 +-
 drivers/media/platform/vsp1/vsp1_wpf.c| 29 --
 9 files changed, 90 insertions(+), 80 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 989e96f7e360..b25032bd37a7 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -71,6 +71,7 @@ struct vsp1_device {
struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
 
struct list_head entities;
+   struct list_head videos;
 
struct v4l2_device v4l2_dev;
struct media_device media_dev;
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index 1308dfef0f92..b4cc9bc478af 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -19,6 +19,7 @@
 #include "vsp1.h"
 #include "vsp1_bru.h"
 #include "vsp1_rwpf.h"
+#include "vsp1_video.h"
 
 #define BRU_MIN_SIZE   1U
 #define BRU_MAX_SIZE   8190U
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 4e61886384e3..de0b80e8d048 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -28,6 +28,7 @@
 #include "vsp1_rwpf.h"
 #include "vsp1_sru.h"
 #include "vsp1_uds.h"
+#include "vsp1_video.h"
 
 /* 
-
  * Interrupt Handling
@@ -117,14 +118,19 @@ static int vsp1_create_links(struct vsp1_device *vsp1, 
struct vsp1_entity *sink)
 
 static void vsp1_destroy_entities(struct vsp1_device *vsp1)
 {
-   struct vsp1_entity *entity;
-   struct vsp1_entity *next;
+   struct vsp1_entity *entity, *_entity;
+   struct vsp1_video *video, *_video;
 
-   list_for_each_entry_safe(entity, next, >entities, list_dev) {
+   list_for_each_entry_safe(entity, _entity, >entities, list_dev) {
list_del(>list_dev);
vsp1_entity_destroy(entity);
}
 
+   list_for_each_entry_safe(video, _video, >videos, list) {
+   list_del(>list);
+   vsp1_video_cleanup(video);
+   }
+
v4l2_device_unregister(>v4l2_dev);
media_device_unregister(>media_dev);
 }
@@ -202,6 +208,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
 
for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
+   struct vsp1_video *video;
struct vsp1_rwpf *rpf;
 
rpf = vsp1_rpf_create(vsp1, i);
@@ -212,6 +219,14 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 
vsp1->rpf[i] = rpf;
list_add_tail(>entity.list_dev, >entities);
+
+   video = vsp1_video_create(vsp1, rpf);
+   if (IS_ERR(video)) {
+   ret = PTR_ERR(video);
+   goto done;
+   }
+
+   list_add_tail(>list, >videos);
}
 
if (vsp1->pdata.features & VSP1_HAS_SRU) {
@@ -238,6 +253,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
 
for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
+   struct vsp1_video *video;
struct vsp1_rwpf *wpf;
 
wpf = vsp1_wpf_create(vsp1, i);
@@ -248,6 +264,15 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 
vsp1->wpf[i] = wpf;
list_add_tail(>entity.list_dev, >entities);
+
+   video = vsp1_video_create(vsp1, wpf);
+   if (IS_ERR(video)) {
+   ret = PTR_ERR(video);
+   goto done;
+   }
+
+   list_add_tail(>list, >videos);
+   wpf->entity.sink = >video.entity;
}
 
/* Create links. */
@@ -261,6 +286,37 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
goto done;
}
 
+   for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
+   struct vsp1_rwpf *rpf = vsp1->rpf[i];
+
+   ret = media_entity_create_link(>entity.video->video.entity,
+  0, >entity.subdev.entity,
+  RWPF_PAD_SINK,
+ 

[PATCH 16/32] v4l: vsp1: Document the vsp1_pipeline structure

2015-09-13 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_pipe.h | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h 
b/drivers/media/platform/vsp1/vsp1_pipe.h
index 8553d5a03aa3..9c8ded1c29f6 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.h
+++ b/drivers/media/platform/vsp1/vsp1_pipe.h
@@ -29,9 +29,23 @@ enum vsp1_pipeline_state {
 
 /*
  * struct vsp1_pipeline - A VSP1 hardware pipeline
- * @media: the media pipeline
+ * @pipe: the media pipeline
  * @irqlock: protects the pipeline state
+ * @state: current state
+ * @wq: work queue to wait for state change completion
+ * @frame_end: frame end interrupt handler
  * @lock: protects the pipeline use count and stream count
+ * @use_count: number of video nodes using the pipeline
+ * @stream_count: number of streaming video nodes
+ * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
+ * @num_inputs: number of RPFs
+ * @inputs: array of RPFs in the pipeline
+ * @output: WPF at the output of the pipeline
+ * @bru: BRU entity, if present
+ * @lif: LIF entity, if present
+ * @uds: UDS entity, if present
+ * @uds_input: entity at the input of the UDS, if the UDS is present
+ * @entities: list of entities in the pipeline
  */
 struct vsp1_pipeline {
struct media_pipeline pipe;
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/32] v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer

2015-09-13 Thread Laurent Pinchart
The structure represent a vsp1 videobuf2 buffer, name it accordingly.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_rpf.c   |  2 +-
 drivers/media/platform/vsp1/vsp1_rwpf.h  |  4 ++--
 drivers/media/platform/vsp1/vsp1_video.c | 20 ++--
 drivers/media/platform/vsp1/vsp1_video.h |  7 +++
 drivers/media/platform/vsp1/vsp1_wpf.c   |  2 +-
 5 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index a17154d98a54..9c2e34374c60 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -186,7 +186,7 @@ static struct v4l2_subdev_ops rpf_ops = {
  * Video Device Operations
  */
 
-static void rpf_buf_queue(struct vsp1_rwpf *rpf, struct vsp1_video_buffer *buf)
+static void rpf_buf_queue(struct vsp1_rwpf *rpf, struct vsp1_vb2_buffer *buf)
 {
unsigned int i;
 
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index 3cc80be03524..aa22cc062ff3 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -25,10 +25,10 @@
 #define RWPF_PAD_SOURCE1
 
 struct vsp1_rwpf;
-struct vsp1_video_buffer;
+struct vsp1_vb2_buffer;
 
 struct vsp1_rwpf_operations {
-   void (*queue)(struct vsp1_rwpf *rwpf, struct vsp1_video_buffer *buf);
+   void (*queue)(struct vsp1_rwpf *rwpf, struct vsp1_vb2_buffer *buf);
 };
 
 struct vsp1_rwpf {
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 2ddbcbaf498f..d02cd63a9c5e 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -577,12 +577,12 @@ static bool vsp1_pipeline_ready(struct vsp1_pipeline 
*pipe)
  *
  * Return the next queued buffer or NULL if the queue is empty.
  */
-static struct vsp1_video_buffer *
+static struct vsp1_vb2_buffer *
 vsp1_video_complete_buffer(struct vsp1_video *video)
 {
struct vsp1_pipeline *pipe = to_vsp1_pipeline(>video.entity);
-   struct vsp1_video_buffer *next = NULL;
-   struct vsp1_video_buffer *done;
+   struct vsp1_vb2_buffer *next = NULL;
+   struct vsp1_vb2_buffer *done;
unsigned long flags;
unsigned int i;
 
@@ -594,7 +594,7 @@ vsp1_video_complete_buffer(struct vsp1_video *video)
}
 
done = list_first_entry(>irqqueue,
-   struct vsp1_video_buffer, queue);
+   struct vsp1_vb2_buffer, queue);
 
/* In DU output mode reuse the buffer if the list is singular. */
if (pipe->lif && list_is_singular(>irqqueue)) {
@@ -606,7 +606,7 @@ vsp1_video_complete_buffer(struct vsp1_video *video)
 
if (!list_empty(>irqqueue))
next = list_first_entry(>irqqueue,
-   struct vsp1_video_buffer, queue);
+   struct vsp1_vb2_buffer, queue);
 
spin_unlock_irqrestore(>irqlock, flags);
 
@@ -622,7 +622,7 @@ vsp1_video_complete_buffer(struct vsp1_video *video)
 static void vsp1_video_frame_end(struct vsp1_pipeline *pipe,
 struct vsp1_video *video)
 {
-   struct vsp1_video_buffer *buf;
+   struct vsp1_vb2_buffer *buf;
unsigned long flags;
 
buf = vsp1_video_complete_buffer(video);
@@ -821,7 +821,7 @@ vsp1_video_queue_setup(struct vb2_queue *vq, const struct 
v4l2_format *fmt,
 static int vsp1_video_buffer_prepare(struct vb2_buffer *vb)
 {
struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue);
-   struct vsp1_video_buffer *buf = to_vsp1_video_buffer(vb);
+   struct vsp1_vb2_buffer *buf = to_vsp1_vb2_buffer(vb);
const struct v4l2_pix_format_mplane *format = >rwpf->format;
unsigned int i;
 
@@ -843,7 +843,7 @@ static void vsp1_video_buffer_queue(struct vb2_buffer *vb)
 {
struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue);
struct vsp1_pipeline *pipe = to_vsp1_pipeline(>video.entity);
-   struct vsp1_video_buffer *buf = to_vsp1_video_buffer(vb);
+   struct vsp1_vb2_buffer *buf = to_vsp1_vb2_buffer(vb);
unsigned long flags;
bool empty;
 
@@ -935,7 +935,7 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq)
 {
struct vsp1_video *video = vb2_get_drv_priv(vq);
struct vsp1_pipeline *pipe = to_vsp1_pipeline(>video.entity);
-   struct vsp1_video_buffer *buffer;
+   struct vsp1_vb2_buffer *buffer;
unsigned long flags;
int ret;
 
@@ -1260,7 +1260,7 @@ int vsp1_video_init(struct vsp1_video *video, struct 
vsp1_rwpf *rwpf)
video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
video->queue.lock = >lock;
video->queue.drv_priv = video;
-   video->queue.buf_struct_size = sizeof(struct vsp1_video_buffer);
+

[PATCH 02/32] v4l: vsp1: Store the memory format in struct vsp1_rwpf

2015-09-13 Thread Laurent Pinchart
Move the format from struct vsp1_video to struct vsp1_rwpf to prepare
for VSPD KMS support that will not instantiate V4L2 video device nodes.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_bru.c   |  4 ++--
 drivers/media/platform/vsp1/vsp1_rpf.c   |  4 ++--
 drivers/media/platform/vsp1/vsp1_rwpf.h  |  2 ++
 drivers/media/platform/vsp1/vsp1_video.c | 40 
 drivers/media/platform/vsp1/vsp1_video.h |  2 --
 drivers/media/platform/vsp1/vsp1_wpf.c   |  4 ++--
 6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index 7dd763311c0f..1308dfef0f92 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -94,7 +94,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int 
enable)
/* Disable dithering and enable color data normalization unless the
 * format at the pipeline output is premultiplied.
 */
-   flags = pipe->output ? pipe->output->video.format.flags : 0;
+   flags = pipe->output ? pipe->output->format.flags : 0;
vsp1_bru_write(bru, VI6_BRU_INCTRL,
   flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
   0 : VI6_BRU_INCTRL_NRM);
@@ -125,7 +125,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int 
enable)
if (bru->inputs[i].rpf) {
ctrl |= VI6_BRU_CTRL_RBC;
 
-   premultiplied = bru->inputs[i].rpf->video.format.flags
+   premultiplied = bru->inputs[i].rpf->format.flags
  & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
} else {
ctrl |= VI6_BRU_CTRL_CROP(VI6_ROP_NOP)
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index a1093cc1b9a1..6e0564b5b37b 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -75,8 +75,8 @@ static const struct v4l2_ctrl_ops rpf_ctrl_ops = {
 static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
 {
struct vsp1_rwpf *rpf = to_rwpf(subdev);
-   const struct vsp1_format_info *fmtinfo = rpf->video.fmtinfo;
-   const struct v4l2_pix_format_mplane *format = >video.format;
+   const struct vsp1_format_info *fmtinfo = rpf->fmtinfo;
+   const struct v4l2_pix_format_mplane *format = >format;
const struct v4l2_rect *crop = >crop;
u32 pstride;
u32 infmt;
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index f452dce1a931..8609c3d02679 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -32,6 +32,8 @@ struct vsp1_rwpf {
unsigned int max_width;
unsigned int max_height;
 
+   struct v4l2_pix_format_mplane format;
+   const struct vsp1_format_info *fmtinfo;
struct {
unsigned int left;
unsigned int top;
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 48480e66fad6..90d5791c80b6 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -185,9 +185,9 @@ static int vsp1_video_verify_format(struct vsp1_video 
*video)
if (ret < 0)
return ret == -ENOIOCTLCMD ? -EINVAL : ret;
 
-   if (video->fmtinfo->mbus != fmt.format.code ||
-   video->format.height != fmt.format.height ||
-   video->format.width != fmt.format.width)
+   if (video->rwpf->fmtinfo->mbus != fmt.format.code ||
+   video->rwpf->format.height != fmt.format.height ||
+   video->rwpf->format.width != fmt.format.width)
return -EINVAL;
 
return 0;
@@ -805,7 +805,7 @@ vsp1_video_queue_setup(struct vb2_queue *vq, const struct 
v4l2_format *fmt,
 
format = _mp;
} else {
-   format = >format;
+   format = >rwpf->format;
}
 
*nplanes = format->num_planes;
@@ -822,7 +822,7 @@ static int vsp1_video_buffer_prepare(struct vb2_buffer *vb)
 {
struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue);
struct vsp1_video_buffer *buf = to_vsp1_video_buffer(vb);
-   const struct v4l2_pix_format_mplane *format = >format;
+   const struct v4l2_pix_format_mplane *format = >rwpf->format;
unsigned int i;
 
if (vb->num_planes < format->num_planes)
@@ -904,7 +904,7 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, 
unsigned int count)
struct vsp1_rwpf *rpf =
to_rwpf(>uds_input->subdev);
 
-   uds->scale_alpha = rpf->video.fmtinfo->alpha;
+   uds->scale_alpha = rpf->fmtinfo->alpha;
   

[PATCH 24/32] v4l: vsp1: Make the userspace API optional

2015-09-13 Thread Laurent Pinchart
The R-Car Gen3 SoCs include VSP instances dedicated to the DU that will
be controlled entirely by the rcar-du-drm driver through the KMS API. To
support that use case make the userspace V4L2 API optional.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1.h|  1 +
 drivers/media/platform/vsp1/vsp1_drv.c| 57 ++-
 drivers/media/platform/vsp1/vsp1_entity.c |  2 +-
 drivers/media/platform/vsp1/vsp1_sru.c|  6 ++--
 drivers/media/platform/vsp1/vsp1_wpf.c|  6 ++--
 5 files changed, 43 insertions(+), 29 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 173f9f830049..791d24c2c8d1 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -53,6 +53,7 @@ struct vsp1_platform_data {
 
 struct vsp1_device_info {
unsigned int num_bru_inputs;
+   bool uapi;
 };
 
 struct vsp1_device {
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index eccdacdf4f4c..5a18f69c90c2 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -134,6 +134,17 @@ static int vsp1_create_links(struct vsp1_device *vsp1)
return ret;
}
 
+   if (vsp1->pdata.features & VSP1_HAS_LIF) {
+   ret = media_entity_create_link(
+   >wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE,
+   >lif->entity.subdev.entity, LIF_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+   }
+
+   if (!vsp1->info->uapi)
+   return 0;
+
for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
struct vsp1_rwpf *rpf = vsp1->rpf[i];
 
@@ -165,14 +176,6 @@ static int vsp1_create_links(struct vsp1_device *vsp1)
return ret;
}
 
-   if (vsp1->pdata.features & VSP1_HAS_LIF) {
-   ret = media_entity_create_link(
-   >wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE,
-   >lif->entity.subdev.entity, LIF_PAD_SINK, 0);
-   if (ret < 0)
-   return ret;
-   }
-
return 0;
 }
 
@@ -270,7 +273,6 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
 
for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
-   struct vsp1_video *video;
struct vsp1_rwpf *rpf;
 
rpf = vsp1_rpf_create(vsp1, i);
@@ -282,13 +284,16 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
vsp1->rpf[i] = rpf;
list_add_tail(>entity.list_dev, >entities);
 
-   video = vsp1_video_create(vsp1, rpf);
-   if (IS_ERR(video)) {
-   ret = PTR_ERR(video);
-   goto done;
-   }
+   if (vsp1->info->uapi) {
+   struct vsp1_video *video = vsp1_video_create(vsp1, rpf);
 
-   list_add_tail(>list, >videos);
+   if (IS_ERR(video)) {
+   ret = PTR_ERR(video);
+   goto done;
+   }
+
+   list_add_tail(>list, >videos);
+   }
}
 
if (vsp1->pdata.features & VSP1_HAS_SRU) {
@@ -315,7 +320,6 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
 
for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
-   struct vsp1_video *video;
struct vsp1_rwpf *wpf;
 
wpf = vsp1_wpf_create(vsp1, i);
@@ -327,14 +331,17 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
vsp1->wpf[i] = wpf;
list_add_tail(>entity.list_dev, >entities);
 
-   video = vsp1_video_create(vsp1, wpf);
-   if (IS_ERR(video)) {
-   ret = PTR_ERR(video);
-   goto done;
-   }
+   if (vsp1->info->uapi) {
+   struct vsp1_video *video = vsp1_video_create(vsp1, wpf);
+
+   if (IS_ERR(video)) {
+   ret = PTR_ERR(video);
+   goto done;
+   }
 
-   list_add_tail(>list, >videos);
-   wpf->entity.sink = >video.entity;
+   list_add_tail(>list, >videos);
+   wpf->entity.sink = >video.entity;
+   }
}
 
/* Create links. */
@@ -350,7 +357,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
goto done;
}
 
-   ret = v4l2_device_register_subdev_nodes(>v4l2_dev);
+   if (vsp1->info->uapi)
+   ret = v4l2_device_register_subdev_nodes(>v4l2_dev);
 
 done:
if (ret < 0)
@@ -624,6 +632,7 @@ static int vsp1_remove(struct platform_device 

[PATCH 30/32] v4l: vsp1: Implement atomic update for the DRM driver

2015-09-13 Thread Laurent Pinchart
Add two API functions named vsp1_du_atomic_begin() and
vsp1_du_atomic_flush() to signal the start and end of an atomic update.
The vsp1_du_setup_rpf() function is renamed to vsp1_du_atomic_update()
for consistency.

With this new API, the driver will reprogram all modified inputs
atomically before restarting the video stream.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c | 70 +-
 drivers/media/platform/vsp1/vsp1_drm.h |  7 
 include/media/vsp1.h   |  9 +++--
 3 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 5cef619b708d..ef8e91d65209 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -254,7 +254,26 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int 
width,
 EXPORT_SYMBOL_GPL(vsp1_du_setup_lif);
 
 /**
- * vsp1_du_setup_rpf - Setup one RPF input of the VSP pipeline
+ * vsp1_du_atomic_begin - Prepare for an atomic update
+ * @dev: the VSP device
+ */
+void vsp1_du_atomic_begin(struct device *dev)
+{
+   struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+   struct vsp1_pipeline *pipe = >drm->pipe;
+   unsigned long flags;
+
+   spin_lock_irqsave(>irqlock, flags);
+
+   vsp1->drm->num_inputs = pipe->num_inputs;
+   vsp1->drm->update = false;
+
+   spin_unlock_irqrestore(>irqlock, flags);
+}
+EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin);
+
+/**
+ * vsp1_du_atomic_update - Setup one RPF input of the VSP pipeline
  * @dev: the VSP device
  * @rpf_index: index of the RPF to setup (0-based)
  * @pixelformat: V4L2 pixel format for the RPF memory input
@@ -288,10 +307,10 @@ EXPORT_SYMBOL_GPL(vsp1_du_setup_lif);
  *
  * Return 0 on success or a negative error code on failure.
  */
-int vsp1_du_setup_rpf(struct device *dev, unsigned int rpf_index,
- u32 pixelformat, unsigned int pitch,
- dma_addr_t mem[2], const struct v4l2_rect *src,
- const struct v4l2_rect *dst)
+int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
+ u32 pixelformat, unsigned int pitch,
+ dma_addr_t mem[2], const struct v4l2_rect *src,
+ const struct v4l2_rect *dst)
 {
struct vsp1_device *vsp1 = dev_get_drvdata(dev);
struct vsp1_pipeline *pipe = >drm->pipe;
@@ -301,7 +320,6 @@ int vsp1_du_setup_rpf(struct device *dev, unsigned int 
rpf_index,
struct vsp1_rwpf_memory memory;
struct vsp1_rwpf *rpf;
unsigned long flags;
-   bool start_stop = false;
int ret;
 
if (rpf_index >= vsp1->pdata.rpf_count)
@@ -322,16 +340,11 @@ int vsp1_du_setup_rpf(struct device *dev, unsigned int 
rpf_index,
vsp1->bru->inputs[rpf_index].rpf = NULL;
pipe->inputs[rpf_index] = NULL;
 
-   vsp1->drm->update = true;
-   start_stop = --pipe->num_inputs == 0;
+   pipe->num_inputs--;
}
 
spin_unlock_irqrestore(>irqlock, flags);
 
-   /* Stop the pipeline if we're the last user. */
-   if (start_stop)
-   vsp1_pipeline_stop(pipe);
-
return 0;
}
 
@@ -459,19 +472,42 @@ int vsp1_du_setup_rpf(struct device *dev, unsigned int 
rpf_index,
if (!pipe->inputs[rpf->entity.index]) {
vsp1->bru->inputs[rpf_index].rpf = rpf;
pipe->inputs[rpf->entity.index] = rpf;
-   start_stop = pipe->num_inputs++ == 0;
+   pipe->num_inputs++;
}
 
-   /* Start the pipeline if it's currently stopped. */
+   spin_unlock_irqrestore(>irqlock, flags);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(vsp1_du_atomic_update);
+
+/**
+ * vsp1_du_atomic_flush - Commit an atomic update
+ * @dev: the VSP device
+ */
+void vsp1_du_atomic_flush(struct device *dev)
+{
+   struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+   struct vsp1_pipeline *pipe = >drm->pipe;
+   unsigned long flags;
+   bool stop = false;
+
+   spin_lock_irqsave(>irqlock, flags);
+
vsp1->drm->update = true;
-   if (start_stop)
+
+   /* Start or stop the pipeline if needed. */
+   if (!vsp1->drm->num_inputs && pipe->num_inputs)
vsp1_drm_pipeline_run(pipe);
+   else if (vsp1->drm->num_inputs && !pipe->num_inputs)
+   stop = true;
 
spin_unlock_irqrestore(>irqlock, flags);
 
-   return 0;
+   if (stop)
+   vsp1_pipeline_stop(pipe);
 }
-EXPORT_SYMBOL_GPL(vsp1_du_setup_rpf);
+EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush);
 
 /* 
-
  * Initialization
diff --git a/drivers/media/platform/vsp1/vsp1_drm.h 

[PATCH 29/32] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline

2015-09-13 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 2969d570f462..5cef619b708d 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -38,13 +38,17 @@ static int vsp1_drm_pipeline_run(struct vsp1_pipeline *pipe)
struct vsp1_entity *entity;
 
list_for_each_entry(entity, >entities, list_pipe) {
-   /* Skip unused RPFs. */
+   /* Disconnect unused RPFs from the pipeline. */
if (entity->type == VSP1_ENTITY_RPF) {
struct vsp1_rwpf *rpf =
to_rwpf(>subdev);
 
-   if (!pipe->inputs[rpf->entity.index])
+   if (!pipe->inputs[rpf->entity.index]) {
+   vsp1_write(entity->vsp1,
+  entity->route->reg,
+  VI6_DPR_NODE_UNUSED);
continue;
+   }
}
 
vsp1_entity_route_setup(entity);
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 28/32] v4l: vsp1: Add VSP+DU support

2015-09-13 Thread Laurent Pinchart
Implement internal control of the VSP pipeline to be used by the DU
DRM/KMS driver when using the VSP as an internal composer handled
through DRM/KMS only.

Signed-off-by: Laurent Pinchart 

---
 drivers/media/platform/vsp1/Makefile   |   2 +-
 drivers/media/platform/vsp1/vsp1.h |   3 +-
 drivers/media/platform/vsp1/vsp1_drm.c | 550 +
 drivers/media/platform/vsp1/vsp1_drm.h |  26 ++
 drivers/media/platform/vsp1/vsp1_drv.c |  13 +-
 include/media/vsp1.h   |  30 ++
 6 files changed, 617 insertions(+), 7 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_drm.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_drm.h
 create mode 100644 include/media/vsp1.h

diff --git a/drivers/media/platform/vsp1/Makefile 
b/drivers/media/platform/vsp1/Makefile
index 0ef0b5384125..447e72a2ef43 100644
--- a/drivers/media/platform/vsp1/Makefile
+++ b/drivers/media/platform/vsp1/Makefile
@@ -1,5 +1,5 @@
 vsp1-y := vsp1_drv.o vsp1_entity.o vsp1_pipe.o
-vsp1-y += vsp1_video.o
+vsp1-y += vsp1_drm.o vsp1_video.o
 vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o
 vsp1-y += vsp1_hsit.o vsp1_lif.o vsp1_lut.o
 vsp1-y += vsp1_bru.o vsp1_sru.o vsp1_uds.o
diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 6102ade125bb..61a24e4a0848 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -26,6 +26,7 @@
 struct clk;
 struct device;
 
+struct vsp1_drm;
 struct vsp1_platform_data;
 struct vsp1_bru;
 struct vsp1_hsit;
@@ -82,8 +83,8 @@ struct vsp1_device {
 
struct v4l2_device v4l2_dev;
struct media_device media_dev;
-
struct media_entity_operations media_ops;
+   struct vsp1_drm *drm;
 };
 
 int vsp1_device_get(struct vsp1_device *vsp1);
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
new file mode 100644
index ..2969d570f462
--- /dev/null
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -0,0 +1,550 @@
+/*
+ * vsp1_drm.c  --  R-Car VSP1 DRM API
+ *
+ * Copyright (C) 2015 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "vsp1.h"
+#include "vsp1_bru.h"
+#include "vsp1_drm.h"
+#include "vsp1_lif.h"
+#include "vsp1_pipe.h"
+#include "vsp1_rwpf.h"
+
+/* 
-
+ * Runtime Handling
+ */
+
+static int vsp1_drm_pipeline_run(struct vsp1_pipeline *pipe)
+{
+   struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
+   int ret;
+
+   if (vsp1->drm->update) {
+   struct vsp1_entity *entity;
+
+   list_for_each_entry(entity, >entities, list_pipe) {
+   /* Skip unused RPFs. */
+   if (entity->type == VSP1_ENTITY_RPF) {
+   struct vsp1_rwpf *rpf =
+   to_rwpf(>subdev);
+
+   if (!pipe->inputs[rpf->entity.index])
+   continue;
+   }
+
+   vsp1_entity_route_setup(entity);
+
+   ret = v4l2_subdev_call(>subdev, video,
+  s_stream, 1);
+   if (ret < 0) {
+   dev_err(vsp1->dev,
+   "DRM pipeline start failure on entity 
%s\n",
+   entity->subdev.name);
+   return ret;
+   }
+   }
+
+   vsp1->drm->update = false;
+   }
+
+   vsp1_pipeline_run(pipe);
+
+   return 0;
+}
+
+static void vsp1_drm_pipeline_frame_end(struct vsp1_pipeline *pipe)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(>irqlock, flags);
+   if (pipe->num_inputs)
+   vsp1_drm_pipeline_run(pipe);
+   spin_unlock_irqrestore(>irqlock, flags);
+}
+
+/* 
-
+ * DU Driver API
+ */
+
+int vsp1_du_init(struct device *dev)
+{
+   struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+
+   if (!vsp1)
+   return -EPROBE_DEFER;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(vsp1_du_init);
+
+/**
+ * vsp1_du_setup_lif - Setup the output part of the VSP pipeline
+ * @dev: the VSP device
+ * 

[PATCH 19/32] v4l: vsp1: Remove unused module write functions

2015-09-13 Thread Laurent Pinchart
Several module write functions are not used, remove them.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_bru.c | 5 -
 drivers/media/platform/vsp1/vsp1_lif.c | 5 -
 drivers/media/platform/vsp1/vsp1_lut.c | 5 -
 drivers/media/platform/vsp1/vsp1_rpf.c | 6 --
 drivers/media/platform/vsp1/vsp1_uds.c | 6 --
 5 files changed, 27 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index b4cc9bc478af..841bc6664bca 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -28,11 +28,6 @@
  * Device Access
  */
 
-static inline u32 vsp1_bru_read(struct vsp1_bru *bru, u32 reg)
-{
-   return vsp1_read(bru->entity.vsp1, reg);
-}
-
 static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
 {
vsp1_write(bru->entity.vsp1, reg, data);
diff --git a/drivers/media/platform/vsp1/vsp1_lif.c 
b/drivers/media/platform/vsp1/vsp1_lif.c
index 39fa5ef20fbb..b868bce08982 100644
--- a/drivers/media/platform/vsp1/vsp1_lif.c
+++ b/drivers/media/platform/vsp1/vsp1_lif.c
@@ -26,11 +26,6 @@
  * Device Access
  */
 
-static inline u32 vsp1_lif_read(struct vsp1_lif *lif, u32 reg)
-{
-   return vsp1_read(lif->entity.vsp1, reg);
-}
-
 static inline void vsp1_lif_write(struct vsp1_lif *lif, u32 reg, u32 data)
 {
vsp1_write(lif->entity.vsp1, reg, data);
diff --git a/drivers/media/platform/vsp1/vsp1_lut.c 
b/drivers/media/platform/vsp1/vsp1_lut.c
index 656ec272a414..9e33caa9c616 100644
--- a/drivers/media/platform/vsp1/vsp1_lut.c
+++ b/drivers/media/platform/vsp1/vsp1_lut.c
@@ -27,11 +27,6 @@
  * Device Access
  */
 
-static inline u32 vsp1_lut_read(struct vsp1_lut *lut, u32 reg)
-{
-   return vsp1_read(lut->entity.vsp1, reg);
-}
-
 static inline void vsp1_lut_write(struct vsp1_lut *lut, u32 reg, u32 data)
 {
vsp1_write(lut->entity.vsp1, reg, data);
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index c0b7f76cd0b5..b9c39f9e4458 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -26,12 +26,6 @@
  * Device Access
  */
 
-static inline u32 vsp1_rpf_read(struct vsp1_rwpf *rpf, u32 reg)
-{
-   return vsp1_read(rpf->entity.vsp1,
-reg + rpf->entity.index * VI6_RPF_OFFSET);
-}
-
 static inline void vsp1_rpf_write(struct vsp1_rwpf *rpf, u32 reg, u32 data)
 {
vsp1_write(rpf->entity.vsp1,
diff --git a/drivers/media/platform/vsp1/vsp1_uds.c 
b/drivers/media/platform/vsp1/vsp1_uds.c
index ccc8243e3493..27ad07466ebd 100644
--- a/drivers/media/platform/vsp1/vsp1_uds.c
+++ b/drivers/media/platform/vsp1/vsp1_uds.c
@@ -29,12 +29,6 @@
  * Device Access
  */
 
-static inline u32 vsp1_uds_read(struct vsp1_uds *uds, u32 reg)
-{
-   return vsp1_read(uds->entity.vsp1,
-reg + uds->entity.index * VI6_UDS_OFFSET);
-}
-
 static inline void vsp1_uds_write(struct vsp1_uds *uds, u32 reg, u32 data)
 {
vsp1_write(uds->entity.vsp1,
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/32] v4l: vsp1: Extract link creation to separate function

2015-09-13 Thread Laurent Pinchart
Link creation will be handled differently for the DU pipeline.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drv.c | 114 ++---
 1 file changed, 64 insertions(+), 50 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 91ecf75119ba..d1e42260a871 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -67,7 +67,7 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data)
  */
 
 /*
- * vsp1_create_links - Create links from all sources to the given sink
+ * vsp1_create_sink_links - Create links from all sources to the given sink
  *
  * This function creates media links from all valid sources to the given sink
  * pad. Links that would be invalid according to the VSP1 hardware capabilities
@@ -76,7 +76,8 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data)
  * - from a UDS to a UDS (UDS entities can't be chained)
  * - from an entity to itself (no loops are allowed)
  */
-static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity 
*sink)
+static int vsp1_create_sink_links(struct vsp1_device *vsp1,
+ struct vsp1_entity *sink)
 {
struct media_entity *entity = >subdev.entity;
struct vsp1_entity *source;
@@ -116,6 +117,64 @@ static int vsp1_create_links(struct vsp1_device *vsp1, 
struct vsp1_entity *sink)
return 0;
 }
 
+static int vsp1_create_links(struct vsp1_device *vsp1)
+{
+   struct vsp1_entity *entity;
+   unsigned int i;
+   int ret;
+
+   list_for_each_entry(entity, >entities, list_dev) {
+   if (entity->type == VSP1_ENTITY_LIF ||
+   entity->type == VSP1_ENTITY_RPF)
+   continue;
+
+   ret = vsp1_create_sink_links(vsp1, entity);
+   if (ret < 0)
+   return ret;
+   }
+
+   for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
+   struct vsp1_rwpf *rpf = vsp1->rpf[i];
+
+   ret = media_entity_create_link(>video->video.entity, 0,
+  >entity.subdev.entity,
+  RWPF_PAD_SINK,
+  MEDIA_LNK_FL_ENABLED |
+  MEDIA_LNK_FL_IMMUTABLE);
+   if (ret < 0)
+   return ret;
+   }
+
+   for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
+   /* Connect the video device to the WPF. All connections are
+* immutable except for the WPF0 source link if a LIF is
+* present.
+*/
+   struct vsp1_rwpf *wpf = vsp1->wpf[i];
+   unsigned int flags = MEDIA_LNK_FL_ENABLED;
+
+   if (!(vsp1->pdata.features & VSP1_HAS_LIF) || i != 0)
+   flags |= MEDIA_LNK_FL_IMMUTABLE;
+
+   ret = media_entity_create_link(>entity.subdev.entity,
+  RWPF_PAD_SOURCE,
+  >video->video.entity,
+  0, flags);
+   if (ret < 0)
+   return ret;
+   }
+
+   if (vsp1->pdata.features & VSP1_HAS_LIF) {
+   ret = media_entity_create_link(
+   >wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE,
+   >lif->entity.subdev.entity, LIF_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+   }
+
+   return 0;
+}
+
 static void vsp1_destroy_entities(struct vsp1_device *vsp1)
 {
struct vsp1_entity *entity, *_entity;
@@ -276,54 +335,9 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
 
/* Create links. */
-   list_for_each_entry(entity, >entities, list_dev) {
-   if (entity->type == VSP1_ENTITY_LIF ||
-   entity->type == VSP1_ENTITY_RPF)
-   continue;
-
-   ret = vsp1_create_links(vsp1, entity);
-   if (ret < 0)
-   goto done;
-   }
-
-   for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
-   struct vsp1_rwpf *rpf = vsp1->rpf[i];
-
-   ret = media_entity_create_link(>video->video.entity, 0,
-  >entity.subdev.entity,
-  RWPF_PAD_SINK,
-  MEDIA_LNK_FL_ENABLED |
-  MEDIA_LNK_FL_IMMUTABLE);
-   if (ret < 0)
-   goto done;
-   }
-
-   for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
-   /* Connect the video device to the WPF. All connections are
-* immutable except for the WPF0 source link if a LIF is
- 

[PATCH 11/32] v4l: vsp1: Split pipeline management code from vsp1_video.c

2015-09-13 Thread Laurent Pinchart
The code will be used to control the vsp1 driver from the DU driver
without using video nodes.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/Makefile |   3 +-
 drivers/media/platform/vsp1/vsp1_pipe.c  | 247 +++
 drivers/media/platform/vsp1/vsp1_pipe.h  |  85 +++
 drivers/media/platform/vsp1/vsp1_video.c | 223 +---
 drivers/media/platform/vsp1/vsp1_video.h |  59 +---
 5 files changed, 338 insertions(+), 279 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_pipe.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_pipe.h

diff --git a/drivers/media/platform/vsp1/Makefile 
b/drivers/media/platform/vsp1/Makefile
index 6a93f928dfde..0ef0b5384125 100644
--- a/drivers/media/platform/vsp1/Makefile
+++ b/drivers/media/platform/vsp1/Makefile
@@ -1,4 +1,5 @@
-vsp1-y := vsp1_drv.o vsp1_entity.o vsp1_video.o
+vsp1-y := vsp1_drv.o vsp1_entity.o vsp1_pipe.o
+vsp1-y += vsp1_video.o
 vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o
 vsp1-y += vsp1_hsit.o vsp1_lif.o vsp1_lut.o
 vsp1-y += vsp1_bru.o vsp1_sru.o vsp1_uds.o
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
b/drivers/media/platform/vsp1/vsp1_pipe.c
new file mode 100644
index ..199d57f1fe06
--- /dev/null
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -0,0 +1,247 @@
+/*
+ * vsp1_pipe.c  --  R-Car VSP1 Pipeline
+ *
+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "vsp1.h"
+#include "vsp1_bru.h"
+#include "vsp1_entity.h"
+#include "vsp1_pipe.h"
+#include "vsp1_rwpf.h"
+#include "vsp1_uds.h"
+
+/* 
-
+ * Pipeline Management
+ */
+
+void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
+{
+   if (pipe->bru) {
+   struct vsp1_bru *bru = to_bru(>bru->subdev);
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(bru->inputs); ++i)
+   bru->inputs[i].rpf = NULL;
+   }
+
+   INIT_LIST_HEAD(>entities);
+   pipe->state = VSP1_PIPELINE_STOPPED;
+   pipe->buffers_ready = 0;
+   pipe->num_inputs = 0;
+   pipe->output = NULL;
+   pipe->bru = NULL;
+   pipe->lif = NULL;
+   pipe->uds = NULL;
+}
+
+void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
+{
+   struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
+
+   vsp1_write(vsp1, VI6_CMD(pipe->output->entity.index), VI6_CMD_STRCMD);
+   pipe->state = VSP1_PIPELINE_RUNNING;
+   pipe->buffers_ready = 0;
+}
+
+bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
+{
+   unsigned long flags;
+   bool stopped;
+
+   spin_lock_irqsave(>irqlock, flags);
+   stopped = pipe->state == VSP1_PIPELINE_STOPPED,
+   spin_unlock_irqrestore(>irqlock, flags);
+
+   return stopped;
+}
+
+int vsp1_pipeline_stop(struct vsp1_pipeline *pipe)
+{
+   struct vsp1_entity *entity;
+   unsigned long flags;
+   int ret;
+
+   spin_lock_irqsave(>irqlock, flags);
+   if (pipe->state == VSP1_PIPELINE_RUNNING)
+   pipe->state = VSP1_PIPELINE_STOPPING;
+   spin_unlock_irqrestore(>irqlock, flags);
+
+   ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
+msecs_to_jiffies(500));
+   ret = ret == 0 ? -ETIMEDOUT : 0;
+
+   list_for_each_entry(entity, >entities, list_pipe) {
+   if (entity->route && entity->route->reg)
+   vsp1_write(entity->vsp1, entity->route->reg,
+  VI6_DPR_NODE_UNUSED);
+
+   v4l2_subdev_call(>subdev, video, s_stream, 0);
+   }
+
+   return ret;
+}
+
+bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe)
+{
+   unsigned int mask;
+
+   mask = ((1 << pipe->num_inputs) - 1) << 1;
+   if (!pipe->lif)
+   mask |= 1 << 0;
+
+   return pipe->buffers_ready == mask;
+}
+
+void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
+{
+   enum vsp1_pipeline_state state;
+   unsigned long flags;
+
+   if (pipe == NULL)
+   return;
+
+   /* Signal frame end to the pipeline handler. */
+   pipe->frame_end(pipe);
+
+   spin_lock_irqsave(>irqlock, flags);
+
+   state = pipe->state;
+   pipe->state = VSP1_PIPELINE_STOPPED;
+
+   /* If a stop has been requested, 

[PATCH 17/32] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register name

2015-09-13 Thread Laurent Pinchart
Rename the VI6_DISP_IRQ_STA_DSE register to VI6_DISP_IRQ_STA_DST to fix
a typo and match the datasheet.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_regs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/vsp1/vsp1_regs.h 
b/drivers/media/platform/vsp1/vsp1_regs.h
index 25b48738b147..8173ceaab9f9 100644
--- a/drivers/media/platform/vsp1/vsp1_regs.h
+++ b/drivers/media/platform/vsp1/vsp1_regs.h
@@ -46,7 +46,7 @@
 #define VI6_DISP_IRQ_ENB_LNEE(n)   (1 << (n))
 
 #define VI6_DISP_IRQ_STA   0x007c
-#define VI6_DISP_IRQ_STA_DSE   (1 << 8)
+#define VI6_DISP_IRQ_STA_DST   (1 << 8)
 #define VI6_DISP_IRQ_STA_MAE   (1 << 5)
 #define VI6_DISP_IRQ_STA_LNE(n)(1 << (n))
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/32] v4l: vsp1: Make number of BRU inputs configurable

2015-09-13 Thread Laurent Pinchart
The R-Car Gen3 family has 5-inputs BRUs, support them by making the
number of BRU inputs configurable.

As the driver assumes that the number of BRU inputs is equal to the
number of RPFs, replace the BRU_MAX_INPUTS macro with VSP1_MAX_RPF to
make the assumption apparent.

Signed-off-by: Laurent Pinchart 

---
 drivers/media/platform/vsp1/vsp1.h|  5 +
 drivers/media/platform/vsp1/vsp1_bru.c| 19 ++-
 drivers/media/platform/vsp1/vsp1_bru.h|  3 +--
 drivers/media/platform/vsp1/vsp1_drv.c|  9 -
 drivers/media/platform/vsp1/vsp1_entity.h |  4 +++-
 5 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index b25032bd37a7..3b2b2387e085 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -50,9 +50,14 @@ struct vsp1_platform_data {
unsigned int wpf_count;
 };
 
+struct vsp1_device_info {
+   unsigned int num_bru_inputs;
+};
+
 struct vsp1_device {
struct device *dev;
struct vsp1_platform_data pdata;
+   const struct vsp1_device_info *info;
 
void __iomem *mmio;
struct clk *clock;
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index 841bc6664bca..2d31284dfc3f 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -79,7 +79,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int 
enable)
if (!enable)
return 0;
 
-   format = >entity.formats[BRU_PAD_SOURCE];
+   format = >entity.formats[bru->entity.source_pad];
 
/* The hardware is extremely flexible but we have no userspace API to
 * expose all the parameters, nor is it clear whether we would have use
@@ -109,7 +109,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int 
enable)
   VI6_BRU_ROP_CROP(VI6_ROP_NOP) |
   VI6_BRU_ROP_AROP(VI6_ROP_NOP));
 
-   for (i = 0; i < 4; ++i) {
+   for (i = 0; i < bru->entity.source_pad; ++i) {
bool premultiplied = false;
u32 ctrl = 0;
 
@@ -291,7 +291,7 @@ static int bru_set_format(struct v4l2_subdev *subdev, 
struct v4l2_subdev_pad_con
*format = fmt->format;
 
/* Reset the compose rectangle */
-   if (fmt->pad != BRU_PAD_SOURCE) {
+   if (fmt->pad != bru->entity.source_pad) {
struct v4l2_rect *compose;
 
compose = bru_get_compose(bru, cfg, fmt->pad, fmt->which);
@@ -305,7 +305,7 @@ static int bru_set_format(struct v4l2_subdev *subdev, 
struct v4l2_subdev_pad_con
if (fmt->pad == BRU_PAD_SINK(0)) {
unsigned int i;
 
-   for (i = 0; i <= BRU_PAD_SOURCE; ++i) {
+   for (i = 0; i <= bru->entity.source_pad; ++i) {
format = vsp1_entity_get_pad_format(>entity, cfg,
i, fmt->which);
format->code = fmt->format.code;
@@ -321,7 +321,7 @@ static int bru_get_selection(struct v4l2_subdev *subdev,
 {
struct vsp1_bru *bru = to_bru(subdev);
 
-   if (sel->pad == BRU_PAD_SOURCE)
+   if (sel->pad == bru->entity.source_pad)
return -EINVAL;
 
switch (sel->target) {
@@ -349,7 +349,7 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
struct v4l2_mbus_framefmt *format;
struct v4l2_rect *compose;
 
-   if (sel->pad == BRU_PAD_SOURCE)
+   if (sel->pad == bru->entity.source_pad)
return -EINVAL;
 
if (sel->target != V4L2_SEL_TGT_COMPOSE)
@@ -358,8 +358,8 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
/* The compose rectangle top left corner must be inside the output
 * frame.
 */
-   format = vsp1_entity_get_pad_format(>entity, cfg, BRU_PAD_SOURCE,
-   sel->which);
+   format = vsp1_entity_get_pad_format(>entity, cfg,
+   bru->entity.source_pad, sel->which);
sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1);
sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1);
 
@@ -415,7 +415,8 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
 
bru->entity.type = VSP1_ENTITY_BRU;
 
-   ret = vsp1_entity_init(vsp1, >entity, 5);
+   ret = vsp1_entity_init(vsp1, >entity,
+  vsp1->info->num_bru_inputs + 1);
if (ret < 0)
return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_bru.h 
b/drivers/media/platform/vsp1/vsp1_bru.h
index 16b1c6554911..dbac9686ea69 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.h
+++ b/drivers/media/platform/vsp1/vsp1_bru.h
@@ -23,7 +23,6 @@ struct vsp1_device;
 struct vsp1_rwpf;
 
 #define 

[PATCH 12/32] v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix

2015-09-13 Thread Laurent Pinchart
Those functions are specific to video nodes, rename them for
consistency.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_video.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 1a909ab34ea1..8569836ea51b 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -308,9 +308,9 @@ vsp1_video_format_adjust(struct vsp1_video *video,
  * Pipeline Management
  */
 
-static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
-struct vsp1_rwpf *input,
-struct vsp1_rwpf *output)
+static int vsp1_video_pipeline_validate_branch(struct vsp1_pipeline *pipe,
+  struct vsp1_rwpf *input,
+  struct vsp1_rwpf *output)
 {
struct vsp1_entity *entity;
unsigned int entities = 0;
@@ -384,8 +384,8 @@ static int vsp1_pipeline_validate_branch(struct 
vsp1_pipeline *pipe,
return 0;
 }
 
-static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
- struct vsp1_video *video)
+static int vsp1_video_pipeline_validate(struct vsp1_pipeline *pipe,
+   struct vsp1_video *video)
 {
struct media_entity_graph graph;
struct media_entity *entity = >video.entity;
@@ -437,8 +437,8 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline 
*pipe,
 * contains no loop and that all branches end at the output WPF.
 */
for (i = 0; i < pipe->num_inputs; ++i) {
-   ret = vsp1_pipeline_validate_branch(pipe, pipe->inputs[i],
-   pipe->output);
+   ret = vsp1_video_pipeline_validate_branch(pipe, pipe->inputs[i],
+ pipe->output);
if (ret < 0)
goto error;
}
@@ -450,8 +450,8 @@ error:
return ret;
 }
 
-static int vsp1_pipeline_init(struct vsp1_pipeline *pipe,
- struct vsp1_video *video)
+static int vsp1_video_pipeline_init(struct vsp1_pipeline *pipe,
+   struct vsp1_video *video)
 {
int ret;
 
@@ -459,7 +459,7 @@ static int vsp1_pipeline_init(struct vsp1_pipeline *pipe,
 
/* If we're the first user validate and initialize the pipeline. */
if (pipe->use_count == 0) {
-   ret = vsp1_pipeline_validate(pipe, video);
+   ret = vsp1_video_pipeline_validate(pipe, video);
if (ret < 0)
goto done;
}
@@ -472,7 +472,7 @@ done:
return ret;
 }
 
-static void vsp1_pipeline_cleanup(struct vsp1_pipeline *pipe)
+static void vsp1_video_pipeline_cleanup(struct vsp1_pipeline *pipe)
 {
mutex_lock(>lock);
 
@@ -738,7 +738,7 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq)
}
mutex_unlock(>lock);
 
-   vsp1_pipeline_cleanup(pipe);
+   vsp1_video_pipeline_cleanup(pipe);
media_entity_pipeline_stop(>video.entity);
 
/* Remove all buffers from the IRQ queue. */
@@ -879,7 +879,7 @@ vsp1_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
if (ret < 0)
goto err_stop;
 
-   ret = vsp1_pipeline_init(pipe, video);
+   ret = vsp1_video_pipeline_init(pipe, video);
if (ret < 0)
goto err_stop;
 
@@ -891,7 +891,7 @@ vsp1_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
return 0;
 
 err_cleanup:
-   vsp1_pipeline_cleanup(pipe);
+   vsp1_video_pipeline_cleanup(pipe);
 err_stop:
media_entity_pipeline_stop(>video.entity);
return ret;
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 27/32] v4l: vsp1: Don't validate links when the userspace API is disabled

2015-09-13 Thread Laurent Pinchart
As the pipeline is configured internally by the driver when the
userspace API is disabled its configuration can be trusted and link
validation isn't needed.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1.h|  2 ++
 drivers/media/platform/vsp1/vsp1_bru.c|  2 +-
 drivers/media/platform/vsp1/vsp1_drv.c| 10 ++
 drivers/media/platform/vsp1/vsp1_entity.c | 11 +++
 drivers/media/platform/vsp1/vsp1_entity.h |  5 -
 drivers/media/platform/vsp1/vsp1_hsit.c   |  2 +-
 drivers/media/platform/vsp1/vsp1_lif.c|  2 +-
 drivers/media/platform/vsp1/vsp1_lut.c|  2 +-
 drivers/media/platform/vsp1/vsp1_rpf.c|  2 +-
 drivers/media/platform/vsp1/vsp1_sru.c|  2 +-
 drivers/media/platform/vsp1/vsp1_uds.c|  2 +-
 drivers/media/platform/vsp1/vsp1_wpf.c|  2 +-
 12 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 791d24c2c8d1..6102ade125bb 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -82,6 +82,8 @@ struct vsp1_device {
 
struct v4l2_device v4l2_dev;
struct media_device media_dev;
+
+   struct media_entity_operations media_ops;
 };
 
 int vsp1_device_get(struct vsp1_device *vsp1);
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
index 2d31284dfc3f..99b742ff53c9 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -424,7 +424,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
subdev = >entity.subdev;
v4l2_subdev_init(subdev, _ops);
 
-   subdev->entity.ops = _media_ops;
+   subdev->entity.ops = >media_ops;
subdev->internal_ops = _subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s bru",
 dev_name(vsp1->dev));
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 5a18f69c90c2..fb9c8f59e3b0 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -21,6 +21,8 @@
 #include 
 #include 
 
+#include 
+
 #include "vsp1.h"
 #include "vsp1_bru.h"
 #include "vsp1_hsit.h"
@@ -217,6 +219,14 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
return ret;
}
 
+   vsp1->media_ops.link_setup = vsp1_entity_link_setup;
+   /* Don't perform link validation when the userspace API is disabled as
+* the pipeline is configured internally by the driver in that case, and
+* its configuration can thus be trusted.
+*/
+   if (vsp1->info->uapi)
+   vsp1->media_ops.link_validate = v4l2_subdev_link_validate;
+
vdev->mdev = mdev;
ret = v4l2_device_register(vsp1->dev, vdev);
if (ret < 0) {
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index 7068ba1e89e9..79e05b76d6e3 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -131,9 +131,9 @@ const struct v4l2_subdev_internal_ops 
vsp1_subdev_internal_ops = {
  * Media Operations
  */
 
-static int vsp1_entity_link_setup(struct media_entity *entity,
- const struct media_pad *local,
- const struct media_pad *remote, u32 flags)
+int vsp1_entity_link_setup(struct media_entity *entity,
+  const struct media_pad *local,
+  const struct media_pad *remote, u32 flags)
 {
struct vsp1_entity *source;
 
@@ -158,11 +158,6 @@ static int vsp1_entity_link_setup(struct media_entity 
*entity,
return 0;
 }
 
-const struct media_entity_operations vsp1_media_ops = {
-   .link_setup = vsp1_entity_link_setup,
-   .link_validate = v4l2_subdev_link_validate,
-};
-
 /* 
-
  * Initialization
  */
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h 
b/drivers/media/platform/vsp1/vsp1_entity.h
index 360a2e668ac2..83570dfde8ec 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -86,7 +86,10 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct 
vsp1_entity *entity,
 void vsp1_entity_destroy(struct vsp1_entity *entity);
 
 extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
-extern const struct media_entity_operations vsp1_media_ops;
+
+int vsp1_entity_link_setup(struct media_entity *entity,
+  const struct media_pad *local,
+  const struct media_pad *remote, u32 flags);
 
 struct v4l2_mbus_framefmt *
 vsp1_entity_get_pad_format(struct vsp1_entity *entity,
diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c 
b/drivers/media/platform/vsp1/vsp1_hsit.c
index 

[PATCH 06/32] v4l: vsp1: Make rwpf operations independent of video device

2015-09-13 Thread Laurent Pinchart
The rwpf queue operation doesn't queue a buffer but sets the memory
address for the next run. Rename it to set_memory and pass it a new
structure independent of the video buffer than only contains memory
information.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_rpf.c   | 16 
 drivers/media/platform/vsp1/vsp1_rwpf.h  | 10 --
 drivers/media/platform/vsp1/vsp1_video.c | 14 --
 drivers/media/platform/vsp1/vsp1_video.h |  7 +++
 drivers/media/platform/vsp1/vsp1_wpf.c   | 14 +++---
 5 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index ae51c31112aa..c0b7f76cd0b5 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -186,28 +186,28 @@ static struct v4l2_subdev_ops rpf_ops = {
  * Video Device Operations
  */
 
-static void rpf_buf_queue(struct vsp1_rwpf *rpf, struct vsp1_vb2_buffer *buf)
+static void rpf_set_memory(struct vsp1_rwpf *rpf, struct vsp1_rwpf_memory *mem)
 {
unsigned int i;
 
for (i = 0; i < 3; ++i)
-   rpf->buf_addr[i] = buf->addr[i];
+   rpf->buf_addr[i] = mem->addr[i];
 
if (!vsp1_entity_is_streaming(>entity))
return;
 
vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y,
-  buf->addr[0] + rpf->offsets[0]);
-   if (buf->buf.num_planes > 1)
+  mem->addr[0] + rpf->offsets[0]);
+   if (mem->num_planes > 1)
vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0,
-  buf->addr[1] + rpf->offsets[1]);
-   if (buf->buf.num_planes > 2)
+  mem->addr[1] + rpf->offsets[1]);
+   if (mem->num_planes > 2)
vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1,
-  buf->addr[2] + rpf->offsets[1]);
+  mem->addr[2] + rpf->offsets[1]);
 }
 
 static const struct vsp1_rwpf_operations rpf_vdev_ops = {
-   .queue = rpf_buf_queue,
+   .set_memory = rpf_set_memory,
 };
 
 /* 
-
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index ee2a8bf269fa..0076920adb28 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -24,10 +24,16 @@
 #define RWPF_PAD_SOURCE1
 
 struct vsp1_rwpf;
-struct vsp1_vb2_buffer;
+
+struct vsp1_rwpf_memory {
+   unsigned int num_planes;
+   dma_addr_t addr[3];
+   unsigned int length[3];
+};
 
 struct vsp1_rwpf_operations {
-   void (*queue)(struct vsp1_rwpf *rwpf, struct vsp1_vb2_buffer *buf);
+   void (*set_memory)(struct vsp1_rwpf *rwpf,
+  struct vsp1_rwpf_memory *mem);
 };
 
 struct vsp1_rwpf {
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 216894cee2e7..121f8724bcf6 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -613,7 +613,7 @@ vsp1_video_complete_buffer(struct vsp1_video *video)
done->buf.v4l2_buf.sequence = video->sequence++;
v4l2_get_timestamp(>buf.v4l2_buf.timestamp);
for (i = 0; i < done->buf.num_planes; ++i)
-   vb2_set_plane_payload(>buf, i, done->length[i]);
+   vb2_set_plane_payload(>buf, i, done->mem.length[i]);
vb2_buffer_done(>buf, VB2_BUF_STATE_DONE);
 
return next;
@@ -631,7 +631,7 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe,
 
spin_lock_irqsave(>irqlock, flags);
 
-   video->rwpf->ops->queue(video->rwpf, buf);
+   video->rwpf->ops->set_memory(video->rwpf, >mem);
pipe->buffers_ready |= 1 << video->pipe_index;
 
spin_unlock_irqrestore(>irqlock, flags);
@@ -828,11 +828,13 @@ static int vsp1_video_buffer_prepare(struct vb2_buffer 
*vb)
if (vb->num_planes < format->num_planes)
return -EINVAL;
 
+   buf->mem.num_planes = vb->num_planes;
+
for (i = 0; i < vb->num_planes; ++i) {
-   buf->addr[i] = vb2_dma_contig_plane_dma_addr(vb, i);
-   buf->length[i] = vb2_plane_size(vb, i);
+   buf->mem.addr[i] = vb2_dma_contig_plane_dma_addr(vb, i);
+   buf->mem.length[i] = vb2_plane_size(vb, i);
 
-   if (buf->length[i] < format->plane_fmt[i].sizeimage)
+   if (buf->mem.length[i] < format->plane_fmt[i].sizeimage)
return -EINVAL;
}
 
@@ -857,7 +859,7 @@ static void vsp1_video_buffer_queue(struct vb2_buffer *vb)
 
spin_lock_irqsave(>irqlock, flags);
 
-   video->rwpf->ops->queue(video->rwpf, buf);
+   video->rwpf->ops->set_memory(video->rwpf, >mem);
pipe->buffers_ready |= 1 << 

[PATCH 18/32] v4l: vsp1: Set the SRU CTRL0 register when starting the stream

2015-09-13 Thread Laurent Pinchart
Commit 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity
controllable during streaming") refactored the stream start code and
removed the SRU CTRL0 register write by mistake. Add it back.

Fixes: 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity controllable 
during streaming")
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_sru.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/vsp1/vsp1_sru.c 
b/drivers/media/platform/vsp1/vsp1_sru.c
index 6310acab60e7..d41ae950d1a1 100644
--- a/drivers/media/platform/vsp1/vsp1_sru.c
+++ b/drivers/media/platform/vsp1/vsp1_sru.c
@@ -154,6 +154,7 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int 
enable)
mutex_lock(sru->ctrls.lock);
ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
   & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
+   vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);
mutex_unlock(sru->ctrls.lock);
 
vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/32] VSP: Add R-Car Gen3 support

2015-09-13 Thread Laurent Pinchart
Hello,

This patch set adds support for the Renesas R-Car Gen3 SoC family to the VSP1
driver. The large number of patches is caused by a change in the display
controller architecture that makes usage of the VSP mandatory as the display
controller has lost the ability to read data from memory.

Patch 01/31 to 26/31 prepare for the implementation of an API exported to the
DRM driver in patch 27/31. Patches 30/31 enables support for the R-Car Gen3
family, and patch 31/31 finally enhances perfomances by implementing support
for display lists.

Laurent Pinchart (31):
  v4l: vsp1: Change the type of the rwpf field in struct vsp1_video
  v4l: vsp1: Store the memory format in struct vsp1_rwpf
  v4l: vsp1: Move video operations to vsp1_rwpf
  v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer
  v4l: vsp1: Move video device out of struct vsp1_rwpf
  v4l: vsp1: Make rwpf operations independent of video device
  v4l: vsp1: Support VSP1 instances without any UDS
  v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf
  v4l: vsp1: Remove struct vsp1_pipeline num_video field
  v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video
  v4l: vsp1: Split pipeline management code from vsp1_video.c
  v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix
  v4l: vsp1: Extract pipeline initialization code into a function
  v4l: vsp1: Reuse local variable instead of recomputing it
  v4l: vsp1: Extract link creation to separate function
  v4l: vsp1: Document the vsp1_pipeline structure
  v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register name
  v4l: vsp1: Set the SRU CTRL0 register when starting the stream
  v4l: vsp1: Remove unused module write functions
  v4l: vsp1: Move entity route setup function to vsp1_entity.c
  v4l: vsp1: Make number of BRU inputs configurable
  v4l: vsp1: Make the BRU optional
  v4l: vsp1: Move format info to vsp1_pipe.c
  v4l: vsp1: Make the userspace API optional
  v4l: vsp1: Make pipeline inputs array index by RPF index
  v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream
handlers
  v4l: vsp1: Don't validate links when the userspace API is disabled
  v4l: vsp1: Add VSP+DU support
  v4l: vsp1: Disconnect unused RPFs from the DRM pipeline
  v4l: vsp1: Implement atomic update for the DRM driver
  v4l: vsp1: Add support for the R-Car Gen3 VSP2

Takashi Saito (1):
  v4l: vsp1: Add display list support

 .../devicetree/bindings/media/renesas,vsp1.txt |  11 +-
 drivers/media/platform/vsp1/Makefile   |   3 +-
 drivers/media/platform/vsp1/vsp1.h |  28 +
 drivers/media/platform/vsp1/vsp1_bru.c |  33 +-
 drivers/media/platform/vsp1/vsp1_bru.h |   3 +-
 drivers/media/platform/vsp1/vsp1_dl.c  | 304 +++
 drivers/media/platform/vsp1/vsp1_dl.h  |  42 ++
 drivers/media/platform/vsp1/vsp1_drm.c | 595 +
 drivers/media/platform/vsp1/vsp1_drm.h |  38 ++
 drivers/media/platform/vsp1/vsp1_drv.c | 255 +++--
 drivers/media/platform/vsp1/vsp1_entity.c  |  31 +-
 drivers/media/platform/vsp1/vsp1_entity.h  |  14 +-
 drivers/media/platform/vsp1/vsp1_hsit.c|   2 +-
 drivers/media/platform/vsp1/vsp1_lif.c |  11 +-
 drivers/media/platform/vsp1/vsp1_lut.c |   7 +-
 drivers/media/platform/vsp1/vsp1_pipe.c| 405 ++
 drivers/media/platform/vsp1/vsp1_pipe.h| 134 +
 drivers/media/platform/vsp1/vsp1_regs.h|  14 +-
 drivers/media/platform/vsp1/vsp1_rpf.c |  77 ++-
 drivers/media/platform/vsp1/vsp1_rwpf.h|  24 +-
 drivers/media/platform/vsp1/vsp1_sru.c |   9 +-
 drivers/media/platform/vsp1/vsp1_uds.c |   8 +-
 drivers/media/platform/vsp1/vsp1_video.c   | 515 --
 drivers/media/platform/vsp1/vsp1_video.h   | 110 +---
 drivers/media/platform/vsp1/vsp1_wpf.c |  88 ++-
 include/media/vsp1.h   |  33 ++
 26 files changed, 2050 insertions(+), 744 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_dl.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_dl.h
 create mode 100644 drivers/media/platform/vsp1/vsp1_drm.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_drm.h
 create mode 100644 drivers/media/platform/vsp1/vsp1_pipe.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_pipe.h
 create mode 100644 include/media/vsp1.h

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 31/32] v4l: vsp1: Add support for the R-Car Gen3 VSP2

2015-09-13 Thread Laurent Pinchart
Add DT compatible strings for the VSP2 instances found in the R-Car Gen3
SoCs and support them in the vsp1 driver.

Cc: devicet...@vger.kernel.org
Signed-off-by: Laurent Pinchart 
---
 Documentation/devicetree/bindings/media/renesas,vsp1.txt |  5 -
 drivers/media/platform/vsp1/vsp1_drv.c   | 12 
 drivers/media/platform/vsp1/vsp1_entity.c|  3 ++-
 drivers/media/platform/vsp1/vsp1_regs.h  | 12 ++--
 4 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt 
b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
index 766f034c1e45..dc7fc142aada 100644
--- a/Documentation/devicetree/bindings/media/renesas,vsp1.txt
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -6,7 +6,10 @@ It can be found in the Renesas R-Car second generation SoCs.
 
 Required properties:
 
-  - compatible: Must contain "renesas,vsp1"
+  - compatible: Must contain one of the following values
+- "renesas,vsp1" for the R-Car Gen2 VSP1
+- "renesas,vsp2" for the R-Car Gen3 VSP2BC, VSP2BD or VSP2I
+- "renesas,vsp2d" for the R-Car Gen3 VSP2D
 
   - reg: Base address and length of the registers block for the VSP1.
   - interrupts: VSP1 interrupt specifier.
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 5d58cad5b125..75cdf8715d9a 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -648,8 +648,20 @@ static const struct vsp1_device_info vsp1_gen2_info = {
.uapi = true,
 };
 
+static const struct vsp1_device_info vsp1_gen3_info = {
+   .num_bru_inputs = 5,
+   .uapi = true,
+};
+
+static const struct vsp1_device_info vsp1_gen3_vspd_info = {
+   .num_bru_inputs = 5,
+   .uapi = false,
+};
+
 static const struct of_device_id vsp1_of_match[] = {
{ .compatible = "renesas,vsp1", .data = _gen2_info },
+   { .compatible = "renesas,vsp2", .data = _gen3_info },
+   { .compatible = "renesas,vsp2d", .data = _gen3_vspd_info },
{ },
 };
 
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index 79e05b76d6e3..8947c1883bf4 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -165,7 +165,8 @@ int vsp1_entity_link_setup(struct media_entity *entity,
 static const struct vsp1_route vsp1_routes[] = {
{ VSP1_ENTITY_BRU, 0, VI6_DPR_BRU_ROUTE,
  { VI6_DPR_NODE_BRU_IN(0), VI6_DPR_NODE_BRU_IN(1),
-   VI6_DPR_NODE_BRU_IN(2), VI6_DPR_NODE_BRU_IN(3), } },
+   VI6_DPR_NODE_BRU_IN(2), VI6_DPR_NODE_BRU_IN(3),
+   VI6_DPR_NODE_BRU_IN(4) } },
{ VSP1_ENTITY_HSI, 0, VI6_DPR_HSI_ROUTE, { VI6_DPR_NODE_HSI, } },
{ VSP1_ENTITY_HST, 0, VI6_DPR_HST_ROUTE, { VI6_DPR_NODE_HST, } },
{ VSP1_ENTITY_LIF, 0, 0, { VI6_DPR_NODE_LIF, } },
diff --git a/drivers/media/platform/vsp1/vsp1_regs.h 
b/drivers/media/platform/vsp1/vsp1_regs.h
index 8173ceaab9f9..f94050224aa0 100644
--- a/drivers/media/platform/vsp1/vsp1_regs.h
+++ b/drivers/media/platform/vsp1/vsp1_regs.h
@@ -322,7 +322,7 @@
 #define VI6_DPR_NODE_SRU   16
 #define VI6_DPR_NODE_UDS(n)(17 + (n))
 #define VI6_DPR_NODE_LUT   22
-#define VI6_DPR_NODE_BRU_IN(n) (23 + (n))
+#define VI6_DPR_NODE_BRU_IN(n) (((n) <= 3) ? 23 + (n) : 49)
 #define VI6_DPR_NODE_BRU_OUT   27
 #define VI6_DPR_NODE_CLU   29
 #define VI6_DPR_NODE_HST   30
@@ -504,12 +504,12 @@
 #define VI6_BRU_VIRRPF_COL_BCB_MASK(0xff << 0)
 #define VI6_BRU_VIRRPF_COL_BCB_SHIFT   0
 
-#define VI6_BRU_CTRL(n)(0x2c10 + (n) * 8)
+#define VI6_BRU_CTRL(n)(0x2c10 + (n) * 8 + ((n) <= 3 ? 
0 : 4))
 #define VI6_BRU_CTRL_RBC   (1 << 31)
-#define VI6_BRU_CTRL_DSTSEL_BRUIN(n)   ((n) << 20)
+#define VI6_BRU_CTRL_DSTSEL_BRUIN(n)   (((n) <= 3 ? (n) : (n)+1) << 20)
 #define VI6_BRU_CTRL_DSTSEL_VRPF   (4 << 20)
 #define VI6_BRU_CTRL_DSTSEL_MASK   (7 << 20)
-#define VI6_BRU_CTRL_SRCSEL_BRUIN(n)   ((n) << 16)
+#define VI6_BRU_CTRL_SRCSEL_BRUIN(n)   (((n) <= 3 ? (n) : (n)+1) << 16)
 #define VI6_BRU_CTRL_SRCSEL_VRPF   (4 << 16)
 #define VI6_BRU_CTRL_SRCSEL_MASK   (7 << 16)
 #define VI6_BRU_CTRL_CROP(rop) ((rop) << 4)
@@ -517,7 +517,7 @@
 #define VI6_BRU_CTRL_AROP(rop) ((rop) << 0)
 #define VI6_BRU_CTRL_AROP_MASK (0xf << 0)
 
-#define VI6_BRU_BLD(n) (0x2c14 + (n) * 8)
+#define VI6_BRU_BLD(n) (0x2c14 + (n) * 8 + ((n) <= 3 ? 0 : 4))
 #define VI6_BRU_BLD_CBES   (1 << 31)
 #define VI6_BRU_BLD_CCMDX_DST_A(0 << 28)
 #define VI6_BRU_BLD_CCMDX_255_DST_A(1 << 28)
@@ -551,7 +551,7 @@
 #define VI6_BRU_BLD_COEFY_SHIFT0
 
 #define VI6_BRU_ROP

[PATCH 2/4] vivid-tpg: add support for SMPTE 2084 transfer function

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

Support the new SMPTE 2084 transfer function in the test pattern generator.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-tpg-colors.c | 96 -
 drivers/media/platform/vivid/vivid-tpg-colors.h |  2 +-
 2 files changed, 94 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-tpg-colors.c 
b/drivers/media/platform/vivid/vivid-tpg-colors.c
index dee7b14..2299f0c 100644
--- a/drivers/media/platform/vivid/vivid-tpg-colors.c
+++ b/drivers/media/platform/vivid/vivid-tpg-colors.c
@@ -598,7 +598,7 @@ const unsigned short tpg_linear_to_rec709[255 * 16 + 1] = {
 };
 
 /* Generated table */
-const struct color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 + 
1][V4L2_XFER_FUNC_DCI_P3 + 1][TPG_COLOR_CSC_BLACK + 1] = {
+const struct color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 + 
1][V4L2_XFER_FUNC_SMPTE2084 + 1][TPG_COLOR_CSC_BLACK + 1] = {
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 2939 
},
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_709][1] = { 2953, 2963, 586 
},
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_709][2] = { 0, 2967, 2937 },
@@ -647,6 +647,14 @@ const struct color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 
+ 1][V4L2_XFER_FUNC_D
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][5] = { 3248, 944, 
1094 },
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][6] = { 1017, 967, 
3168 },
[V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_DCI_P3][7] = { 1084, 1084, 
1084 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][0] = { 3798, 
3798, 3798 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][1] = { 3802, 
3805, 2602 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][2] = { 0, 3806, 
3797 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][3] = { 1780, 
3812, 2592 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][4] = { 3820, 
2215, 3796 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][5] = { 3824, 
2409, 2574 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][6] = { 2491, 
2435, 3795 },
+   [V4L2_COLORSPACE_SMPTE170M][V4L2_XFER_FUNC_SMPTE2084][7] = { 2563, 
2563, 2563 },
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 2939 
},
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_709][1] = { 2953, 2963, 586 
},
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_709][2] = { 0, 2967, 2937 },
@@ -695,6 +703,14 @@ const struct color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 
+ 1][V4L2_XFER_FUNC_D
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][5] = { 3248, 944, 
1094 },
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][6] = { 1017, 967, 
3168 },
[V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_DCI_P3][7] = { 1084, 1084, 
1084 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][0] = { 3798, 
3798, 3798 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][1] = { 3802, 
3805, 2602 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][2] = { 0, 3806, 
3797 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][3] = { 1780, 
3812, 2592 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][4] = { 3820, 
2215, 3796 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][5] = { 3824, 
2409, 2574 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][6] = { 2491, 
2435, 3795 },
+   [V4L2_COLORSPACE_SMPTE240M][V4L2_XFER_FUNC_SMPTE2084][7] = { 2563, 
2563, 2563 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 2939 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_709][1] = { 2939, 2939, 547 },
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_709][2] = { 547, 2939, 2939 },
@@ -743,6 +759,14 @@ const struct color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 
+ 1][V4L2_XFER_FUNC_D
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][5] = { 3175, 1084, 1084 
},
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][6] = { 1084, 1084, 3175 
},
[V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_DCI_P3][7] = { 1084, 1084, 1084 
},
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][0] = { 3798, 3798, 
3798 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][1] = { 3798, 3798, 
2563 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][2] = { 2563, 3798, 
3798 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][3] = { 2563, 3798, 
2563 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][4] = { 3798, 2563, 
3798 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][5] = { 3798, 2563, 
2563 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][6] = { 2563, 2563, 
3798 },
+   [V4L2_COLORSPACE_REC709][V4L2_XFER_FUNC_SMPTE2084][7] = { 2563, 2563, 
2563 },
[V4L2_COLORSPACE_470_SYSTEM_M][V4L2_XFER_FUNC_709][0] = { 2939, 2939, 
2939 

[PATCH 3/4] vivid: add support for SMPTE 2084 transfer function

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

Support the new SMPTE 2084 transfer function in the vivid test driver.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/vivid/vivid-ctrls.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/vivid/vivid-ctrls.c 
b/drivers/media/platform/vivid/vivid-ctrls.c
index 995e303..630086b 100644
--- a/drivers/media/platform/vivid/vivid-ctrls.c
+++ b/drivers/media/platform/vivid/vivid-ctrls.c
@@ -727,6 +727,7 @@ static const char * const vivid_ctrl_xfer_func_strings[] = {
"SMPTE 240M",
"None",
"DCI-P3",
+   "SMPTE 2084",
NULL,
 };
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] DocBook media: Document the SMPTE 2084 transfer function

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

Document this new transfer function used by High Dynamic Range content.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/biblio.xml |  9 +++
 Documentation/DocBook/media/v4l/pixfmt.xml | 39 ++
 2 files changed, 48 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/biblio.xml 
b/Documentation/DocBook/media/v4l/biblio.xml
index f54db59..9beb30f 100644
--- a/Documentation/DocBook/media/v4l/biblio.xml
+++ b/Documentation/DocBook/media/v4l/biblio.xml
@@ -186,6 +186,15 @@ Signal - NTSC for Studio Applications"
   SMPTE RP 431-2:2011 "D-Cinema Quality - Reference Projector and 
Environment"
 
 
+
+  SMPTEST2084
+  
+   Society of Motion Picture and Television Engineers
+(http://www.smpte.org;>http://www.smpte.org)
+  
+  SMPTE ST 2084:2014 "High Dynamic Range Electro-Optical Transfer 
Function of Master Reference Displays"
+
+
 
   sRGB
   
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index 417..70cd0fd 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -609,6 +609,10 @@ colorspaces except for BT.2020 which uses limited range 
R'G'B' quantization.V4L2_XFER_FUNC_DCI_P3
Use the DCI-P3 transfer function.
  
+ 
+   V4L2_XFER_FUNC_SMPTE2084
+   Use the SMPTE 2084 transfer function.
+ 

   
 
@@ -1472,6 +1476,41 @@ and 
V4L2_QUANTIZATION_FULL_RANGE.
 
   
 
+  
+Detailed Transfer Function Descriptions
+
+  Transfer Function SMPTE 2084 
(V4L2_XFER_FUNC_SMPTE2084)
+  The  standard defines the transfer 
function used by
+High Dynamic Range content.
+  
+   
+  Constants:
+ 
+m1 = (2610 / 4096) / 4
+m2 = (2523 / 4096) * 128
+c1 = 3424 / 4096
+c2 = (2413 / 4096) * 32
+c3 = (2392 / 4096) * 32
+ 
+   
+   
+  Transfer function:
+ 
+L' = ((c1 + c2 * Lm1) / (1 + c3 * 
Lm1))m2
+ 
+   
+  
+  
+   
+  Inverse Transfer function:
+ 
+L = (max(L'1/m2 - c1, 0) / (c2 - 
c3 * L'1/m2))1/m1
+ 
+   
+  
+
+  
+
   
 Indexed Format
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] v4l2: add support for the SMPTE 2084 transfer function

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

This transfer function is used in High Dynamic Range content. It can be signaled
via the new HDMI Dynamic Range and Mastering InfoFrame (defined in CEA-861.3).

Regards,

Hans

Hans Verkuil (4):
  videodev2.h: add SMPTE 2084 transfer function define
  vivid-tpg: add support for SMPTE 2084 transfer function
  vivid: add support for SMPTE 2084 transfer function
  DocBook media: Document the SMPTE 2084 transfer function

 Documentation/DocBook/media/v4l/biblio.xml  |  9 +++
 Documentation/DocBook/media/v4l/pixfmt.xml  | 39 ++
 drivers/media/platform/vivid/vivid-ctrls.c  |  1 +
 drivers/media/platform/vivid/vivid-tpg-colors.c | 96 -
 drivers/media/platform/vivid/vivid-tpg-colors.h |  2 +-
 include/uapi/linux/videodev2.h  |  1 +
 6 files changed, 144 insertions(+), 4 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] videodev2.h: add SMPTE 2084 transfer function define

2015-09-13 Thread Hans Verkuil
From: Hans Verkuil 

CEA-861.3 adds support for the SMPTE 2084 Electro-Optical Transfer Function
as can be used in HDR displays. Add a defined for this in videodev2.h.

Signed-off-by: Hans Verkuil 
---
 include/uapi/linux/videodev2.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 4900e15..80314ad 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -269,6 +269,7 @@ enum v4l2_xfer_func {
V4L2_XFER_FUNC_SMPTE240M   = 4,
V4L2_XFER_FUNC_NONE= 5,
V4L2_XFER_FUNC_DCI_P3  = 6,
+   V4L2_XFER_FUNC_SMPTE2084   = 7,
 };
 
 /*
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/32] v4l: vsp1: Support VSP1 instances without any UDS

2015-09-13 Thread Laurent Pinchart
Not all VSP1 instances include a UDS. Make the renesas,#uds DT property
optional and accept a number of UDS equal to 0 as valid.

Cc: devicet...@vger.kernel.org
Signed-off-by: Laurent Pinchart 
---
 Documentation/devicetree/bindings/media/renesas,vsp1.txt | 3 ++-
 drivers/media/platform/vsp1/vsp1_drv.c   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt 
b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
index 87fe08abf36d..674c8c30d046 100644
--- a/Documentation/devicetree/bindings/media/renesas,vsp1.txt
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -13,12 +13,13 @@ Required properties:
   - clocks: A phandle + clock-specifier pair for the VSP1 functional clock.
 
   - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
-  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
   - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
 
 
 Optional properties:
 
+  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1. Defaults
+to 0 if not present.
   - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
 available.
   - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index de0b80e8d048..5f93cbdcb0f1 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -513,7 +513,7 @@ static int vsp1_parse_dt(struct vsp1_device *vsp1)
return -EINVAL;
}
 
-   if (pdata->uds_count <= 0 || pdata->uds_count > VSP1_MAX_UDS) {
+   if (pdata->uds_count > VSP1_MAX_UDS) {
dev_err(vsp1->dev, "invalid number of UDS (%u)\n",
pdata->uds_count);
return -EINVAL;
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/32] v4l: vsp1: Remove struct vsp1_pipeline num_video field

2015-09-13 Thread Laurent Pinchart
The field always has the same value as the num_inputs field, remove the
duplicate.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_video.c | 7 ++-
 drivers/media/platform/vsp1/vsp1_video.h | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 2d27e8334911..c726d76bd570 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -396,7 +396,6 @@ static void __vsp1_pipeline_cleanup(struct vsp1_pipeline 
*pipe)
INIT_LIST_HEAD(>entities);
pipe->state = VSP1_PIPELINE_STOPPED;
pipe->buffers_ready = 0;
-   pipe->num_video = 0;
pipe->num_inputs = 0;
pipe->output = NULL;
pipe->bru = NULL;
@@ -423,10 +422,8 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline 
*pipe,
struct vsp1_rwpf *rwpf;
struct vsp1_entity *e;
 
-   if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
-   pipe->num_video++;
+   if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV)
continue;
-   }
 
subdev = media_entity_to_v4l2_subdev(entity);
e = to_vsp1_entity(subdev);
@@ -890,7 +887,7 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, 
unsigned int count)
int ret;
 
mutex_lock(>lock);
-   if (pipe->stream_count == pipe->num_video - 1) {
+   if (pipe->stream_count == pipe->num_inputs - 1) {
if (pipe->uds) {
struct vsp1_uds *uds = to_uds(>uds->subdev);
 
diff --git a/drivers/media/platform/vsp1/vsp1_video.h 
b/drivers/media/platform/vsp1/vsp1_video.h
index b7eabe6bab70..cea6d1f3f07b 100644
--- a/drivers/media/platform/vsp1/vsp1_video.h
+++ b/drivers/media/platform/vsp1/vsp1_video.h
@@ -75,7 +75,6 @@ struct vsp1_pipeline {
unsigned int stream_count;
unsigned int buffers_ready;
 
-   unsigned int num_video;
unsigned int num_inputs;
struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
struct vsp1_rwpf *output;
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/32] v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf

2015-09-13 Thread Laurent Pinchart
Only RPFs and WPFs can be associated with video nodes, don't waste
memory by storing the video pointer in all entities.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drv.c|  6 +++---
 drivers/media/platform/vsp1/vsp1_entity.h |  3 ---
 drivers/media/platform/vsp1/vsp1_rwpf.h   |  3 +++
 drivers/media/platform/vsp1/vsp1_video.c  | 10 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 5f93cbdcb0f1..91ecf75119ba 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -289,8 +289,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
struct vsp1_rwpf *rpf = vsp1->rpf[i];
 
-   ret = media_entity_create_link(>entity.video->video.entity,
-  0, >entity.subdev.entity,
+   ret = media_entity_create_link(>video->video.entity, 0,
+  >entity.subdev.entity,
   RWPF_PAD_SINK,
   MEDIA_LNK_FL_ENABLED |
   MEDIA_LNK_FL_IMMUTABLE);
@@ -311,7 +311,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 
ret = media_entity_create_link(>entity.subdev.entity,
   RWPF_PAD_SOURCE,
-  >entity.video->video.entity,
+  >video->video.entity,
   0, flags);
if (ret < 0)
goto done;
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h 
b/drivers/media/platform/vsp1/vsp1_entity.h
index 8867a5787c28..9c95507ec762 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -19,7 +19,6 @@
 #include 
 
 struct vsp1_device;
-struct vsp1_video;
 
 enum vsp1_entity_type {
VSP1_ENTITY_BRU,
@@ -71,8 +70,6 @@ struct vsp1_entity {
struct v4l2_subdev subdev;
struct v4l2_mbus_framefmt *formats;
 
-   struct vsp1_video *video;
-
spinlock_t lock;/* Protects the streaming field */
bool streaming;
 };
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index 0076920adb28..1a90c7c8e972 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -24,6 +24,7 @@
 #define RWPF_PAD_SOURCE1
 
 struct vsp1_rwpf;
+struct vsp1_video;
 
 struct vsp1_rwpf_memory {
unsigned int num_planes;
@@ -40,6 +41,8 @@ struct vsp1_rwpf {
struct vsp1_entity entity;
struct v4l2_ctrl_handler ctrls;
 
+   struct vsp1_video *video;
+
const struct vsp1_rwpf_operations *ops;
 
unsigned int max_width;
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 121f8724bcf6..2d27e8334911 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -435,11 +435,11 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline 
*pipe,
if (e->type == VSP1_ENTITY_RPF) {
rwpf = to_rwpf(subdev);
pipe->inputs[pipe->num_inputs++] = rwpf;
-   rwpf->entity.video->pipe_index = pipe->num_inputs;
+   rwpf->video->pipe_index = pipe->num_inputs;
} else if (e->type == VSP1_ENTITY_WPF) {
rwpf = to_rwpf(subdev);
pipe->output = to_rwpf(subdev);
-   rwpf->entity.video->pipe_index = 0;
+   rwpf->video->pipe_index = 0;
} else if (e->type == VSP1_ENTITY_LIF) {
pipe->lif = e;
} else if (e->type == VSP1_ENTITY_BRU) {
@@ -648,10 +648,10 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
 
/* Complete buffers on all video nodes. */
for (i = 0; i < pipe->num_inputs; ++i)
-   vsp1_video_frame_end(pipe, pipe->inputs[i]->entity.video);
+   vsp1_video_frame_end(pipe, pipe->inputs[i]->video);
 
if (!pipe->lif)
-   vsp1_video_frame_end(pipe, pipe->output->entity.video);
+   vsp1_video_frame_end(pipe, pipe->output->video);
 
spin_lock_irqsave(>irqlock, flags);
 
@@ -1200,7 +1200,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device 
*vsp1,
if (!video)
return ERR_PTR(-ENOMEM);
 
-   rwpf->entity.video = video;
+   rwpf->video = video;
 
video->vsp1 = vsp1;
video->rwpf = rwpf;
-- 
2.4.6

--
To 

[PATCH 01/32] v4l: vsp1: Change the type of the rwpf field in struct vsp1_video

2015-09-13 Thread Laurent Pinchart
The rwpf field contains a pointer to the rpf or wpf associated with the
video node. Instead of storing it as a vsp1_entity, store the
corresponding vsp1_rwpf pointer to allow accessing the vsp1_rwpf fields
directly.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_rpf.c   | 2 +-
 drivers/media/platform/vsp1/vsp1_video.c | 4 ++--
 drivers/media/platform/vsp1/vsp1_video.h | 5 +++--
 drivers/media/platform/vsp1/vsp1_wpf.c   | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index 3294529a3108..a1093cc1b9a1 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -271,7 +271,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, 
unsigned int index)
video->vsp1 = vsp1;
video->ops = _vdev_ops;
 
-   ret = vsp1_video_init(video, >entity);
+   ret = vsp1_video_init(video, rpf);
if (ret < 0)
goto error;
 
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 3c124c14ce14..48480e66fad6 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -1187,7 +1187,7 @@ static struct v4l2_file_operations vsp1_video_fops = {
  * Initialization and Cleanup
  */
 
-int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf)
+int vsp1_video_init(struct vsp1_video *video, struct vsp1_rwpf *rwpf)
 {
const char *direction;
int ret;
@@ -1242,7 +1242,7 @@ int vsp1_video_init(struct vsp1_video *video, struct 
vsp1_entity *rwpf)
video->video.v4l2_dev = >vsp1->v4l2_dev;
video->video.fops = _video_fops;
snprintf(video->video.name, sizeof(video->video.name), "%s %s",
-rwpf->subdev.name, direction);
+rwpf->entity.subdev.name, direction);
video->video.vfl_type = VFL_TYPE_GRABBER;
video->video.release = video_device_release_empty;
video->video.ioctl_ops = _video_ioctl_ops;
diff --git a/drivers/media/platform/vsp1/vsp1_video.h 
b/drivers/media/platform/vsp1/vsp1_video.h
index 0887a4d2742c..5f48eec5562c 100644
--- a/drivers/media/platform/vsp1/vsp1_video.h
+++ b/drivers/media/platform/vsp1/vsp1_video.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 
+struct vsp1_rwpf;
 struct vsp1_video;
 
 /*
@@ -113,7 +114,7 @@ struct vsp1_video_operations {
 
 struct vsp1_video {
struct vsp1_device *vsp1;
-   struct vsp1_entity *rwpf;
+   struct vsp1_rwpf *rwpf;
 
const struct vsp1_video_operations *ops;
 
@@ -140,7 +141,7 @@ static inline struct vsp1_video *to_vsp1_video(struct 
video_device *vdev)
return container_of(vdev, struct vsp1_video, video);
 }
 
-int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf);
+int vsp1_video_init(struct vsp1_video *video, struct vsp1_rwpf *rwpf);
 void vsp1_video_cleanup(struct vsp1_video *video);
 
 void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
b/drivers/media/platform/vsp1/vsp1_wpf.c
index 1d2b3a2f1573..50dfb3060156 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -271,7 +271,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, 
unsigned int index)
video->vsp1 = vsp1;
video->ops = _vdev_ops;
 
-   ret = vsp1_video_init(video, >entity);
+   ret = vsp1_video_init(video, wpf);
if (ret < 0)
goto error;
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/32] v4l: vsp1: Move video operations to vsp1_rwpf

2015-09-13 Thread Laurent Pinchart
This removes the dependency of vsp1_rpf and vsp1_wpf on vsp1_video,
making it possible to reuse the operations without a V4L2 video device
node.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_rpf.c   | 11 +--
 drivers/media/platform/vsp1/vsp1_rwpf.h  |  9 +
 drivers/media/platform/vsp1/vsp1_video.c |  4 ++--
 drivers/media/platform/vsp1/vsp1_video.h |  6 --
 drivers/media/platform/vsp1/vsp1_wpf.c   | 12 +---
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index 6e0564b5b37b..a17154d98a54 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -186,10 +186,8 @@ static struct v4l2_subdev_ops rpf_ops = {
  * Video Device Operations
  */
 
-static void rpf_vdev_queue(struct vsp1_video *video,
-  struct vsp1_video_buffer *buf)
+static void rpf_buf_queue(struct vsp1_rwpf *rpf, struct vsp1_video_buffer *buf)
 {
-   struct vsp1_rwpf *rpf = container_of(video, struct vsp1_rwpf, video);
unsigned int i;
 
for (i = 0; i < 3; ++i)
@@ -208,8 +206,8 @@ static void rpf_vdev_queue(struct vsp1_video *video,
   buf->addr[2] + rpf->offsets[1]);
 }
 
-static const struct vsp1_video_operations rpf_vdev_ops = {
-   .queue = rpf_vdev_queue,
+static const struct vsp1_rwpf_operations rpf_vdev_ops = {
+   .queue = rpf_buf_queue,
 };
 
 /* 
-
@@ -227,6 +225,8 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, 
unsigned int index)
if (rpf == NULL)
return ERR_PTR(-ENOMEM);
 
+   rpf->ops = _vdev_ops;
+
rpf->max_width = RPF_MAX_WIDTH;
rpf->max_height = RPF_MAX_HEIGHT;
 
@@ -269,7 +269,6 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, 
unsigned int index)
 
video->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
video->vsp1 = vsp1;
-   video->ops = _vdev_ops;
 
ret = vsp1_video_init(video, rpf);
if (ret < 0)
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index 8609c3d02679..3cc80be03524 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -24,11 +24,20 @@
 #define RWPF_PAD_SINK  0
 #define RWPF_PAD_SOURCE1
 
+struct vsp1_rwpf;
+struct vsp1_video_buffer;
+
+struct vsp1_rwpf_operations {
+   void (*queue)(struct vsp1_rwpf *rwpf, struct vsp1_video_buffer *buf);
+};
+
 struct vsp1_rwpf {
struct vsp1_entity entity;
struct vsp1_video video;
struct v4l2_ctrl_handler ctrls;
 
+   const struct vsp1_rwpf_operations *ops;
+
unsigned int max_width;
unsigned int max_height;
 
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 90d5791c80b6..2ddbcbaf498f 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -631,7 +631,7 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe,
 
spin_lock_irqsave(>irqlock, flags);
 
-   video->ops->queue(video, buf);
+   video->rwpf->ops->queue(video->rwpf, buf);
pipe->buffers_ready |= 1 << video->pipe_index;
 
spin_unlock_irqrestore(>irqlock, flags);
@@ -857,7 +857,7 @@ static void vsp1_video_buffer_queue(struct vb2_buffer *vb)
 
spin_lock_irqsave(>irqlock, flags);
 
-   video->ops->queue(video, buf);
+   video->rwpf->ops->queue(video->rwpf, buf);
pipe->buffers_ready |= 1 << video->pipe_index;
 
if (vb2_is_streaming(>queue) &&
diff --git a/drivers/media/platform/vsp1/vsp1_video.h 
b/drivers/media/platform/vsp1/vsp1_video.h
index dbcb7b5b6c95..34efc471351c 100644
--- a/drivers/media/platform/vsp1/vsp1_video.h
+++ b/drivers/media/platform/vsp1/vsp1_video.h
@@ -108,16 +108,10 @@ to_vsp1_video_buffer(struct vb2_buffer *vb)
return container_of(vb, struct vsp1_video_buffer, buf);
 }
 
-struct vsp1_video_operations {
-   void (*queue)(struct vsp1_video *video, struct vsp1_video_buffer *buf);
-};
-
 struct vsp1_video {
struct vsp1_device *vsp1;
struct vsp1_rwpf *rwpf;
 
-   const struct vsp1_video_operations *ops;
-
struct video_device video;
enum v4l2_buf_type type;
struct media_pad pad;
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
b/drivers/media/platform/vsp1/vsp1_wpf.c
index b14070d1e457..f93b545949b6 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -195,11 +195,8 @@ static struct v4l2_subdev_ops wpf_ops = {
  * Video Device Operations
  */
 
-static void wpf_vdev_queue(struct vsp1_video *video,
-  struct vsp1_video_buffer *buf)

ERROR: "vb2_ops_wait_finish" [drivers/input/touchscreen/sur40.ko] undefined!

2015-09-13 Thread kbuild test robot
Hi Florian,

FYI, the error/warning still remains. You may either fix it or ask me to 
silently ignore in future.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f
commit: e831cd251fb91d6c25352d322743db0d17ea11dd [media] add raw video stream 
support for Samsung SUR40
date:   5 months ago
config: x86_64-randconfig-s1-09140141 (attached as .config)
reproduce:
  git checkout e831cd251fb91d6c25352d322743db0d17ea11dd
  # save the attached .config to linux build tree
  make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> ERROR: "vb2_ops_wait_finish" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ops_wait_prepare" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_fop_release" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "v4l2_fh_open" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_fop_mmap" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "video_ioctl2" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_fop_poll" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_fop_read" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_streamoff" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_streamon" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_create_bufs" [drivers/input/touchscreen/sur40.ko] 
>> undefined!
>> ERROR: "vb2_ioctl_dqbuf" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_expbuf" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_qbuf" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_querybuf" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_ioctl_reqbufs" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "v4l2_get_timestamp" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_plane_cookie" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "video_devdata" [drivers/input/touchscreen/sur40.ko] undefined!
>> ERROR: "vb2_buffer_done" [drivers/input/touchscreen/sur40.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 4.0.0-rc1 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
CONFIG_KERNEL_LZMA=y
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_FHANDLE=y
# CONFIG_USELIB is not set
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_GENERIC_MSI_IRQ=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y

Re: [PATCH 0/4] v4l2: add support for the SMPTE 2084 transfer function

2015-09-13 Thread Hans Verkuil
On 09/13/2015 09:15 PM, Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> This transfer function is used in High Dynamic Range content. It can be 
> signaled
> via the new HDMI Dynamic Range and Mastering InfoFrame (defined in CEA-861.3).

Forgot to mention: this patch series sits up top of the series adding DCI-P3 
colorspace
support.

Also, a version of v4l-utils that understands both this new transfer function 
and
the DCI-P3 colorspace is available here:

http://git.linuxtv.org/cgit.cgi/hverkuil/v4l-utils.git/log/?h=dcip3

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] horus3a: Fix horus3a_attach() function parameters

2015-09-13 Thread Javier Martinez Canillas
If CONFIG_DVB_HORUS3A is disabled a stub static inline function is
defined that just prints a warning about the driver being disabled
but the function parameters were wrong which caused a build error.

Reported-by: Fengguang Wu 
Signed-off-by: Javier Martinez Canillas 

---

 drivers/media/dvb-frontends/horus3a.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/horus3a.h 
b/drivers/media/dvb-frontends/horus3a.h
index b055319d532e..c1e2d1834b78 100644
--- a/drivers/media/dvb-frontends/horus3a.h
+++ b/drivers/media/dvb-frontends/horus3a.h
@@ -46,8 +46,8 @@ extern struct dvb_frontend *horus3a_attach(struct 
dvb_frontend *fe,
const struct horus3a_config *config,
struct i2c_adapter *i2c);
 #else
-static inline struct dvb_frontend *horus3a_attach(
-   const struct cxd2820r_config *config,
+static inline struct dvb_frontend *horus3a_attach(struct dvb_frontend *fe,
+   const struct horus3a_config *config,
struct i2c_adapter *i2c)
 {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/32] VSP: Add R-Car Gen3 support

2015-09-13 Thread Laurent Pinchart
On Sunday 13 September 2015 23:56:38 Laurent Pinchart wrote:
> Hello,
> 
> This patch set adds support for the Renesas R-Car Gen3 SoC family to the
> VSP1 driver. The large number of patches is caused by a change in the
> display controller architecture that makes usage of the VSP mandatory as
> the display controller has lost the ability to read data from memory.
> 
> Patch 01/31 to 26/31 prepare for the implementation of an API exported to
> the DRM driver in patch 27/31. Patches 30/31 enables support for the R-Car
> Gen3 family, and patch 31/31 finally enhances perfomances by implementing
> support for display lists.

For reference, the patch set that introduces usage of the VSP exported API in 
the DRM driver has been posted to the dri-devel mailing list and is available 
in the list archive at 
http://lists.freedesktop.org/archives/dri-devel/2015-September/090218.html

> Laurent Pinchart (31):
>   v4l: vsp1: Change the type of the rwpf field in struct vsp1_video
>   v4l: vsp1: Store the memory format in struct vsp1_rwpf
>   v4l: vsp1: Move video operations to vsp1_rwpf
>   v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer
>   v4l: vsp1: Move video device out of struct vsp1_rwpf
>   v4l: vsp1: Make rwpf operations independent of video device
>   v4l: vsp1: Support VSP1 instances without any UDS
>   v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf
>   v4l: vsp1: Remove struct vsp1_pipeline num_video field
>   v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video
>   v4l: vsp1: Split pipeline management code from vsp1_video.c
>   v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix
>   v4l: vsp1: Extract pipeline initialization code into a function
>   v4l: vsp1: Reuse local variable instead of recomputing it
>   v4l: vsp1: Extract link creation to separate function
>   v4l: vsp1: Document the vsp1_pipeline structure
>   v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register name
>   v4l: vsp1: Set the SRU CTRL0 register when starting the stream
>   v4l: vsp1: Remove unused module write functions
>   v4l: vsp1: Move entity route setup function to vsp1_entity.c
>   v4l: vsp1: Make number of BRU inputs configurable
>   v4l: vsp1: Make the BRU optional
>   v4l: vsp1: Move format info to vsp1_pipe.c
>   v4l: vsp1: Make the userspace API optional
>   v4l: vsp1: Make pipeline inputs array index by RPF index
>   v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream
> handlers
>   v4l: vsp1: Don't validate links when the userspace API is disabled
>   v4l: vsp1: Add VSP+DU support
>   v4l: vsp1: Disconnect unused RPFs from the DRM pipeline
>   v4l: vsp1: Implement atomic update for the DRM driver
>   v4l: vsp1: Add support for the R-Car Gen3 VSP2
> 
> Takashi Saito (1):
>   v4l: vsp1: Add display list support
> 
>  .../devicetree/bindings/media/renesas,vsp1.txt |  11 +-
>  drivers/media/platform/vsp1/Makefile   |   3 +-
>  drivers/media/platform/vsp1/vsp1.h |  28 +
>  drivers/media/platform/vsp1/vsp1_bru.c |  33 +-
>  drivers/media/platform/vsp1/vsp1_bru.h |   3 +-
>  drivers/media/platform/vsp1/vsp1_dl.c  | 304 +++
>  drivers/media/platform/vsp1/vsp1_dl.h  |  42 ++
>  drivers/media/platform/vsp1/vsp1_drm.c | 595 ++
>  drivers/media/platform/vsp1/vsp1_drm.h |  38 ++
>  drivers/media/platform/vsp1/vsp1_drv.c | 255 +++--
>  drivers/media/platform/vsp1/vsp1_entity.c  |  31 +-
>  drivers/media/platform/vsp1/vsp1_entity.h  |  14 +-
>  drivers/media/platform/vsp1/vsp1_hsit.c|   2 +-
>  drivers/media/platform/vsp1/vsp1_lif.c |  11 +-
>  drivers/media/platform/vsp1/vsp1_lut.c |   7 +-
>  drivers/media/platform/vsp1/vsp1_pipe.c| 405 ++
>  drivers/media/platform/vsp1/vsp1_pipe.h| 134 +
>  drivers/media/platform/vsp1/vsp1_regs.h|  14 +-
>  drivers/media/platform/vsp1/vsp1_rpf.c |  77 ++-
>  drivers/media/platform/vsp1/vsp1_rwpf.h|  24 +-
>  drivers/media/platform/vsp1/vsp1_sru.c |   9 +-
>  drivers/media/platform/vsp1/vsp1_uds.c |   8 +-
>  drivers/media/platform/vsp1/vsp1_video.c   | 515 --
>  drivers/media/platform/vsp1/vsp1_video.h   | 110 +---
>  drivers/media/platform/vsp1/vsp1_wpf.c |  88 ++-
>  include/media/vsp1.h   |  33 ++
>  26 files changed, 2050 insertions(+), 744 deletions(-)
>  create mode 100644 drivers/media/platform/vsp1/vsp1_dl.c
>  create mode 100644 drivers/media/platform/vsp1/vsp1_dl.h
>  create mode 100644 drivers/media/platform/vsp1/vsp1_drm.c
>  create mode 100644 drivers/media/platform/vsp1/vsp1_drm.h
>  create mode 100644 drivers/media/platform/vsp1/vsp1_pipe.c
>  create mode 100644 drivers/media/platform/vsp1/vsp1_pipe.h
>  create mode 100644 include/media/vsp1.h

-- 

cron job: media_tree daily build: ERRORS

2015-09-13 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Mon Sep 14 04:00:33 CEST 2015
git branch: test
git hash:   9ddf9071ea17b83954358b2dac42b34e5857a9af
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-51-ga53cea2
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

linux-git-arm-at91: ERRORS
linux-git-arm-davinci: ERRORS
linux-git-arm-exynos: ERRORS
linux-git-arm-mx: ERRORS
linux-git-arm-omap: ERRORS
linux-git-arm-omap1: ERRORS
linux-git-arm-pxa: ERRORS
linux-git-blackfin-bf561: ERRORS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: ERRORS
linux-git-powerpc64: OK
linux-git-sh: ERRORS
linux-git-x86_64: OK
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: ERRORS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-rc1-i686: OK
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: ERRORS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: ERRORS
ABI WARNING: change for arm-at91
ABI WARNING: change for arm-davinci
ABI WARNING: change for arm-exynos
ABI WARNING: change for arm-mx
ABI WARNING: change for arm-omap
ABI WARNING: change for arm-omap1
ABI WARNING: change for arm-pxa
ABI WARNING: change for blackfin-bf561
ABI WARNING: change for mips
ABI WARNING: change for sh
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] [media] horus3a: Fix horus3a_attach() function parameters

2015-09-13 Thread Javier Martinez Canillas
If CONFIG_DVB_HORUS3A is disabled a stub static inline function is
defined that just prints a warning about the driver being disabled
but the function parameters were wrong which caused a build error.

Fixes: a5d32b358254f ("[media] horus3a: Sony Horus3A DVB-S/S2 tuner driver")
Reported-by: Fengguang Wu 
Signed-off-by: Javier Martinez Canillas 

---
The offending commit landed in v4.3-rc1 so this patch is -rc material.

Changes in v2:
- Added a Fixes tag which was forgotten on v1, sorry for the noise.

 drivers/media/dvb-frontends/horus3a.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/horus3a.h 
b/drivers/media/dvb-frontends/horus3a.h
index b055319d532e..c1e2d1834b78 100644
--- a/drivers/media/dvb-frontends/horus3a.h
+++ b/drivers/media/dvb-frontends/horus3a.h
@@ -46,8 +46,8 @@ extern struct dvb_frontend *horus3a_attach(struct 
dvb_frontend *fe,
const struct horus3a_config *config,
struct i2c_adapter *i2c);
 #else
-static inline struct dvb_frontend *horus3a_attach(
-   const struct cxd2820r_config *config,
+static inline struct dvb_frontend *horus3a_attach(struct dvb_frontend *fe,
+   const struct horus3a_config *config,
struct i2c_adapter *i2c)
 {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] lnbh25: Fix lnbh25_attach() function return type

2015-09-13 Thread Javier Martinez Canillas
If CONFIG_DVB_LNBH25 is disabled, a stub static inline function is
defined that just prints a warning about the driver being disabled
but the function return type was wrong which caused a build error.

Fixes: e025273b86fb ("[media] lnbh25: LNBH25 SEC controller driver")
Reported-by: Fengguang Wu 
Signed-off-by: Javier Martinez Canillas 

---
The offending commit landed in v4.3-rc1 so this patch is -rc material.

 drivers/media/dvb-frontends/lnbh25.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/lnbh25.h 
b/drivers/media/dvb-frontends/lnbh25.h
index 69f30e21f6b3..1f329ef05acc 100644
--- a/drivers/media/dvb-frontends/lnbh25.h
+++ b/drivers/media/dvb-frontends/lnbh25.h
@@ -43,7 +43,7 @@ struct dvb_frontend *lnbh25_attach(
struct lnbh25_config *cfg,
struct i2c_adapter *i2c);
 #else
-static inline dvb_frontend *lnbh25_attach(
+static inline struct dvb_frontend *lnbh25_attach(
struct dvb_frontend *fe,
struct lnbh25_config *cfg,
struct i2c_adapter *i2c)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH v4 1/8] [media] videobuf2: Replace videobuf2-core with videobuf2-v4l2

2015-09-13 Thread Junghak Sung



On 09/11/2015 05:02 PM, Hans Verkuil wrote:

On 09/09/2015 01:19 PM, Junghak Sung wrote:

Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
 echo $file
 sed "s/$str1/$str2/g" $file > $file.out
 mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"

Signed-off-by: Junghak Sung 
Signed-off-by: Geunyoung Kim 
Acked-by: Seung-Woo Kim 
Acked-by: Inki Dae 


Acked-by: Hans Verkuil 

However, see one small comment below:




diff --git a/include/media/videobuf2-dvb.h b/include/media/videobuf2-dvb.h
index 8f61456..bef9127 100644
--- a/include/media/videobuf2-dvb.h
+++ b/include/media/videobuf2-dvb.h
@@ -6,7 +6,7 @@
  #include 
  #include 
  #include 
-#include 
+#include 


I actually think this should remain core.h since videobuf2-dvb.c/h has
nothing to do with v4l2.

Regards,

Hans



I agree with you.
In this patch series, vb2_thread_*() are still remained in
videobuf2-v4l2, because vb2_tread_*() and vb2_fileio_*() have
dependencies on v4l2 and it is not easy to remove them completely.
I'll try to remove the dependencies and make
videobuf2-dvb to include videobuf2-core instead of videobuf2-v4l2
at next round.

Regards,
Junghak



  struct vb2_dvb {
/* filling that the job of the driver */




--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html