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 */
26 /* Based on a egl cube test app originally written by Arvin Schnell */
28 #include "cube.h"
29 #include <opts.h>
30 #include <kms++util.h>
32 using namespace std;
34 bool s_verbose;
35 bool s_fullscreen;
36 unsigned s_num_frames;
38 int main(int argc, char *argv[])
39 {
40 OptionSet optionset = {
41 Option("v|verbose",
42 [&]()
43 {
44 s_verbose = true;
45 }),
46 Option("f|fullscreen",
47 [&]()
48 {
49 s_fullscreen = true;
50 }),
51 Option("n|numframes=",
52 [&](string s)
53 {
54 s_num_frames = stoi(s);
55 }),
56 };
58 optionset.parse(argc, argv);
60 string m;
62 if (optionset.params().size() == 0)
63 m = "gbm";
64 else
65 m = optionset.params().front();
67 if (m == "gbm")
68 main_gbm();
69 else if (m == "null")
70 main_null();
71 else if (m == "x")
72 main_x11();
73 else if (m == "wl")
74 main_wl();
75 else {
76 printf("Unknown mode %s\n", m.c_str());
77 return -1;
78 }
80 return 0;
81 }