blob: cdff0cf9c9e52308a34127b13c31110b8778e3f8 [file] [log] [blame]
Chris Wilsonb98bade2013-08-20 21:39:27 +01001/*
2 * Copyright © 2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#ifndef GPU_TOP_H
26#define GPU_TOP_H
27
Chris Wilsonf9a50de2013-08-17 11:12:07 +010028#define MAX_RINGS 4
29
30#include <stdint.h>
31
32struct gpu_top {
Chris Wilson2e482a32013-08-20 19:11:44 +010033 enum { PERF, MMIO } type;
Chris Wilsonf9a50de2013-08-17 11:12:07 +010034 int fd;
Chris Wilson2e482a32013-08-20 19:11:44 +010035
Chris Wilsonf9a50de2013-08-17 11:12:07 +010036 int num_rings;
Chris Wilson2e482a32013-08-20 19:11:44 +010037 int have_wait;
38 int have_sema;
39
Chris Wilsonf9a50de2013-08-17 11:12:07 +010040 struct gpu_top_ring {
41 const char *name;
42 union gpu_top_payload {
43 struct {
44 uint8_t busy;
45 uint8_t wait;
46 uint8_t sema;
47 } u;
48 uint32_t payload;
49 } u;
50 } ring[MAX_RINGS];
Chris Wilson2e482a32013-08-20 19:11:44 +010051
52 struct gpu_top_stat {
53 uint64_t time;
54 uint64_t busy[MAX_RINGS];
55 uint64_t wait[MAX_RINGS];
56 uint64_t sema[MAX_RINGS];
57 } stat[2];
58 int count;
Chris Wilsonf9a50de2013-08-17 11:12:07 +010059};
60
61void gpu_top_init(struct gpu_top *gt);
62int gpu_top_update(struct gpu_top *gt);
Chris Wilsonb98bade2013-08-20 21:39:27 +010063
64#endif /* GPU_TOP_H */