From 8631b43a2d7a41a2061a9fc4b53840fa1f4bea2c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 8 Jul 2020 09:20:55 +0200 Subject: [PATCH] Add API for selecting supported wl_shm formats We would always reported all formats we could convert from as supported on the wl_shm protocol. This would sometimes cause clients to pick formats that required internal conversion when creating OpenGL textures from the images. To avoid this, we default to only supporting the RGB32 and ARGB32_Premultiplied formats (which are required and advertised automatically) and if the user wants to add additional formats, we now have a additionalShmFormats property for this. [ChangeLog][QtWaylandCompositor] The compositor will now by default only advertise support for the required wl_shm formats. Additional formats can be added to the list by setting the additionalShmFormats property on the compositor. Fixes: QTBUG-77531 Change-Id: Ibd5d5be2a37968353c00308abbfff7ca6f8d310d Reviewed-by: Paul Olav Tvete --- .../shared/qwaylandsharedmemoryformathelper_p.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index ac4428dfd5f..6feaff3f9a7 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -71,7 +71,6 @@ public: default: return QImage::Format_Invalid; } } - static inline QList supportedWaylandFormats(); private: //IMPLEMENTATION (which has to be inline in the header because of the include trick) @@ -127,19 +126,6 @@ wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format return array.data[format]; } -QList QWaylandSharedMemoryFormatHelper::supportedWaylandFormats() -{ - QList retFormats; - Array array = getData(); - for (size_t i = 0; i < array.size; i++) { - if (int(array.data[i]) != INT_MIN - && !retFormats.contains(array.data[i])) { - retFormats.append(array.data[i]); - } - } - return retFormats; -} - QT_END_NAMESPACE #endif //QWAYLANDSHAREDMEMORYFORMATHELPER_H