summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_query.c
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2015-10-28 11:36:00 +0000
committerEmil Velikov <[email protected]>2015-10-30 17:37:09 +0000
commit78be78b68172f702bb053ecb39105b2550e34454 (patch)
tree560c7389a602e9180382e4a185be2c58e01dabc8 /src/gallium/drivers/virgl/virgl_query.c
parentdafcb21405622eae3f8aa49000142f870549cc9b (diff)
virgl: introduce virgl_query() inline wrapper
Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_query.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_query.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/virgl/virgl_query.c b/src/gallium/drivers/virgl/virgl_query.c
index ea50f2f9341..b06635b671a 100644
--- a/src/gallium/drivers/virgl/virgl_query.c
+++ b/src/gallium/drivers/virgl/virgl_query.c
@@ -37,13 +37,18 @@ struct virgl_query {
unsigned result_gotten_sent;
};
+static inline struct virgl_query *virgl_query(struct pipe_query *q)
+{
+ return (struct virgl_query *)q;
+}
+
static void virgl_render_condition(struct pipe_context *ctx,
struct pipe_query *q,
boolean condition,
uint mode)
{
struct virgl_context *vctx = virgl_context(ctx);
- struct virgl_query *query = (struct virgl_query *)q;
+ struct virgl_query *query = virgl_query(q);
uint32_t handle = 0;
if (q)
handle = query->handle;
@@ -82,7 +87,7 @@ static void virgl_destroy_query(struct pipe_context *ctx,
struct pipe_query *q)
{
struct virgl_context *vctx = virgl_context(ctx);
- struct virgl_query *query = (struct virgl_query *)q;
+ struct virgl_query *query = virgl_query(q);
virgl_encode_delete_object(vctx, query->handle, VIRGL_OBJECT_QUERY);
@@ -94,7 +99,7 @@ static boolean virgl_begin_query(struct pipe_context *ctx,
struct pipe_query *q)
{
struct virgl_context *vctx = virgl_context(ctx);
- struct virgl_query *query = (struct virgl_query *)q;
+ struct virgl_query *query = virgl_query(q);
query->buf->clean = FALSE;
virgl_encoder_begin_query(vctx, query->handle);
@@ -105,7 +110,7 @@ static void virgl_end_query(struct pipe_context *ctx,
struct pipe_query *q)
{
struct virgl_context *vctx = virgl_context(ctx);
- struct virgl_query *query = (struct virgl_query *)q;
+ struct virgl_query *query = virgl_query(q);
struct pipe_box box;
uint32_t qs = VIRGL_QUERY_STATE_WAIT_HOST;
@@ -123,7 +128,7 @@ static boolean virgl_get_query_result(struct pipe_context *ctx,
union pipe_query_result *result)
{
struct virgl_context *vctx = virgl_context(ctx);
- struct virgl_query *query = (struct virgl_query *)q;
+ struct virgl_query *query = virgl_query(q);
struct pipe_transfer *transfer;
struct virgl_host_query_state *host_state;