Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/subtitlecomposer/, media-video/subtitlecomposer/files/
Date: Mon, 09 May 2022 21:56:13
Message-Id: 1652133313.a38de3c946c83c6148450c6aa4d9c7152d37b429.asturm@gentoo
1 commit: a38de3c946c83c6148450c6aa4d9c7152d37b429
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 9 06:17:05 2022 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Mon May 9 21:55:13 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a38de3c9
7
8 media-video/subtitlecomposer: Fix build with dev-qt/qtgui[gles2-only]
9
10 Closes: https://bugs.gentoo.org/820035
11 Package-Manager: Portage-3.0.30, Repoman-3.0.3
12 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
13
14 .../subtitlecomposer-0.7.1-gles-support.patch | 122 +++++++++++++++++++++
15 .../subtitlecomposer/subtitlecomposer-0.7.1.ebuild | 7 +-
16 2 files changed, 127 insertions(+), 2 deletions(-)
17
18 diff --git a/media-video/subtitlecomposer/files/subtitlecomposer-0.7.1-gles-support.patch b/media-video/subtitlecomposer/files/subtitlecomposer-0.7.1-gles-support.patch
19 new file mode 100644
20 index 000000000000..98de494cf306
21 --- /dev/null
22 +++ b/media-video/subtitlecomposer/files/subtitlecomposer-0.7.1-gles-support.patch
23 @@ -0,0 +1,122 @@
24 +From 167a941f8070f4a9abacb3aa2f61ee6ee00d6cb8 Mon Sep 17 00:00:00 2001
25 +From: Mladen Milinkovic <maxrd2@××××××××××.net>
26 +Date: Thu, 7 Oct 2021 19:37:23 +0200
27 +Subject: [PATCH] GLRenderer: added GLES support
28 +
29 +---
30 + src/videoplayer/backend/glrenderer.cpp | 44 ++++++++++++++++++++++----
31 + 1 file changed, 38 insertions(+), 6 deletions(-)
32 +
33 +diff --git a/src/videoplayer/backend/glrenderer.cpp b/src/videoplayer/backend/glrenderer.cpp
34 +index 7c9c38b..5cb985d 100644
35 +--- a/src/videoplayer/backend/glrenderer.cpp
36 ++++ b/src/videoplayer/backend/glrenderer.cpp
37 +@@ -20,6 +20,7 @@ extern "C" {
38 + }
39 +
40 + #define DEBUG_GL 0
41 ++#define FORCE_GLES 0
42 + #define OPENGL_CORE 0
43 + #define OPENGL_VER 2,0
44 +
45 +@@ -33,6 +34,17 @@ extern "C" {
46 + #define asGL(glCall) glCall
47 + #endif
48 +
49 ++#if defined(GL_ES_VERSION_2_0) || FORCE_GLES
50 ++#define USE_GLES
51 ++#define TEXTURE_RGB_FORMAT GL_RGBA
52 ++// NOTE: we don't currently support more than 8bpp on GLES
53 ++#define TEXTURE_U16_FORMAT GL_R8
54 ++#else
55 ++#undef USE_GLES
56 ++#define TEXTURE_RGB_FORMAT GL_BGRA
57 ++#define TEXTURE_U16_FORMAT GL_R16
58 ++#endif
59 ++
60 + using namespace SubtitleComposer;
61 +
62 + enum { ID_Y, ID_U, ID_V, ID_OVR, ID_SIZE };
63 +@@ -82,6 +94,9 @@ void
64 + GLRenderer::setupProfile()
65 + {
66 + QSurfaceFormat format(QSurfaceFormat::defaultFormat());
67 ++#if FORCE_GLES
68 ++ format.setRenderableType(QSurfaceFormat::OpenGLES);
69 ++#endif
70 + format.setVersion(OPENGL_VER);
71 + #if DEBUG_GL
72 + format.setOption(QSurfaceFormat::DebugContext);
73 +@@ -126,7 +141,7 @@ GLRenderer::setFrameFormat(int width, int height, int compBits, int crWidthShift
74 + m_crHeight = crHeight;
75 +
76 + m_glType = compBytes == 1 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
77 +- m_glFormat = compBytes == 1 ? GL_R8 : GL_R16;
78 ++ m_glFormat = compBytes == 1 ? GL_R8 : TEXTURE_U16_FORMAT;
79 +
80 + delete[] m_bufYUV;
81 + m_bufSize = bufSize;
82 +@@ -261,7 +276,11 @@ GLRenderer::initShader()
83 + delete m_vertShader;
84 + m_vertShader = new QOpenGLShader(QOpenGLShader::Vertex, this);
85 + bool success = m_vertShader->compileSourceCode(
86 ++#ifdef USE_GLES
87 ++ "#version 100\n"
88 ++#else
89 + "#version 120\n"
90 ++#endif
91 + "attribute vec4 vPos;"
92 + "attribute vec2 vVidTex;"
93 + "attribute vec2 vOvrTex;"
94 +@@ -288,7 +307,13 @@ GLRenderer::initShader()
95 + csms.append(QString::number(csm[i], 'g', 10));
96 + }
97 +
98 +- success = m_fragShader->compileSourceCode(QStringLiteral("#version 120\n"
99 ++ success = m_fragShader->compileSourceCode(QStringLiteral(
100 ++#ifdef USE_GLES
101 ++ "#version 100\n"
102 ++ "precision mediump float;\n"
103 ++#else
104 ++ "#version 120\n"
105 ++#endif
106 + "varying vec2 vfVidTex;"
107 + "varying vec2 vfOvrTex;"
108 + "uniform sampler2D texY;"
109 +@@ -348,8 +373,15 @@ GLRenderer::initializeGL()
110 + QMutexLocker l(&m_texMutex);
111 +
112 + initializeOpenGLFunctions();
113 +- qDebug() << "OpenGL version: " << reinterpret_cast<const char *>(glGetString(GL_VERSION));
114 +- qDebug() << "GLSL version: " << reinterpret_cast<const char *>(glGetString(GL_SHADING_LANGUAGE_VERSION));
115 ++ qDebug().nospace() << "GL API: OpenGL " << (format().renderableType() == QSurfaceFormat::OpenGLES ? "ES" : "Desktop")
116 ++ << ' ' << format().majorVersion() << "." << format().minorVersion()
117 ++#ifdef USE_GLES
118 ++ << " (compiled for OpenGL ES)";
119 ++#else
120 ++ << " (compiled for OpenGL Desktop)";
121 ++#endif
122 ++ qDebug() << "OpenGL version:" << reinterpret_cast<const char *>(glGetString(GL_VERSION));
123 ++ qDebug() << "GLSL version:" << reinterpret_cast<const char *>(glGetString(GL_SHADING_LANGUAGE_VERSION));
124 +
125 + if(m_vao.create())
126 + m_vao.bind();
127 +@@ -453,13 +485,13 @@ GLRenderer::uploadMM(int texWidth, int texHeight, T *texBuf, const T *texSrc)
128 + if(D == 1) {
129 + asGL(glTexImage2D(GL_TEXTURE_2D, level, m_glFormat, texWidth, texHeight, 0, GL_RED, m_glType, texSrc));
130 + } else { // D == 4
131 +- asGL(glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, texWidth, texHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, texSrc));
132 ++ asGL(glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, texWidth, texHeight, 0, TEXTURE_RGB_FORMAT, GL_UNSIGNED_BYTE, texSrc));
133 + }
134 + } else {
135 + if(D == 1) {
136 + asGL(glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, texWidth, texHeight, GL_RED, m_glType, texSrc));
137 + } else { // D == 4
138 +- asGL(glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, texWidth, texHeight, GL_BGRA, GL_UNSIGNED_BYTE, texSrc));
139 ++ asGL(glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, texWidth, texHeight, TEXTURE_RGB_FORMAT, GL_UNSIGNED_BYTE, texSrc));
140 + }
141 + }
142 +
143 +--
144 +GitLab
145 +
146
147 diff --git a/media-video/subtitlecomposer/subtitlecomposer-0.7.1.ebuild b/media-video/subtitlecomposer/subtitlecomposer-0.7.1.ebuild
148 index aef529fbf604..3ff7e5e962a5 100644
149 --- a/media-video/subtitlecomposer/subtitlecomposer-0.7.1.ebuild
150 +++ b/media-video/subtitlecomposer/subtitlecomposer-0.7.1.ebuild
151 @@ -1,4 +1,4 @@
152 -# Copyright 1999-2021 Gentoo Authors
153 +# Copyright 1999-2022 Gentoo Authors
154 # Distributed under the terms of the GNU General Public License v2
155
156 EAPI=8
157 @@ -43,7 +43,10 @@ BDEPEND="
158 virtual/pkgconfig
159 "
160
161 -PATCHES=( "${FILESDIR}/${P}-tests-optional.patch" )
162 +PATCHES=(
163 + "${FILESDIR}/${P}-tests-optional.patch"
164 + "${FILESDIR}/${P}-gles-support.patch" # bug 820035
165 +)
166
167 src_configure() {
168 local mycmakeargs=(