D10750: wayland: Add support for zwp_linux_dmabuf

Fredrik Höglund noreply at phabricator.kde.org
Thu Mar 1 16:06:50 UTC 2018


fredrik added a comment.


  An issue that this patch does not fully address is switching compositing backends at runtime.
  
  Buffers are imported by the scene. The scene allocates and returns a subclassed LinuxDmabuf::Buffer that contains the file descriptors and backend specific objects, such as EGL images. When the compositing backend is destroyed, the EGL images are also destroyed, but the buffers survive. The new backend could use the file descriptors to re-import the buffers, if the buffer class wasn't specific to the old backend.
  
  A possible solution to this is a shared Buffer class (in platformsupport/scenes/common?):
  
        ...
    private:
        ...
        QVector<Plane> planes;
        EGLimage eglImage;
        VkImage vulkanImage;
        VkImageView imageView;
        VkDeviceMemory deviceMemory;
    };
  
  Or a SceneBufferData object, created and destroyed by the scene:
  
    private:
        ...
        QVector<Plane> planes;
        SceneBufferData *sceneData;
    };
  
  But even with a shared class there are no guarantees that a re-import is possible, since the new backend might not support the same formats and/or modifiers. So I don't know if runtime switching is something that should be expected to work.

INLINE COMMENTS

> anthonyfieroni wrote in abstract_egl_backend.cpp:117
> Call delete dmabuf will have same effect.

No, it will not. It will leave a dangling pointer in the wl_resource, which will result in a double-free when the client deletes the buffer. Or a segfault the next time it tries to attach the buffer to a surface.

I will expand on this in a separate comment.

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D10750

To: fredrik, #kwin, #plasma, davidedmundson, mart, graesslin
Cc: anthonyfieroni, plasma-devel, kwin, iodelay, bwowk, ZrenBot, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180301/2a265797/attachment.html>


More information about the Plasma-devel mailing list