Skip to content

Commit 7258812

Browse files
lixin5xXinfengZhang
authored andcommitted
va_trace: dump input/output data in va_TraceProtectedSessionExecute
When LIBVA_TRACE_BUFDATA is set, dump the raw bytes of VAProtectedSessionExecuteBuffer's input.data and output.data fields as hex, 16 bytes per row, using va_TraceMsg for the row offset label and va_TracePrint for the byte values.
1 parent 707a78e commit 7258812

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

va/va_trace.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7543,6 +7543,8 @@ void va_TraceProtectedSessionExecute(
75437543
VABufferType type;
75447544
unsigned int size;
75457545
unsigned int num_elements;
7546+
unsigned int i;
7547+
unsigned char *p;
75467548
bool buf_valid = false;
75477549
VAProtectedSessionExecuteBuffer *execute_buf = NULL;
75487550

@@ -7575,6 +7577,29 @@ void va_TraceProtectedSessionExecute(
75757577
va_TraceMsg(trace_ctx, "\t\toutput.data_size = %u\n", execute_buf->output.data_size);
75767578
va_TraceMsg(trace_ctx, "\t\toutput.max_data_size = %u\n", execute_buf->output.max_data_size);
75777579
va_TraceMsg(trace_ctx, "\t\tstatus = 0x%08x\n", execute_buf->status);
7580+
7581+
if (va_trace_flag & VA_TRACE_FLAG_BUFDATA) {
7582+
if (execute_buf->input.data && execute_buf->input.data_size > 0) {
7583+
p = (unsigned char *)execute_buf->input.data;
7584+
for (i = 0; i < execute_buf->input.data_size; i++) {
7585+
if ((i % 16) == 0)
7586+
va_TraceMsg(trace_ctx, "\t\tinput.data[0x%04x]:", i);
7587+
va_TracePrint(trace_ctx, " %02x", p[i]);
7588+
if (((i % 16) == 15) || (i == execute_buf->input.data_size - 1))
7589+
va_TracePrint(trace_ctx, "\n");
7590+
}
7591+
}
7592+
if (execute_buf->output.data && execute_buf->output.data_size > 0) {
7593+
p = (unsigned char *)execute_buf->output.data;
7594+
for (i = 0; i < execute_buf->output.data_size; i++) {
7595+
if ((i % 16) == 0)
7596+
va_TraceMsg(trace_ctx, "\t\toutput.data[0x%04x]:", i);
7597+
va_TracePrint(trace_ctx, " %02x", p[i]);
7598+
if (((i % 16) == 15) || (i == execute_buf->output.data_size - 1))
7599+
va_TracePrint(trace_ctx, "\n");
7600+
}
7601+
}
7602+
}
75787603
} else {
75797604
va_TraceMsg(trace_ctx, "\tbuffer is not valid\n");
75807605
}

0 commit comments

Comments
 (0)