Use highp float percision only in YUY2 color convert shaders.
Ported from https://coral.googlesource.com/imx-gst-plugins-base/+/80e1febe8ca63da591e536d2d2071bac29f4d214%5E%21/#F0
Fix the gl render artifact from YUY2 to BGRA
Change-Id: Ic2a2d9f369dc9caeab4399ef7b7854c64b82dd1b
diff --git a/debian/patches/0003-gl-colorconvert-yuy2.patch b/debian/patches/0003-gl-colorconvert-yuy2.patch
new file mode 100644
index 0000000..c8acc1d
--- /dev/null
+++ b/debian/patches/0003-gl-colorconvert-yuy2.patch
@@ -0,0 +1,41 @@
+diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
+index 60d9653a..b493a325 100644
+--- a/gst-libs/gst/gl/gstglcolorconvert.c
++++ b/gst-libs/gst/gl/gstglcolorconvert.c
+@@ -137,6 +137,18 @@ static const gfloat from_rgb_bt709_vcoeff[] = {0.440654f, -0.400285f, -0.040370f
+ "uniform float poffset_x;\n" \
+ "uniform float poffset_y;\n"
+
++#define DEFAULT_UNIFORMS_HIGH \
++ "#ifdef GL_ES\n" \
++ "precision highp float;\n" \
++ "#endif\n" \
++ "uniform vec2 tex_scale0;\n" \
++ "uniform vec2 tex_scale1;\n" \
++ "uniform vec2 tex_scale2;\n" \
++ "uniform float width;\n" \
++ "uniform float height;\n" \
++ "uniform float poffset_x;\n" \
++ "uniform float poffset_y;\n"
++
+ #define MAX_FUNCTIONS 4
+
+ #define glsl_OES_extension_string "#extension GL_OES_EGL_image_external : require \n"
+@@ -356,7 +368,7 @@ static const gchar templ_YUY2_UYVY_to_RGB_BODY[] =
+
+ static const struct shader_templ templ_YUY2_UYVY_to_RGB =
+ { NULL,
+- DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex;\n",
++ DEFAULT_UNIFORMS_HIGH YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex;\n",
+ { glsl_func_yuv_to_rgb, NULL, },
+ GST_GL_TEXTURE_TARGET_2D
+ };
+@@ -387,7 +399,7 @@ static const gchar templ_RGB_to_YUY2_UYVY_BODY[] =
+
+ static const struct shader_templ templ_RGB_to_YUY2_UYVY =
+ { NULL,
+- DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
++ DEFAULT_UNIFORMS_HIGH RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
+ { glsl_func_rgb_to_yuv, NULL, },
+ GST_GL_TEXTURE_TARGET_2D
+ };
diff --git a/debian/patches/series b/debian/patches/series
index bfea053..7a1d925 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
0001-gstrtspconnection-Security-loophole-making-heap-over.patch
0001-mtk.patch
0002-1.15.1-glimagesink.patch
+0003-gl-colorconvert-yuy2.patch