aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-07-19 15:25:39 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-07-19 15:42:47 +0200
commit020fc6eb424f7a594e3e3dc9b9e83f50111aa42b (patch)
treecb7bf10a0638ff4a0b28732540ba78a03edfdd0d
parent82079781a8b64120acfa714337bb3b87bcd960a5 (diff)
v4l-utils: update v4l2-tpg.patch
Update the patch for the v4l2 TPG so it is in sync with the latest media master. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--Makefile.am2
-rw-r--r--utils/common/v4l2-tpg.patch198
2 files changed, 108 insertions, 92 deletions
diff --git a/Makefile.am b/Makefile.am
index 3c3d3ce6..52eb8af9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,7 +53,7 @@ sync-with-kernel:
cp -a $(KERNEL_DIR)/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c $(top_srcdir)/utils/common
cp -a $(KERNEL_DIR)/include/media/tpg/v4l2-tpg.h $(top_srcdir)/utils/common
cp -a $(KERNEL_DIR)/include/media/fwht-ctrls.h $(top_srcdir)/utils/common
- patch -d $(top_srcdir) --no-backup-if-mismatch -p0 <$(top_srcdir)/utils/common/v4l2-tpg.patch
+ patch -d $(top_srcdir) --no-backup-if-mismatch -p1 <$(top_srcdir)/utils/common/v4l2-tpg.patch
cp -a $(KERNEL_DIR)/drivers/media/test-drivers/vicodec/codec-fwht.[ch] $(top_srcdir)/utils/common/
cp -a $(KERNEL_DIR)/drivers/media/test-drivers/vicodec/codec-v4l2-fwht.[ch] $(top_srcdir)/utils/common/
patch -d $(top_srcdir) --no-backup-if-mismatch -p1 <$(top_srcdir)/utils/common/codec-fwht.patch
diff --git a/utils/common/v4l2-tpg.patch b/utils/common/v4l2-tpg.patch
index 91b79842..831c820e 100644
--- a/utils/common/v4l2-tpg.patch
+++ b/utils/common/v4l2-tpg.patch
@@ -1,72 +1,22 @@
---- utils/common/v4l2-tpg.h.bak 2016-04-22 09:22:11.168936563 +0200
-+++ utils/common/v4l2-tpg.h 2016-04-22 09:23:07.337262639 +0200
-@@ -20,12 +20,58 @@
- #ifndef _V4L2_TPG_H_
- #define _V4L2_TPG_H_
+diff --git a/utils/common/v4l2-tpg-colors.c b/utils/common/v4l2-tpg-colors.c
+index a4341205..b4e257c2 100644
+--- a/utils/common/v4l2-tpg-colors.c
++++ b/utils/common/v4l2-tpg-colors.c
+@@ -24,7 +24,7 @@
+ */
--#include <linux/types.h>
--#include <linux/errno.h>
--#include <linux/random.h>
--#include <linux/slab.h>
--#include <linux/vmalloc.h>
#include <linux/videodev2.h>
-+
-+#include <stdbool.h>
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <string.h>
-+#include <errno.h>
-+
-+typedef __u32 u32;
-+typedef __u16 u16;
-+typedef __s16 s16;
-+typedef __u8 u8;
-+typedef __s8 s8;
-+
-+#ifndef __packed
-+#define __packed __attribute__((packed))
-+#endif
-+#define pr_info printf
-+#define noinline
-+
-+#ifndef min
-+#define min(a,b) ((a) < (b) ? (a) : (b))
-+#define max(a,b) ((a) > (b) ? (a) : (b))
-+#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)
-+{
-+ free(p);
-+}
-+
-+static inline void *vzalloc(unsigned long size)
-+{
-+ return calloc(1, size);
-+}
-+
-+#define clamp(val, min, max) ({ \
-+ typeof(val) __val = (val); \
-+ typeof(min) __min = (min); \
-+ typeof(max) __max = (max); \
-+ (void) (&__val == &__min); \
-+ (void) (&__val == &__max); \
-+ __val = __val < __min ? __min: __val; \
-+ __val > __max ? __max: __val; })
-+
-+static inline u32 prandom_u32_max(u32 ep_ro)
-+{
-+ return rand() % ep_ro;
-+}
+-#include <media/tpg/v4l2-tpg.h>
++#include "v4l2-tpg-colors.h"
- enum tpg_pattern {
- TPG_PAT_75_COLORBAR,
---- ../media-git/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c 2016-04-21 08:15:35.439610205 +0200
-+++ utils/common/v4l2-tpg-core.c 2016-04-22 09:29:50.955939090 +0200
-@@ -20,7 +18,6 @@
+ /* sRGB colors with range [0-255] */
+ const struct tpg_rbg_color8 tpg_colors[TPG_COLOR_MAX] = {
+diff --git a/utils/common/v4l2-tpg-core.c b/utils/common/v4l2-tpg-core.c
+index 630a75e0..44972222 100644
+--- a/utils/common/v4l2-tpg-core.c
++++ b/utils/common/v4l2-tpg-core.c
+@@ -8,8 +8,7 @@
+ * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*/
-#include <linux/module.h>
@@ -75,7 +25,7 @@
/* Must remain in sync with enum tpg_pattern */
const char * const tpg_pattern_strings[] = {
-@@ -49,7 +45,6 @@
+@@ -37,7 +36,6 @@ const char * const tpg_pattern_strings[] = {
"Noise",
NULL
};
@@ -83,7 +33,7 @@
/* Must remain in sync with enum tpg_aspect */
const char * const tpg_aspect_strings[] = {
-@@ -60,7 +55,6 @@
+@@ -48,7 +46,6 @@ const char * const tpg_aspect_strings[] = {
"16x9 Anamorphic",
NULL
};
@@ -91,7 +41,7 @@
/*
* Sine table: sin[0] = 127 * sin(-180 degrees)
-@@ -96,7 +90,6 @@
+@@ -84,7 +81,6 @@ void tpg_set_font(const u8 *f)
{
font8x16 = f;
}
@@ -99,15 +49,15 @@
void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
{
-@@ -118,7 +111,6 @@
- tpg->colorspace = V4L2_COLORSPACE_SRGB;
+@@ -107,7 +103,6 @@ void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
tpg->perc_fill = 100;
+ tpg->hsv_enc = V4L2_HSV_ENC_180;
}
-EXPORT_SYMBOL_GPL(tpg_init);
int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
{
-@@ -155,7 +147,6 @@
+@@ -149,7 +144,6 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
}
return 0;
}
@@ -115,7 +65,7 @@
void tpg_free(struct tpg_data *tpg)
{
-@@ -180,7 +171,6 @@
+@@ -174,7 +168,6 @@ void tpg_free(struct tpg_data *tpg)
tpg->random_line[plane] = NULL;
}
}
@@ -123,7 +73,7 @@
bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
{
-@@ -410,7 +400,6 @@
+@@ -466,7 +459,6 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
}
return true;
}
@@ -131,7 +81,7 @@
void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
const struct v4l2_rect *compose)
-@@ -426,7 +415,6 @@
+@@ -482,7 +474,6 @@ void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
tpg->scaled_width = 2;
tpg->recalc_lines = true;
}
@@ -139,7 +89,7 @@
void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height,
u32 field)
-@@ -451,7 +439,6 @@
+@@ -507,7 +498,6 @@ void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height,
(2 * tpg->hdownsampling[p]);
tpg->recalc_square_border = true;
}
@@ -147,7 +97,7 @@
static enum tpg_color tpg_get_textbg_color(struct tpg_data *tpg)
{
-@@ -1260,7 +1247,6 @@
+@@ -1528,7 +1518,6 @@ unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line)
return 0;
}
}
@@ -155,15 +105,23 @@
/* Return how many pattern lines are used by the current pattern. */
static unsigned tpg_get_pat_lines(const struct tpg_data *tpg)
-@@ -1736,7 +1722,6 @@
+@@ -2006,7 +1995,6 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
}
}
}
-EXPORT_SYMBOL_GPL(tpg_gen_text);
+ const char *tpg_g_color_order(const struct tpg_data *tpg)
+ {
+@@ -2030,7 +2018,6 @@ const char *tpg_g_color_order(const struct tpg_data *tpg)
+ return NULL;
+ }
+ }
+-EXPORT_SYMBOL_GPL(tpg_g_color_order);
+
void tpg_update_mv_step(struct tpg_data *tpg)
{
-@@ -1785,7 +1770,6 @@
+@@ -2079,7 +2066,6 @@ void tpg_update_mv_step(struct tpg_data *tpg)
if (factor < 0)
tpg->mv_vert_step = tpg->src_height - tpg->mv_vert_step;
}
@@ -171,7 +129,7 @@
/* Map the line number relative to the crop rectangle to a frame line number */
static unsigned tpg_calc_frameline(const struct tpg_data *tpg, unsigned src_y,
-@@ -1875,7 +1859,6 @@
+@@ -2171,7 +2157,6 @@ void tpg_calc_text_basep(struct tpg_data *tpg,
if (p == 0 && tpg->interleaved)
tpg_calc_text_basep(tpg, basep, 1, vbuf);
}
@@ -179,7 +137,7 @@
static int tpg_pattern_avg(const struct tpg_data *tpg,
unsigned pat1, unsigned pat2)
-@@ -1905,7 +1888,6 @@
+@@ -2223,7 +2208,6 @@ void tpg_log_status(struct tpg_data *tpg)
pr_info("tpg quantization: %d/%d\n", tpg->quantization, tpg->real_quantization);
pr_info("tpg RGB range: %d/%d\n", tpg->rgb_range, tpg->real_rgb_range);
}
@@ -187,7 +145,7 @@
/*
* This struct contains common parameters used by both the drawing of the
-@@ -2311,7 +2293,6 @@
+@@ -2629,7 +2613,6 @@ void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
vbuf + buf_line * params.stride);
}
}
@@ -195,7 +153,7 @@
void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf)
{
-@@ -2328,8 +2309,3 @@
+@@ -2646,8 +2629,3 @@ void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf)
offset += tpg_calc_plane_size(tpg, i);
}
}
@@ -204,14 +162,72 @@
-MODULE_DESCRIPTION("V4L2 Test Pattern Generator");
-MODULE_AUTHOR("Hans Verkuil");
-MODULE_LICENSE("GPL");
---- ../media-git/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c 2016-04-21 08:15:35.439610205 +0200
-+++ utils/common/v4l2-tpg-colors.c 2016-04-22 09:26:24.638509385 +0200
-@@ -36,7 +34,7 @@
- */
+diff --git a/utils/common/v4l2-tpg.h b/utils/common/v4l2-tpg.h
+index 0b0ddb87..91da74ec 100644
+--- a/utils/common/v4l2-tpg.h
++++ b/utils/common/v4l2-tpg.h
+@@ -8,13 +8,59 @@
+ #ifndef _V4L2_TPG_H_
+ #define _V4L2_TPG_H_
+-#include <linux/types.h>
+-#include <linux/errno.h>
+-#include <linux/random.h>
+-#include <linux/slab.h>
+-#include <linux/vmalloc.h>
#include <linux/videodev2.h>
--#include <media/tpg/v4l2-tpg.h>
-+#include "v4l2-tpg-colors.h"
- /* sRGB colors with range [0-255] */
- const struct color tpg_colors[TPG_COLOR_MAX] = {
++#include <stdbool.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
++#include <errno.h>
++
++typedef __u32 u32;
++typedef __u16 u16;
++typedef __s16 s16;
++typedef __u8 u8;
++typedef __s8 s8;
++
++#ifndef __packed
++#define __packed __attribute__((packed))
++#endif
++#define pr_info printf
++#define noinline
++
++#ifndef min
++#define min(a,b) ((a) < (b) ? (a) : (b))
++#define max(a,b) ((a) > (b) ? (a) : (b))
++#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)
++{
++ free(p);
++}
++
++static inline void *vzalloc(unsigned long size)
++{
++ return calloc(1, size);
++}
++
++#define clamp(val, min, max) ({ \
++ typeof(val) __val = (val); \
++ typeof(min) __min = (min); \
++ typeof(max) __max = (max); \
++ (void) (&__val == &__min); \
++ (void) (&__val == &__max); \
++ __val = __val < __min ? __min: __val; \
++ __val > __max ? __max: __val; })
++
++static inline u32 prandom_u32_max(u32 ep_ro)
++{
++ return rand() % ep_ro;
++}
++
+ struct tpg_rbg_color8 {
+ unsigned char r, g, b;
+ };

Privacy Policy