<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 - Mapping a DMABUF frame as a VkImage and then copying/blitting the image to another produces blank output"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104865">104865</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mapping a DMABUF frame as a VkImage and then copying/blitting the image to another produces blank output
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>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>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/Vulkan/intel
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>atomnuker@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jason@jlekstrand.net
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

As the title says, mapping a DMABUF image via
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT or
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR (both work the same) and then
trying to vkCmdBlitImage or vkCmdCopyImage to another image results in a blank
output image (all 0's). The aim is to detile the image.

You can replicate if you clone this repo (sorry I couldn't make a small
standalone program):
<a href="https://github.com/atomnuker/FFmpeg/tree/exp_vulkan">https://github.com/atomnuker/FFmpeg/tree/exp_vulkan</a>
Configure with ./configure --enable-libdrm --enable-vulkan
Run with: sudo ./ffmpeg_g -init_hw_device
"vulkan=sl:0,extensions=VK_EXT_debug_report" -device /dev/dri/card0 -crtc_id 0
-framerate 60 -format bgr0 -f kmsgrab -i /dev/zero -filter_hw_device sl -vf
hwmap,chromaticaberration_vulkan,hwdownload,format=bgr0 -y -loglevel trace -c:v
rawvideo out.nut
Playing back the .nut file via mpv should display a recording of the screen but
instead its blank.

The odd thing is that if the VkImage is created with linear tiling (and
misinforming the driver by doing so) then the output will not be a blank image
but a tiled recording of the screen.

Here's the code which does the mapping:
<a href="https://github.com/atomnuker/FFmpeg/blob/exp_vulkan/libavutil/hwcontext_vulkan.c#L1186">https://github.com/atomnuker/FFmpeg/blob/exp_vulkan/libavutil/hwcontext_vulkan.c#L1186</a>
Here's the command buffer:
<a href="https://github.com/atomnuker/FFmpeg/blob/exp_vulkan/libavfilter/vf_caberration_vulkan.c#L196">https://github.com/atomnuker/FFmpeg/blob/exp_vulkan/libavfilter/vf_caberration_vulkan.c#L196</a>

The repo requires the newest version of the validation layer and libvulkan.</pre>
        </div>
      </p>


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

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