<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Should we have a define for the
      0x80000000 somewhere?<br>
      <br>
      And please break the commit log into fewer characters per line.<br>
      <br>
      Apart from that looks good to me,<br>
      Christian.<br>
      <br>
      Am 25.07.19 um 00:23 schrieb Liu, Leo:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR12MB2456E8FF88AA6C6F48A0A12FE5C60@DM5PR12MB2456.namprd12.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      Please separate the patches to 2 patches. i. e. New ring test as
      one patch.<br>
      <br>
      Regards, <br>
      Leo<br>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b>
          amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> on
          behalf of Thai, Thong <a class="moz-txt-link-rfc2396E" href="mailto:Thong.Thai@amd.com"><Thong.Thai@amd.com></a><br>
          <b>Sent:</b> July 24, 2019 3:50:47 PM<br>
          <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a><br>
          <b>Subject:</b> [PATCH] drm/amd/amdgpu/vcn_v2_0: Set
          CMD_SOURCE for RB commands</font>
        <div> </div>
      </div>
      <div class="BodyFragment"><font size="2"><span
            style="font-size:11pt;">
            <div class="PlainText">Sets the CMD_SOURCE bit for VCN 2.0
              decoder ring-buffer commands. This bit was previously set
              by the RBC HW on older versions of the firmware, and now
              needs to be set by the driver in order to work with the SW
              RBC found in newer versions of the firmware.<br>
              <br>
              Signed-off-by: Thong Thai <a class="moz-txt-link-rfc2396E" href="mailto:thong.thai@amd.com"><thong.thai@amd.com></a><br>
              ---<br>
               drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 44
              ++++++++++++++++++++++-----<br>
               1 file changed, 37 insertions(+), 7 deletions(-)<br>
              <br>
              diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
              b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
              index bc9726787c97..8daee23425f8 100644<br>
              --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
              +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
              @@ -1488,7 +1488,7 @@ static void
              vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)<br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));<br>
                       amdgpu_ring_write(ring, 0);<br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
              -       amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START
              << 1);<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_PACKET_START << 1));<br>
               }<br>
               <br>
               /**<br>
              @@ -1501,7 +1501,7 @@ static void
              vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)<br>
               static void vcn_v2_0_dec_ring_insert_end(struct
              amdgpu_ring *ring)<br>
               {<br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
              -       amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END
              << 1);<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_PACKET_END << 1));<br>
               }<br>
               <br>
               /**<br>
              @@ -1546,7 +1546,7 @@ static void
              vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64
              addr, u64<br>
                       amdgpu_ring_write(ring, upper_32_bits(addr) &
              0xff);<br>
               <br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
              -       amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE <<
              1);<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_FENCE << 1));<br>
               <br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));<br>
                       amdgpu_ring_write(ring, 0);<br>
              @@ -1556,7 +1556,7 @@ static void
              vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64
              addr, u64<br>
               <br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
               <br>
              -       amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP <<
              1);<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_TRAP << 1));<br>
               }<br>
               <br>
               /**<br>
              @@ -1600,7 +1600,7 @@ static void
              vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring,<br>
               <br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
               <br>
              -       amdgpu_ring_write(ring,
              VCN_DEC_CMD_REG_READ_COND_WAIT << 1);<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_REG_READ_COND_WAIT << 1));<br>
               }<br>
               <br>
               static void vcn_v2_0_dec_ring_emit_vm_flush(struct
              amdgpu_ring *ring,<br>
              @@ -1629,7 +1629,7 @@ static void
              vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring,<br>
               <br>
                       amdgpu_ring_write(ring,
              PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));<br>
               <br>
              -       amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG
              << 1);<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_WRITE_REG << 1));<br>
               }<br>
               <br>
               /**<br>
              @@ -2082,6 +2082,36 @@ static int
              vcn_v2_0_process_interrupt(struct amdgpu_device *adev,<br>
                       return 0;<br>
               }<br>
               <br>
              +int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)<br>
              +{<br>
              +       struct amdgpu_device *adev = ring->adev;<br>
              +       uint32_t tmp = 0;<br>
              +       unsigned i;<br>
              +       int r;<br>
              +<br>
              +       WREG32(adev->vcn.external.scratch9,
              0xCAFEDEAD);<br>
              +       r = amdgpu_ring_alloc(ring, 3);<br>
              +       if (r)<br>
              +               return r;<br>
              +       amdgpu_ring_write(ring,
              PACKET0(adev->vcn.internal.cmd, 0));<br>
              +       amdgpu_ring_write(ring, 0x80000000 |
              (VCN_DEC_CMD_PACKET_START << 1));<br>
              +       amdgpu_ring_write(ring,
              PACKET0(adev->vcn.internal.scratch9, 0));<br>
              +       amdgpu_ring_write(ring, 0xDEADBEEF);<br>
              +       amdgpu_ring_commit(ring);<br>
              +       for (i = 0; i < adev->usec_timeout; i++) {<br>
              +               tmp =
              RREG32(adev->vcn.external.scratch9);<br>
              +               if (tmp == 0xDEADBEEF)<br>
              +                       break;<br>
              +               DRM_UDELAY(1);<br>
              +       }<br>
              +<br>
              +       if (i >= adev->usec_timeout)<br>
              +               r = -ETIMEDOUT;<br>
              +<br>
              +       return r;<br>
              +}<br>
              +<br>
              +<br>
               static int vcn_v2_0_set_powergating_state(void *handle,<br>
                                                         enum
              amd_powergating_state state)<br>
               {<br>
              @@ -2145,7 +2175,7 @@ static const struct
              amdgpu_ring_funcs vcn_v2_0_dec_ring_vm_funcs = {<br>
                       .emit_ib = vcn_v2_0_dec_ring_emit_ib,<br>
                       .emit_fence = vcn_v2_0_dec_ring_emit_fence,<br>
                       .emit_vm_flush = vcn_v2_0_dec_ring_emit_vm_flush,<br>
              -       .test_ring = amdgpu_vcn_dec_ring_test_ring,<br>
              +       .test_ring = vcn_v2_0_dec_ring_test_ring,<br>
                       .test_ib = amdgpu_vcn_dec_ring_test_ib,<br>
                       .insert_nop = vcn_v2_0_dec_ring_insert_nop,<br>
                       .insert_start = vcn_v2_0_dec_ring_insert_start,<br>
              -- <br>
              2.17.1<br>
              <br>
              _______________________________________________<br>
              amd-gfx mailing list<br>
              <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
              <a
                href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
                moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
          </span></font></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></pre>
    </blockquote>
    <br>
  </body>
</html>