waylandDisplay->addGlobalObject(m_drm_object->base(),&wl_drm_interface,&drm_interface,post_drm_device);
}
-void Dri2XcbHWIntegration::bindBufferToTexture(wl_buffer *buffer, GLuint textureId)
+GLuint Dri2XcbHWIntegration::createTextureFromBuffer(wl_buffer *buffer)
{
Dri2XcbBuffer *dri2Buffer = Wayland::wayland_cast<Dri2XcbBuffer *>(buffer);
+ GLuint textureId = 0;
+ glGenTextures(1,&textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, dri2Buffer->image());
+
+ return textureId;
}
void initializeHardware(Wayland::Display *waylandDisplay);
- void bindBufferToTexture(wl_buffer *buffer, GLuint textureId);
+ GLuint createTextureFromBuffer(wl_buffer *buffer);
private:
DrmObject *m_drm_object;
/** Bind the Wayland buffer to the textureId. The correct context is the current context,
so there is no need to do makeCurrent in this function.
**/
- virtual void bindBufferToTexture(struct wl_buffer *buffer, GLuint textureId) = 0;
+ virtual GLuint createTextureFromBuffer(struct wl_buffer *buffer) = 0;
protected:
WaylandCompositor *m_compositor;
}
}
-void MesaEglIntegration::bindBufferToTexture(wl_buffer *buffer, GLuint textureId)
+GLuint MesaEglIntegration::createTextureFromBuffer(wl_buffer *buffer)
{
Q_D(MesaEglIntegration);
EGLImageKHR image = eglCreateImageKHR(d->egl_display, d->egl_context,
EGL_WAYLAND_BUFFER_WL,
buffer, NULL);
+ GLuint textureId;
+ glGenTextures(1,&textureId);
+
glBindTexture(GL_TEXTURE_2D, textureId);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
eglDestroyImageKHR(d->egl_display, image);
-
+ return textureId;
}
void initializeHardware(Wayland::Display *waylandDisplay);
- void bindBufferToTexture(wl_buffer *buffer, GLuint textureId);
+ GLuint createTextureFromBuffer(wl_buffer *buffer);
private:
Q_DISABLE_COPY(MesaEglIntegration)
void Compositor::surfaceDamaged(Surface *surface, const QRect &rect)
{
+ surface->commit();
m_qt_compositor->surfaceDamaged(surface->id(), rect);
}
current.type = State::Invalid;
staged.type = State::Invalid;
#ifdef QT_COMPOSITOR_WAYLAND_GL
- if (QWidget *topLevel = m_compositor->topLevelWidget()) {
- if (topLevel->platformWindow() && topLevel->platformWindow()->glContext()) {
- topLevel->platformWindow()->glContext()->makeCurrent();
- glGenTextures(1,¤t.texture_id);
- staged.texture_id = current.texture_id;
- }
- }
+ staged.texture_id = current.texture_id = 0;
#endif
}
Q_D(Surface);
d->staged.type = SurfacePrivate::State::Texture;
d->current.type = d->staged.type;
- d->current.texture_id = d->staged.texture_id;
//make current for the topLevel. We could have used the eglContext,
//but then we would need to handle eglSurfaces as well.
d->m_compositor->topLevelWidget()->platformWindow()->glContext()->makeCurrent();
- d->m_compositor->graphicsHWIntegration()->bindBufferToTexture(buffer,d->current.texture_id);
+ glDeleteTextures(1,&d->staged.texture_id);
+
+ d->staged.texture_id = d->m_compositor->graphicsHWIntegration()->createTextureFromBuffer(buffer);
d->m_compositor->surfaceResized(this,QSize(buffer->width,buffer->height));
}
void Surface::commit()
{
Q_D(Surface);
+ SurfacePrivate::State tmpState = d->current;
d->current = d->staged;
+ d->staged = tmpState;
}
}