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.
macos/master
Dave Airlie 9 years ago
parent b4cd13e121
commit fd8116476b
  1. 4
      src/virgl_protocol.h
  2. 9
      src/vrend_decode.c
  3. 6
      src/vrend_renderer.c
  4. 4
      src/vrend_renderer.h

@ -407,7 +407,9 @@ enum virgl_context_cmd {
/* query object */ /* query object */
#define VIRGL_OBJ_QUERY_SIZE 4 #define VIRGL_OBJ_QUERY_SIZE 4
#define VIRGL_OBJ_QUERY_HANDLE 1 #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_OFFSET 3
#define VIRGL_OBJ_QUERY_RES_HANDLE 4 #define VIRGL_OBJ_QUERY_RES_HANDLE 4

@ -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) static int vrend_decode_create_query(struct vrend_decode_ctx *ctx, uint32_t handle, uint16_t length)
{ {
uint32_t query_type; uint32_t query_type;
uint32_t query_index;
uint32_t res_handle; uint32_t res_handle;
uint32_t offset; uint32_t offset;
uint32_t tmp;
if (length != VIRGL_OBJ_QUERY_SIZE) if (length != VIRGL_OBJ_QUERY_SIZE)
return EINVAL; 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); offset = get_buf_entry(ctx, VIRGL_OBJ_QUERY_OFFSET);
res_handle = get_buf_entry(ctx, VIRGL_OBJ_QUERY_RES_HANDLE); 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) static int vrend_decode_create_object(struct vrend_decode_ctx *ctx, int length)

@ -64,6 +64,7 @@ struct vrend_query {
GLuint id; GLuint id;
GLuint type; GLuint type;
GLuint index;
GLuint gltype; GLuint gltype;
int ctx_id; int ctx_id;
struct vrend_resource *res; 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, int vrend_create_query(struct vrend_context *ctx, uint32_t handle,
uint32_t query_type, uint32_t res_handle, uint32_t query_type, uint32_t query_index,
uint32_t offset) uint32_t res_handle, uint32_t offset)
{ {
struct vrend_query *q; struct vrend_query *q;
struct vrend_resource *res; struct vrend_resource *res;
@ -5278,6 +5279,7 @@ int vrend_create_query(struct vrend_context *ctx, uint32_t handle,
list_inithead(&q->waiting_queries); list_inithead(&q->waiting_queries);
q->type = query_type; q->type = query_type;
q->index = query_index;
q->ctx_id = ctx->ctx_id; q->ctx_id = ctx->ctx_id;
vrend_resource_reference(&q->res, res); vrend_resource_reference(&q->res, res);

@ -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); void vrend_renderer_object_destroy(struct vrend_context *ctx, uint32_t handle);
int vrend_create_query(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 query_type, uint32_t query_index,
uint32_t offset); uint32_t res_handle, uint32_t offset);
void vrend_begin_query(struct vrend_context *ctx, uint32_t handle); void vrend_begin_query(struct vrend_context *ctx, uint32_t handle);
void vrend_end_query(struct vrend_context *ctx, uint32_t handle); void vrend_end_query(struct vrend_context *ctx, uint32_t handle);

Loading…
Cancel
Save