<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AMD Radeon 5700 / Navi: VAAPI encoding generates garbled output"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=112133">112133</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AMD Radeon 5700 / Navi: VAAPI encoding generates garbled output
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DRI
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>DRI git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>not set
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DRM/AMDgpu
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>toscar@gmx.net
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using ffmpeg to encode video to h264/hevc with constant or variable bitrate
results in completely garbled output video on navi/radeon 5700 gpu.

ffmpeg command used:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi
-hwaccel_output_format vaapi -hwaccel_device foo \
-i <input file> -filter_hw_device foo -vf 'format=nv12|vaapi,hwupload' -c:v
hevc_vaapi -b:v 5000k -maxrate 5000k -f matroska <output file>
-This issue also applies to h264 encoding (replace "hevc_vaapi" with
"h264_vaapi" above).

HW used:
AMD Radeon 5700 XT

SW used:
linux-amd-staging-drm-next-git-5.4.858569.1c2677f991d3-1-x86_64
mesa-git 1:19.3.0_devel.116641.f11ea226664
libva-utils 2.5.0
ffmpeg 1:4.2.1

This issue sounds a bit like <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - VAAPI HEVC encoding is unstable and produces garbled output"
   href="show_bug.cgi?id=109538">BUG 109538</a>, however #109538 speaks of "garbled
line at the bottom" where I get completely garbled output, not just at the
bottom.

In additon, ffmpeg stalls/crashes sometimes as described in #109538 with:
[drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring vcn_enc0 timeout, signaled
seq=150025, emitted seq=150027
[drm:amdgpu_job_timedout [amdgpu]] *ERROR* Process information: process ffmpeg
pid 228611 thread ffmpeg:cs0 pid 228612</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>