summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-mali400/recipes-benchmarks/glmark2/files/0001-src-options.cpp-Add-options-to-configure-bpp-and-dep.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-mali400/recipes-benchmarks/glmark2/files/0001-src-options.cpp-Add-options-to-configure-bpp-and-dep.patch')
-rw-r--r--meta-xilinx-mali400/recipes-benchmarks/glmark2/files/0001-src-options.cpp-Add-options-to-configure-bpp-and-dep.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/meta-xilinx-mali400/recipes-benchmarks/glmark2/files/0001-src-options.cpp-Add-options-to-configure-bpp-and-dep.patch b/meta-xilinx-mali400/recipes-benchmarks/glmark2/files/0001-src-options.cpp-Add-options-to-configure-bpp-and-dep.patch
new file mode 100644
index 00000000..015f2f49
--- /dev/null
+++ b/meta-xilinx-mali400/recipes-benchmarks/glmark2/files/0001-src-options.cpp-Add-options-to-configure-bpp-and-dep.patch
@@ -0,0 +1,104 @@
1From c5de6efc463c1f8f47d37c2423da983c016b3ce8 Mon Sep 17 00:00:00 2001
2From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
3Date: Thu, 27 Jun 2019 16:16:05 -0700
4Subject: [PATCH] src/options.cpp: Add options to configure bpp and depth
5
6Instead of hardcoding the depth and bpp for drm backend, application
7should have a knob to configure the same.
8
9Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
10Upstream-Status: Inappropriate [Xilinx specific]
11---
12 src/native-state-drm.cpp | 5 +++--
13 src/options.cpp | 10 ++++++++++
14 src/options.h | 2 ++
15 3 files changed, 15 insertions(+), 2 deletions(-)
16
17diff --git a/src/native-state-drm.cpp b/src/native-state-drm.cpp
18index 62566ee..9743575 100644
19--- a/src/native-state-drm.cpp
20+++ b/src/native-state-drm.cpp
21@@ -24,6 +24,7 @@
22 */
23 #include "native-state-drm.h"
24 #include "log.h"
25+#include "options.h"
26
27 #include <fcntl.h>
28 #include <libudev.h>
29@@ -403,7 +404,7 @@ NativeStateDRM::fb_get_from_bo(gbm_bo* bo)
30 unsigned int stride = gbm_bo_get_stride(bo);
31 unsigned int handle = gbm_bo_get_handle(bo).u32;
32 unsigned int fb_id(0);
33- int status = drmModeAddFB(fd_, width, height, 24, 32, stride, handle, &fb_id);
34+ int status = drmModeAddFB(fd_, width, height, Options::depth, Options::bpp, stride, handle, &fb_id);
35 if (status < 0) {
36 Log::error("Failed to create FB: %d\n", status);
37 return 0;
38@@ -428,7 +429,7 @@ NativeStateDRM::init_gbm()
39 }
40
41 surface_ = gbm_surface_create(dev_, mode_->hdisplay, mode_->vdisplay,
42- GBM_FORMAT_XRGB8888,
43+ (Options::bpp == 32) ? GBM_FORMAT_XRGB8888 : GBM_FORMAT_RGB565,
44 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
45 if (!surface_) {
46 Log::error("Failed to create GBM surface\n");
47diff --git a/src/options.cpp b/src/options.cpp
48index 05cd617..7de1ddc 100644
49--- a/src/options.cpp
50+++ b/src/options.cpp
51@@ -41,6 +41,8 @@ bool Options::reuse_context = false;
52 bool Options::run_forever = false;
53 bool Options::annotate = false;
54 bool Options::offscreen = false;
55+int Options::depth = 16;
56+int Options::bpp = 16;
57 GLVisualConfig Options::visual_config;
58
59 static struct option long_options[] = {
60@@ -59,6 +61,8 @@ static struct option long_options[] = {
61 {"show-all-options", 0, 0, 0},
62 {"debug", 0, 0, 0},
63 {"help", 0, 0, 0},
64+ {"depth", 1, 0, 0},
65+ {"bpp", 1, 0, 0},
66 {0, 0, 0, 0}
67 };
68
69@@ -142,6 +146,8 @@ Options::print_help()
70 " --annotate Annotate the benchmarks with on-screen information\n"
71 " (same as -b :show-fps=true:title=#info#)\n"
72 " -d, --debug Display debug messages\n"
73+ " --depth Depth for drm backend\n"
74+ " --bpp Bpp for drm backend\n"
75 " -h, --help Display help\n");
76 }
77
78@@ -193,6 +199,10 @@ Options::parse_args(int argc, char **argv)
79 Options::show_debug = true;
80 else if (c == 'h' || !strcmp(optname, "help"))
81 Options::show_help = true;
82+ else if (!strcmp(optname, "depth"))
83+ Options::depth = Util::fromString<int>(optarg);
84+ else if (!strcmp(optname, "bpp"))
85+ Options::bpp = Util::fromString<int>(optarg);
86 }
87
88 return true;
89diff --git a/src/options.h b/src/options.h
90index f62e02a..04bef5f 100644
91--- a/src/options.h
92+++ b/src/options.h
93@@ -53,6 +53,8 @@ struct Options {
94 static bool run_forever;
95 static bool annotate;
96 static bool offscreen;
97+ static int depth;
98+ static int bpp;
99 static GLVisualConfig visual_config;
100 };
101
102--
1032.7.4
104