Experimental.
m_compositor->destroyClientForSurface(surface->handle());
}
-void WaylandCompositor::setDirectRenderWinId(uint winId)
+void WaylandCompositor::setDirectRenderSurface(WaylandSurface *surface)
{
- Q_UNUSED(winId);
+ m_compositor->setDirectRenderSurface(surface ? surface->handle() : 0);
}
-uint WaylandCompositor::directRenderWinId() const
+WaylandSurface *WaylandCompositor::directRenderSurface() const
{
- return 0;
+ Wayland::Surface *surf = m_compositor->directRenderSurface();
+ return surf ? surf->handle() : 0;
}
QWidget * WaylandCompositor::topLevelWidget() const
void setInputFocus(WaylandSurface *surface);
void destroyClientForSurface(WaylandSurface *surface);
- void setDirectRenderWinId(uint winId);
- uint directRenderWinId() const;
+ void setDirectRenderSurface(WaylandSurface *surface);
+ WaylandSurface *directRenderSurface() const;
QWidget *topLevelWidget()const;
**/
virtual GLuint createTextureFromBuffer(struct wl_buffer *buffer) = 0;
+ virtual bool setDirectRenderSurface(WaylandSurface *surface) {return false;}
+ virtual bool postBuffer(struct wl_buffer *) {return false;}
+
static GraphicsHardwareIntegration *createGraphicsHardwareIntegration(WaylandCompositor *compositor);
protected:
, m_qt_compositor(qt_compositor)
, m_pointerFocusSurface(0)
, m_keyFocusSurface(0)
+ , m_directRenderSurface(0)
{
#if defined (QT_COMPOSITOR_WAYLAND_GL)
m_graphics_hw_integration = GraphicsHardwareIntegration::createGraphicsHardwareIntegration(qt_compositor);
#endif
}
+bool Compositor::setDirectRenderSurface(Surface *surface)
+{
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+ if (m_graphics_hw_integration->setDirectRenderSurface(surface ? surface->handle() : 0)) {
+ m_directRenderSurface = surface;
+ return true;
+ }
+#endif
+ return false;
+}
+
}
GraphicsHardwareIntegration *graphicsHWIntegration() const;
void initializeHardwareIntegration();
+ bool setDirectRenderSurface(Surface *surface);
+ Surface *directRenderSurface() const {return m_directRenderSurface;}
wl_input_device *defaultInputDevice();
+ WaylandCompositor *qtCompositor() const { return m_qt_compositor; }
private slots:
void processWaylandEvents();
Surface *m_pointerFocusSurface;
Surface *m_keyFocusSurface;
+ Surface *m_directRenderSurface;
#ifdef QT_COMPOSITOR_WAYLAND_GL
GraphicsHardwareIntegration *m_graphics_hw_integration;
: client(client)
, compositor(compositor)
, needsMap(false)
+ , directRenderBuffer(0)
{
type = WaylandSurface::Invalid;
#ifdef QT_COMPOSITOR_WAYLAND_GL
GLuint texture_id;
#endif
bool needsMap;
+ wl_buffer *directRenderBuffer;
};
void Surface::damage(const QRect &rect)
{
Q_D(Surface);
+ if (d->directRenderBuffer) {
+ //qDebug() << "DIRECT RENDER";
+ if (d->compositor->graphicsHWIntegration()->postBuffer(d->directRenderBuffer))
+ return;
+ }
d->compositor->markSurfaceAsDirty(this);
emit d->qtSurface->damaged(rect);
}
void Surface::attachHWBuffer(struct wl_buffer *buffer)
{
Q_D(Surface);
+
+ if (d->compositor->qtCompositor()->directRenderSurface() == handle()) {
+ d->directRenderBuffer = buffer;
+ if (d->texture_id) {
+ glDeleteTextures(1,&d->texture_id);
+ d->texture_id = 0;
+ }
+ //qDebug() << " not creating texture";
+ return;
+ }
+ //qDebug() << "creating texture" << handle() << "direct" << d->compositor->qtCompositor()->directRenderSurface();
+ d->directRenderBuffer = 0;
d->type = WaylandSurface::Texture;
//make current for the topLevel. We could have used the eglContext,