This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: v4l-utils: sync with media_tree master branch
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Wed Jul 25 14:44:35 2018 +0200

Update to the latest media public API.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

 contrib/freebsd/include/linux/v4l2-controls.h | 20 +++++++++++--
 contrib/freebsd/include/linux/videodev2.h     |  1 +
 contrib/test/ioctl-test.h                     |  4 +++
 contrib/test/ioctl_32.h                       |  4 +++
 contrib/test/ioctl_64.h                       |  4 +++
 contrib/xc3028-firmware/tuner-xc2028-types.h  |  2 +-
 include/linux/cec.h                           |  2 ++
 include/linux/media.h                         | 41 +++++++++++++++++++++------
 include/linux/v4l2-controls.h                 | 20 +++++++++++--
 include/linux/v4l2-subdev.h                   |  4 +++
 include/linux/videodev2.h                     |  1 +
 utils/common/v4l2-tpg-core.c                  | 15 ++++++----
 utils/common/v4l2-tpg.h                       |  2 ++
 13 files changed, 102 insertions(+), 18 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=6452647903618a848b3eabbca4288abb766ad1dd
diff --git a/contrib/freebsd/include/linux/v4l2-controls.h 
b/contrib/freebsd/include/linux/v4l2-controls.h
index 8d473c979b61..e4ee10ee917d 100644
--- a/contrib/freebsd/include/linux/v4l2-controls.h
+++ b/contrib/freebsd/include/linux/v4l2-controls.h
@@ -188,7 +188,7 @@ enum v4l2_colorfx {
 
 /* The base for the imx driver controls.
  * We reserve 16 controls for this driver. */
-#define V4L2_CID_USER_IMX_BASE                 (V4L2_CID_USER_BASE + 0x1090)
+#define V4L2_CID_USER_IMX_BASE                 (V4L2_CID_USER_BASE + 0x10b0)
 
 /* MPEG-class control IDs */
 /* The MPEG controls are applicable to all codec controls
@@ -587,7 +587,23 @@ enum v4l2_vp8_golden_frame_sel {
 #define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP                 (V4L2_CID_MPEG_BASE+508)
 #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP             (V4L2_CID_MPEG_BASE+509)
 #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP             (V4L2_CID_MPEG_BASE+510)
-#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE                        
(V4L2_CID_MPEG_BASE+511)
+
+#define V4L2_CID_MPEG_VIDEO_VP8_PROFILE                        
(V4L2_CID_MPEG_BASE+511)
+enum v4l2_mpeg_video_vp8_profile {
+       V4L2_MPEG_VIDEO_VP8_PROFILE_0                           = 0,
+       V4L2_MPEG_VIDEO_VP8_PROFILE_1                           = 1,
+       V4L2_MPEG_VIDEO_VP8_PROFILE_2                           = 2,
+       V4L2_MPEG_VIDEO_VP8_PROFILE_3                           = 3,
+};
+/* Deprecated alias for compatibility reasons. */
+#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE        V4L2_CID_MPEG_VIDEO_VP8_PROFILE
+#define V4L2_CID_MPEG_VIDEO_VP9_PROFILE                        
(V4L2_CID_MPEG_BASE+512)
+enum v4l2_mpeg_video_vp9_profile {
+       V4L2_MPEG_VIDEO_VP9_PROFILE_0                           = 0,
+       V4L2_MPEG_VIDEO_VP9_PROFILE_1                           = 1,
+       V4L2_MPEG_VIDEO_VP9_PROFILE_2                           = 2,
+       V4L2_MPEG_VIDEO_VP9_PROFILE_3                           = 3,
+};
 
 /* CIDs for HEVC encoding. */
 
diff --git a/contrib/freebsd/include/linux/videodev2.h 
b/contrib/freebsd/include/linux/videodev2.h
index 4993560ecba6..84e60c6d3485 100644
--- a/contrib/freebsd/include/linux/videodev2.h
+++ b/contrib/freebsd/include/linux/videodev2.h
@@ -666,6 +666,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_VP8      v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
 #define V4L2_PIX_FMT_VP9      v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
 #define V4L2_PIX_FMT_HEVC     v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka 
H.265 */
+#define V4L2_PIX_FMT_FWHT     v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh 
Hadamard Transform (vicodec) */
 
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
diff --git a/contrib/test/ioctl-test.h b/contrib/test/ioctl-test.h
index 82df4d7aad6b..d6d10251ca2a 100644
--- a/contrib/test/ioctl-test.h
+++ b/contrib/test/ioctl-test.h
@@ -180,6 +180,7 @@ static const struct {
        ioc(video, VIDIOC_STREAMOFF),                                           
        /*  int */
        ioc(video, VIDIOC_STREAMON),                                            
        /*  int */
        ioc(subdev, VIDIOC_SUBDEV_DV_TIMINGS_CAP),                              
        /*  struct v4l2_dv_timings_cap */
+       ioc(subdev, VIDIOC_SUBDEV_ENUMSTD),                                     
        /*  struct v4l2_standard */
        ioc(subdev, VIDIOC_SUBDEV_ENUM_DV_TIMINGS),                             
        /*  struct v4l2_enum_dv_timings */
        ioc(subdev, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL),                         
        /*  struct v4l2_subdev_frame_interval_enum */
        ioc(subdev, VIDIOC_SUBDEV_ENUM_FRAME_SIZE),                             
        /*  struct v4l2_subdev_frame_size_enum */
@@ -190,6 +191,8 @@ static const struct {
        ioc(subdev, VIDIOC_SUBDEV_G_FMT),                                       
        /*  struct v4l2_subdev_format */
        ioc(subdev, VIDIOC_SUBDEV_G_FRAME_INTERVAL),                            
        /*  struct v4l2_subdev_frame_interval */
        ioc(subdev, VIDIOC_SUBDEV_G_SELECTION),                                 
        /*  struct v4l2_subdev_selection */
+       ioc(subdev, VIDIOC_SUBDEV_G_STD),                                       
        /*  v4l2_std_id */
+       ioc(subdev, VIDIOC_SUBDEV_QUERYSTD),                                    
        /*  v4l2_std_id */
        ioc(subdev, VIDIOC_SUBDEV_QUERY_DV_TIMINGS),                            
        /*  struct v4l2_dv_timings */
        ioc(subdev, VIDIOC_SUBDEV_S_CROP),                                      
        /*  struct v4l2_subdev_crop */
        ioc(subdev, VIDIOC_SUBDEV_S_DV_TIMINGS),                                
        /*  struct v4l2_dv_timings */
@@ -197,6 +200,7 @@ static const struct {
        ioc(subdev, VIDIOC_SUBDEV_S_FMT),                                       
        /*  struct v4l2_subdev_format */
        ioc(subdev, VIDIOC_SUBDEV_S_FRAME_INTERVAL),                            
        /*  struct v4l2_subdev_frame_interval */
        ioc(subdev, VIDIOC_SUBDEV_S_SELECTION),                                 
        /*  struct v4l2_subdev_selection */
+       ioc(subdev, VIDIOC_SUBDEV_S_STD),                                       
        /*  v4l2_std_id */
        ioc(video, VIDIOC_SUBSCRIBE_EVENT),                                     
        /*  struct v4l2_event_subscription */
        ioc(video, VIDIOC_S_AUDIO),                                             
        /*  struct v4l2_audio */
        ioc(video, VIDIOC_S_AUDOUT),                                            
        /*  struct v4l2_audioout */
diff --git a/contrib/test/ioctl_32.h b/contrib/test/ioctl_32.h
index 1252550d007c..6efca41b62b2 100644
--- a/contrib/test/ioctl_32.h
+++ b/contrib/test/ioctl_32.h
@@ -92,6 +92,7 @@
 #define CMD32_VIDIOC_STREAMOFF 0x40045613
 #define CMD32_VIDIOC_STREAMON 0x40045612
 #define CMD32_VIDIOC_SUBDEV_DV_TIMINGS_CAP 0xc0905664
+#define CMD32_VIDIOC_SUBDEV_ENUMSTD 0xc0405619
 #define CMD32_VIDIOC_SUBDEV_ENUM_DV_TIMINGS 0xc0945662
 #define CMD32_VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL 0xc040564b
 #define CMD32_VIDIOC_SUBDEV_ENUM_FRAME_SIZE 0xc040564a
@@ -102,6 +103,8 @@
 #define CMD32_VIDIOC_SUBDEV_G_FMT 0xc0585604
 #define CMD32_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615
 #define CMD32_VIDIOC_SUBDEV_G_SELECTION 0xc040563d
+#define CMD32_VIDIOC_SUBDEV_G_STD 0x80085617
+#define CMD32_VIDIOC_SUBDEV_QUERYSTD 0x8008563f
 #define CMD32_VIDIOC_SUBDEV_QUERY_DV_TIMINGS 0x80845663
 #define CMD32_VIDIOC_SUBDEV_S_CROP 0xc038563c
 #define CMD32_VIDIOC_SUBDEV_S_DV_TIMINGS 0xc0845657
@@ -109,6 +112,7 @@
 #define CMD32_VIDIOC_SUBDEV_S_FMT 0xc0585605
 #define CMD32_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616
 #define CMD32_VIDIOC_SUBDEV_S_SELECTION 0xc040563e
+#define CMD32_VIDIOC_SUBDEV_S_STD 0x40085618
 #define CMD32_VIDIOC_SUBSCRIBE_EVENT 0x4020565a
 #define CMD32_VIDIOC_S_AUDIO 0x40345622
 #define CMD32_VIDIOC_S_AUDOUT 0x40345632
diff --git a/contrib/test/ioctl_64.h b/contrib/test/ioctl_64.h
index 8becd4d9a490..d769be7c7bc7 100644
--- a/contrib/test/ioctl_64.h
+++ b/contrib/test/ioctl_64.h
@@ -92,6 +92,7 @@
 #define CMD64_VIDIOC_STREAMOFF 0x40045613
 #define CMD64_VIDIOC_STREAMON 0x40045612
 #define CMD64_VIDIOC_SUBDEV_DV_TIMINGS_CAP 0xc0905664
+#define CMD64_VIDIOC_SUBDEV_ENUMSTD 0xc0485619
 #define CMD64_VIDIOC_SUBDEV_ENUM_DV_TIMINGS 0xc0945662
 #define CMD64_VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL 0xc040564b
 #define CMD64_VIDIOC_SUBDEV_ENUM_FRAME_SIZE 0xc040564a
@@ -102,6 +103,8 @@
 #define CMD64_VIDIOC_SUBDEV_G_FMT 0xc0585604
 #define CMD64_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615
 #define CMD64_VIDIOC_SUBDEV_G_SELECTION 0xc040563d
+#define CMD64_VIDIOC_SUBDEV_G_STD 0x80085617
+#define CMD64_VIDIOC_SUBDEV_QUERYSTD 0x8008563f
 #define CMD64_VIDIOC_SUBDEV_QUERY_DV_TIMINGS 0x80845663
 #define CMD64_VIDIOC_SUBDEV_S_CROP 0xc038563c
 #define CMD64_VIDIOC_SUBDEV_S_DV_TIMINGS 0xc0845657
@@ -109,6 +112,7 @@
 #define CMD64_VIDIOC_SUBDEV_S_FMT 0xc0585605
 #define CMD64_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616
 #define CMD64_VIDIOC_SUBDEV_S_SELECTION 0xc040563e
+#define CMD64_VIDIOC_SUBDEV_S_STD 0x40085618
 #define CMD64_VIDIOC_SUBSCRIBE_EVENT 0x4020565a
 #define CMD64_VIDIOC_S_AUDIO 0x40345622
 #define CMD64_VIDIOC_S_AUDOUT 0x40345632
diff --git a/contrib/xc3028-firmware/tuner-xc2028-types.h 
b/contrib/xc3028-firmware/tuner-xc2028-types.h
index bb0437c36c03..50d017a4822a 100644
--- a/contrib/xc3028-firmware/tuner-xc2028-types.h
+++ b/contrib/xc3028-firmware/tuner-xc2028-types.h
@@ -5,7 +5,7 @@
  * This file includes internal tipes to be used inside tuner-xc2028.
  * Shouldn't be included outside tuner-xc2028
  *
- * Copyright (c) 2007-2008 Mauro Carvalho Chehab (mche...@infradead.org)
+ * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mche...@kernel.org>
  */
 
 /* xc3028 firmware types */
diff --git a/include/linux/cec.h b/include/linux/cec.h
index 20fe091b7e96..097fcd812471 100644
--- a/include/linux/cec.h
+++ b/include/linux/cec.h
@@ -384,6 +384,8 @@ struct cec_log_addrs {
 #define CEC_EVENT_PIN_CEC_HIGH         4
 #define CEC_EVENT_PIN_HPD_LOW          5
 #define CEC_EVENT_PIN_HPD_HIGH         6
+#define CEC_EVENT_PIN_5V_LOW           7
+#define CEC_EVENT_PIN_5V_HIGH          8
 
 #define CEC_EVENT_FL_INITIAL_STATE     (1 << 0)
 #define CEC_EVENT_FL_DROPPED_EVENTS    (1 << 1)
diff --git a/include/linux/media.h b/include/linux/media.h
index 11dd72fdcca5..57f00bcca1de 100644
--- a/include/linux/media.h
+++ b/include/linux/media.h
@@ -88,12 +88,6 @@ struct media_device_info {
 #define MEDIA_ENT_F_LENS                       (MEDIA_ENT_F_OLD_SUBDEV_BASE + 
3)
 
 /*
- * Video decoder functions
- */
-#define MEDIA_ENT_F_ATV_DECODER                        
(MEDIA_ENT_F_OLD_SUBDEV_BASE + 4)
-#define MEDIA_ENT_F_DTV_DECODER                        (MEDIA_ENT_F_BASE + 
0x6001)
-
-/*
  * Digital TV, analog TV, radio and/or software defined radio tuner functions.
  *
  * It is a responsibility of the master/bridge drivers to add connectors
@@ -130,6 +124,8 @@ struct media_device_info {
 #define MEDIA_ENT_F_PROC_VIDEO_LUT             (MEDIA_ENT_F_BASE + 0x4004)
 #define MEDIA_ENT_F_PROC_VIDEO_SCALER          (MEDIA_ENT_F_BASE + 0x4005)
 #define MEDIA_ENT_F_PROC_VIDEO_STATISTICS      (MEDIA_ENT_F_BASE + 0x4006)
+#define MEDIA_ENT_F_PROC_VIDEO_ENCODER         (MEDIA_ENT_F_BASE + 0x4007)
+#define MEDIA_ENT_F_PROC_VIDEO_DECODER         (MEDIA_ENT_F_BASE + 0x4008)
 
 /*
  * Switch and bridge entity functions
@@ -137,6 +133,13 @@ struct media_device_info {
 #define MEDIA_ENT_F_VID_MUX                    (MEDIA_ENT_F_BASE + 0x5001)
 #define MEDIA_ENT_F_VID_IF_BRIDGE              (MEDIA_ENT_F_BASE + 0x5002)
 
+/*
+ * Video decoder/encoder functions
+ */
+#define MEDIA_ENT_F_ATV_DECODER                        
(MEDIA_ENT_F_OLD_SUBDEV_BASE + 4)
+#define MEDIA_ENT_F_DV_DECODER                 (MEDIA_ENT_F_BASE + 0x6001)
+#define MEDIA_ENT_F_DV_ENCODER                 (MEDIA_ENT_F_BASE + 0x6002)
+
 /* Entity flags */
 #define MEDIA_ENT_FL_DEFAULT                   (1 << 0)
 #define MEDIA_ENT_FL_CONNECTOR                 (1 << 1)
@@ -261,11 +264,21 @@ struct media_links_enum {
  * MC next gen API definitions
  */
 
+/*
+ * Appeared in 4.19.0.
+ *
+ * The media_version argument comes from the media_version field in
+ * struct media_device_info.
+ */
+#define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \
+       ((media_version) >= ((4 << 16) | (19 << 8) | 0))
+
 struct media_v2_entity {
        __u32 id;
        char name[64];
        __u32 function;         /* Main function of the entity */
-       __u32 reserved[6];
+       __u32 flags;
+       __u32 reserved[5];
 } __attribute__ ((packed));
 
 /* Should match the specific fields at media_intf_devnode */
@@ -286,11 +299,21 @@ struct media_v2_interface {
        };
 } __attribute__ ((packed));
 
+/*
+ * Appeared in 4.19.0.
+ *
+ * The media_version argument comes from the media_version field in
+ * struct media_device_info.
+ */
+#define MEDIA_V2_PAD_HAS_INDEX(media_version) \
+       ((media_version) >= ((4 << 16) | (19 << 8) | 0))
+
 struct media_v2_pad {
        __u32 id;
        __u32 entity_id;
        __u32 flags;
-       __u32 reserved[5];
+       __u32 index;
+       __u32 reserved[4];
 } __attribute__ ((packed));
 
 struct media_v2_link {
@@ -360,6 +383,8 @@ struct media_v2_topology {
 #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER                MEDIA_ENT_F_ATV_DECODER
 #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER          MEDIA_ENT_F_TUNER
 
+#define MEDIA_ENT_F_DTV_DECODER                        MEDIA_ENT_F_DV_DECODER
+
 /*
  * There is still no ALSA support in the media controller. These
  * defines should not have been added and we leave them here only
diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
index 8d473c979b61..e4ee10ee917d 100644
--- a/include/linux/v4l2-controls.h
+++ b/include/linux/v4l2-controls.h
@@ -188,7 +188,7 @@ enum v4l2_colorfx {
 
 /* The base for the imx driver controls.
  * We reserve 16 controls for this driver. */
-#define V4L2_CID_USER_IMX_BASE                 (V4L2_CID_USER_BASE + 0x1090)
+#define V4L2_CID_USER_IMX_BASE                 (V4L2_CID_USER_BASE + 0x10b0)
 
 /* MPEG-class control IDs */
 /* The MPEG controls are applicable to all codec controls
@@ -587,7 +587,23 @@ enum v4l2_vp8_golden_frame_sel {
 #define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP                 (V4L2_CID_MPEG_BASE+508)
 #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP             (V4L2_CID_MPEG_BASE+509)
 #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP             (V4L2_CID_MPEG_BASE+510)
-#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE                        
(V4L2_CID_MPEG_BASE+511)
+
+#define V4L2_CID_MPEG_VIDEO_VP8_PROFILE                        
(V4L2_CID_MPEG_BASE+511)
+enum v4l2_mpeg_video_vp8_profile {
+       V4L2_MPEG_VIDEO_VP8_PROFILE_0                           = 0,
+       V4L2_MPEG_VIDEO_VP8_PROFILE_1                           = 1,
+       V4L2_MPEG_VIDEO_VP8_PROFILE_2                           = 2,
+       V4L2_MPEG_VIDEO_VP8_PROFILE_3                           = 3,
+};
+/* Deprecated alias for compatibility reasons. */
+#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE        V4L2_CID_MPEG_VIDEO_VP8_PROFILE
+#define V4L2_CID_MPEG_VIDEO_VP9_PROFILE                        
(V4L2_CID_MPEG_BASE+512)
+enum v4l2_mpeg_video_vp9_profile {
+       V4L2_MPEG_VIDEO_VP9_PROFILE_0                           = 0,
+       V4L2_MPEG_VIDEO_VP9_PROFILE_1                           = 1,
+       V4L2_MPEG_VIDEO_VP9_PROFILE_2                           = 2,
+       V4L2_MPEG_VIDEO_VP9_PROFILE_3                           = 3,
+};
 
 /* CIDs for HEVC encoding. */
 
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index c95a53e6743c..03970ce30741 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -170,8 +170,12 @@ struct v4l2_subdev_selection {
 #define VIDIOC_SUBDEV_G_SELECTION              _IOWR('V', 61, struct 
v4l2_subdev_selection)
 #define VIDIOC_SUBDEV_S_SELECTION              _IOWR('V', 62, struct 
v4l2_subdev_selection)
 /* The following ioctls are identical to the ioctls in videodev2.h */
+#define VIDIOC_SUBDEV_G_STD                    _IOR('V', 23, v4l2_std_id)
+#define VIDIOC_SUBDEV_S_STD                    _IOW('V', 24, v4l2_std_id)
+#define VIDIOC_SUBDEV_ENUMSTD                  _IOWR('V', 25, struct 
v4l2_standard)
 #define VIDIOC_SUBDEV_G_EDID                   _IOWR('V', 40, struct v4l2_edid)
 #define VIDIOC_SUBDEV_S_EDID                   _IOWR('V', 41, struct v4l2_edid)
+#define VIDIOC_SUBDEV_QUERYSTD                 _IOR('V', 63, v4l2_std_id)
 #define VIDIOC_SUBDEV_S_DV_TIMINGS             _IOWR('V', 87, struct 
v4l2_dv_timings)
 #define VIDIOC_SUBDEV_G_DV_TIMINGS             _IOWR('V', 88, struct 
v4l2_dv_timings)
 #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS          _IOWR('V', 98, struct 
v4l2_enum_dv_timings)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index a9e07d7f902b..bb3a2c6bbb6c 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -632,6 +632,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_VP8      v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
 #define V4L2_PIX_FMT_VP9      v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
 #define V4L2_PIX_FMT_HEVC     v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka 
H.265 */
+#define V4L2_PIX_FMT_FWHT     v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh 
Hadamard Transform (vicodec) */
 
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
diff --git a/utils/common/v4l2-tpg-core.c b/utils/common/v4l2-tpg-core.c
index eca22db7b83c..e4e65a21c822 100644
--- a/utils/common/v4l2-tpg-core.c
+++ b/utils/common/v4l2-tpg-core.c
@@ -114,12 +114,14 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
                for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
                        unsigned pixelsz = plane ? 2 : 4;
 
-                       tpg->lines[pat][plane] = vzalloc(max_w * 2 * pixelsz);
+                       tpg->lines[pat][plane] =
+                               vzalloc(array3_size(max_w, 2, pixelsz));
                        if (!tpg->lines[pat][plane])
                                return -ENOMEM;
                        if (plane == 0)
                                continue;
-                       tpg->downsampled_lines[pat][plane] = vzalloc(max_w * 2 
* pixelsz);
+                       tpg->downsampled_lines[pat][plane] =
+                               vzalloc(array3_size(max_w, 2, pixelsz));
                        if (!tpg->downsampled_lines[pat][plane])
                                return -ENOMEM;
                }
@@ -127,13 +129,16 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
        for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
                unsigned pixelsz = plane ? 2 : 4;
 
-               tpg->contrast_line[plane] = vzalloc(max_w * pixelsz);
+               tpg->contrast_line[plane] =
+                       vzalloc(array_size(pixelsz, max_w));
                if (!tpg->contrast_line[plane])
                        return -ENOMEM;
-               tpg->black_line[plane] = vzalloc(max_w * pixelsz);
+               tpg->black_line[plane] =
+                       vzalloc(array_size(pixelsz, max_w));
                if (!tpg->black_line[plane])
                        return -ENOMEM;
-               tpg->random_line[plane] = vzalloc(max_w * 2 * pixelsz);
+               tpg->random_line[plane] =
+                       vzalloc(array3_size(max_w, 2, pixelsz));
                if (!tpg->random_line[plane])
                        return -ENOMEM;
        }
diff --git a/utils/common/v4l2-tpg.h b/utils/common/v4l2-tpg.h
index 782d304d294d..c07c60aa9cd6 100644
--- a/utils/common/v4l2-tpg.h
+++ b/utils/common/v4l2-tpg.h
@@ -32,6 +32,8 @@ typedef __s8 s8;
 #endif /* !min */
 #define min3(x, y, z) min((typeof(x))min(x, y), z)
 #define max3(x, y, z) max((typeof(x))max(x, y), z)
+#define array_size(a, b) ((a) * (b))
+#define array3_size(a, b, c) ((a) * (b) * (c))
 
 static inline void vfree(void *p)
 {

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to