diff options
author | Paul Olav Tvete <paul.tvete@gmail.com> | 2016-09-07 17:10:49 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2016-10-01 15:42:54 +0000 |
commit | 844204b2b04d0f3477d069db326f0e70129c71e2 (patch) | |
tree | c7134c0b7991192131c82fb14455cfbdfc4d9a14 /src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h | |
parent | 2cfefb35b755e1489aff1a3c427d781e8b887223 (diff) |
Refactor buffer handling
We cannot support bindToTexture() functions. On some
platforms the texture is provided by the driver. Therefore,
the HW integration must always provide a texture.
This has the added bonus of unifying the two separate code paths
that were introduced when EGLStream support was added.
Add a separate buffer manager that owns all buffers.
Don't destroy buffer objects on release. The client will probably
attach them again later. Also, release shm buffers immediately
after uploading to texture (needs to be documented that image()
will not work afterwards).
Make the old SurfaceBuffer class into an abstract base class,
so we can store state in the buffer class instead of having
to map from the wl_resource in each buffer integration. Move
the shared memory buffer handling into a separate subclass.
Change-Id: I81e471d13c92913d31ea1efe487f93fa908b5e0c
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io>
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h')
-rw-r--r-- | src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h index 9caeb4645..7b63f976e 100644 --- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h +++ b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h @@ -38,7 +38,7 @@ #define XCOMPOSITEGLXINTEGRATION_H #include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h> - +#include <QtWaylandCompositor/private/qwlclientbuffer_p.h> #include "xlibinclude.h" #define GLX_GLXEXT_PROTOTYPES @@ -56,21 +56,38 @@ public: ~XCompositeGLXClientBufferIntegration(); void initializeHardware(struct ::wl_display *display) Q_DECL_OVERRIDE; + QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) Q_DECL_OVERRIDE; - void bindTextureToBuffer(struct ::wl_resource *buffer) Q_DECL_OVERRIDE; - QWaylandSurface::Origin origin(struct ::wl_resource *) const Q_DECL_OVERRIDE; - - QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE; + inline Display *xDisplay() const { return mDisplay; } + inline int xScreen() const { return mScreen; } -private: PFNGLXBINDTEXIMAGEEXTPROC m_glxBindTexImageEXT; PFNGLXRELEASETEXIMAGEEXTPROC m_glxReleaseTexImageEXT; +private: Display *mDisplay; int mScreen; XCompositeHandler *mHandler; }; +class XCompositeGLXClientBuffer : public QtWayland::ClientBuffer +{ +public: + XCompositeGLXClientBuffer(XCompositeGLXClientBufferIntegration *integration, wl_resource *bufferResource); + + QSize size() const; + QWaylandSurface::Origin origin() const; + QOpenGLTexture *toOpenGlTexture(int plane) Q_DECL_OVERRIDE; + QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const Q_DECL_OVERRIDE { + return QWaylandBufferRef::BufferFormatEgl_RGBA; + } + +private: + QOpenGLTexture *m_texture; + XCompositeGLXClientBufferIntegration *m_integration; + GLXPixmap m_glxPixmap; +}; + QT_END_NAMESPACE #endif // XCOMPOSITEGLXINTEGRATION_H |