summaryrefslogtreecommitdiffstats
path: root/src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-12-05 17:09:02 +0100
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-12-07 09:58:35 +0100
commit4c89518228012ddc3602eab405e4b5fb8108fcdf (patch)
tree615d4fdc38999e408d52998c39760064d223b652 /src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp
parent542eca71e074b5110df2aaf822449bf7d6ec2b91 (diff)
Make wayland actually a module
Also fix so that QtCompositor can be built as shared object. + fix so that the default QT_WAYLAND_GL_CONFIG is wayland_egl Change-Id: I02b72e99286584426bd37ab2d00bbc84af11efdc Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp')
-rw-r--r--src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp b/src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp
new file mode 100644
index 000000000..eb516d1d2
--- /dev/null
+++ b/src/compositor/hardware_integration/dri2_xcb/dri2xcbbuffer.cpp
@@ -0,0 +1,46 @@
+#include "dri2xcbbuffer.h"
+
+#include "waylandobject.h"
+
+#define EGL_EGLEXT_PROTOTYPES
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+Dri2XcbBuffer::Dri2XcbBuffer(uint32_t id, uint32_t name, const QSize &size, uint32_t stride, wl_visual *visual, EGLDisplay eglDisplay, Wayland::Compositor *compositor)
+ :m_egl_display(eglDisplay)
+{
+ base()->compositor = compositor->base();
+ base()->visual = visual;
+ base()->height = size.height();
+ base()->width = size.width();
+ base()->attach = 0;
+ base()->damage = 0;
+
+ EGLint attribs[] = {
+ EGL_WIDTH, size.width(),
+ EGL_HEIGHT, size.height(),
+ EGL_DRM_BUFFER_STRIDE_MESA, stride /4,
+ EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+ EGL_NONE
+ };
+
+ m_image = eglCreateImageKHR(m_egl_display,
+ EGL_NO_CONTEXT,
+ EGL_DRM_BUFFER_MESA,
+ (EGLClientBuffer) name, attribs);
+}
+
+Dri2XcbBuffer::~Dri2XcbBuffer()
+{
+ eglDestroyImageKHR (m_egl_display, m_image);
+}
+
+void dri2XcbBufferDestroy(struct wl_client *client, struct wl_buffer *buffer)
+{
+ delete Wayland::wayland_cast<Dri2XcbBuffer *>(buffer);
+}
+
+EGLImageKHR Dri2XcbBuffer::image() const
+{
+ return m_image;
+}