113699463a33c1adf44005125c488e886e074a05bKeith Whitwell/**************************************************************************
213699463a33c1adf44005125c488e886e074a05bKeith Whitwell *
313699463a33c1adf44005125c488e886e074a05bKeith Whitwell * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
413699463a33c1adf44005125c488e886e074a05bKeith Whitwell * All Rights Reserved.
513699463a33c1adf44005125c488e886e074a05bKeith Whitwell *
613699463a33c1adf44005125c488e886e074a05bKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
713699463a33c1adf44005125c488e886e074a05bKeith Whitwell * copy of this software and associated documentation files (the
813699463a33c1adf44005125c488e886e074a05bKeith Whitwell * "Software"), to deal in the Software without restriction, including
913699463a33c1adf44005125c488e886e074a05bKeith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
1013699463a33c1adf44005125c488e886e074a05bKeith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
1113699463a33c1adf44005125c488e886e074a05bKeith Whitwell * permit persons to whom the Software is furnished to do so, subject to
1213699463a33c1adf44005125c488e886e074a05bKeith Whitwell * the following conditions:
1313699463a33c1adf44005125c488e886e074a05bKeith Whitwell *
1413699463a33c1adf44005125c488e886e074a05bKeith Whitwell * The above copyright notice and this permission notice (including the
1513699463a33c1adf44005125c488e886e074a05bKeith Whitwell * next paragraph) shall be included in all copies or substantial portions
1613699463a33c1adf44005125c488e886e074a05bKeith Whitwell * of the Software.
1713699463a33c1adf44005125c488e886e074a05bKeith Whitwell *
1813699463a33c1adf44005125c488e886e074a05bKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1913699463a33c1adf44005125c488e886e074a05bKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2013699463a33c1adf44005125c488e886e074a05bKeith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
2113699463a33c1adf44005125c488e886e074a05bKeith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
2213699463a33c1adf44005125c488e886e074a05bKeith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2313699463a33c1adf44005125c488e886e074a05bKeith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2413699463a33c1adf44005125c488e886e074a05bKeith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2513699463a33c1adf44005125c488e886e074a05bKeith Whitwell *
2613699463a33c1adf44005125c488e886e074a05bKeith Whitwell **************************************************************************/
2713699463a33c1adf44005125c488e886e074a05bKeith Whitwell
2813699463a33c1adf44005125c488e886e074a05bKeith Whitwell/* Author:
2913699463a33c1adf44005125c488e886e074a05bKeith Whitwell *    Keith Whitwell <keith@tungstengraphics.com>
3013699463a33c1adf44005125c488e886e074a05bKeith Whitwell */
3113699463a33c1adf44005125c488e886e074a05bKeith Whitwell
326acd63a4980951727939c0dd545a0324965b3834José Fonseca#include "draw/draw_context.h"
33cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich#include "os/os_time.h"
3413699463a33c1adf44005125c488e886e074a05bKeith Whitwell#include "pipe/p_defines.h"
354f25420bdd834e81a3e22733304efc5261c2998aBrian Paul#include "util/u_memory.h"
3613699463a33c1adf44005125c488e886e074a05bKeith Whitwell#include "sp_context.h"
3713699463a33c1adf44005125c488e886e074a05bKeith Whitwell#include "sp_query.h"
3857fd20237541c34ed06587bca9f5a58c8a63fbf4Keith Whitwell#include "sp_state.h"
3913699463a33c1adf44005125c488e886e074a05bKeith Whitwell
4013699463a33c1adf44005125c488e886e074a05bKeith Whitwellstruct softpipe_query {
41cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   unsigned type;
42ab3a9f1eeda5b216099763f6eb932da723309f4aJosé Fonseca   uint64_t start;
43ab3a9f1eeda5b216099763f6eb932da723309f4aJosé Fonseca   uint64_t end;
44be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   struct pipe_query_data_so_statistics so;
45ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   unsigned num_primitives_generated;
4613699463a33c1adf44005125c488e886e074a05bKeith Whitwell};
4713699463a33c1adf44005125c488e886e074a05bKeith Whitwell
4813699463a33c1adf44005125c488e886e074a05bKeith Whitwell
4913699463a33c1adf44005125c488e886e074a05bKeith Whitwellstatic struct softpipe_query *softpipe_query( struct pipe_query *p )
5013699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
5113699463a33c1adf44005125c488e886e074a05bKeith Whitwell   return (struct softpipe_query *)p;
5213699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
5313699463a33c1adf44005125c488e886e074a05bKeith Whitwell
5413699463a33c1adf44005125c488e886e074a05bKeith Whitwellstatic struct pipe_query *
5513699463a33c1adf44005125c488e886e074a05bKeith Whitwellsoftpipe_create_query(struct pipe_context *pipe,
5613699463a33c1adf44005125c488e886e074a05bKeith Whitwell		      unsigned type)
5713699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
58cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   struct softpipe_query* sq;
59cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich
60be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   assert(type == PIPE_QUERY_OCCLUSION_COUNTER ||
61be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin          type == PIPE_QUERY_TIME_ELAPSED ||
62b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin          type == PIPE_QUERY_SO_STATISTICS ||
63ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie          type == PIPE_QUERY_PRIMITIVES_EMITTED ||
64ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie          type == PIPE_QUERY_PRIMITIVES_GENERATED ||
65e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin          type == PIPE_QUERY_GPU_FINISHED ||
661f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller          type == PIPE_QUERY_TIMESTAMP ||
67e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin          type == PIPE_QUERY_TIMESTAMP_DISJOINT);
68cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   sq = CALLOC_STRUCT( softpipe_query );
69cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   sq->type = type;
70cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich
71cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   return (struct pipe_query *)sq;
7213699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
7313699463a33c1adf44005125c488e886e074a05bKeith Whitwell
7413699463a33c1adf44005125c488e886e074a05bKeith Whitwell
7513699463a33c1adf44005125c488e886e074a05bKeith Whitwellstatic void
7613699463a33c1adf44005125c488e886e074a05bKeith Whitwellsoftpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
7713699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
7813699463a33c1adf44005125c488e886e074a05bKeith Whitwell   FREE(q);
7913699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
8013699463a33c1adf44005125c488e886e074a05bKeith Whitwell
8113699463a33c1adf44005125c488e886e074a05bKeith Whitwell
8213699463a33c1adf44005125c488e886e074a05bKeith Whitwellstatic void
8313699463a33c1adf44005125c488e886e074a05bKeith Whitwellsoftpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
8413699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
8513699463a33c1adf44005125c488e886e074a05bKeith Whitwell   struct softpipe_context *softpipe = softpipe_context( pipe );
8613699463a33c1adf44005125c488e886e074a05bKeith Whitwell   struct softpipe_query *sq = softpipe_query(q);
87b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin
88cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   switch (sq->type) {
89cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   case PIPE_QUERY_OCCLUSION_COUNTER:
90cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      sq->start = softpipe->occlusion_count;
91cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      break;
921f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller   case PIPE_QUERY_TIMESTAMP_DISJOINT:
93cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   case PIPE_QUERY_TIME_ELAPSED:
94cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      sq->start = 1000*os_time_get();
95cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      break;
96be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   case PIPE_QUERY_SO_STATISTICS:
97be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin      sq->so.primitives_storage_needed = 0;
98ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   case PIPE_QUERY_PRIMITIVES_EMITTED:
99ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      sq->so.num_primitives_written = 0;
100ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      softpipe->so_stats.num_primitives_written = 0;
101ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      break;
102ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   case PIPE_QUERY_PRIMITIVES_GENERATED:
103ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      sq->num_primitives_generated = 0;
104ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      softpipe->num_primitives_generated = 0;
105551467d4ef28786597cc215e9b7159e70a8e742cZack Rusin      break;
1061f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller   case PIPE_QUERY_TIMESTAMP:
107b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin   case PIPE_QUERY_GPU_FINISHED:
108b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin      break;
109cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   default:
110cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      assert(0);
111cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      break;
112cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   }
11357fd20237541c34ed06587bca9f5a58c8a63fbf4Keith Whitwell   softpipe->active_query_count++;
11457fd20237541c34ed06587bca9f5a58c8a63fbf4Keith Whitwell   softpipe->dirty |= SP_NEW_QUERY;
11513699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
11613699463a33c1adf44005125c488e886e074a05bKeith Whitwell
11713699463a33c1adf44005125c488e886e074a05bKeith Whitwell
11813699463a33c1adf44005125c488e886e074a05bKeith Whitwellstatic void
11913699463a33c1adf44005125c488e886e074a05bKeith Whitwellsoftpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
12013699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
12113699463a33c1adf44005125c488e886e074a05bKeith Whitwell   struct softpipe_context *softpipe = softpipe_context( pipe );
12213699463a33c1adf44005125c488e886e074a05bKeith Whitwell   struct softpipe_query *sq = softpipe_query(q);
12313699463a33c1adf44005125c488e886e074a05bKeith Whitwell
12457fd20237541c34ed06587bca9f5a58c8a63fbf4Keith Whitwell   softpipe->active_query_count--;
125cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   switch (sq->type) {
126cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   case PIPE_QUERY_OCCLUSION_COUNTER:
127cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      sq->end = softpipe->occlusion_count;
128cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      break;
1291f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller   case PIPE_QUERY_TIMESTAMP:
1301f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller      sq->start = 0;
1311f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller      /* fall through */
1321f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller   case PIPE_QUERY_TIMESTAMP_DISJOINT:
133cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   case PIPE_QUERY_TIME_ELAPSED:
134cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      sq->end = 1000*os_time_get();
135cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      break;
136be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   case PIPE_QUERY_SO_STATISTICS:
137be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin      sq->so.primitives_storage_needed =
138be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin         softpipe->so_stats.primitives_storage_needed;
139ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   case PIPE_QUERY_PRIMITIVES_EMITTED:
140ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      sq->so.num_primitives_written =
141ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie         softpipe->so_stats.num_primitives_written;
142ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      break;
143ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   case PIPE_QUERY_PRIMITIVES_GENERATED:
144ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      sq->num_primitives_generated = softpipe->num_primitives_generated;
145551467d4ef28786597cc215e9b7159e70a8e742cZack Rusin      break;
146b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin   case PIPE_QUERY_GPU_FINISHED:
147b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin      break;
148cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   default:
149cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      assert(0);
150cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich      break;
151cdbd5f4203391ee7eb12911bc86fea34dc61c957Mathias Fröhlich   }
15257fd20237541c34ed06587bca9f5a58c8a63fbf4Keith Whitwell   softpipe->dirty |= SP_NEW_QUERY;
15313699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
15413699463a33c1adf44005125c488e886e074a05bKeith Whitwell
15513699463a33c1adf44005125c488e886e074a05bKeith Whitwell
15613699463a33c1adf44005125c488e886e074a05bKeith Whitwellstatic boolean
15713699463a33c1adf44005125c488e886e074a05bKeith Whitwellsoftpipe_get_query_result(struct pipe_context *pipe,
15813699463a33c1adf44005125c488e886e074a05bKeith Whitwell			  struct pipe_query *q,
15913699463a33c1adf44005125c488e886e074a05bKeith Whitwell			  boolean wait,
1604445e170bee23a3607ece0e010adef7058ac6a11Marek Olšák			  union pipe_query_result *vresult)
16113699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
16213699463a33c1adf44005125c488e886e074a05bKeith Whitwell   struct softpipe_query *sq = softpipe_query(q);
16334f7681669987bc804f4603463f2fa3f82bc844fZack Rusin   uint64_t *result = (uint64_t*)vresult;
164be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin
165be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   switch (sq->type) {
166be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   case PIPE_QUERY_SO_STATISTICS:
167be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin      memcpy(vresult, &sq->so,
168be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin             sizeof(struct pipe_query_data_so_statistics));
169be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin      break;
170b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin   case PIPE_QUERY_GPU_FINISHED:
171b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin      *result = TRUE;
172b6c360b46c2b2b1548e2aeaa1a1cd201dfcf82aeZack Rusin      break;
173e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin   case PIPE_QUERY_TIMESTAMP_DISJOINT: {
174e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin      struct pipe_query_data_timestamp_disjoint td;
175e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin      /*os_get_time is in microseconds*/
176e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin      td.frequency = 1000000;
1771f4f0c41db2eb81e858475f6677995c9e15ec03fChristoph Bumiller      td.disjoint = sq->end != sq->start;
1789e8f556b199a662c5525b9d03f52a067244fa602Marek Olšák      memcpy(vresult, &td,
179e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin             sizeof(struct pipe_query_data_timestamp_disjoint));
180e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin   }
181e433b73dd256577b022bf38c8499c7ea4eda9845Zack Rusin      break;
182ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   case PIPE_QUERY_PRIMITIVES_EMITTED:
183ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      *result = sq->so.num_primitives_written;
184ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      break;
185ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie   case PIPE_QUERY_PRIMITIVES_GENERATED:
186ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      *result = sq->num_primitives_generated;
187ec8cbd79ac4065111365a6720c9564de56855cc8Dave Airlie      break;
188be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   default:
189be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin      *result = sq->end - sq->start;
190be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin      break;
191be7d8ddf0c0a293ee94db360a44561beb10e62f9Zack Rusin   }
19213699463a33c1adf44005125c488e886e074a05bKeith Whitwell   return TRUE;
19313699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
19413699463a33c1adf44005125c488e886e074a05bKeith Whitwell
19513699463a33c1adf44005125c488e886e074a05bKeith Whitwell
19641450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul/**
19741450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul * Called by rendering function to check rendering is conditional.
19841450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul * \return TRUE if we should render, FALSE if we should skip rendering
19941450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul */
20041450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paulboolean
20141450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paulsoftpipe_check_render_cond(struct softpipe_context *sp)
20241450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul{
20341450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   struct pipe_context *pipe = &sp->pipe;
20441450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   boolean b, wait;
20541450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   uint64_t result;
20641450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul
20741450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   if (!sp->render_cond_query) {
20841450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul      return TRUE;  /* no query predicate, draw normally */
20941450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   }
21041450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul
21141450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   wait = (sp->render_cond_mode == PIPE_RENDER_COND_WAIT ||
21241450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul           sp->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT);
21341450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul
2144445e170bee23a3607ece0e010adef7058ac6a11Marek Olšák   b = pipe->get_query_result(pipe, sp->render_cond_query, wait,
2154445e170bee23a3607ece0e010adef7058ac6a11Marek Olšák                              (void*)&result);
21641450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   if (b)
21741450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul      return result > 0;
21841450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul   else
21941450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul      return TRUE;
22041450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul}
22141450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul
22241450b03a8e8e0f94f8eefc6880d32e9b0ef6f6dBrian Paul
22313699463a33c1adf44005125c488e886e074a05bKeith Whitwellvoid softpipe_init_query_funcs(struct softpipe_context *softpipe )
22413699463a33c1adf44005125c488e886e074a05bKeith Whitwell{
22513699463a33c1adf44005125c488e886e074a05bKeith Whitwell   softpipe->pipe.create_query = softpipe_create_query;
22613699463a33c1adf44005125c488e886e074a05bKeith Whitwell   softpipe->pipe.destroy_query = softpipe_destroy_query;
22713699463a33c1adf44005125c488e886e074a05bKeith Whitwell   softpipe->pipe.begin_query = softpipe_begin_query;
22813699463a33c1adf44005125c488e886e074a05bKeith Whitwell   softpipe->pipe.end_query = softpipe_end_query;
22913699463a33c1adf44005125c488e886e074a05bKeith Whitwell   softpipe->pipe.get_query_result = softpipe_get_query_result;
23013699463a33c1adf44005125c488e886e074a05bKeith Whitwell}
23113699463a33c1adf44005125c488e886e074a05bKeith Whitwell
23213699463a33c1adf44005125c488e886e074a05bKeith Whitwell
233