gitlab-ci: add apitrace's DXGI traces support
authorAndres Gomez <tanty@igalia.com>
Sun, 8 Mar 2020 21:40:04 +0000 (23:40 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 27 Mar 2020 13:48:17 +0000 (13:48 +0000)
v2:
  - Pass the whole retrace command for apitrace traces (Alexandros).

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4238>

.gitlab-ci/tracie/README.md
.gitlab-ci/tracie/dump_trace_images.py
.gitlab-ci/tracie/traceutil.py

index e7fccfaf481c91f88f9e0da6efaccf626424f83d..8dc32d043c9733dc714a141ed914a508341a33fe 100644 (file)
@@ -152,3 +152,8 @@ To ensure that this layer can be found when running the trace you need
 to set `VK_LAYER_PATH` to point to the location of
 `VkLayer_screenshot.json` and `LD_LIBRARY_PATH` to point to the
 location of `libVkLayer_screenshot.so`.
+
+In the case of DXGI traces, the scripts require Wine, a recent version
+of DXVK installed in the default `WINEPREFIX`, and a recent binary
+version of apitrace for Windows which should be reachable through
+Windows' `PATH` environment variable.
index 343ff77bb3196077121a532b7365a94148a56188..0416414dfabc4662f48139ee44a74c51808883dd 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python3
 
 # Copyright (c) 2019 Collabora Ltd
-# Copyright © 2019 Valve Corporation.
+# Copyright © 2019-2020 Valve Corporation.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -48,8 +48,8 @@ def run_logged_command(cmd, env, log_path):
             logoutput.decode(errors='replace') +
             "[dump_traces_images] Process failed with error code: %d" % ret.returncode)
 
-def get_last_apitrace_frame_call(trace_path):
-    cmd = ["apitrace", "dump", "--calls=frame", str(trace_path)]
+def get_last_apitrace_frame_call(cmd_wrapper, trace_path):
+    cmd = cmd_wrapper + ["apitrace", "dump", "--calls=frame", str(trace_path)]
     ret = subprocess.run(cmd, stdout=subprocess.PIPE)
     for l in reversed(ret.stdout.decode(errors='replace').splitlines()):
         s = l.split(None, 1)
@@ -71,14 +71,14 @@ def get_last_gfxreconstruct_frame_call(trace_path):
                 return int(c[0])
     return -1
 
-def dump_with_apitrace(trace_path, calls, device_name):
+def dump_with_apitrace(retrace_cmd, trace_path, calls, device_name):
     outputdir = str(trace_path.parent / "test" / device_name)
     os.makedirs(outputdir, exist_ok=True)
     outputprefix = str(Path(outputdir) / trace_path.name) + "-"
     if len(calls) == 0:
-        calls = [str(get_last_apitrace_frame_call(trace_path))]
-    cmd = ["eglretrace", "--snapshot=" + ','.join(calls),
-           "--snapshot-prefix=" + outputprefix, str(trace_path)]
+        calls = [str(get_last_apitrace_frame_call(retrace_cmd[:-1], trace_path))]
+    cmd = retrace_cmd + ["--snapshot=" + ','.join(calls),
+                         "--snapshot-prefix=" + outputprefix, str(trace_path)]
     log_path = Path(outputdir) / (trace_path.name + ".log")
     run_logged_command(cmd, None, log_path)
 
@@ -137,7 +137,9 @@ def dump_from_trace(trace_path, calls, device_name):
     trace_type = trace_type_from_filename(trace_path.name)
     try:
         if trace_type == TraceType.APITRACE:
-            dump_with_apitrace(trace_path, calls, device_name)
+            dump_with_apitrace(["eglretrace"], trace_path, calls, device_name)
+        elif trace_type == TraceType.APITRACE_DXGI:
+            dump_with_apitrace(["wine", "d3dretrace"], trace_path, calls, device_name)
         elif trace_type == TraceType.RENDERDOC:
             dump_with_renderdoc(trace_path, calls, device_name)
         elif trace_type == TraceType.GFXRECONSTRUCT:
index d383e41df30f7e720b681bcbf6b9a00a2ea649f1..dc5e3a6cf6c2add96685b9fedc244f540b35b45d 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (c) 2019 Collabora Ltd
-# Copyright © 2019 Valve Corporation.
+# Copyright © 2019-2020 Valve Corporation.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -28,12 +28,14 @@ from enum import Enum, auto
 class TraceType(Enum):
     UNKNOWN = auto()
     APITRACE = auto()
+    APITRACE_DXGI = auto()
     RENDERDOC = auto()
     GFXRECONSTRUCT = auto()
     TESTTRACE = auto()
 
 _trace_type_info_map = {
     TraceType.APITRACE : ("apitrace", ".trace"),
+    TraceType.APITRACE_DXGI : ("apitrace-dxgi", ".trace-dxgi"),
     TraceType.RENDERDOC : ("renderdoc", ".rdc"),
     TraceType.GFXRECONSTRUCT : ("gfxreconstruct", ".gfxr"),
     TraceType.TESTTRACE : ("testtrace", ".testtrace")