Shared Memory



  • Hi,

    I've been tracing through the Qt for Embedded Linux framework code for the past couple weeks. According to the "architecture overview":http://doc.qt.nokia.com/4.7/qt-embedded-architecture.html the client application is supposed to render its graphics into the shared memory and the server is suppoed to copy the shared memory content to the framebuffer. However, I can't seem to find exactly where in the code the client actually writes to shared memory. I've determined that the shared memory class being used is QWSSharedMemory, and I can see that it's being used by QWSDisplay and QWSSharedMemSurface. However, when I inserted some debugging print statements into the framework, I found that QWSSharedMemSurface actually isn't being used; instead QWSLocalMemSurface is used. I also can't see how QWSDisplay is being used by client applications to write their graphics into memory. Can anyone help me out? Thanks in advance.



  • You're on the right track. The shared memory surface (QWSSharedMemSurface) is only used when you have multiple clients. In QWS, the first application that starts up is the window server so this one doesn't need shared memory, it just uses the local mem surface which just stores the pixel data in a "new uchar[size]" which then gets passed to a QImage. This QImage is what gets painted on when widgets paint themselves to the screen. QWSSharedMemorySurface behaves the same way except instead of a uchar array allocated in process, it uses a shared memory segment to hold the data behind the QImage.

    The window surfaces push their content to the screen in the QWSWindowSurface::flush() function. Here the clients will tell the QWSDisplay that new content is ready for a given region of a given window. In multi-process mode, this will send a command over a UNIX domain socket to the server to compose the new region. In single process mode, it will simply do the composition to the framebuffer in process.



  • [quote author="jbarron" date="1306821724"]You're on the right track. The shared memory surface (QWSSharedMemSurface) is only used when you have multiple clients. In QWS, the first application that starts up is the window server so this one doesn't need shared memory, it just uses the local mem surface which just stores the pixel data in a "new uchar[size]" which then gets passed to a QImage. This QImage is what gets painted on when widgets paint themselves to the screen. QWSSharedMemorySurface behaves the same way except instead of a uchar array allocated in process, it uses a shared memory segment to hold the data behind the QImage.

    The window surfaces push their content to the screen in the QWSWindowSurface::flush() function. Here the clients will tell the QWSDisplay that new content is ready for a given region of a given window. In multi-process mode, this will send a command over a UNIX domain socket to the server to compose the new region. In single process mode, it will simply do the composition to the framebuffer in process.[/quote]

    I know this is reviving a really old thread, but thanks for your answer. It was really helpful


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.