<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <span style="white-space: pre-wrap">
</span>
    <blockquote type="cite"
cite="mid:769f6c5788eff9459414b8ce0b056989e29773af.camel@mailbox.org">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+ *
+ * Return:
+ * 0 on success, or an error on failing to expand the array.
+ */
+int drm_sched_job_prealloc_dependency_slots(struct drm_sched_job
*job,
+                                           unsigned int num_deps)
+{
+       struct dma_fence *fence;
+       u32 id = 0;
+       int ret;
+
+       while (num_deps--) {
+               fence = dma_fence_get_stub();
+               ret = xa_alloc(&job->dependencies, &id, fence,
xa_limit_32b,
+                              GFP_KERNEL);
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
So this would fill the xarr with already signaled fences which then
later will be replaced with unsignaled fences?</pre>
    </blockquote>
    <br>
    Yes, exactly that's the idea.<br>
    <br>
    <blockquote type="cite"
cite="mid:769f6c5788eff9459414b8ce0b056989e29773af.camel@mailbox.org">
      <pre class="moz-quote-pre" wrap="">Help me out here: would it also work to add NULL instead of that stub-
fence?</pre>
    </blockquote>
    <br>
    Good question, idk. That's an implementation detail of the xarray.<br>
    <br>
    Tvrtko also correctly pointed out that it is most likely a bad idea
    to use dma_fence_is_signaled() in the critical code path.<br>
    <br>
    I will try to dig through the xarray behavior up and update the
    patch if possible.<br>
    <br>
    Thanks,<br>
    Christian.<br>
    <br>
  </body>
</html>