iris: save query type
[mesa.git] / src / gallium / drivers / iris / iris_query.c
1 /*
2 * Copyright © 2017 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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23 #include <stdio.h>
24 #include <errno.h>
25 #include "pipe/p_defines.h"
26 #include "pipe/p_state.h"
27 #include "pipe/p_context.h"
28 #include "pipe/p_screen.h"
29 #include "util/u_inlines.h"
30 #include "util/u_format.h"
31 #include "util/u_upload_mgr.h"
32 #include "util/ralloc.h"
33 #include "iris_context.h"
34 #include "iris_resource.h"
35 #include "iris_screen.h"
36 #include "intel/compiler/brw_compiler.h"
37
38 struct iris_query {
39 enum pipe_query_type type;
40 };
41
42 static struct pipe_query *
43 iris_create_query(struct pipe_context *ctx,
44 unsigned query_type,
45 unsigned index)
46 {
47 struct iris_query *query = calloc(1, sizeof(struct iris_query));
48
49 query->type = query_type;
50
51 return (struct pipe_query *) query;
52 }
53
54 static void
55 iris_destroy_query(struct pipe_context *ctx, struct pipe_query *p_query)
56 {
57 struct iris_query *query = (void *) p_query;
58 free(query);
59 }
60
61 static boolean
62 iris_begin_query(struct pipe_context *ctx, struct pipe_query *query)
63 {
64 return true;
65 }
66
67 static bool
68 iris_end_query(struct pipe_context *ctx, struct pipe_query *query)
69 {
70 return true;
71 }
72
73 static boolean
74 iris_get_query_result(struct pipe_context *ctx,
75 struct pipe_query *query,
76 boolean wait,
77 union pipe_query_result *vresult)
78 {
79 uint64_t *result = (uint64_t*)vresult;
80
81 *result = 0;
82 return TRUE;
83 }
84
85 static void
86 iris_set_active_query_state(struct pipe_context *pipe, boolean enable)
87 {
88 }
89
90 void
91 iris_init_query_functions(struct pipe_context *ctx)
92 {
93 ctx->create_query = iris_create_query;
94 ctx->destroy_query = iris_destroy_query;
95 ctx->begin_query = iris_begin_query;
96 ctx->end_query = iris_end_query;
97 ctx->get_query_result = iris_get_query_result;
98 ctx->set_active_query_state = iris_set_active_query_state;
99 }