[FFmpeg-trac] #8542(avdevice:reopened): ffmpeg use kmsgrab on wayland not working

FFmpeg trac at avcodec.org
Thu May 7 21:23:42 EEST 2020


#8542: ffmpeg use kmsgrab on wayland not working
-------------------------------------+-------------------------------------
             Reporter:               |                    Owner:
  chenjie199234                      |
                 Type:  defect       |                   Status:  reopened
             Priority:  normal       |                Component:  avdevice
              Version:  git-master   |               Resolution:
             Keywords:  kmsgrab      |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  1            |
-------------------------------------+-------------------------------------

Comment (by maximbaz):

 Thank you for the reply! This is very insightful, because I have actually
 been playing with a side-project lately and as part of it was trying to
 import DMA-BUFs as an image on my hardware.

 I know it is possible to import DMA-BUFs using EGL, for example see {{{
 wlr_egl_create_image_from_dmabuf() }}} function in wlroots [1] (I
 confirmed that it works as expected).

 I have spent the last two days learning Vulkan and trying to import DMA-
 BUFs using it instead of EGL, and have actually been using {{{
 libavutil/hwcontext_vulkan.c }}} from ffmpeg as a reference ({{{
 vulkan_map_from_drm_frame_desc() }}} function) - that's how I stumbled
 upon this bug, because I wanted to confirm that the code in ffmpeg itself
 is able to import the image :)

 From what I've understood so far, {{{ vulkaninfo }}} tells me that my GPU
 supports {{{ VK_EXT_external_memory_dma_buf }}} but doesn't support {{{
 VK_EXT_image_drm_format_modifier }}}. I have already had some suspicions
 that {{{ vulkan_map_from_drm_frame_desc() }}} won't be able to import DMA-
 BUFs on my hardware, because it creates multi-planar {{{ VkImageCreateInfo
 }}} structure only when {{{ VK_EXT_image_drm_format_modifier }}} bit is
 supported (see line 1764 currently), which definitely isn't the case with
 my GPU.

 Do you think it is something that can be fixed, or importing such multi-
 planar DMA-BUFs is fundamentally impossible using Vulkan API nowadays? I
 would appreciate some pointers, as I am very new to these topics, but I'm
 eager to get to the bottom of it. I would be happy to experiment with
 importing DMA-BUFs using Vulkan, and contribute back to your code in {{{
 libavutil/hwcontext_vulkan.c }}}, even if it won't fully fix this ticket,
 it will hopefully be a step in the right direction.

 Patching sway as you suggested is of course an option, but if I can make
 it work without patching, I would of course prefer that.

 1:
 https://github.com/swaywm/wlroots/blob/6357e166f9a31f0c828ea5bb0000627c15442505/render/egl.c#L477

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8542#comment:7>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list