Skip to content

Commit bb8a9eb

Browse files
committed
trace:add vpp output surface dump support
use LIBVA_TRACE_SURFACE=vppout to dump vpp output surface Signed-off-by: Carl Zhang <[email protected]>
1 parent bc0cd86 commit bb8a9eb

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

va/va_trace.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,11 @@ void va_TraceInit(VADisplay dpy)
846846
va_trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE;
847847
if (strstr(env_value, "jpeg") || strstr(env_value, "jpg"))
848848
va_trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG;
849+
/* now one context only support 1 surface dump file
850+
* may add vpp input in future
851+
*/
852+
if (strstr(env_value, "vppout"))
853+
va_trace_flag |= VA_TRACE_FLAG_SURFACE_VPPOUT;
849854

850855
if (va_parseConfig("LIBVA_TRACE_SURFACE_GEOMETRY", &env_value[0]) == 0) {
851856
char *p = env_value, *q;
@@ -1440,7 +1445,7 @@ void va_TraceCreateContext(
14401445
struct va_trace *pva_trace = NULL;
14411446
struct trace_context *trace_ctx = NULL;
14421447
int tra_ctx_id = 0;
1443-
int encode = 0, decode = 0, jpeg = 0;
1448+
int encode = 0, decode = 0, jpeg = 0, vpp = 0;
14441449
int i;
14451450

14461451
pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace);
@@ -1525,9 +1530,12 @@ void va_TraceCreateContext(
15251530
encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
15261531
decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
15271532
jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
1533+
vpp = (trace_ctx->trace_entrypoint == VAEntrypointVideoProc);
1534+
15281535
if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
15291536
(decode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
1530-
(jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
1537+
(jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)) ||
1538+
(vpp && (va_trace_flag & VA_TRACE_FLAG_SURFACE_VPPOUT))) {
15311539
if (open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) {
15321540
va_errorMessage(dpy, "Open surface fail failed for ctx 0x%08x\n", *context);
15331541

@@ -6871,20 +6879,22 @@ void va_TraceEndPictureExt(
68716879
int endpic_done
68726880
)
68736881
{
6874-
int encode, decode, jpeg;
6882+
int encode, decode, jpeg, vpp;
68756883
DPY2TRACECTX(dpy, context, VA_INVALID_ID);
68766884
/* avoid to create so many empty files */
68776885
encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
68786886
decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
68796887
jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
6888+
vpp = (trace_ctx->trace_entrypoint == VAEntrypointVideoProc);
68806889

68816890
/* trace encode source surface, can do it before HW completes rendering */
68826891
if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
68836892
(jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)))
68846893
va_TraceSurface(dpy, context);
68856894

68866895
/* trace decoded surface, do it after HW completes rendering */
6887-
if (decode && ((va_trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) {
6896+
if ((decode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
6897+
(vpp && (va_trace_flag & VA_TRACE_FLAG_SURFACE_VPPOUT))) {
68886898
vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
68896899
va_TraceSurface(dpy, context);
68906900
}

va/va_trace.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ extern int va_trace_flag;
3737
#define VA_TRACE_FLAG_SURFACE_DECODE 0x8
3838
#define VA_TRACE_FLAG_SURFACE_ENCODE 0x10
3939
#define VA_TRACE_FLAG_SURFACE_JPEG 0x20
40+
#define VA_TRACE_FLAG_SURFACE_VPPOUT 0x80
41+
4042
#define VA_TRACE_FLAG_SURFACE (VA_TRACE_FLAG_SURFACE_DECODE | \
4143
VA_TRACE_FLAG_SURFACE_ENCODE | \
4244
VA_TRACE_FLAG_SURFACE_JPEG)
4345
#define VA_TRACE_FLAG_FTRACE 0x40
4446
#define VA_TRACE_FLAG_FTRACE_BUFDATA (VA_TRACE_FLAG_FTRACE | \
4547
VA_TRACE_FLAG_BUFDATA)
4648

49+
4750
#define VA_TRACE_LOG(trace_func,...) \
4851
if (va_trace_flag & VA_TRACE_FLAG_LOG) { \
4952
trace_func(__VA_ARGS__); \

0 commit comments

Comments
 (0)