• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 			       s_verbose = true;
43 		       }),
44 		Option("f|fullscreen",
45 		       [&]() {
46 			       s_fullscreen = true;
47 		       }),
48 		Option("n|numframes=",
49 		       [&](string s) {
50 			       s_num_frames = stoi(s);
51 		       }),
52 	};
53 
54 	optionset.parse(argc, argv);
55 
56 	string m;
57 
58 	if (optionset.params().size() == 0)
59 		m = "gbm";
60 	else
61 		m = optionset.params().front();
62 
63 	if (m == "gbm")
64 		main_gbm();
65 	else if (m == "null")
66 		main_null();
67 	else if (m == "x")
68 		main_x11();
69 	else if (m == "wl")
70 		main_wl();
71 	else {
72 		printf("Unknown mode %s\n", m.c_str());
73 		return -1;
74 	}
75 
76 	return 0;
77 }
78