Important: Please read the Qt Code of Conduct -

How to copy a qt application framebuffer from one process to another

  • Hello,

    I am currently running Qt on wayland on jetson xavier nx platform which has tegra_udrm without any issue by exporting QT_QPA_PLATFORM=wayland. So I created a simple example application on qt and while running the qt application on board, I am trying to reach qt application’s framebuffer in order to export it by using dma_buf from drmPrimeHandleToFD function to another process.

    So In order to reach qt application’s framebuffer, I implemented another application to get resources such as crtc,encoder and tried to get plane resources in order to reach frame buffer of planes by using libDRM functions and was expecting to reach it but can not reach qt application’s framebuffer.

    So Do you have any idea how to proceed with that? If it is not possible to get qt wayland framebuffer by using libdrm functions, is there some api on qt framework to manage the goal ?

    By the way, I get gbm_device from nativeInterface->nativeResourceForIntegration("NativeDisplay"); call but can not find a way to reach struct gbm_bo which is *EGLNativePixmapType. Also I can not reach to gbm_bo_handle union to export frame buffer.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Shouldn't you rather do that at the wayland level ?

  • Hi @SGaist ,

    Do you have any idea how to manage it ? I can reach to

    struct wl_display wl_dpy = reinterpret_cast<struct wl_display>( reinterpret_cast<void*>(nativeInterface->nativeResourceForWindow("display", NULL)));

    on QT C++ but could not see an api to get frame buffer or handle on wayland. If you know the api please share with me.


  • Hello ,

    There is also one more question, I am trying to reach EGLContext and EGLSurface from qt with the following functions:
    EGLContext context = eglGetCurrentContext();
    EGLSurface surface = eglGetCurrentSurface(EGL_READ);

    all the time these pointers returns(EGL_NO_CONTEXT and EGL_NO_SURFACE) that means I can not reach these pointers for qt application.Is there any idea what might be the reason ? Or Is there any idea how to reach these pointers on qt.

    I tried with QOpenGLContext but no luck.


  • Lifetime Qt Champion

    Depending on what you use for your application, Qt will not use OpenGL.

  • Hello,

    I created a simple qml file only for test purposes as the following :

    import QtQuick 2.9
    import QtQuick.Window 2.2
    import Sendercpp 1.0

    Window {
    visible: true
    width: 640
    height: 600
    title: qsTr("Hello World")

        anchors.fill: parent
        color: "red"


    and trying to reach EGLContext and EGLSurface but no luck for now.So If you have any idea please letme know.

Log in to reply