summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-07-05 17:17:50 +0200
committerRoland Scheidegger <[email protected]>2010-07-05 17:17:50 +0200
commit3ed0a099c70e9d771e60e0ddf70bc0b5ba83a483 (patch)
tree74048647c0b503828babf0ccdbc50e46775be7f2 /src/gallium
parenta3b0aaf26fd55a40bef08312df8b9ac9f1d9d338 (diff)
llvmpipe: wait for queries being finished when asked for it or before deletion
This fixes bug #28757, though does not yet address the issue that fences aren't always emitted.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index c902c046845..02eeaf64871 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -48,7 +48,7 @@ static struct llvmpipe_query *llvmpipe_query( struct pipe_query *p )
static struct pipe_query *
llvmpipe_create_query(struct pipe_context *pipe,
- unsigned type)
+ unsigned type)
{
struct llvmpipe_query *pq;
@@ -67,6 +67,16 @@ static void
llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct llvmpipe_query *pq = llvmpipe_query(q);
+ /* query might still be in process if we never waited for the result */
+ if (!pq->done) {
+ struct pipe_fence_handle *fence = NULL;
+ llvmpipe_flush(pipe, 0, &fence);
+ if (fence) {
+ pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_reference(pipe->screen, &fence, NULL);
+ }
+ }
+
pipe_mutex_destroy(pq->mutex);
FREE(pq);
}
@@ -74,16 +84,26 @@ llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
static boolean
llvmpipe_get_query_result(struct pipe_context *pipe,
- struct pipe_query *q,
- boolean wait,
- void *vresult)
+ struct pipe_query *q,
+ boolean wait,
+ 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);
+ if (wait) {
+ struct pipe_fence_handle *fence = NULL;
+ llvmpipe_flush(pipe, 0, &fence);
+ if (fence) {
+ pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_reference(pipe->screen, &fence, NULL);
+ }
+ }
+ /* this is a bit inconsequent but should be ok */
+ else {
+ llvmpipe_flush(pipe, 0, NULL);
+ }
}
if (pq->done) {