<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>The patch solves the UVD issue.</p>
    <p>By the way, I had to change one of the "->"'s to a "." to
      compile:</p>
    <pre>drivers/gpu/drm/amd/amdgpu/amdgpu_job.c: In function ‘amdgpu_job_free_resources’:</pre>
    <pre>drivers/gpu/drm/amd/amdgpu/amdgpu_job.c:159:61: error: invalid type argument of ‘->’ (have ‘struct dma_fence’)</pre>
    <pre>  159 |         if (job->base.s_fence && job->base.s_fence->finished->ops)</pre>
    <pre>      |                                                             ^~</pre>
    <p>Thanks,</p>
    <p>Thong Thai<br>
    </p>
    <div class="moz-cite-prefix">On 2023-01-12 09:05, Alex Deucher
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CADnq5_NC93kgwPZxv550JxtzMDb6=Y9Pi4DAED5B1sZiiTx-vQ@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">On Thu, Jan 12, 2023 at 8:48 AM Christian König
<a class="moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com"><ckoenig.leichtzumerken@gmail.com></a> wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
It can be that neither fence were initialized when we run out of UVD
streams for example.

Signed-off-by: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Bug: <a class="moz-txt-link-freetext" href="https://gitlab.freedesktop.org/drm/amd/-/issues/2324">https://gitlab.freedesktop.org/drm/amd/-/issues/2324</a>

Reviewed-by: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>


</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 9e549923622b..28929c6219a7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -161,8 +161,14 @@ void amdgpu_job_free_resources(struct amdgpu_job *job)
        struct dma_fence *f;
        unsigned i;

-       /* use sched fence if available */
-       f = job->base.s_fence ? &job->base.s_fence->finished :  &job->hw_fence;
+       /* Check if any fences where initialized */
+       if (job->base.s_fence && job->base.s_fence->finished->ops)
+               f = &job->base.s_fence->finished;
+       else if (job->hw_fence.ops)
+               f = &job->hw_fence;
+       else
+               f = NULL;
+
        for (i = 0; i < job->num_ibs; ++i)
                amdgpu_ib_free(ring->adev, &job->ibs[i], f);
 }
--
2.25.1

</pre>
      </blockquote>
    </blockquote>
  </body>
</html>