summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-04-20 09:22:48 -0500
committerNicolai Hähnle <[email protected]>2016-04-21 22:32:50 -0500
commit32214e0c6837a24ad82152e9971baa3926992498 (patch)
tree8a455e6552f76440dd71d85c0e5381a6526428fc /src/gallium/drivers
parent6a0d036483caf87d43ebe2edd1905873446c9589 (diff)
gallium: add bool return to pipe_context::end_query
Even when begin_query succeeds, there can still be failures in query handling. For example for radeon, additional buffers may have to be allocated when queries span multiple command buffers. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/ddebug/dd_context.c4
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query.c3
-rw-r--r--src/gallium/drivers/i915/i915_query.c3
-rw-r--r--src/gallium/drivers/ilo/ilo_query.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c4
-rw-r--r--src/gallium/drivers/noop/noop_pipe.c3
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_query.c3
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_query.c3
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_query.c3
-rw-r--r--src/gallium/drivers/r300/r300_query.c8
-rw-r--r--src/gallium/drivers/radeon/r600_query.c3
-rw-r--r--src/gallium/drivers/rbug/rbug_context.c9
-rw-r--r--src/gallium/drivers/softpipe/sp_query.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c3
-rw-r--r--src/gallium/drivers/swr/swr_query.cpp3
-rw-r--r--src/gallium/drivers/trace/tr_context.c6
-rw-r--r--src/gallium/drivers/vc4/vc4_query.c3
-rw-r--r--src/gallium/drivers/virgl/virgl_query.c3
18 files changed, 48 insertions, 25 deletions
diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c
index 72a950a456a..d06efbc0a1c 100644
--- a/src/gallium/drivers/ddebug/dd_context.c
+++ b/src/gallium/drivers/ddebug/dd_context.c
@@ -104,13 +104,13 @@ dd_context_begin_query(struct pipe_context *_pipe, struct pipe_query *query)
return pipe->begin_query(pipe, dd_query_unwrap(query));
}
-static void
+static bool
dd_context_end_query(struct pipe_context *_pipe, struct pipe_query *query)
{
struct dd_context *dctx = dd_context(_pipe);
struct pipe_context *pipe = dctx->pipe;
- pipe->end_query(pipe, dd_query_unwrap(query));
+ return pipe->end_query(pipe, dd_query_unwrap(query));
}
static boolean
diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c
index a9427058579..18e0c793c51 100644
--- a/src/gallium/drivers/freedreno/freedreno_query.c
+++ b/src/gallium/drivers/freedreno/freedreno_query.c
@@ -66,11 +66,12 @@ fd_begin_query(struct pipe_context *pctx, struct pipe_query *pq)
return q->funcs->begin_query(fd_context(pctx), q);
}
-static void
+static bool
fd_end_query(struct pipe_context *pctx, struct pipe_query *pq)
{
struct fd_query *q = fd_query(pq);
q->funcs->end_query(fd_context(pctx), q);
+ return true;
}
static boolean
diff --git a/src/gallium/drivers/i915/i915_query.c b/src/gallium/drivers/i915/i915_query.c
index fa1b01d1804..d6015a62f46 100644
--- a/src/gallium/drivers/i915/i915_query.c
+++ b/src/gallium/drivers/i915/i915_query.c
@@ -60,8 +60,9 @@ static boolean i915_begin_query(struct pipe_context *ctx,
return true;
}
-static void i915_end_query(struct pipe_context *ctx, struct pipe_query *query)
+static bool i915_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
+ return true;
}
static boolean i915_get_query_result(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/ilo/ilo_query.c b/src/gallium/drivers/ilo/ilo_query.c
index 8a42f58a87f..3088c969787 100644
--- a/src/gallium/drivers/ilo/ilo_query.c
+++ b/src/gallium/drivers/ilo/ilo_query.c
@@ -128,7 +128,7 @@ ilo_begin_query(struct pipe_context *pipe, struct pipe_query *query)
return true;
}
-static void
+static bool
ilo_end_query(struct pipe_context *pipe, struct pipe_query *query)
{
struct ilo_query *q = ilo_query(query);
@@ -136,7 +136,7 @@ ilo_end_query(struct pipe_context *pipe, struct pipe_query *query)
if (!q->active) {
/* require ilo_begin_query() first */
if (q->in_pairs)
- return;
+ return false;
ilo_begin_query(pipe, query);
}
@@ -144,6 +144,8 @@ ilo_end_query(struct pipe_context *pipe, struct pipe_query *query)
q->active = false;
ilo_query_table[q->type].end(ilo_context(pipe), q);
+
+ return true;
}
/**
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 2fddc90503f..d5ed6561b8c 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -239,7 +239,7 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
}
-static void
+static bool
llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
@@ -298,6 +298,8 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
default:
break;
}
+
+ return true;
}
boolean
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index 55aca74628e..99e5f1ae1a9 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -63,8 +63,9 @@ static boolean noop_begin_query(struct pipe_context *ctx, struct pipe_query *que
return true;
}
-static void noop_end_query(struct pipe_context *ctx, struct pipe_query *query)
+static bool noop_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
+ return true;
}
static boolean noop_get_query_result(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_query.c b/src/gallium/drivers/nouveau/nv30/nv30_query.c
index cb53a3663e5..aa9a12fe3bd 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_query.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_query.c
@@ -175,7 +175,7 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
return true;
}
-static void
+static bool
nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv30_context *nv30 = nv30_context(pipe);
@@ -194,6 +194,7 @@ nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
PUSH_DATA (push, 0);
}
PUSH_KICK (push);
+ return true;
}
static boolean
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index fa70fb6950e..9a1397a9860 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -54,11 +54,12 @@ nv50_begin_query(struct pipe_context *pipe, struct pipe_query *pq)
return q->funcs->begin_query(nv50_context(pipe), q);
}
-static void
+static bool
nv50_end_query(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv50_query *q = nv50_query(pq);
q->funcs->end_query(nv50_context(pipe), q);
+ return true;
}
static boolean
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index b34271c4911..91fb72f90b5 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -58,11 +58,12 @@ nvc0_begin_query(struct pipe_context *pipe, struct pipe_query *pq)
return q->funcs->begin_query(nvc0_context(pipe), q);
}
-static void
+static bool
nvc0_end_query(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nvc0_query *q = nvc0_query(pq);
q->funcs->end_query(nvc0_context(pipe), q);
+ return true;
}
static boolean
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 7603985b14b..8557eb72141 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -110,7 +110,7 @@ void r300_stop_query(struct r300_context *r300)
r300->query_current = NULL;
}
-static void r300_end_query(struct pipe_context* pipe,
+static bool r300_end_query(struct pipe_context* pipe,
struct pipe_query* query)
{
struct r300_context* r300 = r300_context(pipe);
@@ -120,16 +120,18 @@ static void r300_end_query(struct pipe_context* pipe,
pb_reference(&q->buf, NULL);
r300_flush(pipe, RADEON_FLUSH_ASYNC,
(struct pipe_fence_handle**)&q->buf);
- return;
+ return true;
}
if (q != r300->query_current) {
fprintf(stderr, "r300: end_query: Got invalid query.\n");
assert(0);
- return;
+ return false;
}
r300_stop_query(r300);
+
+ return true;
}
static boolean r300_get_query_result(struct pipe_context* pipe,
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index 346238e0ff8..e3b9de087dd 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -725,12 +725,13 @@ boolean r600_query_hw_begin(struct r600_common_context *rctx,
return true;
}
-static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
+static bool r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct r600_query *rquery = (struct r600_query *)query;
rquery->ops->end(rctx, rquery);
+ return true;
}
void r600_query_hw_end(struct r600_common_context *rctx,
diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
index 1280c45b539..38dee7434cb 100644
--- a/src/gallium/drivers/rbug/rbug_context.c
+++ b/src/gallium/drivers/rbug/rbug_context.c
@@ -178,17 +178,20 @@ rbug_begin_query(struct pipe_context *_pipe,
return ret;
}
-static void
+static bool
rbug_end_query(struct pipe_context *_pipe,
struct pipe_query *query)
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct pipe_context *pipe = rb_pipe->pipe;
+ bool ret;
pipe_mutex_lock(rb_pipe->call_mutex);
- pipe->end_query(pipe,
- query);
+ ret = pipe->end_query(pipe,
+ query);
pipe_mutex_unlock(rb_pipe->call_mutex);
+
+ return ret;
}
static boolean
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 81e97107d59..bec0116a56e 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -134,7 +134,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
}
-static void
+static bool
softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
@@ -201,6 +201,7 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
break;
}
softpipe->dirty |= SP_NEW_QUERY;
+ return true;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index 75bc9ce092b..05b756a71c7 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -945,7 +945,7 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)
}
-static void
+static bool
svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct svga_context *svga = svga_context(pipe);
@@ -1057,6 +1057,7 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
assert(!"unexpected query type in svga_end_query()");
}
svga->sq[sq->type] = NULL;
+ return true;
}
diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp
index e4b8b683278..ff4d9b35018 100644
--- a/src/gallium/drivers/swr/swr_query.cpp
+++ b/src/gallium/drivers/swr/swr_query.cpp
@@ -281,7 +281,7 @@ swr_begin_query(struct pipe_context *pipe, struct pipe_query *q)
return true;
}
-static void
+static bool
swr_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct swr_context *ctx = swr_context(pipe);
@@ -295,6 +295,7 @@ swr_end_query(struct pipe_context *pipe, struct pipe_query *q)
pq->result = &pq->end;
pq->enable_stats = FALSE;
swr_gather_stats(pipe, pq);
+ return true;
}
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index b575f2cdb34..7ed4f4988dd 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -218,12 +218,13 @@ trace_context_begin_query(struct pipe_context *_pipe,
}
-static void
+static bool
trace_context_end_query(struct pipe_context *_pipe,
struct pipe_query *query)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
+ bool ret;
query = trace_query_unwrap(query);
@@ -232,9 +233,10 @@ trace_context_end_query(struct pipe_context *_pipe,
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, query);
- pipe->end_query(pipe, query);
+ ret = pipe->end_query(pipe, query);
trace_dump_call_end();
+ return ret;
}
diff --git a/src/gallium/drivers/vc4/vc4_query.c b/src/gallium/drivers/vc4/vc4_query.c
index 17400a37ca3..ddf8f8fb0c2 100644
--- a/src/gallium/drivers/vc4/vc4_query.c
+++ b/src/gallium/drivers/vc4/vc4_query.c
@@ -56,9 +56,10 @@ vc4_begin_query(struct pipe_context *ctx, struct pipe_query *query)
return true;
}
-static void
+static bool
vc4_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
+ return true;
}
static boolean
diff --git a/src/gallium/drivers/virgl/virgl_query.c b/src/gallium/drivers/virgl/virgl_query.c
index 5173bd39a45..4ddb925b347 100644
--- a/src/gallium/drivers/virgl/virgl_query.c
+++ b/src/gallium/drivers/virgl/virgl_query.c
@@ -107,7 +107,7 @@ static boolean virgl_begin_query(struct pipe_context *ctx,
return true;
}
-static void virgl_end_query(struct pipe_context *ctx,
+static bool virgl_end_query(struct pipe_context *ctx,
struct pipe_query *q)
{
struct virgl_context *vctx = virgl_context(ctx);
@@ -121,6 +121,7 @@ static void virgl_end_query(struct pipe_context *ctx,
virgl_encoder_end_query(vctx, query->handle);
+ return true;
}
static boolean virgl_get_query_result(struct pipe_context *ctx,