1 /*
2 * Copyright (c) 2012 Arvin Schnell <arvin.schnell@gmail.com>
3 * Copyright (c) 2012 Rob Clark <rob@ti.com>
4 * Copyright (c) 2015 Tomi Valkeinen <tomi.valkeinen@ti.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sub license,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 */
25
26 /* Based on a egl cube test app originally written by Arvin Schnell */
27
28 #include "cube.h"
29 #include <kms++util/kms++util.h>
30
31 using namespace std;
32
33 bool s_verbose;
34 bool s_fullscreen;
35 unsigned s_num_frames;
36
main(int argc,char * argv[])37 int main(int argc, char *argv[])
38 {
39 OptionSet optionset = {
40 Option("v|verbose",
41 [&]()
42 {
43 s_verbose = true;
44 }),
45 Option("f|fullscreen",
46 [&]()
47 {
48 s_fullscreen = true;
49 }),
50 Option("n|numframes=",
51 [&](string s)
52 {
53 s_num_frames = stoi(s);
54 }),
55 };
56
57 optionset.parse(argc, argv);
58
59 string m;
60
61 if (optionset.params().size() == 0)
62 m = "gbm";
63 else
64 m = optionset.params().front();
65
66 if (m == "gbm")
67 main_gbm();
68 else if (m == "null")
69 main_null();
70 else if (m == "x")
71 main_x11();
72 else if (m == "wl")
73 main_wl();
74 else {
75 printf("Unknown mode %s\n", m.c_str());
76 return -1;
77 }
78
79 return 0;
80 }
81