Commit 7fcdb664 authored by Dave Airlie's avatar Dave Airlie
Browse files

initial qbo support

parent 144d40ee
......@@ -992,3 +992,20 @@ int virgl_encode_launch_grid(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, grid_info->indirect_offset);
return 0;
}
int virgl_encode_get_query_result_qbo(struct virgl_context *ctx,
uint32_t handle,
struct virgl_resource *res, boolean wait,
uint32_t result_type,
uint32_t offset,
uint32_t index)
{
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_GET_QUERY_RESULT_QBO, 0, 6));
virgl_encoder_write_dword(ctx->cbuf, handle);
virgl_encoder_write_res(ctx, res);
virgl_encoder_write_dword(ctx->cbuf, wait ? 1 : 0);
virgl_encoder_write_dword(ctx->cbuf, result_type);
virgl_encoder_write_dword(ctx->cbuf, offset);
virgl_encoder_write_dword(ctx->cbuf, index);
return 0;
}
......@@ -269,4 +269,11 @@ int virgl_encode_memory_barrier(struct virgl_context *ctx,
int virgl_encode_launch_grid(struct virgl_context *ctx,
const struct pipe_grid_info *grid_info);
int virgl_encode_get_query_result_qbo(struct virgl_context *ctx,
uint32_t handle,
struct virgl_resource *res, boolean wait,
uint32_t result_type,
uint32_t offset,
uint32_t index);
#endif
......@@ -213,6 +213,7 @@ enum virgl_formats {
#define VIRGL_BIND_CURSOR (1 << 16)
#define VIRGL_BIND_CUSTOM (1 << 17)
#define VIRGL_BIND_SCANOUT (1 << 18)
#define VIRGL_BIND_QUERY_BUFFER (1 << 22)
struct virgl_caps_bool_set1 {
unsigned indep_blend_enable:1;
......
......@@ -85,6 +85,7 @@ enum virgl_context_cmd {
VIRGL_CCMD_BIND_SHADER,
VIRGL_CCMD_SET_TESS_STATE,
VIRGL_CCMD_GET_QUERY_RESULT_QBO,
VIRGL_CCMD_SET_SHADER_IMAGES,
VIRGL_CCMD_SET_SHADER_BUFFERS,
......@@ -445,6 +446,7 @@ enum virgl_context_cmd {
#define VIRGL_QUERY_END_HANDLE 1
#define VIRGL_QUERY_RESULT_SIZE 2
#define VIRGL_QUERY_RESULT_HANDLE 1
#define VIRGL_QUERY_RESULT_WAIT 2
......@@ -520,4 +522,12 @@ enum virgl_context_cmd {
#define VIRGL_LAUNCH_GRID_Z 6
#define VIRGL_LAUNCH_INDIRECT_HANDLE 7
#define VIRGL_LAUNCH_INDIRECT_OFFSET 8
#define VIRGL_QUERY_RESULT_QBO_SIZE 6
#define VIRGL_QUERY_RESULT_QBO_HANDLE 1
#define VIRGL_QUERY_RESULT_QBO_QBO_HANDLE 2
#define VIRGL_QUERY_RESULT_QBO_WAIT 3
#define VIRGL_QUERY_RESULT_QBO_RESULT_TYPE 4
#define VIRGL_QUERY_RESULT_QBO_OFFSET 5
#define VIRGL_QUERY_RESULT_QBO_INDEX 6
#endif
......@@ -205,6 +205,22 @@ virgl_set_active_query_state(struct pipe_context *pipe, boolean enable)
{
}
static void
virgl_get_query_result_resource(struct pipe_context *ctx,
struct pipe_query *q,
boolean wait,
enum pipe_query_value_type result_type,
int index,
struct pipe_resource *resource,
unsigned offset)
{
struct virgl_context *vctx = virgl_context(ctx);
struct virgl_query *query = virgl_query(q);
struct virgl_resource *qbo = (struct virgl_resource *)resource;
virgl_encode_get_query_result_qbo(vctx, query->handle, qbo, wait, result_type, offset, index);
}
void virgl_init_query_functions(struct virgl_context *vctx)
{
vctx->base.render_condition = virgl_render_condition;
......@@ -214,4 +230,5 @@ void virgl_init_query_functions(struct virgl_context *vctx)
vctx->base.end_query = virgl_end_query;
vctx->base.get_query_result = virgl_get_query_result;
vctx->base.set_active_query_state = virgl_set_active_query_state;
vctx->base.get_query_result_resource = virgl_get_query_result_resource;
}
......@@ -134,6 +134,8 @@ static inline unsigned pipe_to_virgl_bind(unsigned pbind)
outbind |= VIRGL_BIND_CUSTOM;
if (pbind & PIPE_BIND_SCANOUT)
outbind |= VIRGL_BIND_SCANOUT;
if (pbind & PIPE_BIND_QUERY_BUFFER)
outbind |= VIRGL_BIND_QUERY_BUFFER;
return outbind;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment