diff options
author | Gert Wollny <[email protected]> | 2018-09-12 11:59:35 +0200 |
---|---|---|
committer | Gert Wollny <[email protected]> | 2018-11-13 14:42:22 +0100 |
commit | 8d4bb6e5cd674da31d665ea54f5a500e8c7c1a6f (patch) | |
tree | 813252a5a608d06ee77cc6c7a5287e794e0a9d5c /src/gallium/drivers/virgl/virgl_encode.c | |
parent | caa964b422152788a95a1b248c884df8918a2bbd (diff) |
virgl: Add command and flags to initiate debugging on the host (v2)
On the host VREND_DEBUG=guestallow must be set to let the guest override
the debug flags.
v2: Send flag string instead of flags, this avoids the need to keep
the flags in sync.
v3: Only request host logging if the host actually understands the command
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index e86d0711a57..400ba684742 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -1044,3 +1044,27 @@ int virgl_encode_texture_barrier(struct virgl_context *ctx, virgl_encoder_write_dword(ctx->cbuf, flags); return 0; } + +int virgl_encode_host_debug_flagstring(struct virgl_context *ctx, + char *flagstring) +{ + unsigned long slen = strlen(flagstring) + 1; + uint32_t sslen; + uint32_t string_length; + + if (!slen) + return 0; + + if (slen > 4 * 0xffff) { + debug_printf("VIRGL: host debug flag string too long, will be truncated\n"); + slen = 4 * 0xffff; + } + + sslen = (uint32_t )(slen + 3) / 4; + string_length = (uint32_t)MIN2(sslen * 4, slen); + + virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_DEBUG_FLAGS, 0, sslen)); + virgl_encoder_write_block(ctx->cbuf, (uint8_t *)flagstring, string_length); + + return 0; +} |