Fix run time failure for UI autotests (INTEGRITY)
- Add WFD resources release: It provides possibility to re-create native window on run time. It allows to run several Qt UI applications (one by one) without device reboot. - Fix crash that found during window re-creation: ~QOpenGLCompositorBacking() calls QOpenGLCompositor::instance(). But compositor is deleted for that moment. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I1e6dc9a012a166d1fd6cd1c24f9d2e9a8995fc00 Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
406bb6ae20
commit
b5124d9719
@ -95,18 +95,20 @@ QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore()
|
|||||||
QScopedPointer<QOffscreenSurface> tempSurface;
|
QScopedPointer<QOffscreenSurface> tempSurface;
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
ctx = QOpenGLCompositor::instance()->context();
|
ctx = QOpenGLCompositor::instance()->context();
|
||||||
tempSurface.reset(new QOffscreenSurface);
|
if (ctx) {
|
||||||
tempSurface->setFormat(ctx->format());
|
tempSurface.reset(new QOffscreenSurface);
|
||||||
tempSurface->create();
|
tempSurface->setFormat(ctx->format());
|
||||||
ctx->makeCurrent(tempSurface.data());
|
tempSurface->create();
|
||||||
|
ctx->makeCurrent(tempSurface.data());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bsTextureContext && ctx->shareGroup() == m_bsTextureContext->shareGroup())
|
if (m_bsTextureContext && ctx && ctx->shareGroup() == m_bsTextureContext->shareGroup())
|
||||||
glDeleteTextures(1, &m_bsTexture);
|
glDeleteTextures(1, &m_bsTexture);
|
||||||
else
|
else
|
||||||
qWarning("QOpenGLCompositorBackingStore: Texture is not valid in the current context");
|
qWarning("QOpenGLCompositorBackingStore: Texture is not valid in the current context");
|
||||||
|
|
||||||
if (tempSurface)
|
if (tempSurface && ctx)
|
||||||
ctx->doneCurrent();
|
ctx->doneCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,23 +154,23 @@ EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow
|
|||||||
if (!ok)
|
if (!ok)
|
||||||
pipelineId = pipelineIds[0];
|
pipelineId = pipelineIds[0];
|
||||||
|
|
||||||
WFDPipeline pipeline = wfdCreatePipeline(mDevice, pipelineId, nullptr);
|
mPipeline = wfdCreatePipeline(mDevice, pipelineId, nullptr);
|
||||||
if (WFD_INVALID_HANDLE == pipeline)
|
if (WFD_INVALID_HANDLE == mPipeline)
|
||||||
qFatal("Failed to create wfd pipeline");
|
qFatal("Failed to create wfd pipeline");
|
||||||
|
|
||||||
wfdSetPipelineAttribi(mDevice, pipeline, WFD_PIPELINE_TRANSPARENCY_ENABLE,
|
wfdSetPipelineAttribi(mDevice, mPipeline, WFD_PIPELINE_TRANSPARENCY_ENABLE,
|
||||||
(WFD_TRANSPARENCY_SOURCE_ALPHA|WFD_TRANSPARENCY_GLOBAL_ALPHA));
|
(WFD_TRANSPARENCY_SOURCE_ALPHA|WFD_TRANSPARENCY_GLOBAL_ALPHA));
|
||||||
|
|
||||||
WFDErrorCode eError = wfdGetError(mDevice);
|
WFDErrorCode eError = wfdGetError(mDevice);
|
||||||
if (WFD_ERROR_NONE != eError)
|
if (WFD_ERROR_NONE != eError)
|
||||||
qFatal("Failed to set WFD_PIPELINE_TRANSPARENCY_ENABLE");
|
qFatal("Failed to set WFD_PIPELINE_TRANSPARENCY_ENABLE");
|
||||||
|
|
||||||
wfdSetPipelineAttribi(mDevice, pipeline, WFD_PIPELINE_GLOBAL_ALPHA, 255);
|
wfdSetPipelineAttribi(mDevice, mPipeline, WFD_PIPELINE_GLOBAL_ALPHA, 255);
|
||||||
eError = wfdGetError(mDevice);
|
eError = wfdGetError(mDevice);
|
||||||
if (WFD_ERROR_NONE != eError)
|
if (WFD_ERROR_NONE != eError)
|
||||||
qFatal("Failed to set WFD_PIPELINE_GLOBAL_ALPHA");
|
qFatal("Failed to set WFD_PIPELINE_GLOBAL_ALPHA");
|
||||||
|
|
||||||
wfdBindPipelineToPort(mDevice, mPort, pipeline);
|
wfdBindPipelineToPort(mDevice, mPort, mPipeline);
|
||||||
eError = wfdGetError(mDevice);
|
eError = wfdGetError(mDevice);
|
||||||
if (WFD_ERROR_NONE != eError)
|
if (WFD_ERROR_NONE != eError)
|
||||||
qFatal("Failed to bind port to pipeline");
|
qFatal("Failed to bind port to pipeline");
|
||||||
@ -190,7 +190,7 @@ EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow
|
|||||||
if (WFD_INVALID_HANDLE == wfdEglImages[i])
|
if (WFD_INVALID_HANDLE == wfdEglImages[i])
|
||||||
qFatal("Failed to create WDFEGLImages");
|
qFatal("Failed to create WDFEGLImages");
|
||||||
|
|
||||||
source[i] = wfdCreateSourceFromImage(mDevice, pipeline, eglImageHandles[i], nullptr);
|
source[i] = wfdCreateSourceFromImage(mDevice, mPipeline, eglImageHandles[i], nullptr);
|
||||||
if (WFD_INVALID_HANDLE == source[i])
|
if (WFD_INVALID_HANDLE == source[i])
|
||||||
qFatal("Failed to create source from EGLImage");
|
qFatal("Failed to create source from EGLImage");
|
||||||
}
|
}
|
||||||
@ -208,14 +208,13 @@ EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow
|
|||||||
|
|
||||||
nativeWindow->dev = mDevice;
|
nativeWindow->dev = mDevice;
|
||||||
nativeWindow->port = mPort;
|
nativeWindow->port = mPort;
|
||||||
nativeWindow->pipeline = pipeline;
|
nativeWindow->pipeline = mPipeline;
|
||||||
nativeWindow->numBuffers = MAX_NUM_OF_WFD_BUFFERS;
|
nativeWindow->numBuffers = MAX_NUM_OF_WFD_BUFFERS;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_NUM_OF_WFD_BUFFERS; i++) {
|
for (int i = 0; i < MAX_NUM_OF_WFD_BUFFERS; i++) {
|
||||||
nativeWindow->buffers[i].image = wfdEglImages[i];
|
nativeWindow->buffers[i].image = wfdEglImages[i];
|
||||||
nativeWindow->buffers[i].source = source[i];
|
nativeWindow->buffers[i].source = source[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (EGLNativeWindowType)nativeWindow;
|
return (EGLNativeWindowType)nativeWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +230,16 @@ QSurfaceFormat QEglFSOpenWFDIntegration::surfaceFormatFor(const QSurfaceFormat &
|
|||||||
|
|
||||||
void QEglFSOpenWFDIntegration::destroyNativeWindow(EGLNativeWindowType window)
|
void QEglFSOpenWFDIntegration::destroyNativeWindow(EGLNativeWindowType window)
|
||||||
{
|
{
|
||||||
|
wfdDestroyPipeline(mDevice, mPipeline);
|
||||||
free((void*)window);
|
free((void*)window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QEglFSOpenWFDIntegration::platformDestroy()
|
||||||
|
{
|
||||||
|
wfdDestroyPort(mDevice, mPort);
|
||||||
|
WFDErrorCode error = wfdDestroyDevice(mDevice);
|
||||||
|
if (error != WFD_ERROR_NONE)
|
||||||
|
qWarning() << "Failed to release wfd device! Error = " << error;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -51,6 +51,7 @@ class QEglFSOpenWFDIntegration : public QEglFSDeviceIntegration
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void platformInit() override;
|
void platformInit() override;
|
||||||
|
void platformDestroy() override;
|
||||||
QSize screenSize() const override;
|
QSize screenSize() const override;
|
||||||
EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override;
|
EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override;
|
||||||
void destroyNativeWindow(EGLNativeWindowType window) override;
|
void destroyNativeWindow(EGLNativeWindowType window) override;
|
||||||
@ -62,6 +63,7 @@ private:
|
|||||||
EGLNativeDisplayType mNativeDisplay;
|
EGLNativeDisplayType mNativeDisplay;
|
||||||
WFDDevice mDevice;
|
WFDDevice mDevice;
|
||||||
WFDPort mPort;
|
WFDPort mPort;
|
||||||
|
WFDPipeline mPipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user