From fd8116476b129288bf8fe6ecedc69135dae7b7a1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 23 Oct 2015 11:04:01 +1000 Subject: [PATCH] virgl: add query index to top 16-bits of query type. This is an ABI valid change, we won't get passed indices unless we advertise later GLSL versions. --- src/virgl_protocol.h | 4 +++- src/vrend_decode.c | 9 +++++++-- src/vrend_renderer.c | 6 ++++-- src/vrend_renderer.h | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/virgl_protocol.h b/src/virgl_protocol.h index 8a9ba46..11c5b38 100644 --- a/src/virgl_protocol.h +++ b/src/virgl_protocol.h @@ -407,7 +407,9 @@ enum virgl_context_cmd { /* query object */ #define VIRGL_OBJ_QUERY_SIZE 4 #define VIRGL_OBJ_QUERY_HANDLE 1 -#define VIRGL_OBJ_QUERY_TYPE 2 +#define VIRGL_OBJ_QUERY_TYPE_INDEX 2 +#define VIRGL_OBJ_QUERY_TYPE(x) (x & 0xffff) +#define VIRGL_OBJ_QUERY_INDEX(x) ((x & 0xffff) << 16) #define VIRGL_OBJ_QUERY_OFFSET 3 #define VIRGL_OBJ_QUERY_RES_HANDLE 4 diff --git a/src/vrend_decode.c b/src/vrend_decode.c index f57fdd8..1d32774 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -617,17 +617,22 @@ static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle, static int vrend_decode_create_query(struct vrend_decode_ctx *ctx, uint32_t handle, uint16_t length) { uint32_t query_type; + uint32_t query_index; uint32_t res_handle; uint32_t offset; + uint32_t tmp; if (length != VIRGL_OBJ_QUERY_SIZE) return EINVAL; - query_type = get_buf_entry(ctx, VIRGL_OBJ_QUERY_TYPE); + tmp = get_buf_entry(ctx, VIRGL_OBJ_QUERY_TYPE_INDEX); + query_type = VIRGL_OBJ_QUERY_TYPE(tmp); + query_index = VIRGL_OBJ_QUERY_INDEX(tmp); + offset = get_buf_entry(ctx, VIRGL_OBJ_QUERY_OFFSET); res_handle = get_buf_entry(ctx, VIRGL_OBJ_QUERY_RES_HANDLE); - return vrend_create_query(ctx->grctx, handle, query_type, res_handle, offset); + return vrend_create_query(ctx->grctx, handle, query_type, query_index, res_handle, offset); } static int vrend_decode_create_object(struct vrend_decode_ctx *ctx, int length) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 6a37792..a0a261a 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -64,6 +64,7 @@ struct vrend_query { GLuint id; GLuint type; + GLuint index; GLuint gltype; int ctx_id; struct vrend_resource *res; @@ -5260,8 +5261,8 @@ uint32_t vrend_renderer_object_insert(struct vrend_context *ctx, void *data, } int vrend_create_query(struct vrend_context *ctx, uint32_t handle, - uint32_t query_type, uint32_t res_handle, - uint32_t offset) + uint32_t query_type, uint32_t query_index, + uint32_t res_handle, uint32_t offset) { struct vrend_query *q; struct vrend_resource *res; @@ -5278,6 +5279,7 @@ int vrend_create_query(struct vrend_context *ctx, uint32_t handle, list_inithead(&q->waiting_queries); q->type = query_type; + q->index = query_index; q->ctx_id = ctx->ctx_id; vrend_resource_reference(&q->res, res); diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index d43fa43..3cde1d4 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -291,8 +291,8 @@ uint32_t vrend_renderer_object_insert(struct vrend_context *ctx, void *data, void vrend_renderer_object_destroy(struct vrend_context *ctx, uint32_t handle); int vrend_create_query(struct vrend_context *ctx, uint32_t handle, - uint32_t query_type, uint32_t res_handle, - uint32_t offset); + uint32_t query_type, uint32_t query_index, + uint32_t res_handle, uint32_t offset); void vrend_begin_query(struct vrend_context *ctx, uint32_t handle); void vrend_end_query(struct vrend_context *ctx, uint32_t handle);