From 34f7681669987bc804f4603463f2fa3f82bc844f Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 3 Jun 2010 16:12:08 -0400 Subject: [PATCH] gallium: adjust the query interface to support custom types we need to change it to support composite types --- src/gallium/drivers/i965/brw_pipe_query.c | 3 ++- src/gallium/drivers/identity/id_context.c | 2 +- src/gallium/drivers/llvmpipe/lp_query.c | 3 ++- src/gallium/drivers/nv50/nv50_query.c | 3 ++- src/gallium/drivers/nvfx/nvfx_query.c | 3 ++- src/gallium/drivers/r300/r300_query.c | 3 ++- src/gallium/drivers/r600/r600_query.c | 2 +- src/gallium/drivers/rbug/rbug_context.c | 2 +- src/gallium/drivers/softpipe/sp_query.c | 3 ++- src/gallium/drivers/svga/svga_pipe_query.c | 5 +++-- src/gallium/drivers/trace/tr_context.c | 4 ++-- src/gallium/include/pipe/p_context.h | 4 ++-- 12 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/i965/brw_pipe_query.c b/src/gallium/drivers/i965/brw_pipe_query.c index 2eb862635cc..0745254c3cc 100644 --- a/src/gallium/drivers/i965/brw_pipe_query.c +++ b/src/gallium/drivers/i965/brw_pipe_query.c @@ -50,10 +50,11 @@ static boolean brw_query_get_result(struct pipe_context *pipe, struct pipe_query *q, boolean wait, - uint64_t *result) + void *vresult) { struct brw_context *brw = brw_context(pipe); 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 */ if (query->bo) { diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 898e0b3af83..67be895b385 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -158,7 +158,7 @@ static boolean identity_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, boolean wait, - uint64_t *result) + void *result) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index c4864422860..c902c046845 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -76,10 +76,11 @@ static boolean llvmpipe_get_query_result(struct pipe_context *pipe, struct pipe_query *q, boolean wait, - uint64_t *result ) + void *vresult) { struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); struct llvmpipe_query *pq = llvmpipe_query(q); + uint64_t *result = (uint64_t *)vresult; if (!pq->done) { lp_setup_flush(llvmpipe->setup, 0); diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index 57b16a355dc..53f94820ce0 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -106,8 +106,9 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq) static boolean 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); int ret; diff --git a/src/gallium/drivers/nvfx/nvfx_query.c b/src/gallium/drivers/nvfx/nvfx_query.c index 1b20b5245d7..1dab20c41a0 100644 --- a/src/gallium/drivers/nvfx/nvfx_query.c +++ b/src/gallium/drivers/nvfx/nvfx_query.c @@ -96,8 +96,9 @@ nvfx_query_end(struct pipe_context *pipe, struct pipe_query *pq) static boolean 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_query *q = nvfx_query(pq); diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 97081c4a00f..7c088063683 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -114,7 +114,7 @@ static void r300_end_query(struct pipe_context* pipe, static boolean r300_get_query_result(struct pipe_context* pipe, struct pipe_query* query, boolean wait, - uint64_t* result) + void* vresult) { struct r300_context* r300 = r300_context(pipe); 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 temp = 0; unsigned i, num_results; + uint64_t *result = (uint64_t*)vresult; if (q->flushed == FALSE) pipe->flush(pipe, 0, NULL); diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 24746e78771..9b02ae680e7 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -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, struct pipe_query *query, - boolean wait, uint64_t *result) + boolean wait, void *result) { return TRUE; } diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 164d811ab48..00b167e256c 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -241,7 +241,7 @@ static boolean rbug_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, boolean wait, - uint64_t *result) + void *result) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index b959af63aff..ae52c22b3ee 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -118,9 +118,10 @@ static boolean softpipe_get_query_result(struct pipe_context *pipe, struct pipe_query *q, boolean wait, - uint64_t *result ) + void *vresult) { struct softpipe_query *sq = softpipe_query(q); + uint64_t *result = (uint64_t*)vresult; *result = sq->end - sq->start; return TRUE; } diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 96fb4b8e536..579f8034c7c 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -63,7 +63,7 @@ svga_query( struct pipe_query *q ) static boolean svga_get_query_result(struct pipe_context *pipe, struct pipe_query *q, boolean wait, - uint64_t *result); + void *result); static struct pipe_query *svga_create_query( struct pipe_context *pipe, 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, struct pipe_query *q, boolean wait, - uint64_t *result) + void *vresult) { struct svga_context *svga = svga_context( pipe ); struct svga_screen *svgascreen = svga_screen( pipe->screen ); struct svga_winsys_screen *sws = svgascreen->sws; struct svga_query *sq = svga_query( q ); SVGA3dQueryState state; + uint64_t *result = (uint64_t*)vresult; SVGA_DBG(DEBUG_QUERY, "%s wait: %d\n", __FUNCTION__); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 9ca916fe7b4..55dd6cf8837 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -248,7 +248,7 @@ static INLINE boolean trace_context_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, boolean wait, - uint64_t *presult) + void *presult) { struct trace_context *tr_ctx = trace_context(_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); _result = pipe->get_query_result(pipe, query, wait, presult); - result = *presult; + result = *((uint64_t*)presult); trace_dump_arg(uint, result); trace_dump_ret(bool, _result); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 74180888f69..72afad60ba9 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -135,10 +135,10 @@ struct pipe_context { * \param wait if true, this query will block until the result is ready * \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, boolean wait, - uint64_t *result); + void *result); /*@}*/ /** -- 2.30.2