From: Emil Velikov Date: Wed, 28 Oct 2015 11:36:00 +0000 (+0000) Subject: virgl: introduce virgl_query() inline wrapper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=78be78b68172f702bb053ecb39105b2550e34454;p=mesa.git virgl: introduce virgl_query() inline wrapper Signed-off-by: Emil Velikov Reviewed-by: Dave Airlie --- 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;