Xilinx 8-bit color depth YCbCr 4:2:0 media bus format
cover Xilinx 8-bit color depth YCbCr 4:2:0 media bus format
This patch set adds a vendor specific custom YCbCr 4:2:0 format. The way Xilinx Video IP sends data over the bus makes it unrepresented by existing media bus formats.
YCbCr 4:2:0 transmission over the bus does not slice Chroma and Luma components over the bus width. Instead it sends sub-sampled Chroma when present along with the Luma component, otherwise zero padded Luma only data is sent.
The first patch (1/3) adds the format to the uapi header file. The second patch (2/3) adds the format to the table in xilinx-vip.c. The third patch (3/3) updates the subdev format doc file.
Rohit Athavale (3):
uapi: media-bus-format: Add Xilinx specific YCbCr 4:2:0 media bus
format
media: xilinx-vip: Add 8-bit YCbCr 4:2:0 to formats table
Documentation: subdev-formats: Add Xilinx YCbCr to Vendor specific
area
Documentation/media/uapi/v4l/subdev-formats.rst | 5 +++++ drivers/media/platform/xilinx/xilinx-vip.c | 3 +++ include/uapi/linux/media-bus-format.h | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.1
PATCH 1/3 uapi: media-bus-format: Add Xilinx specific YCbCr 4:2:0 media bus format
This commit adds Xilinx Video IP specific 8-bit color depth YCbCr 4:2:0 to the media bus format uapi.
--- include/uapi/linux/media-bus-format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/media-bus-format.h +3 -1
@@ -143,10 +143,12 @@/* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 -/* Vendor specific formats - next is 0x5002 */ +/* Vendor specific formats - next is 0x5003 */ /* S5C73M3 sensor specific interleaved UYVY and JPEG */ #define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001 +/* Xilinx IP Specific 8-bit YCbCr 4:2:0 */ +#define MEDIA_BUS_FMT_XLNX8_VUY420_1X24 0x5002/* HSV - next is 0x6002 */ #define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001
Signature · 1 line
1.9.1
PATCH 3/3 Documentation: subdev-formats: Add Xilinx YCbCr to Vendor specific area
In reply to Rohit AthavaleThis commit adds the custom Xilinx IP specific 8-bit YCbCr 4:2:0 to the custom formats area in the subdev-formats documentation.
--- Documentation/media/uapi/v4l/subdev-formats.rst | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/media/uapi/v4l/subdev-formats.rst +5 -0
@@ -7483,3 +7483,8 @@ formats. - 0x5001 - Interleaved raw UYVY and JPEG image format with embedded meta-data used by Samsung S3C73MX camera sensors. + * .. _MEDIA_BUS_FMT_XLNX8_VUY420_1X24: + + - MEDIA_BUS_FMT_XLNX8_VUY420_1X24 + - 0x5002 + - Xilinx IP specific 8-bit color depth YCbCr 4:2:0 used by Xilinx Video IP.
Signature · 1 line
1.9.1
PATCH 2/3 media: xilinx-vip: Add 8-bit YCbCr 4:2:0 to formats table
In reply to Rohit AthavaleAdd Xilinx YCbCr 4:2:0 to xvip formats table. This commit will allow driver to setup media pad codes to YUV 420 via DT properties.
--- drivers/media/platform/xilinx/xilinx-vip.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/xilinx/xilinx-vip.c +3 -0
@@ -15,6 +15,7 @@#include <linux/clk.h> #include <linux/export.h> #include <linux/kernel.h> +#include <linux/media-bus-format.h> #include <linux/of.h> #include <linux/platform_device.h>
@@ -27,6 +28,8 @@*/ static const struct xvip_video_format xvip_video_formats[] = { + {XVIP_VF_YUV_420 ,8 ,NULL ,MEDIA_BUS_FMT_XLNX8_VUY420_1X24 , +2 ,V4L2_PIX_FMT_NV12 ,"4:2:0, semi-planar, YUYV" }, {XVIP_VF_YUV_422 ,8 ,NULL ,MEDIA_BUS_FMT_UYVY8_1X16 ,2 ,V4L2_PIX_FMT_YUYV ,"4:2:2, packed, YUYV" }, {XVIP_VF_YUV_444 ,8 ,NULL ,MEDIA_BUS_FMT_VUY8_1X24 ,
Signature · 1 line
1.9.1
Laurent Pinchart
maintainerRe: [PATCH 2/3] media: xilinx-vip: Add 8-bit YCbCr 4:2:0 to formats table
Hi Rohit,
Thank you for the patch.
Quoted 14 lines · On Wednesday 09 Aug 2017 11:27:53 Rohit Athavale wrote:
Add Xilinx YCbCr 4:2:0 to xvip formats table. This commit will allow driver to setup media pad codes to YUV 420 via DT properties.
Signed-off-by Rohit Athavale <[email protected]>--- drivers/media/platform/xilinx/xilinx-vip.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/media/platform/xilinx/xilinx-vip.cindex 3112591..37b80bf 100644
drivers/media/platform/xilinx/xilinx-vip.c line 18
Quoted 4 lines
drivers/media/platform/xilinx/xilinx-vip.c +1
-0@@ -15,6 +15,7 @@#include <linux/clk.h> #include <linux/export.h> #include <linux/kernel.h> +#include <linux/media-bus-format.h>
I'm pretty sure the file is included indirectly already, so this isn't strictly needed, but it shouldn't hurt either.
drivers/media/platform/xilinx/xilinx-vip.c line 32
Quoted 9 lines
drivers/media/platform/xilinx/xilinx-vip.c +2
-0#include <linux/of.h> #include <linux/platform_device.h> @@ -27,6 +28,8 @@*/ static const struct xvip_video_format xvip_video_formats[] = { + {XVIP_VF_YUV_420 ,8 ,NULL ,MEDIA_BUS_FMT_XLNX8_VUY420_1X24 , +2 ,V4L2_PIX_FMT_NV12 ,"4:2:0, semi-planar, YUYV" },
You're mapping XVIP_VF_YUV_420 to V4L2_PIX_FMT_NV12 which has an average bpp of 1.5 bytes per pixel, but you're setting bpp to 2. How does that work ? You obviously can't express a 1.5 bpp currently in the driver, so we might need to extend the xvip_video_format structure with additional fields (for instance turning bytes per pixel into bits per pixel, but we might need per-plane information too).
On a side note, how does this work with VDMA ? The latest VDMA version I checked (v6.2, a while ago) didn't seem to support planar formats. Has it changed in more recent versions ? Doesn't it require changes in the xilinx-vip driver ?
Quoted 3 lines
drivers/media/platform/xilinx/xilinx-vip.c +0
-0{XVIP_VF_YUV_422 ,8 ,NULL ,MEDIA_BUS_FMT_UYVY8_1X16 , 2, V4L2_PIX_FMT_YUYV, "4:2:2, packed, YUYV" }, { XVIP_VF_YUV_444, 8, NULL, MEDIA_BUS_FMT_VUY8_1X24,
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerRe: [PATCH 1/3] uapi: media-bus-format: Add Xilinx specific YCbCr 4:2:0 media bus format
In reply to Rohit AthavaleHi Rohit,
Thank you for the patch.
Quoted 13 lines · On Wednesday 09 Aug 2017 11:27:52 Rohit Athavale wrote:
This commit adds Xilinx Video IP specific 8-bit color depth YCbCr 4:2:0 to the media bus format uapi.
Signed-off-by Rohit Athavale <[email protected]>--- include/uapi/linux/media-bus-format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/include/uapi/linux/media-bus-format.hindex ef6fb30..6f65607 100644
include/uapi/linux/media-bus-format.h line 151
Quoted 10 lines
include/uapi/linux/media-bus-format.h +3
-1@@ -143,10 +143,12 @@/* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 -/* Vendor specific formats - next is 0x5002 */ +/* Vendor specific formats - next is 0x5003 */ /* S5C73M3 sensor specific interleaved UYVY and JPEG */ #define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001 +/* Xilinx IP Specific 8-bit YCbCr 4:2:0 */ +#define MEDIA_BUS_FMT_XLNX8_VUY420_1X24 0x5002
Is this really a Xilinx-specific format ? I think it would make sense to define it as a standard YUV format.
Quoted 2 lines
include/uapi/linux/media-bus-format.h +0
-0/* HSV - next is 0x6002 */ #define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerRe: [PATCH 3/3] Documentation: subdev-formats: Add Xilinx YCbCr to Vendor specific area
In reply to Rohit AthavaleHi Rohit,
Thank you for the patch.
Quoted 22 lines · On Wednesday 09 Aug 2017 11:27:54 Rohit Athavale wrote:
This commit adds the custom Xilinx IP specific 8-bit YCbCr 4:2:0 to the custom formats area in the subdev-formats documentation.
Signed-off-by Rohit Athavale <[email protected]>--- Documentation/media/uapi/v4l/subdev-formats.rst | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/Documentation/media/uapi/v4l/subdev-formats.rstindex 8e73bb0..141a837 100644Documentation/media/uapi/v4l/subdev-formats.rst +5
-0@@ -7483,3 +7483,8 @@ formats. - 0x5001 - Interleaved raw UYVY and JPEG image format with embedded meta-data used by Samsung S3C73MX camera sensors. + * .. _MEDIA_BUS_FMT_XLNX8_VUY420_1X24: + + - MEDIA_BUS_FMT_XLNX8_VUY420_1X24 + - 0x5002 + - Xilinx IP specific 8-bit color depth YCbCr 4:2:0 used by Xilinx
Quoted 1 line
Video IP.
You need to document this format in more details, with a table explaining how bits are transferred on the bus, the same way the standard YUV formats are documented.
Signature · 3 lines
Regards, Laurent Pinchart