summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-01-06 12:26:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-06 13:12:32 +0100
commitcd1e9d036ff1354c65b016ba8af0d6d6bd7cea92 (patch)
treefc7ff2a2fc5c3f2862b3c0e46589fc44ee1f1a9f /src/hardwareintegration
parentb2bfcec54cb46fa9e6555d3cb77ae6b995392ac6 (diff)
Revised createTextureFromBuffer
The context is not passed anymore to texture() and similar functions since they have to use the current context anyhow. createTextureFromBuffer() becomes bindTextureToBuffer() which is called with the texture bound. The integration can also provide its own texture in case the one created and managed by the surfacebuffer is not suitable. Change-Id: I1bfc4fe35c0e3db6081b47c551f20f4bca9aa04e Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp15
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h2
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp13
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h2
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp10
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h2
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp6
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h2
8 files changed, 14 insertions, 38 deletions
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
index e5975abc3..a0be625dd 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
@@ -124,30 +124,25 @@ void BrcmEglIntegration::initializeHardware(QtWayland::Display *waylandDisplay)
}
}
-GLuint BrcmEglIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *)
+void BrcmEglIntegration::bindTextureToBuffer(struct ::wl_resource *buffer)
{
Q_D(BrcmEglIntegration);
if (!d->valid) {
- qWarning("createTextureFromBuffer() failed\n");
- return 0;
+ qWarning("bindTextureToBuffer failed!");
+ return;
}
BrcmBuffer *brcmBuffer = BrcmBuffer::fromResource(buffer);
if (!d->eglQueryGlobalImageBRCM(brcmBuffer->handle(), brcmBuffer->handle() + 2)) {
qWarning("eglQueryGlobalImageBRCM failed!");
- return 0;
+ return;
}
EGLImageKHR image = d->eglCreateImageKHR(d->egl_display, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)brcmBuffer->handle(), NULL);
if (image == EGL_NO_IMAGE_KHR)
qWarning("eglCreateImageKHR() failed: %x\n", eglGetError());
- GLuint textureId;
- glGenTextures(1, &textureId);
-
- glBindTexture(GL_TEXTURE_2D, textureId);
-
d->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -156,8 +151,6 @@ GLuint BrcmEglIntegration::createTextureFromBuffer(struct ::wl_resource *buffer,
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
d->eglDestroyImageKHR(d->egl_display, image);
-
- return textureId;
}
bool BrcmEglIntegration::isYInverted(struct ::wl_resource *) const
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
index 7d94e315b..f6486ed4b 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
@@ -58,7 +58,7 @@ public:
void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE;
- GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE;
+ void udpateTextureFromBuffer(struct ::wl_resource *buffer) Q_DECL_OVERRIDE;
bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE;
QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE;
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index bd77db63e..7cc140cd3 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -170,23 +170,18 @@ void WaylandEglClientBufferIntegration::initializeHardware(QtWayland::Display *w
qWarning("EGL Wayland extension successfully initialized.%s\n", !d->display_bound ? " eglBindWaylandDisplayWL ignored" : "");
}
-GLuint WaylandEglClientBufferIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *)
+void WaylandEglClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource *buffer)
{
Q_D(WaylandEglClientBufferIntegration);
if (!d->valid) {
- qWarning("createTextureFromBuffer() failed\n");
- return 0;
+ qWarning("bindTextureToBuffer() failed");
+ return;
}
EGLImageKHR image = d->egl_create_image(d->egl_display, EGL_NO_CONTEXT,
EGL_WAYLAND_BUFFER_WL,
buffer, NULL);
- GLuint textureId;
- glGenTextures(1,&textureId);
-
- glBindTexture(GL_TEXTURE_2D, textureId);
-
d->gl_egl_image_target_texture_2d(GL_TEXTURE_2D, image);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -195,8 +190,6 @@ GLuint WaylandEglClientBufferIntegration::createTextureFromBuffer(struct ::wl_re
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
d->egl_destroy_image(d->egl_display, image);
-
- return textureId;
}
bool WaylandEglClientBufferIntegration::isYInverted(struct ::wl_resource *buffer) const
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
index 2f93e9052..a289baa0d 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
@@ -56,7 +56,7 @@ public:
void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE;
- GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE;
+ void bindTextureToBuffer(struct ::wl_resource *buffer) Q_DECL_OVERRIDE;
bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE;
bool setDirectRenderSurface(QWaylandSurface *) Q_DECL_OVERRIDE;
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
index 55b0cc15e..c645b997f 100644
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
+++ b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
@@ -91,7 +91,7 @@ void XCompositeEglClientBufferIntegration::initializeHardware(QtWayland::Display
new XCompositeHandler(m_compositor->handle(), mDisplay);
}
-GLuint XCompositeEglClientBufferIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *)
+void XCompositeEglClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource *buffer)
{
XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer);
Pixmap pixmap = XCompositeNameWindowPixmap(mDisplay, compositorBuffer->window());
@@ -103,7 +103,7 @@ GLuint XCompositeEglClientBufferIntegration::createTextureFromBuffer(struct ::wl
bool matched = eglChooseConfig(mEglDisplay,eglConfigSpec.constData(),&config,1,&matching);
if (!matched || !matching) {
qWarning("Could not retrieve a suitable EGL config");
- return 0;
+ return;
}
QVector<EGLint> attribList;
@@ -121,17 +121,11 @@ GLuint XCompositeEglClientBufferIntegration::createTextureFromBuffer(struct ::wl
compositorBuffer->setInvertedY(true);
- GLuint textureId;
- glGenTextures(1,&textureId);
- glBindTexture(GL_TEXTURE_2D, textureId);
-
if (!eglBindTexImage(mEglDisplay,surface,EGL_BACK_BUFFER)) {
qDebug() << "Failed to bind";
}
// eglDestroySurface(mEglDisplay,surface);
-
- return textureId;
}
bool XCompositeEglClientBufferIntegration::isYInverted(struct ::wl_resource *buffer) const
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
index 65a574d1e..5497daed4 100644
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
+++ b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
@@ -56,7 +56,7 @@ public:
void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE;
- GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE;
+ void bindTextureToBuffer(struct ::wl_resource *buffer) Q_DECL_OVERRIDE;
bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE;
QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE;
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
index 1df6a4c99..a58827cee 100644
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
+++ b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
@@ -112,7 +112,7 @@ void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display
delete glContext;
}
-GLuint XCompositeGLXClientBufferIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *)
+void XCompositeGLXClientBufferIntegration::updateTextureFromBuffer(struct ::wl_resource *buffer)
{
XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer);
Pixmap pixmap = XCompositeNameWindowPixmap(mDisplay, compositorBuffer->window());
@@ -135,14 +135,10 @@ GLuint XCompositeGLXClientBufferIntegration::createTextureFromBuffer(struct ::wl
XFree(configs);
- GLuint textureId;
- glGenTextures(1,&textureId);
- glBindTexture(GL_TEXTURE_2D, textureId);
m_glxBindTexImageEXT(mDisplay,glxPixmap,GLX_FRONT_EXT, 0);
//Do we need to change the api so that we do bind and release in the painevent?
//The specification states that when deleting the texture the color buffer is deleted
// m_glxReleaseTexImageEXT(mDisplay,glxPixmap,GLX_FRONT_EXT);
- return textureId;
}
bool XCompositeGLXClientBufferIntegration::isYInverted(struct ::wl_resource *buffer) const
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
index be6b02028..5a724eedf 100644
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
+++ b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
@@ -61,7 +61,7 @@ public:
void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE;
- GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE;
+ void bindTextureToBuffer(struct ::wl_resource *buffer) Q_DECL_OVERRIDE;
bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE;
QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE;