Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.92 KB | None | 0 0
  1. diff --git a/hwcomposer/hwcomposer.pro b/hwcomposer/hwcomposer.pro
  2. index 4ca6376..6fd2d0a 100644
  3. --- a/hwcomposer/hwcomposer.pro
  4. +++ b/hwcomposer/hwcomposer.pro
  5. @@ -18,8 +18,8 @@ HEADERS += hwcomposer_screeninfo.h
  6. SOURCES += hwcomposer_backend.cpp
  7. HEADERS += hwcomposer_backend.h
  8.  
  9. -SOURCES += hwcomposer_backend_v0.cpp
  10. -HEADERS += hwcomposer_backend_v0.h
  11. +#SOURCES += hwcomposer_backend_v0.cpp
  12. +#HEADERS += hwcomposer_backend_v0.h
  13.  
  14. SOURCES += hwcomposer_backend_v10.cpp
  15. HEADERS += hwcomposer_backend_v10.h
  16. @@ -28,7 +28,7 @@ SOURCES += hwcomposer_backend_v11.cpp
  17. HEADERS += hwcomposer_backend_v11.h
  18.  
  19.  
  20. -QT += core-private compositor-private gui-private platformsupport-private
  21. +QT += core-private compositor-private gui-private platformsupport-private dbus
  22.  
  23. DEFINES += QEGL_EXTRA_DEBUG
  24. CONFIG += egl qpa/genericunixfontdatabase
  25. @@ -57,14 +57,12 @@ SOURCES += $$PWD/qeglfsintegration.cpp \
  26. $$PWD/qeglfswindow.cpp \
  27. $$PWD/qeglfsbackingstore.cpp \
  28. $$PWD/qeglfsscreen.cpp \
  29. - $$PWD/qeglfscontext.cpp \
  30. - $$PWD/qeglfspageflipper.cpp
  31. + $$PWD/qeglfscontext.cpp
  32.  
  33. HEADERS += $$PWD/qeglfsintegration.h \
  34. $$PWD/qeglfswindow.h \
  35. $$PWD/qeglfsbackingstore.h \
  36. $$PWD/qeglfsscreen.h \
  37. - $$PWD/qeglfscontext.h \
  38. - $$PWD/qeglfspageflipper.h
  39. + $$PWD/qeglfscontext.h
  40.  
  41. QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
  42. diff --git a/hwcomposer/hwcomposer_backend.cpp b/hwcomposer/hwcomposer_backend.cpp
  43. index af684a6..7bdad35 100644
  44. --- a/hwcomposer/hwcomposer_backend.cpp
  45. +++ b/hwcomposer/hwcomposer_backend.cpp
  46. @@ -40,7 +40,7 @@
  47. ****************************************************************************/
  48.  
  49. #include "hwcomposer_backend.h"
  50. -#include "hwcomposer_backend_v0.h"
  51. +//#include "hwcomposer_backend_v0.h"
  52. #include "hwcomposer_backend_v10.h"
  53. #include "hwcomposer_backend_v11.h"
  54.  
  55. @@ -100,19 +100,19 @@ HwComposerBackend::create()
  56. // Special-case for old hw adaptations that have the version encoded in
  57. // legacy format, we have to check hwc_device->version directly, because
  58. // the constants are actually encoded in the old format
  59. - if ((hwc_device->version == HWC_DEVICE_API_VERSION_0_1) ||
  60. - (hwc_device->version == HWC_DEVICE_API_VERSION_0_2) ||
  61. - (hwc_device->version == HWC_DEVICE_API_VERSION_0_3)) {
  62. - return new HwComposerBackend_v0(hwc_module, hwc_device);
  63. - }
  64. +// if ((hwc_device->version == HWC_DEVICE_API_VERSION_0_1) ||
  65. +// (hwc_device->version == HWC_DEVICE_API_VERSION_0_2) ||
  66. +// (hwc_device->version == HWC_DEVICE_API_VERSION_0_3)) {
  67. +// return new HwComposerBackend_v0(hwc_module, hwc_device);
  68. +// }
  69.  
  70. // Determine which backend we use based on the supported module API version
  71. switch (version) {
  72. - case HWC_DEVICE_API_VERSION_0_1:
  73. - case HWC_DEVICE_API_VERSION_0_2:
  74. - case HWC_DEVICE_API_VERSION_0_3:
  75. - return new HwComposerBackend_v0(hwc_module, hwc_device);
  76. - break;
  77. +// case HWC_DEVICE_API_VERSION_0_1:
  78. +// case HWC_DEVICE_API_VERSION_0_2:
  79. +// case HWC_DEVICE_API_VERSION_0_3:
  80. +// return new HwComposerBackend_v0(hwc_module, hwc_device);
  81. +// break;
  82. #ifdef HWC_DEVICE_API_VERSION_1_0
  83. case HWC_DEVICE_API_VERSION_1_0:
  84. return new HwComposerBackend_v10(hwc_module, hwc_device);
  85. diff --git a/hwcomposer/hwcomposer_backend_v0.cpp b/hwcomposer/hwcomposer_backend_v0.cpp
  86. index 9a8f9a5..e91080c 100644
  87. --- a/hwcomposer/hwcomposer_backend_v0.cpp
  88. +++ b/hwcomposer/hwcomposer_backend_v0.cpp
  89. @@ -39,7 +39,7 @@
  90. **
  91. ****************************************************************************/
  92.  
  93. -#include "hwcomposer_backend_v0.h"
  94. +//#include "hwcomposer_backend_v0.h"
  95.  
  96.  
  97. HwComposerBackend_v0::HwComposerBackend_v0(hw_module_t *hwc_module, hw_device_t *hw_device)
  98. diff --git a/hwcomposer/main.cpp b/hwcomposer/main.cpp
  99. index 666dd31..de5192e 100644
  100. --- a/hwcomposer/main.cpp
  101. +++ b/hwcomposer/main.cpp
  102. @@ -47,20 +47,16 @@ QT_BEGIN_NAMESPACE
  103. class QEglFSIntegrationPlugin : public QPlatformIntegrationPlugin
  104. {
  105. Q_OBJECT
  106. -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
  107. - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.1" FILE "hwcomposer.json")
  108. -#else
  109. - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "hwcomposer.json")
  110. -#endif
  111. + Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "hwcomposer.json");
  112. public:
  113. - QPlatformIntegration *create(const QString&, const QStringList&);
  114. + QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
  115. };
  116.  
  117. QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList)
  118. {
  119. Q_UNUSED(paramList);
  120. - if (system.toLower() == "hwcomposer")
  121. - return new QEglFSIntegration;
  122. + if (!system.compare(QLatin1String("hwcomposer"), Qt::CaseInsensitive))
  123. + return new QEglFSIntegration();
  124.  
  125. return 0;
  126. }
  127. diff --git a/hwcomposer/qeglfscontext.cpp b/hwcomposer/qeglfscontext.cpp
  128. index d15581b..3e30e08 100644
  129. --- a/hwcomposer/qeglfscontext.cpp
  130. +++ b/hwcomposer/qeglfscontext.cpp
  131. @@ -42,23 +42,50 @@
  132. #include "qeglfscontext.h"
  133. #include "qeglfswindow.h"
  134. #include "qeglfsintegration.h"
  135. -#include "qeglfspageflipper.h"
  136. +//#include "qeglfspageflipper.h"
  137. #include <QtPlatformSupport/private/qeglpbuffer_p.h>
  138. #include <QtGui/QSurface>
  139. #include <QtDebug>
  140.  
  141. QT_BEGIN_NAMESPACE
  142.  
  143. -QEglFSContext::QEglFSContext(HwComposerContext *hwc, QEglFSPageFlipper *pageFlipper, const QSurfaceFormat &format, QPlatformOpenGLContext *share,
  144. - EGLDisplay display, EGLenum eglApi)
  145. - : QEGLPlatformContext(hwc->surfaceFormatFor(format), share, display, QEglFSIntegration::chooseConfig(display, hwc->surfaceFormatFor(format)), eglApi),
  146. - m_pageFlipper(pageFlipper), m_hwc(hwc)
  147. +QEglFSContext::QEglFSContext(
  148. + HwComposerContext *hwc
  149. + , const QSurfaceFormat &format
  150. + , QPlatformOpenGLContext *share
  151. + , EGLDisplay display
  152. +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
  153. + , EGLenum eglApi
  154. +#endif
  155. + )
  156. + : QEGLPlatformContext(
  157. + hwc->surfaceFormatFor(format)
  158. + , share
  159. + , display
  160. + , &(m_config = QEglFSIntegration::chooseConfig(display, hwc->surfaceFormatFor(format)))
  161. +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
  162. + , eglApi
  163. +#endif
  164. + ),
  165. + m_hwc(hwc), m_swapIntervalConfigured(false)
  166. {
  167. }
  168.  
  169. bool QEglFSContext::makeCurrent(QPlatformSurface *surface)
  170. {
  171. - return QEGLPlatformContext::makeCurrent(surface);
  172. + bool current = QEGLPlatformContext::makeCurrent(surface);
  173. + if (current && !m_swapIntervalConfigured) {
  174. + m_swapIntervalConfigured = true;
  175. + int swapInterval = 1;
  176. + QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL");
  177. + if (!swapIntervalString.isEmpty()) {
  178. + bool ok;
  179. + swapInterval = swapIntervalString.toInt(&ok);
  180. + if (!ok)
  181. + swapInterval = 1;
  182. + }
  183. + eglSwapInterval(eglDisplay(), swapInterval);
  184. + }
  185. }
  186.  
  187. EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
  188. diff --git a/hwcomposer/qeglfscontext.h b/hwcomposer/qeglfscontext.h
  189. index 2864252..c5da9fc 100644
  190. --- a/hwcomposer/qeglfscontext.h
  191. +++ b/hwcomposer/qeglfscontext.h
  192. @@ -44,7 +44,6 @@
  193.  
  194. #include <QtPlatformSupport/private/qeglconvenience_p.h>
  195. #include <QtPlatformSupport/private/qeglplatformcontext_p.h>
  196. -#include "qeglfspageflipper.h"
  197.  
  198. #include "hwcomposer_context.h"
  199.  
  200. @@ -53,15 +52,20 @@ QT_BEGIN_NAMESPACE
  201. class QEglFSContext : public QEGLPlatformContext
  202. {
  203. public:
  204. - QEglFSContext(HwComposerContext *hwc, QEglFSPageFlipper *pageFlipper,
  205. - const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
  206. - EGLenum eglApi = EGL_OPENGL_ES_API);
  207. + QEglFSContext(HwComposerContext *hwc,
  208. + const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display
  209. +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
  210. + , EGLenum eglApi = EGL_OPENGL_ES_API);
  211. +#else
  212. + );
  213. +#endif
  214. bool makeCurrent(QPlatformSurface *surface);
  215. EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface);
  216. void swapBuffers(QPlatformSurface *surface);
  217. private:
  218. HwComposerContext *m_hwc;
  219. - QEglFSPageFlipper *m_pageFlipper;
  220. + EGLConfig m_config;
  221. + bool m_swapIntervalConfigured;
  222. };
  223.  
  224. QT_END_NAMESPACE
  225. diff --git a/hwcomposer/qeglfsintegration.cpp b/hwcomposer/qeglfsintegration.cpp
  226. index 9fe2bf2..a05769d 100644
  227. --- a/hwcomposer/qeglfsintegration.cpp
  228. +++ b/hwcomposer/qeglfsintegration.cpp
  229. @@ -63,7 +63,6 @@
  230. #include <qpa/qplatforminputcontextfactory_p.h>
  231.  
  232. #include "qeglfscontext.h"
  233. -#include "qeglfspageflipper.h"
  234.  
  235. #include <EGL/egl.h>
  236.  
  237. @@ -107,16 +106,6 @@ QEglFSIntegration::QEglFSIntegration()
  238. qFatal("EGL error");
  239. }
  240.  
  241. - int swapInterval = 1;
  242. - QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL");
  243. - if (!swapIntervalString.isEmpty()) {
  244. - bool ok;
  245. - swapInterval = swapIntervalString.toInt(&ok);
  246. - if (!ok)
  247. - swapInterval = 1;
  248. - }
  249. - eglSwapInterval(mDisplay, swapInterval);
  250. -
  251. mScreen = new QEglFSScreen(mHwc, mDisplay);
  252. screenAdded(mScreen);
  253.  
  254. @@ -160,7 +149,7 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi
  255.  
  256. QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
  257. {
  258. - return new QEglFSContext(mHwc, static_cast<QEglFSPageFlipper *>(mScreen->pageFlipper()), mHwc->surfaceFormatFor(context->format()), context->shareHandle(), mDisplay);
  259. + return new QEglFSContext(mHwc, mHwc->surfaceFormatFor(context->format()), context->shareHandle(), mDisplay);
  260. }
  261.  
  262. QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
  263. diff --git a/hwcomposer/qeglfsscreen.cpp b/hwcomposer/qeglfsscreen.cpp
  264. index 8b9efb7..86c9fca 100644
  265. --- a/hwcomposer/qeglfsscreen.cpp
  266. +++ b/hwcomposer/qeglfsscreen.cpp
  267. @@ -41,7 +41,6 @@
  268.  
  269. #include "qeglfsscreen.h"
  270. #include "qeglfswindow.h"
  271. -#include "qeglfspageflipper.h"
  272.  
  273. #include <private/qmath_p.h>
  274.  
  275. @@ -50,7 +49,6 @@ QT_BEGIN_NAMESPACE
  276. QEglFSScreen::QEglFSScreen(HwComposerContext *hwc, EGLDisplay dpy)
  277. : m_hwc(hwc)
  278. , m_dpy(dpy)
  279. - , m_pageFlipper(new QEglFSPageFlipper(this))
  280. {
  281. #ifdef QEGL_EXTRA_DEBUG
  282. qWarning("QEglScreen %p\n", this);
  283. @@ -59,16 +57,8 @@ QEglFSScreen::QEglFSScreen(HwComposerContext *hwc, EGLDisplay dpy)
  284.  
  285. QEglFSScreen::~QEglFSScreen()
  286. {
  287. - delete m_pageFlipper;
  288. }
  289.  
  290. -#if 0
  291. -QPlatformScreenPageFlipper *QEglFSScreen::pageFlipper() const
  292. -{
  293. - return m_pageFlipper;
  294. -}
  295. -#endif
  296. -
  297.  
  298. QRect QEglFSScreen::geometry() const
  299. {
  300. diff --git a/rpm/qt5-qpa-hwcomposer-plugin.spec b/rpm/qt5-qpa-hwcomposer-plugin.spec
  301. index 69cbb0f..c574fce 100644
  302. --- a/rpm/qt5-qpa-hwcomposer-plugin.spec
  303. +++ b/rpm/qt5-qpa-hwcomposer-plugin.spec
  304. @@ -9,7 +9,7 @@ Source0: %{name}-%{version}.tar.bz2
  305. BuildRequires: pkgconfig(Qt5Core)
  306. BuildRequires: pkgconfig(Qt5Gui)
  307. BuildRequires: pkgconfig(Qt5DBus)
  308. -BuildRequires: pkgconfig(Qt5PlatformSupport)
  309. +BuildRequires: qt5-qtplatformsupport-devel >= 5.6.0
  310. BuildRequires: pkgconfig(egl)
  311. BuildRequires: pkgconfig(glesv2)
  312. BuildRequires: pkgconfig(wayland-egl)
  313. @@ -37,7 +37,7 @@ hwcomposer for composing content onto the screen.
  314. %build
  315. export QTDIR=/usr/share/qt5
  316. cd hwcomposer
  317. -%qmake5
  318. +%qmake5 DEFINES+=QT_NO_OPENGL_ES_3
  319. make %{_smp_mflags}
  320.  
  321. %install
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement