v1.1: fix size define.
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_DEBUG_FLAGS, 0, sslen));
virgl_encoder_write_block(ctx->cbuf, (const uint8_t *)flagstring, string_length);
+ 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, VIRGL_QUERY_RESULT_QBO_SIZE));
+ 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;
}
int virgl_encode_host_debug_flagstring(struct virgl_context *ctx,
const char *envname);
+
+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
#define VIRGL_CAP_TGSI_COMPONENTS (1 << 13)
#define VIRGL_CAP_GUEST_MAY_INIT_LOG (1 << 14)
#define VIRGL_CAP_SRGB_WRITE_CONTROL (1 << 15)
+#define VIRGL_CAP_QBO (1 << 16)
/* virgl bind flags - these are compatible with mesa 10.5 gallium.
* but are fixed, no other should be passed to virgl either.
#define VIRGL_BIND_DISPLAY_TARGET (1 << 7)
#define VIRGL_BIND_STREAM_OUTPUT (1 << 11)
#define VIRGL_BIND_SHADER_BUFFER (1 << 14)
+#define VIRGL_BIND_QUERY_BUFFER (1 << 15)
#define VIRGL_BIND_CURSOR (1 << 16)
#define VIRGL_BIND_CUSTOM (1 << 17)
#define VIRGL_BIND_SCANOUT (1 << 18)
VIRGL_CCMD_TEXTURE_BARRIER,
VIRGL_CCMD_SET_ATOMIC_BUFFERS,
VIRGL_CCMD_SET_DEBUG_FLAGS,
+ VIRGL_CCMD_GET_QUERY_RESULT_QBO,
};
/*
#define VIRGL_QUERY_END_HANDLE 1
+#define VIRGL_QUERY_RESULT_SIZE 2
#define VIRGL_QUERY_RESULT_HANDLE 1
#define VIRGL_QUERY_RESULT_WAIT 2
#define VIRGL_SET_ATOMIC_BUFFER_LENGTH(x) ((x) * VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE + 3)
#define VIRGL_SET_ATOMIC_BUFFER_RES_HANDLE(x) ((x) * VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE + 4)
+/* qbo */
+#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
{
}
+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;
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;
}
outbind |= VIRGL_BIND_SCANOUT;
if (pbind & PIPE_BIND_SHADER_BUFFER)
outbind |= VIRGL_BIND_SHADER_BUFFER;
+ if (pbind & PIPE_BIND_QUERY_BUFFER)
+ outbind |= VIRGL_BIND_QUERY_BUFFER;
return outbind;
}
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return 1; /* TODO: need to introduce a hw-cap for this */
+ case PIPE_CAP_QUERY_BUFFER_OBJECT:
+ return vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_QBO;
case PIPE_CAP_TEXTURE_GATHER_SM5:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_FAKE_SW_MSAA:
case PIPE_CAP_INVALIDATE_BUFFER:
case PIPE_CAP_GENERATE_MIPMAP:
case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
- case PIPE_CAP_QUERY_BUFFER_OBJECT:
case PIPE_CAP_STRING_MARKER:
case PIPE_CAP_QUERY_MEMORY_INFO:
case PIPE_CAP_PCI_GROUP: