diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-11-09 20:44:18 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-01-25 18:04:41 (GMT) |
commit | 73a2833abc1c9e9d5d3abe461e2ce9196bcb2a74 (patch) | |
tree | 09ea9a2f84d21b18badbe3b08c6ebcf87ea6257f /src/plugins | |
parent | aba46c644461616a2b14fc422efba74d5c44d017 (diff) | |
download | Qt-73a2833abc1c9e9d5d3abe461e2ce9196bcb2a74.zip Qt-73a2833abc1c9e9d5d3abe461e2ce9196bcb2a74.tar.gz Qt-73a2833abc1c9e9d5d3abe461e2ce9196bcb2a74.tar.bz2 |
Wayland: request rbg and premultiplied argb visuals as needed
When creating DRM buffers we should try to match the visual type
requested with the buffer format.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddrmsurface.cpp | 17 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandintegration.cpp | 10 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandintegration.h | 3 |
3 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 7756e85..cb4445c 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -112,7 +112,7 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, : mDisplay(display) , mSize(size) { - Q_UNUSED(format); + struct wl_visual *visual; EGLint name, stride; static const EGLint contextAttribs[] = { @@ -143,8 +143,21 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, eglExportDRMImageMESA(mDisplay->eglDisplay(), mImage, &name, NULL, &stride); + switch (format) { + case QImage::Format_ARGB32: + visual = display->argbVisual(); + break; + case QImage::Format_ARGB32_Premultiplied: + visual = display->argbPremultipliedVisual(); + break; + default: + qDebug("unsupported buffer format %d requested\n", format); + visual = display->argbVisual(); + break; + } + mBuffer = display->createDrmBuffer(name, size.width(), size.height(), - stride, display->argbVisual()); + stride, visual); } QWaylandDrmBuffer::~QWaylandDrmBuffer(void) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 0109678..19f339a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -185,11 +185,21 @@ struct wl_buffer *QWaylandDisplay::createDrmBuffer(int name, return wl_drm_create_buffer(mDrm, name, width, height, stride, visual); } +struct wl_visual *QWaylandDisplay::rgbVisual() +{ + return wl_display_get_rgb_visual(mDisplay); +} + struct wl_visual *QWaylandDisplay::argbVisual() { return wl_display_get_argb_visual(mDisplay); } +struct wl_visual *QWaylandDisplay::argbPremultipliedVisual() +{ + return wl_display_get_premultiplied_argb_visual(mDisplay); +} + void QWaylandDisplay::drmHandleDevice(void *data, struct wl_drm *drm, const char *device) { diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 1c5f834..611ce43 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -79,8 +79,9 @@ public: struct wl_buffer *createDrmBuffer(int name, int width, int height, uint32_t stride, struct wl_visual *visual); - + struct wl_visual *rgbVisual(); struct wl_visual *argbVisual(); + struct wl_visual *argbPremultipliedVisual(); EGLDisplay eglDisplay() { return mEglDisplay; } void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y); |