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