summaryrefslogtreecommitdiff
path: root/src/hardwareintegration
diff options
context:
space:
mode:
authorInho Lee <inho.lee@qt.io>2021-11-05 13:35:55 +0100
committerInho Lee <inho.lee@qt.io>2022-01-25 08:57:44 +0000
commit448b5e2e000f10a5ce049b674108ea26a4eab7e0 (patch)
tree4c92b8ca9b8943d09cd3e8014209b4006b0b311f /src/hardwareintegration
parent0e4a5a94b130328f812eb527e2a4218da0da94b5 (diff)
downloadqtwayland-448b5e2e000f10a5ce049b674108ea26a4eab7e0.tar.gz
Don't keep eglConfig in hardwareintegration
There is no reason to keep eglConfig value as a member variable. Even this can result in creating wrong surface from the current surface. And it makes no sense to change alpha bits of the surface format by supporting decorations. Task-number: QTBUG-97916 Pick-to: 6.3 6.2 5.15 Change-Id: Iaa395d36e83373ea197dc5e14424fcb62cd2cd8b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp8
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h2
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp18
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h1
4 files changed, 11 insertions, 18 deletions
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
index 87ae8c02..b19c3663 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
@@ -185,14 +185,14 @@ void QWaylandBrcmEglWindow::createEglSurfaces()
m_count = window()->format().swapBehavior() == QSurfaceFormat::TripleBuffer ? 3 : 2;
- m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT);
+ EGLConfig eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT);
- m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), m_eglConfig);
+ m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), eglConfig);
EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM;
EGLint rt;
- eglGetConfigAttrib(m_eglIntegration->eglDisplay(), m_eglConfig, EGL_RENDERABLE_TYPE, &rt);
+ eglGetConfigAttrib(m_eglIntegration->eglDisplay(), eglConfig, EGL_RENDERABLE_TYPE, &rt);
if (rt & EGL_OPENGL_ES_BIT) {
pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM;
@@ -228,7 +228,7 @@ void QWaylandBrcmEglWindow::createEglSurfaces()
EGL_NONE
};
- m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), m_eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs);
+ m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs);
if (m_eglSurfaces[i] == EGL_NO_SURFACE)
qFatal("eglCreatePixmapSurface failed: %x, global image id: %d %d\n", eglGetError(), m_globalImages[5*i], m_globalImages[5*i+1]);
m_buffers[i] = new QWaylandBrcmBuffer(mDisplay, m_eglIntegration->waylandBrcm(), size, &m_globalImages[5*i], 5, m_eventQueue);
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
index 0c809e1a..20eeab92 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
@@ -76,8 +76,6 @@ private:
const QWaylandWindow *m_parentWindow = nullptr;
- EGLConfig m_eglConfig = 0;
-
EGLint m_globalImages[3*5];
EGLSurface m_eglSurfaces[3];
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index adccef5b..4389d894 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -57,17 +57,8 @@ namespace QtWaylandClient {
QWaylandEglWindow::QWaylandEglWindow(QWindow *window, QWaylandDisplay *display)
: QWaylandWindow(window, display)
, m_clientBufferIntegration(static_cast<QWaylandEglClientBufferIntegration *>(mDisplay->clientBufferIntegration()))
+ , m_format(window->requestedFormat())
{
- QSurfaceFormat fmt = window->requestedFormat();
- if (mDisplay->supportsWindowDecoration())
- fmt.setAlphaBufferSize(8);
- m_eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
- m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig, fmt);
-
- // Do not create anything from here. This platform window may belong to a
- // RasterGLSurface window which may have pure raster content. In this case, where the
- // window is never actually made current, creating a wl_egl_window and EGL surface
- // should be avoided.
}
QWaylandEglWindow::~QWaylandEglWindow()
@@ -145,7 +136,12 @@ void QWaylandEglWindow::updateSurface(bool create)
if (!m_eglSurface && m_waylandEglWindow && create) {
EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow;
- m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0);
+ QSurfaceFormat fmt = window()->requestedFormat();
+ if (mDisplay->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ EGLConfig eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
+ m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), eglConfig);
+ m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), eglConfig, eglw, 0);
if (Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE))
qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError());
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
index 8150fd7a..0c8e01e1 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
@@ -94,7 +94,6 @@ private:
const QWaylandWindow *m_parentWindow = nullptr;
EGLSurface m_eglSurface = EGL_NO_SURFACE;
- EGLConfig m_eglConfig;
mutable bool m_resize = false;
mutable QOpenGLFramebufferObject *m_contentFBO = nullptr;