gallium: adjust the query interface to support custom types

we need to change it to support composite types
This commit is contained in:
Zack Rusin
2010-06-03 16:12:08 -04:00
parent 3a7fc2e4f3
commit 34f7681669
12 changed files with 22 additions and 15 deletions

View File

@@ -50,10 +50,11 @@ static boolean
brw_query_get_result(struct pipe_context *pipe, brw_query_get_result(struct pipe_context *pipe,
struct pipe_query *q, struct pipe_query *q,
boolean wait, boolean wait,
uint64_t *result) void *vresult)
{ {
struct brw_context *brw = brw_context(pipe); struct brw_context *brw = brw_context(pipe);
struct brw_query_object *query = (struct brw_query_object *)q; struct brw_query_object *query = (struct brw_query_object *)q;
uint64_t *result = (uint64_t*)vresult;
/* Map and count the pixels from the current query BO */ /* Map and count the pixels from the current query BO */
if (query->bo) { if (query->bo) {

View File

@@ -158,7 +158,7 @@ static boolean
identity_get_query_result(struct pipe_context *_pipe, identity_get_query_result(struct pipe_context *_pipe,
struct pipe_query *query, struct pipe_query *query,
boolean wait, boolean wait,
uint64_t *result) void *result)
{ {
struct identity_context *id_pipe = identity_context(_pipe); struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe; struct pipe_context *pipe = id_pipe->pipe;

View File

@@ -76,10 +76,11 @@ static boolean
llvmpipe_get_query_result(struct pipe_context *pipe, llvmpipe_get_query_result(struct pipe_context *pipe,
struct pipe_query *q, struct pipe_query *q,
boolean wait, boolean wait,
uint64_t *result ) void *vresult)
{ {
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
struct llvmpipe_query *pq = llvmpipe_query(q); struct llvmpipe_query *pq = llvmpipe_query(q);
uint64_t *result = (uint64_t *)vresult;
if (!pq->done) { if (!pq->done) {
lp_setup_flush(llvmpipe->setup, 0); lp_setup_flush(llvmpipe->setup, 0);

View File

@@ -106,8 +106,9 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
static boolean static boolean
nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq,
boolean wait, uint64_t *result) boolean wait, void *vresult)
{ {
uint64_t *result = (uint64_t*)vresult;
struct nv50_query *q = nv50_query(pq); struct nv50_query *q = nv50_query(pq);
int ret; int ret;

View File

@@ -96,8 +96,9 @@ nvfx_query_end(struct pipe_context *pipe, struct pipe_query *pq)
static boolean static boolean
nvfx_query_result(struct pipe_context *pipe, struct pipe_query *pq, nvfx_query_result(struct pipe_context *pipe, struct pipe_query *pq,
boolean wait, uint64_t *result) boolean wait, void *vresult)
{ {
uint64_t *result = (uint64_t *)vresult;
struct nvfx_context *nvfx = nvfx_context(pipe); struct nvfx_context *nvfx = nvfx_context(pipe);
struct nvfx_query *q = nvfx_query(pq); struct nvfx_query *q = nvfx_query(pq);

View File

@@ -114,7 +114,7 @@ static void r300_end_query(struct pipe_context* pipe,
static boolean r300_get_query_result(struct pipe_context* pipe, static boolean r300_get_query_result(struct pipe_context* pipe,
struct pipe_query* query, struct pipe_query* query,
boolean wait, boolean wait,
uint64_t* result) void* vresult)
{ {
struct r300_context* r300 = r300_context(pipe); struct r300_context* r300 = r300_context(pipe);
struct r300_screen* r300screen = r300->screen; struct r300_screen* r300screen = r300->screen;
@@ -124,6 +124,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
uint32_t* map; uint32_t* map;
uint32_t temp = 0; uint32_t temp = 0;
unsigned i, num_results; unsigned i, num_results;
uint64_t *result = (uint64_t*)vresult;
if (q->flushed == FALSE) if (q->flushed == FALSE)
pipe->flush(pipe, 0, NULL); pipe->flush(pipe, 0, NULL);

View File

@@ -50,7 +50,7 @@ static void r600_end_query(struct pipe_context *pipe, struct pipe_query *query)
static boolean r600_get_query_result(struct pipe_context *pipe, static boolean r600_get_query_result(struct pipe_context *pipe,
struct pipe_query *query, struct pipe_query *query,
boolean wait, uint64_t *result) boolean wait, void *result)
{ {
return TRUE; return TRUE;
} }

View File

@@ -241,7 +241,7 @@ static boolean
rbug_get_query_result(struct pipe_context *_pipe, rbug_get_query_result(struct pipe_context *_pipe,
struct pipe_query *query, struct pipe_query *query,
boolean wait, boolean wait,
uint64_t *result) void *result)
{ {
struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_context *rb_pipe = rbug_context(_pipe);
struct pipe_context *pipe = rb_pipe->pipe; struct pipe_context *pipe = rb_pipe->pipe;

View File

@@ -118,9 +118,10 @@ static boolean
softpipe_get_query_result(struct pipe_context *pipe, softpipe_get_query_result(struct pipe_context *pipe,
struct pipe_query *q, struct pipe_query *q,
boolean wait, boolean wait,
uint64_t *result ) void *vresult)
{ {
struct softpipe_query *sq = softpipe_query(q); struct softpipe_query *sq = softpipe_query(q);
uint64_t *result = (uint64_t*)vresult;
*result = sq->end - sq->start; *result = sq->end - sq->start;
return TRUE; return TRUE;
} }

View File

@@ -63,7 +63,7 @@ svga_query( struct pipe_query *q )
static boolean svga_get_query_result(struct pipe_context *pipe, static boolean svga_get_query_result(struct pipe_context *pipe,
struct pipe_query *q, struct pipe_query *q,
boolean wait, boolean wait,
uint64_t *result); void *result);
static struct pipe_query *svga_create_query( struct pipe_context *pipe, static struct pipe_query *svga_create_query( struct pipe_context *pipe,
unsigned query_type ) unsigned query_type )
@@ -207,13 +207,14 @@ static void svga_end_query(struct pipe_context *pipe,
static boolean svga_get_query_result(struct pipe_context *pipe, static boolean svga_get_query_result(struct pipe_context *pipe,
struct pipe_query *q, struct pipe_query *q,
boolean wait, boolean wait,
uint64_t *result) void *vresult)
{ {
struct svga_context *svga = svga_context( pipe ); struct svga_context *svga = svga_context( pipe );
struct svga_screen *svgascreen = svga_screen( pipe->screen ); struct svga_screen *svgascreen = svga_screen( pipe->screen );
struct svga_winsys_screen *sws = svgascreen->sws; struct svga_winsys_screen *sws = svgascreen->sws;
struct svga_query *sq = svga_query( q ); struct svga_query *sq = svga_query( q );
SVGA3dQueryState state; SVGA3dQueryState state;
uint64_t *result = (uint64_t*)vresult;
SVGA_DBG(DEBUG_QUERY, "%s wait: %d\n", __FUNCTION__); SVGA_DBG(DEBUG_QUERY, "%s wait: %d\n", __FUNCTION__);

View File

@@ -248,7 +248,7 @@ static INLINE boolean
trace_context_get_query_result(struct pipe_context *_pipe, trace_context_get_query_result(struct pipe_context *_pipe,
struct pipe_query *query, struct pipe_query *query,
boolean wait, boolean wait,
uint64_t *presult) void *presult)
{ {
struct trace_context *tr_ctx = trace_context(_pipe); struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe; struct pipe_context *pipe = tr_ctx->pipe;
@@ -260,7 +260,7 @@ trace_context_get_query_result(struct pipe_context *_pipe,
trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, pipe);
_result = pipe->get_query_result(pipe, query, wait, presult); _result = pipe->get_query_result(pipe, query, wait, presult);
result = *presult; result = *((uint64_t*)presult);
trace_dump_arg(uint, result); trace_dump_arg(uint, result);
trace_dump_ret(bool, _result); trace_dump_ret(bool, _result);

View File

@@ -135,10 +135,10 @@ struct pipe_context {
* \param wait if true, this query will block until the result is ready * \param wait if true, this query will block until the result is ready
* \return TRUE if results are ready, FALSE otherwise * \return TRUE if results are ready, FALSE otherwise
*/ */
boolean (*get_query_result)(struct pipe_context *pipe, boolean (*get_query_result)(struct pipe_context *pipe,
struct pipe_query *q, struct pipe_query *q,
boolean wait, boolean wait,
uint64_t *result); void *result);
/*@}*/ /*@}*/
/** /**