Hello,
Our application requires that we blend 3 layers. The base layer is opaque video, the middle layer is video blended on top of the base layer with a global alpha channel that we need to be able to modify on the fly, and a top GUI layer with transparency. Our initial attempt using Wayland failed because it does not seem to support global alpha settings on the middle layer.
After a discussion with our TI rep, we decided to use the DSS directly. We have disabled Wayland in the Arago distribution for the AM57XX EVM and enabled 3 framebuffers in the kernel. Using the sysfs entries, we've configured the GFX layer to be on top ( z-order 3 ) and the video1 and video2 layers to be beneath it.
The GFX layer uses Overlay0 and is tied to /dev/fb0. We have a Qt5.5 GUI app with semi-transparent widgets running on it using the following syntax: ./app -platform linuxfb:fb=/dev/fb0. We are confident the GUI code is written correctly as it displays as expected on both Ubuntu and Windows 7. Two other Qt 5.5 applications run "beneath" it on /dev/fb1 and /dev/fb2 and simply display static images for now.
We are using Overlay1 to globally alpha blend /dev/fb1 ( which has a z-order of 1 ) to an alpha value of 150. The application on Overlay1 is called like this: ./app2 -platform linuxfb:fb=/dev/fb1.
The last Qt5 application on /dev/fb2 has the lowest z-order and is fully opaque. It runs on Overlay2 and is launched with this command: ./app3 -platform linuxfb:fb=/dev/fb2.
Global alpha blending on Overlay1 works great, we partially see "through" our image on /dev/fb1 and it blends with the base layer on Overlay2. The problem is that when we run the top level GUI application, we cannot set the background of the GFX layer Overlay0 to be fully transparent. It simply appears black. This covers the 2 lower z-order applications and they are no longer visible.
We attempted to investigate this issue by looking at the Qt5.5 linuxfb plugin source code. Beginning at line 251 of qfbscreen.cpp in the Qt5.5 source ( located in qt5base-5.5.1/src/platformsupport/fbconvenience ), we see where the linuxfb plugin sets the base layer to black. If we change that one line to "qt::transparent", and re-launch our app, then we see the lower 2 layers "through" the GUI in the regions of the GUI where it is fully transparent. Initially, the fully transparent GUI displays correctly. It displays a menu, which initially appears correct. A problem occurs when we then try to hide the menu. It remains displayed on the screen. Apparently, the redraw of the base layer, which is transparent, does not replace the pixels from the menu, but is instead blended with the menu pixels.
We have tried several composition modes in the base layer's paint event, including Source and Clear, but neither fixes the problem. On previous products ( using the DM3730 ), we used this same approach ( DSS blended framebuffers ) with Qt 4.8 and it worked as expected. How can we make this work with Qt 5.5?
qfbscreen.cpp:
// we only expect one rectangle, but defensive coding... foreach (const QRect &rect, intersect.rects()) { bool firstLayer = true; if (layer == -1) { mCompositePainter->fillRect(rect, Qt::black); firstLayer = false; layer = mWindowStack.size() - 1; } for (int layerIndex = layer; layerIndex != -1; layerIndex--) { if (!mWindowStack[layerIndex]->window()->isVisible()) continue; // if (mWindowStack[layerIndex]->isMinimized()) // continue; QRect windowRect = mWindowStack[layerIndex]->geometry().translated(-screenOffset); QRect windowIntersect = rect.translated(-windowRect.left(), -windowRect.top()); QFbBackingStore *backingStore = mWindowStack[layerIndex]->backingStore(); if (backingStore) { backingStore->lock(); mCompositePainter->drawImage(rect, backingStore->image(), windowIntersect); backingStore->unlock(); } if (firstLayer) { firstLayer = false; } } }
We greatly appreciate any help - thank you.