Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
It won't write anything to the framebuffer though. As long as you do not create an actual window (only use QOffscreenSurface, not QWindow) and do not call swapBuffers() there will be nothing written out. How and when the EGL implementation opens the framebuffer is not under Qt's or the application's control. Best regards, Laszlo From: development-bounces+laszlo.agocs=theqtcompany@qt-project.org development-bounces+laszlo.agocs=theqtcompany@qt-project.org on behalf of Paul Knopf theonlylawisl...@gmail.com Sent: Thursday, April 23, 2015 3:38 PM To: Sean Harmer Cc: development@qt-project.org Subject: Re: [Development] Qt 'minimal' platform no rendering alpha/opacity. Sean, I took a look at the example, and this all looks good. However, I think my platform will still grab a handle to the framebuffer. I will be using an i.MX6 device, and the configuration would use the following EGLFS hook. https://github.com/qtproject/qtbase/blob/befe1e37e28db95a79622d628a338feaa8eee77b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp QEglFSVivIntegration::platformInit(), it looks it still opens the framebuffer, even if we plan on doing only off-screen rendering. The problem is that, I need to open/close/manage the linux framebuffer myself, which is the whole point of doing offscreen rendering. Maybe I can create a custom EGLFS hook, based off of viv, but return a dummy size, and do no initialization. If I am doing strictly off-screen rendering, can I be sure that QEglFSVivIntegration::platformDisplay(), QEglFSVivIntegration::createNativeWindow(), and QEglFSVivIntegration::destroyNativeWindow() will never be called? On Mon, Apr 20, 2015 at 5:03 AM, Sean Harmer sean.har...@kdab.commailto:sean.har...@kdab.com wrote: On 20/04/2015 08:25, Paul Knopf wrote: Thanks a lot! This worked. I now have a valid alpha component that I can send to my hard vendors API for FPGA video overlay. With this said, I would REALLY like to support OpenGL (for Qt Quick 2/qml). Here is an imagehttp://i.imgur.com/hhlcbb9.jpg of what I am trying to essentially do. What are your thoughts implementing this in Qt? Here is what I need my monitor output to be. The original buffer: size w / h : [R G B A][R G B A][R G B A][...] The output i want:size (w*.25) / (h*.25):[R G B][A R G][B A R][G B A][...] My thoughts are to Render OpenGL off screen (not using framebuffer), then have a thread that periodically captures the output (RGBA) and sends it my linux framebuffer. My output doesn't need high FPS. I understand that sending the extra alpha will increase the size of my resolution by 25%.. The FPGA component/board will identify itself as having a resolution of 1350 (1080 * .25) so that it can internally translate to 1080 with an alpha channel. Does the EGLFS support off-screen rendering? Maybe then, I could create 1080 opengl context off-screen, and then output it, including alpha, to the 1350 framebuffer. OpenGL supports offscreen rendering as long as the QPA supports OpenGL. * Create a QOffscreenSurface * Create a QOpenGLContext * Create a suitable Framebuffer Object with a colour texture attachment and most likely a depth and stencil attachment. * Bind the FBO as the GL_BUFFER (both read and write binding points) * Draw stuff * Read back the texture attached to the FBO as needed If you are wanting to use this approach to render Qt Quick 2 content, then take a look at the QQuickRenderControl class and accompanying example that ships with Qt. Cheers, Sean -- Dr Sean Harmer | sean.har...@kdab.commailto:sean.har...@kdab.com | Managing Director UK Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090tel:%2B46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions ___ Development mailing list Development@qt-project.orgmailto:Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
Sean, I took a look at the example, and this all looks good. However, I think my platform will still grab a handle to the framebuffer. I will be using an i.MX6 device, and the configuration would use the following EGLFS hook. https://github.com/qtproject/qtbase/blob/befe1e37e28db95a79622d628a338feaa8eee77b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp QEglFSVivIntegration::platformInit(), it looks it still opens the framebuffer, even if we plan on doing only off-screen rendering. The problem is that, I need to open/close/manage the linux framebuffer myself, which is the whole point of doing offscreen rendering. Maybe I can create a custom EGLFS hook, based off of viv, but return a dummy size, and do no initialization. If I am doing strictly off-screen rendering, can I be sure that QEglFSVivIntegration::platformDisplay(), QEglFSVivIntegration::createNativeWindow(), and QEglFSVivIntegration::destroyNativeWindow() will never be called? On Mon, Apr 20, 2015 at 5:03 AM, Sean Harmer sean.har...@kdab.com wrote: On 20/04/2015 08:25, Paul Knopf wrote: Thanks a lot! This worked. I now have a valid alpha component that I can send to my hard vendors API for FPGA video overlay. With this said, I would REALLY like to support OpenGL (for Qt Quick 2/qml). Here is an image http://i.imgur.com/hhlcbb9.jpg of what I am trying to essentially do. What are your thoughts implementing this in Qt? Here is what I need my monitor output to be. The original buffer: size w / h : [R G B A][R G B A][R G B A][...] The output i want:size (w*.25) / (h*.25):[R G B][A R G][B A R][G B A][...] My thoughts are to Render OpenGL off screen (not using framebuffer), then have a thread that periodically captures the output (RGBA) and sends it my linux framebuffer. My output doesn't need high FPS. I understand that sending the extra alpha will increase the size of my resolution by 25%.. The FPGA component/board will identify itself as having a resolution of 1350 (1080 * .25) so that it can internally translate to 1080 with an alpha channel. Does the EGLFS support off-screen rendering? Maybe then, I could create 1080 opengl context off-screen, and then output it, including alpha, to the 1350 framebuffer. OpenGL supports offscreen rendering as long as the QPA supports OpenGL. * Create a QOffscreenSurface * Create a QOpenGLContext * Create a suitable Framebuffer Object with a colour texture attachment and most likely a depth and stencil attachment. * Bind the FBO as the GL_BUFFER (both read and write binding points) * Draw stuff * Read back the texture attached to the FBO as needed If you are wanting to use this approach to render Qt Quick 2 content, then take a look at the QQuickRenderControl class and accompanying example that ships with Qt. Cheers, Sean -- Dr Sean Harmer | sean.har...@kdab.com | Managing Director UK Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
Thanks a lot! This worked. I now have a valid alpha component that I can send to my hard vendors API for FPGA video overlay. With this said, I would REALLY like to support OpenGL (for Qt Quick 2/qml). Here is an image http://i.imgur.com/hhlcbb9.jpg of what I am trying to essentially do. What are your thoughts implementing this in Qt? Here is what I need my monitor output to be. The original buffer: size w / h : [R G B A][R G B A][R G B A][...] The output i want:size (w*.25) / (h*.25):[R G B][A R G][B A R][G B A][...] My thoughts are to Render OpenGL off screen (not using framebuffer), then have a thread that periodically captures the output (RGBA) and sends it my linux framebuffer. My output doesn't need high FPS. I understand that sending the extra alpha will increase the size of my resolution by 25%.. The FPGA component/board will identify itself as having a resolution of 1350 (1080 * .25) so that it can internally translate to 1080 with an alpha channel. Does the EGLFS support off-screen rendering? Maybe then, I could create 1080 opengl context off-screen, and then output it, including alpha, to the 1350 framebuffer. Or is there a better way that I could achieve this? I understand that I am asking a lot from you guys, but if someone has some concrete ideas, I am open to a consultation arrangement. Thanks, Paul On Sat, Apr 18, 2015 at 2:14 PM, Agocs Laszlo laszlo.ag...@theqtcompany.com wrote: The code snippet has no relation whatsoever to what setWindowOpacity is doing. If you are only after having transparent (alpha == 0) areas on the window, then there is no difference with 'minimal' compared to any other platform. In fact it's much easier since you won't need to worry about having transparency functional on the windowing system level. Just writing out pixels with an alpha of 0 is good enough, f.ex.: tlw.setAutoFillBackground(true); tlw.setBrush(QPalette::Window, Qt::transparent); See http://doc.qt.io/qt-5.4/qwidget.html#transparency-and-double-buffering Cheers, Laszlo From: Paul Knopf theonlylawisl...@gmail.com Date: Friday 17 April 2015 17:45 To: Agocs Laszlo laszlo.ag...@theqtcompany.com Cc: development@qt-project.org development@qt-project.org Subject: Re: [Development] Qt 'minimal' platform no rendering alpha/opacity. What do you mean when you say compositor? Are you referring to a window system? Is this something that is possible to implement with the minimal project? What would have to change? I have need a custom platform that encodes the ARGB (proprietary, vendor specific) to the linux framebuffer, but the alpha channel has to actually be correct. How come I can do this without a compositor? QImage bitmap(widget.size(), QImage::Format_ARGB32); bitmap.fill(Qt::transparent); QPainter painter(bitmap); widget.render(painter, QPoint(), QRegion(), QWidget::DrawChildren); bitmap.save(file.png); There must be a way to achieve the same result using a platform plugin. If all else fails, I could create my own thread loop that renders the QWidget with the above code and outputs it to my driver manually, instead of going through the platform plugins, but I would like to support the platform plugin so that I can then switch it out to develop locally using standard Qt platforms (X11, etc). On Fri, Apr 17, 2015 at 10:32 AM, Agocs Laszlo laszlo.ag...@theqtcompany.com wrote: You do have alpha because the minimal's backingstore uses ARGB32_Premultiplied for the backing QImage. What you do not have is setWindowOpacity(). You would need to implement QPlatformWindow::setOpacity() for that, but that is not possible with minimal since there is no compositor that could apply the opacity to the window contents during the composition step. Best regards, Laszlo From: Paul Knopf theonlylawisl...@gmail.com Date: Friday 17 April 2015 16:20 To: development@qt-project.org development@qt-project.org Subject: [Development] Qt 'minimal' platform no rendering alpha/opacity. I am testing the 'minimal' platform (mine is based off of it), and it seems that is doesn't render the alpha channel (setting opacity). Here is a gist https://gist.github.com/anonymous/544e84fbcde5022a6878 of my main function testing the opacity. The saved images seems to have a tan background and no transparency. Any ideas on how to get the alpha channel represented in the platform backing store? -- Thanks! ~Paul -- Thanks! ~Paul -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
On 20/04/2015 08:25, Paul Knopf wrote: Thanks a lot! This worked. I now have a valid alpha component that I can send to my hard vendors API for FPGA video overlay. With this said, I would REALLY like to support OpenGL (for Qt Quick 2/qml). Here is an image http://i.imgur.com/hhlcbb9.jpg of what I am trying to essentially do. What are your thoughts implementing this in Qt? Here is what I need my monitor output to be. The original buffer: size w / h : [R G B A][R G B A][R G B A][...] The output i want:size (w*.25) / (h*.25):[R G B][A R G][B A R][G B A][...] My thoughts are to Render OpenGL off screen (not using framebuffer), then have a thread that periodically captures the output (RGBA) and sends it my linux framebuffer. My output doesn't need high FPS. I understand that sending the extra alpha will increase the size of my resolution by 25%.. The FPGA component/board will identify itself as having a resolution of 1350 (1080 * .25) so that it can internally translate to 1080 with an alpha channel. Does the EGLFS support off-screen rendering? Maybe then, I could create 1080 opengl context off-screen, and then output it, including alpha, to the 1350 framebuffer. OpenGL supports offscreen rendering as long as the QPA supports OpenGL. * Create a QOffscreenSurface * Create a QOpenGLContext * Create a suitable Framebuffer Object with a colour texture attachment and most likely a depth and stencil attachment. * Bind the FBO as the GL_BUFFER (both read and write binding points) * Draw stuff * Read back the texture attached to the FBO as needed If you are wanting to use this approach to render Qt Quick 2 content, then take a look at the QQuickRenderControl class and accompanying example that ships with Qt. Cheers, Sean -- Dr Sean Harmer | sean.har...@kdab.com | Managing Director UK Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
The code snippet has no relation whatsoever to what setWindowOpacity is doing. If you are only after having transparent (alpha == 0) areas on the window, then there is no difference with 'minimal' compared to any other platform. In fact it's much easier since you won't need to worry about having transparency functional on the windowing system level. Just writing out pixels with an alpha of 0 is good enough, f.ex.: tlw.setAutoFillBackground(true); tlw.setBrush(QPalette::Window, Qt::transparent); See http://doc.qt.io/qt-5.4/qwidget.html#transparency-and-double-buffering Cheers, Laszlo From: Paul Knopf theonlylawisl...@gmail.commailto:theonlylawisl...@gmail.com Date: Friday 17 April 2015 17:45 To: Agocs Laszlo laszlo.ag...@theqtcompany.commailto:laszlo.ag...@theqtcompany.com Cc: development@qt-project.orgmailto:development@qt-project.org development@qt-project.orgmailto:development@qt-project.org Subject: Re: [Development] Qt 'minimal' platform no rendering alpha/opacity. What do you mean when you say compositor? Are you referring to a window system? Is this something that is possible to implement with the minimal project? What would have to change? I have need a custom platform that encodes the ARGB (proprietary, vendor specific) to the linux framebuffer, but the alpha channel has to actually be correct. How come I can do this without a compositor? QImage bitmap(widget.size(), QImage::Format_ARGB32); bitmap.fill(Qt::transparent); QPainter painter(bitmap); widget.render(painter, QPoint(), QRegion(), QWidget::DrawChildren); bitmap.save(file.png); There must be a way to achieve the same result using a platform plugin. If all else fails, I could create my own thread loop that renders the QWidget with the above code and outputs it to my driver manually, instead of going through the platform plugins, but I would like to support the platform plugin so that I can then switch it out to develop locally using standard Qt platforms (X11, etc). On Fri, Apr 17, 2015 at 10:32 AM, Agocs Laszlo laszlo.ag...@theqtcompany.commailto:laszlo.ag...@theqtcompany.com wrote: You do have alpha because the minimal's backingstore uses ARGB32_Premultiplied for the backing QImage. What you do not have is setWindowOpacity(). You would need to implement QPlatformWindow::setOpacity() for that, but that is not possible with minimal since there is no compositor that could apply the opacity to the window contents during the composition step. Best regards, Laszlo From: Paul Knopf theonlylawisl...@gmail.commailto:theonlylawisl...@gmail.com Date: Friday 17 April 2015 16:20 To: development@qt-project.orgmailto:development@qt-project.org development@qt-project.orgmailto:development@qt-project.org Subject: [Development] Qt 'minimal' platform no rendering alpha/opacity. I am testing the 'minimal' platform (mine is based off of it), and it seems that is doesn't render the alpha channel (setting opacity). Here is a gisthttps://gist.github.com/anonymous/544e84fbcde5022a6878 of my main function testing the opacity. The saved images seems to have a tan background and no transparency. Any ideas on how to get the alpha channel represented in the platform backing store? -- Thanks! ~Paul -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
[Development] Qt 'minimal' platform no rendering alpha/opacity.
I am testing the 'minimal' platform (mine is based off of it), and it seems that is doesn't render the alpha channel (setting opacity). Here is a gist https://gist.github.com/anonymous/544e84fbcde5022a6878 of my main function testing the opacity. The saved images seems to have a tan background and no transparency. Any ideas on how to get the alpha channel represented in the platform backing store? -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
You do have alpha because the minimal's backingstore uses ARGB32_Premultiplied for the backing QImage. What you do not have is setWindowOpacity(). You would need to implement QPlatformWindow::setOpacity() for that, but that is not possible with minimal since there is no compositor that could apply the opacity to the window contents during the composition step. Best regards, Laszlo From: Paul Knopf theonlylawisl...@gmail.commailto:theonlylawisl...@gmail.com Date: Friday 17 April 2015 16:20 To: development@qt-project.orgmailto:development@qt-project.org development@qt-project.orgmailto:development@qt-project.org Subject: [Development] Qt 'minimal' platform no rendering alpha/opacity. I am testing the 'minimal' platform (mine is based off of it), and it seems that is doesn't render the alpha channel (setting opacity). Here is a gisthttps://gist.github.com/anonymous/544e84fbcde5022a6878 of my main function testing the opacity. The saved images seems to have a tan background and no transparency. Any ideas on how to get the alpha channel represented in the platform backing store? -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.
What do you mean when you say compositor? Are you referring to a window system? Is this something that is possible to implement with the minimal project? What would have to change? I have need a custom platform that encodes the ARGB (proprietary, vendor specific) to the linux framebuffer, but the alpha channel has to actually be correct. How come I can do this without a compositor? QImage bitmap(widget.size(), QImage::Format_ARGB32); bitmap.fill(Qt::transparent); QPainter painter(bitmap); widget.render(painter, QPoint(), QRegion(), QWidget::DrawChildren); bitmap.save(file.png); There must be a way to achieve the same result using a platform plugin. If all else fails, I could create my own thread loop that renders the QWidget with the above code and outputs it to my driver manually, instead of going through the platform plugins, but I would like to support the platform plugin so that I can then switch it out to develop locally using standard Qt platforms (X11, etc). On Fri, Apr 17, 2015 at 10:32 AM, Agocs Laszlo laszlo.ag...@theqtcompany.com wrote: You do have alpha because the minimal's backingstore uses ARGB32_Premultiplied for the backing QImage. What you do not have is setWindowOpacity(). You would need to implement QPlatformWindow::setOpacity() for that, but that is not possible with minimal since there is no compositor that could apply the opacity to the window contents during the composition step. Best regards, Laszlo From: Paul Knopf theonlylawisl...@gmail.com Date: Friday 17 April 2015 16:20 To: development@qt-project.org development@qt-project.org Subject: [Development] Qt 'minimal' platform no rendering alpha/opacity. I am testing the 'minimal' platform (mine is based off of it), and it seems that is doesn't render the alpha channel (setting opacity). Here is a gist https://gist.github.com/anonymous/544e84fbcde5022a6878 of my main function testing the opacity. The saved images seems to have a tan background and no transparency. Any ideas on how to get the alpha channel represented in the platform backing store? -- Thanks! ~Paul -- Thanks! ~Paul ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development