baad5825d3b6dbc88ac85691839d421f74d89ef2
2 * Copyright 2015 Advanced Micro Devices, Inc.
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:
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
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 FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Nicolai Hähnle <nicolai.haehnle@amd.com>
31 #include "pipe/p_defines.h"
32 #include "util/list.h"
34 struct r600_common_context
;
38 #define R600_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0)
39 #define R600_QUERY_REQUESTED_VRAM (PIPE_QUERY_DRIVER_SPECIFIC + 1)
40 #define R600_QUERY_REQUESTED_GTT (PIPE_QUERY_DRIVER_SPECIFIC + 2)
41 #define R600_QUERY_BUFFER_WAIT_TIME (PIPE_QUERY_DRIVER_SPECIFIC + 3)
42 #define R600_QUERY_NUM_CS_FLUSHES (PIPE_QUERY_DRIVER_SPECIFIC + 4)
43 #define R600_QUERY_NUM_BYTES_MOVED (PIPE_QUERY_DRIVER_SPECIFIC + 5)
44 #define R600_QUERY_VRAM_USAGE (PIPE_QUERY_DRIVER_SPECIFIC + 6)
45 #define R600_QUERY_GTT_USAGE (PIPE_QUERY_DRIVER_SPECIFIC + 7)
46 #define R600_QUERY_GPU_TEMPERATURE (PIPE_QUERY_DRIVER_SPECIFIC + 8)
47 #define R600_QUERY_CURRENT_GPU_SCLK (PIPE_QUERY_DRIVER_SPECIFIC + 9)
48 #define R600_QUERY_CURRENT_GPU_MCLK (PIPE_QUERY_DRIVER_SPECIFIC + 10)
49 #define R600_QUERY_GPU_LOAD (PIPE_QUERY_DRIVER_SPECIFIC + 11)
50 #define R600_QUERY_NUM_COMPILATIONS (PIPE_QUERY_DRIVER_SPECIFIC + 12)
51 #define R600_QUERY_NUM_SHADERS_CREATED (PIPE_QUERY_DRIVER_SPECIFIC + 13)
52 #define R600_QUERY_FIRST_PERFCOUNTER (PIPE_QUERY_DRIVER_SPECIFIC + 100)
54 struct r600_query_ops
{
55 void (*destroy
)(struct r600_common_context
*, struct r600_query
*);
56 boolean (*begin
)(struct r600_common_context
*, struct r600_query
*);
57 void (*end
)(struct r600_common_context
*, struct r600_query
*);
58 boolean (*get_result
)(struct r600_common_context
*,
59 struct r600_query
*, boolean wait
,
60 union pipe_query_result
*result
);
64 struct r600_query_ops
*ops
;
66 /* The type of query */
70 struct r600_query_buffer
{
71 /* The buffer where query results are stored. */
72 struct r600_resource
*buf
;
73 /* Offset of the next free result after current query data */
75 /* If a query buffer is full, a new buffer is created and the old one
76 * is put in here. When we calculate the result, we sum up the samples
77 * from all buffers. */
78 struct r600_query_buffer
*previous
;
81 struct r600_query_hw
{
84 /* The query buffer and how many results are in it. */
85 struct r600_query_buffer buffer
;
86 /* Size of the result in memory for both begin_query and end_query,
87 * this can be one or two numbers, or it could even be a size of a structure. */
89 /* The number of dwords for begin_query or end_query. */
91 /* Linked list of queries */
92 struct list_head list
;
93 /* For transform feedback: which stream the query is for */
97 void r600_query_hw_destroy(struct r600_common_context
*rctx
,
98 struct r600_query
*rquery
);
100 #endif /* R600_QUERY_H */