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 <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
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
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
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,
return true;
}
-static void
+static bool
ilo_end_query(struct pipe_context *pipe, struct pipe_query *query)
{
struct ilo_query *q = ilo_query(query);
if (!q->active) {
/* require ilo_begin_query() first */
if (q->in_pairs)
- return;
+ return false;
ilo_begin_query(pipe, query);
}
q->active = false;
ilo_query_table[q->type].end(ilo_context(pipe), q);
+
+ return true;
}
/**
}
-static void
+static bool
llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
default:
break;
}
+
+ return true;
}
boolean
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,
return true;
}
-static void
+static bool
nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv30_context *nv30 = nv30_context(pipe);
PUSH_DATA (push, 0);
}
PUSH_KICK (push);
+ return true;
}
static boolean
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
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
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);
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,
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,
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
}
-static void
+static bool
softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
break;
}
softpipe->dirty |= SP_NEW_QUERY;
+ return true;
}
}
-static void
+static bool
svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct svga_context *svga = svga_context(pipe);
assert(!"unexpected query type in svga_end_query()");
}
svga->sq[sq->type] = NULL;
+ return true;
}
return true;
}
-static void
+static bool
swr_end_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct swr_context *ctx = swr_context(pipe);
pq->result = &pq->end;
pq->enable_stats = FALSE;
swr_gather_stats(pipe, pq);
+ return true;
}
}
-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);
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;
}
return true;
}
-static void
+static bool
vc4_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
+ return true;
}
static boolean
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);
virgl_encoder_end_query(vctx, query->handle);
+ return true;
}
static boolean virgl_get_query_result(struct pipe_context *ctx,
struct pipe_query *q);
boolean (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
- void (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
+ bool (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
/**
* Get results of a query.