]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/omapdrmtest.git/blob - fliptest.c
filevpedisplay: added usage details
[glsdk/omapdrmtest.git] / fliptest.c
1 /*
2  * Copyright (C) 2011 Texas Instruments
3  * Author: Rob Clark <rob.clark@linaro.org>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
19 #include "util.h"
21 #define NBUF 3
22 #define CNT  500
24 static void
25 usage(char *name)
26 {
27         MSG("Usage: %s [OPTION]...", name);
28         MSG("Simple page-flip test, similar to 'modetest' but with option to use tiled buffers.");
29         MSG("");
30         disp_usage();
31 }
33 int
34 main(int argc, char **argv)
35 {
36         struct display *disp;
37         struct buffer **buffers;
38         int ret, i;
40         MSG("Opening Display..");
41         disp = disp_open(argc, argv);
42         if (!disp) {
43                 usage(argv[0]);
44                 return 1;
45         }
47         if (check_args(argc, argv)) {
48                 /* remaining args.. print usage msg */
49                 usage(argv[0]);
50                 return 0;
51         }
53         buffers = disp_get_buffers(disp, NBUF);
54         if (!buffers) {
55                 return 1;
56         }
58         for (i = 0; i < CNT; i++) {
59                 struct buffer *buf = buffers[i % NBUF];
60                 fill(buf, i * 2);
61                 ret = disp_post_buffer(disp, buf);
62                 if (ret) {
63                         return ret;
64                 }
65         }
67         MSG("Ok!");
68         disp_close(disp);
70         return 0;
71 }