summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandolph Sapp <rs@ti.com>2024-03-05 16:41:23 -0600
committerKhem Raj <raj.khem@gmail.com>2024-03-05 15:09:25 -0800
commit658408c2a09679164864e47ea1f4fdefef425ef6 (patch)
tree6261de311d9dd4cc5de3040852aa1b02141107f3
parent123c58693ac786c3cef8a74b03c1557a66dc0142 (diff)
downloadmeta-openembedded-658408c2a09679164864e47ea1f4fdefef425ef6.tar.gz
glmark2: add upstream patch to not care about stencil config
The upstream project already patched this, but considering this package is currently locked to the latest tag, I'll add it here. This fixes an issue with stencil configs being scored unnecessarily low. It also addresses a problem when the target config is below 0. Signed-off-by: Randolph Sapp <rs@ti.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-benchmark/glmark2/files/0003-GLVisualConfig-By-default-don-t-care-about-the-stenc.patch103
-rw-r--r--meta-oe/recipes-benchmark/glmark2/glmark2_git.bb1
2 files changed, 104 insertions, 0 deletions
diff --git a/meta-oe/recipes-benchmark/glmark2/files/0003-GLVisualConfig-By-default-don-t-care-about-the-stenc.patch b/meta-oe/recipes-benchmark/glmark2/files/0003-GLVisualConfig-By-default-don-t-care-about-the-stenc.patch
new file mode 100644
index 0000000000..dc47af83e7
--- /dev/null
+++ b/meta-oe/recipes-benchmark/glmark2/files/0003-GLVisualConfig-By-default-don-t-care-about-the-stenc.patch
@@ -0,0 +1,103 @@
1From b59ec731c8c7e084b289e4ea92938faaebcc389d Mon Sep 17 00:00:00 2001
2From: Alexandros Frantzis <alexandros.frantzis@collabora.com>
3Date: Wed, 1 Nov 2023 13:43:00 +0200
4Subject: [PATCH] GLVisualConfig: By default don't care about the stencil
5 config component
6
7Our benchmarks don't use a stencil buffer, but its presence doesn't hurt
8either, so don't mark configs that have one as unacceptable. Our scoring
9still favors configs without one, unless the user explicitly specifies
10otherwise with --visual-config.
11
12Upstream-Status: Backport [https://github.com/glmark2/glmark2/commit/5f23d540342ba69e12afeb6a1ac4f6fd36747975]
13---
14 doc/glmark2.1.in | 2 +-
15 src/gl-visual-config.cpp | 9 ++++++---
16 src/gl-visual-config.h | 2 +-
17 src/options.cpp | 6 +++---
18 4 files changed, 11 insertions(+), 8 deletions(-)
19
20diff --git a/doc/glmark2.1.in b/doc/glmark2.1.in
21index 015ba20..1f4a047 100644
22--- a/doc/glmark2.1.in
23+++ b/doc/glmark2.1.in
24@@ -38,7 +38,7 @@ Render to an off-screen surface
25 The visual configuration to use for the rendering target:
26 \'id=ID:red=R:green=G:blue=B:alpha=A:buffer=BUF:stencil=STENCIL:samples=SAMPLES'.
27 The parameters may be defined in any order, and any omitted parameters assume a
28-default value of '0' (id, stencil, samples) or '1' (red, green, blue, alpha, buffer).
29+default value of '0' (id, samples), -1 (stencil) or '1' (red, green, blue, alpha, buffer).
30 If 'id' is set to a non-zero value, all other parameters are ignored
31 .TP
32 \fB\-\-reuse\-context\fR
33diff --git a/src/gl-visual-config.cpp b/src/gl-visual-config.cpp
34index de92f93..665f53a 100644
35--- a/src/gl-visual-config.cpp
36+++ b/src/gl-visual-config.cpp
37@@ -26,7 +26,7 @@
38 #include <vector>
39
40 GLVisualConfig::GLVisualConfig(const std::string &s) :
41- id(0), red(1), green(1), blue(1), alpha(1), depth(1), stencil(0), buffer(1), samples(0)
42+ GLVisualConfig()
43 {
44 std::vector<std::string> elems;
45
46@@ -85,7 +85,7 @@ GLVisualConfig::match_score(const GLVisualConfig &target) const
47 score += score_component(blue, target.blue, 4);
48 score += score_component(alpha, target.alpha, 4);
49 score += score_component(depth, target.depth, 1);
50- score += score_component(stencil, target.stencil, 0);
51+ score += score_component(stencil, target.stencil, 1);
52 score += score_component(buffer, target.buffer, 1);
53 score += score_component(samples, target.samples, -1);
54
55@@ -135,11 +135,14 @@ GLVisualConfig::score_component(int component, int target, int scale) const
56 * score for all components ranges from [0,MAXIMUM_COMPONENT_SCORE).
57 * If scale > 0, we reward the largest positive difference from target,
58 * otherwise the smallest positive difference from target.
59+ * We also reward the smallest positive difference from the target,
60+ * if the target < 0, i.e., we don't care about this value.
61 */
62 int diff = std::abs(scale) * (component - target);
63 if (diff > 0)
64 {
65- score = scale < 0 ? MAXIMUM_COMPONENT_SCORE - diff : diff;
66+ score = (scale < 0 || target < 0) ?
67+ MAXIMUM_COMPONENT_SCORE - diff : diff;
68 score = std::min(MAXIMUM_COMPONENT_SCORE, score);
69 score = std::max(0, score);
70 }
71diff --git a/src/gl-visual-config.h b/src/gl-visual-config.h
72index b28473f..013ce14 100644
73--- a/src/gl-visual-config.h
74+++ b/src/gl-visual-config.h
75@@ -31,7 +31,7 @@ class GLVisualConfig
76 {
77 public:
78 GLVisualConfig():
79- id(0), red(1), green(1), blue(1), alpha(1), depth(1), stencil(0), buffer(1), samples(0) {}
80+ id(0), red(1), green(1), blue(1), alpha(1), depth(1), stencil(-1), buffer(1), samples(0) {}
81 GLVisualConfig(const std::string &s);
82
83 /**
84diff --git a/src/options.cpp b/src/options.cpp
85index 8d1ec16..3a31d3d 100644
86--- a/src/options.cpp
87+++ b/src/options.cpp
88@@ -213,9 +213,9 @@ Options::print_help()
89 " target: 'id=ID:red=R:green=G:blue=B:alpha=A:buffer=BUF:\n"
90 " stencil=STENCIL:samples=SAMPLES'. The parameters may be\n"
91 " defined in any order, and any omitted parameters assume a\n"
92- " default value of '0' (id, stencil, samples) or '1' (red,\n"
93- " green, blue, alpha, buffer). If 'id' is set to a non-zero\n"
94- " value, all other parameters are ignored\n"
95+ " default value of '0' (id, samples), '-1' (stencil) or\n"
96+ " '1' (red, green, blue, alpha, buffer). If 'id' is set to\n"
97+ " a non-zero value, all other parameters are ignored\n"
98 " --reuse-context Use a single context for all scenes\n"
99 " (by default, each scene gets its own context)\n"
100 " -s, --size WxH Size of the output window (default: 800x600)\n"
101--
1022.44.0
103
diff --git a/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb b/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb
index a2d5b152f2..0b61d6ed62 100644
--- a/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb
+++ b/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb
@@ -17,6 +17,7 @@ SRC_URI = " \
17 git://github.com/glmark2/glmark2.git;protocol=https;branch=master \ 17 git://github.com/glmark2/glmark2.git;protocol=https;branch=master \
18 file://0001-fix-dispmanx-build.patch \ 18 file://0001-fix-dispmanx-build.patch \
19 file://0002-run-dispmanx-fullscreen.patch \ 19 file://0002-run-dispmanx-fullscreen.patch \
20 file://0003-GLVisualConfig-By-default-don-t-care-about-the-stenc.patch \
20" 21"
21SRCREV = "42e3d8fe3aa88743ef90348138f643f7b04a9237" 22SRCREV = "42e3d8fe3aa88743ef90348138f643f7b04a9237"
22 23