• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2008 Maciej Cencora <m.cencora@gmail.com>
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  * Authors:
24  *    Maciej Cencora <m.cencora@gmail.com>
25  *
26  */
27 
28 #include "main/imports.h"
29 #include "util/simple_list.h"
30 #include "radeon_common_context.h"
31 
32 extern void radeonEmitQueryBegin(struct gl_context *ctx);
33 extern void radeonEmitQueryEnd(struct gl_context *ctx);
34 
35 extern void radeonInitQueryObjFunctions(struct dd_function_table *functions);
36 
37 #define RADEON_QUERY_PAGE_SIZE 4096
38 
39 int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom);
40 void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom);
41 
radeon_init_query_stateobj(radeonContextPtr radeon,int SZ)42 static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ)
43 {
44 	radeon->query.queryobj.cmd_size = (SZ);
45 	radeon->query.queryobj.cmd = calloc(SZ, sizeof(uint32_t));
46 	radeon->query.queryobj.name = "queryobj";
47 	radeon->query.queryobj.idx = 0;
48 	radeon->query.queryobj.check = radeon_check_query_active;
49 	radeon->query.queryobj.dirty = GL_FALSE;
50 	radeon->query.queryobj.emit = radeon_emit_queryobj;
51 
52 	radeon->hw.max_state_size += (SZ);
53 	insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj);
54 }
55 
56