Skip to content

Commit

Permalink
Add trace for vaExportSurfaceHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroYY authored and XinfengZhang committed Jul 20, 2023
1 parent c91741d commit c033948
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,8 @@ vaExportSurfaceHandle(VADisplay dpy, VASurfaceID surface_id,
vaStatus = ctx->vtable->vaExportSurfaceHandle(ctx, surface_id,
mem_type, flags,
descriptor);
VA_TRACE_LOG(va_TraceExportSurfaceHandle, dpy, surface_id, mem_type, flags, descriptor);

VA_TRACE_RET(dpy, vaStatus);
return vaStatus;
}
Expand Down
50 changes: 50 additions & 0 deletions va/va_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -6316,3 +6316,53 @@ void va_TraceEventBuffers(
}
return;
}

void va_TraceExportSurfaceHandle(
VADisplay dpy,
VASurfaceID surfaceId,
uint32_t memType,
uint32_t flags,
void *descriptor)
{
int i;

DPY2TRACE_VIRCTX(dpy);

TRACE_FUNCNAME(idx);

va_TraceMsg(trace_ctx, "\tsurfaceId = 0x%08x\n", surfaceId);
va_TraceMsg(trace_ctx, "\tmemType = 0x%08x\n", memType);
va_TraceMsg(trace_ctx, "\tflags = 0x%08x\n", flags);

if (memType != VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2) {
return;
}

VADRMPRIMESurfaceDescriptor *desc = (VADRMPRIMESurfaceDescriptor *)descriptor;

if (!desc) {
return;
}

va_TraceMsg(trace_ctx, "\tfourcc = %u\n", desc->fourcc);
va_TraceMsg(trace_ctx, "\twidth = %u\n", desc->width);
va_TraceMsg(trace_ctx, "\theight = %u\n", desc->height);

va_TraceMsg(trace_ctx, "\tnum_objects = %u\n", desc->num_objects);
for (i = 0; i < desc->num_objects; i++) {
va_TraceMsg(trace_ctx, "\tobject %d, fd = %d\n", i, desc->objects[i].fd);
va_TraceMsg(trace_ctx, "\tobject %d, size = %u\n", i, desc->objects[i].size);
va_TraceMsg(trace_ctx, "\tobject %d, modifier = 0x%llx\n", i, desc->objects[i].drm_format_modifier);
}

va_TraceMsg(trace_ctx, "\tnum_objects = %u\n", desc->num_layers);
for (i = 0; i < desc->num_layers; i++) {
va_TraceMsg(trace_ctx, "\tlayer %d, drm_format = %d\n", i, desc->layers[i].drm_format);
va_TraceMsg(trace_ctx, "\tlayer %d, size = %u\n", i, desc->layers[i].num_planes);
va_TraceMsg(trace_ctx, "\tlayer %d, object idx = [%d, %d, %d, %d]\n", i, desc->layers[i].object_index[0], desc->layers[i].object_index[1], desc->layers[i].object_index[2], desc->layers[i].object_index[3]);
va_TraceMsg(trace_ctx, "\tlayer %d, offset = [%d, %d, %d, %d]\n", i, desc->layers[i].offset[0], desc->layers[i].offset[1], desc->layers[i].offset[2], desc->layers[i].offset[3]);
va_TraceMsg(trace_ctx, "\tlayer %d, pitch = [%d, %d, %d, %d]\n", i, desc->layers[i].pitch[0], desc->layers[i].pitch[1], desc->layers[i].pitch[2], desc->layers[i].pitch[3]);
}

DPY2TRACE_VIRCTX_EXIT(pva_trace);
}
10 changes: 10 additions & 0 deletions va/va_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,16 @@ void va_TraceEventBuffers(
int num_buffers,
VABufferID *buffers);

/** \brief va_TraceExportSurfaceHandle
* trace exported surface handle. */
DLL_HIDDEN
void va_TraceExportSurfaceHandle(
VADisplay dpy,
VASurfaceID surfaceId,
uint32_t memType,
uint32_t flags,
void *descriptor);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit c033948

Please sign in to comment.