perf(turnip): wait for a fence up to 100 ms a call
The Darwin KMD waited in 1 ms slices: i553 made 258682 fence waits in 166 s and 97 % timed out. The kernel already idles until the next GPU interrupt inside a wait, so a call now waits up to 100 ms or the caller's deadline.
This commit is contained in:
1 parent
8b6a0f5fe1
commit
cd1b9757fd
1 file changed
+6
-4
@@ -271,7 +271,7 @@ new file mode 100644
|
||||
index 0000000..b03c6ee
|
||||
--- /dev/null
|
||||
+++ b/src/freedreno/vulkan/tu_knl_darwin.cc
|
||||
@@ -0,0 +1,1110 @@
|
||||
@@ -0,0 +1,1112 @@
|
||||
+/*
|
||||
+ * Native Darwin kernel backend for Turnip: talks to the NativeAdreno IOKit user client (NativeAdrenoABI.h, version 1).
|
||||
+ * Modelled on tu_knl_kgsl.cc (no libdrm) and tu_knl_drm_msm.cc (the client chooses GPU addresses).
|
||||
@@ -450,9 +450,11 @@ index 0000000..b03c6ee
|
||||
+{
|
||||
+ for (;;) {
|
||||
+ uint64_t now = os_time_get_nano();
|
||||
+ uint64_t slice = 1000000; /* 1 ms */
|
||||
+ if (abs_timeout_ns != UINT64_MAX && abs_timeout_ns <= now)
|
||||
+ slice = 0;
|
||||
+ /* The rest of the wait, at most 100 ms a call: the kernel sleeps between fence interrupts until the fence or the
|
||||
+ * timeout. One 1 ms slice a call made a frame's wait several IOKit calls (i553: 258682 waits in 166 s, 97 % timed out). */
|
||||
+ uint64_t slice = 100000000; /* 100 ms */
|
||||
+ if (abs_timeout_ns != UINT64_MAX)
|
||||
+ slice = abs_timeout_ns > now ? MIN2(abs_timeout_ns - now, slice) : 0;
|
||||
+ NativeAdrenoAbiWaitFence req = {.fence = fence, .timeout_ns = slice};
|
||||
+ kern_return_t kr = dw_call(NativeAdrenoMethodWaitFence, &req, sizeof(req), NULL, 0);
|
||||
+ if (kr == KERN_SUCCESS)
|
||||
|
||||
Reference in new issue
Block a user