[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/qt5-qpa-hwcomposer-plugin.git</param>
<param name="branch">master</param>
- <param name="revision">9a09bc9f3cce387eb3aa018a52dcb8e2aaa38a46</param>
+ <param name="revision">fda842ee72c127e611cabfba51ab6bbdaca17d5c</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.5.tar.bz2/hwcomposer/hwcomposer.pro
^
|
@@ -27,6 +27,8 @@
SOURCES += hwcomposer_backend_v11.cpp
HEADERS += hwcomposer_backend_v11.h
+SOURCES += hwcomposer_backend_v20.cpp
+HEADERS += hwcomposer_backend_v20.h
QT += core-private compositor-private gui-private platformsupport-private dbus
@@ -50,6 +52,11 @@
DEFINES += HWC_PLUGIN_HAVE_HWCOMPOSER1_API
}
+packagesExist(libhwc2) {
+ PKGCONFIG += libhwc2
+ DEFINES += HWC_PLUGIN_HAVE_HWCOMPOSER2_API
+}
+
# Avoid X11 header collision
DEFINES += MESA_EGL_NO_X11_HEADERS
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.5.tar.bz2/hwcomposer/hwcomposer_backend.cpp
^
|
@@ -47,6 +47,9 @@
#endif
#include "hwcomposer_backend_v10.h"
#include "hwcomposer_backend_v11.h"
+#ifdef HWC_PLUGIN_HAVE_HWCOMPOSER2_API
+#include "hwcomposer_backend_v20.h"
+#endif
extern "C" void *android_dlopen(const char *filename, int flags);
@@ -166,6 +169,11 @@
return new HwComposerBackend_v11(hwc_module, hwc_device, libminisf, HWC_NUM_DISPLAY_TYPES);
break;
#endif /* HWC_PLUGIN_HAVE_HWCOMPOSER1_API */
+#ifdef HWC_PLUGIN_HAVE_HWCOMPOSER2_API
+ case HWC_DEVICE_API_VERSION_2_0:
+ return new HwComposerBackend_v20(hwc_module, libminisf);
+ break;
+#endif
default:
fprintf(stderr, "Unknown hwcomposer API: 0x%x/0x%x/0x%x\n",
hwc_module->module_api_version,
|
[-]
[+]
|
Added |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.5.tar.bz2/hwcomposer/hwcomposer_backend_v20.cpp
^
|
@@ -0,0 +1,416 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Thomas Perl <thomas.perl@jolla.com>
+**
+** This file is part of the hwcomposer plugin.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <android-version.h>
+#include "hwcomposer_backend_v20.h"
+#include "qeglfswindow.h"
+
+#include <string>
+#include <QtCore/QElapsedTimer>
+#include <QtCore/QTimerEvent>
+#include <QtCore/QCoreApplication>
+#include <private/qwindow_p.h>
+
+#include <private/qsystrace_p.h>
+
+// #ifdef HWC_PLUGIN_HAVE_HWCOMPOSER1_API
+
+// #define QPA_HWC_TIMING
+
+#ifdef QPA_HWC_TIMING
+#define QPA_HWC_TIMING_SAMPLE(variable) variable = timer.nsecsElapsed()
+static QElapsedTimer timer;
+static qint64 presentTime;
+static qint64 syncTime;
+static qint64 prepareTime;
+static qint64 setTime;
+#else
+#define QPA_HWC_TIMING_SAMPLE(variable)
+#endif
+
+struct HwcProcs_v20 : public HWC2EventListener
+{
+ HwComposerBackend_v20 *backend;
+};
+
+void hwc2_callback_vsync(HWC2EventListener* listener, int32_t sequenceId,
+ hwc2_display_t display, int64_t timestamp)
+{
+ static int counter = 0;
+ ++counter;
+ if (counter % 2)
+ QSystrace::begin("graphics", "QPA::vsync", "");
+ else
+ QSystrace::end("graphics", "QPA::vsync", "");
+
+ QCoreApplication::postEvent(static_cast<const HwcProcs_v20 *>(listener)->backend,
+ new QEvent(QEvent::User));
+}
+
+void hwc2_callback_hotplug(HWC2EventListener* listener, int32_t sequenceId,
+ hwc2_display_t display, bool connected,
+ bool primaryDisplay)
+{
+ qDebug("onHotplugReceived(%d, %" PRIu64 ", %s, %s)",
+ sequenceId, display,
+ connected ? "connected" : "disconnected",
+ primaryDisplay ? "primary" : "external");
+
+ static_cast<const HwcProcs_v20 *>(listener)->backend->onHotplugReceived(
+ sequenceId, display, connected, primaryDisplay);
+}
+
+void hwc2_callback_refresh(HWC2EventListener* listener, int32_t sequenceId,
+ hwc2_display_t display)
+{
+}
+
+class HWC2Window : public HWComposerNativeWindow
+{
+ private:
+ hwc2_compat_layer_t *layer;
+ hwc2_compat_display_t *hwcDisplay;
+ int lastPresentFence = -1;
+ bool m_syncBeforeSet;
+ protected:
+ void present(HWComposerNativeWindowBuffer *buffer);
+
+ public:
+
+ HWC2Window(unsigned int width, unsigned int height, unsigned int format,
+ hwc2_compat_display_t *display, hwc2_compat_layer_t *layer);
+ void set();
+};
+
+HWC2Window::HWC2Window(unsigned int width, unsigned int height,
+ unsigned int format, hwc2_compat_display_t* display,
+ hwc2_compat_layer_t *layer) :
+ HWComposerNativeWindow(width, height, format),
+ layer(layer), hwcDisplay(display)
+{
+ int bufferCount = qgetenv("QPA_HWC_BUFFER_COUNT").toInt();
+ if (bufferCount)
+ bufferCount = qBound(2, bufferCount, 8);
+ else
+ // default to triple-buffering as on Android
+ bufferCount = 3;
+ setBufferCount(bufferCount);
+ m_syncBeforeSet = qEnvironmentVariableIsSet("QPA_HWC_SYNC_BEFORE_SET");
+}
+
+void HWC2Window::present(HWComposerNativeWindowBuffer *buffer)
+{
+ uint32_t numTypes = 0;
+ uint32_t numRequests = 0;
+ int displayId = 0;
+ hwc2_error_t error = HWC2_ERROR_NONE;
+
+ QSystraceEvent trace("graphics", "QPA::present");
+
+ QPA_HWC_TIMING_SAMPLE(presentTime);
+
+ int acquireFenceFd = getFenceBufferFd(buffer);
+
+ if (m_syncBeforeSet && acquireFenceFd >= 0) {
+ sync_wait(acquireFenceFd, -1);
+ close(acquireFenceFd);
+ acquireFenceFd = -1;
+ }
+
+ error = hwc2_compat_display_validate(hwcDisplay, &numTypes,
+ &numRequests);
+ if (error != HWC2_ERROR_NONE && error != HWC2_ERROR_HAS_CHANGES) {
+ qDebug("prepare: validate failed for display %d: %d", displayId, error);
+ return;
+ }
+
+ if (numTypes || numRequests) {
+ qDebug("prepare: validate required changes for display %d: %d",
+ displayId, error);
+ return;
+ }
+
+ error = hwc2_compat_display_accept_changes(hwcDisplay);
+ if (error != HWC2_ERROR_NONE) {
+ qDebug("prepare: acceptChanges failed: %d", error);
+ return;
+ }
+
+ QPA_HWC_TIMING_SAMPLE(prepareTime);
+
+ QSystrace::begin("graphics", "QPA::set_client_target", "");
+ hwc2_compat_display_set_client_target(hwcDisplay, /* slot */0, buffer,
+ acquireFenceFd,
+ HAL_DATASPACE_UNKNOWN);
+ QSystrace::end("graphics", "QPA::set_client_target", "");
+
+ QSystrace::begin("graphics", "QPA::present", "");
+ int presentFence;
+ hwc2_compat_display_present(hwcDisplay, &presentFence);
+ QSystrace::end("graphics", "QPA::present", "");
+
+ if (error != HWC2_ERROR_NONE) {
+ qDebug("presentAndGetReleaseFences: failed for display %d: %d",
+ displayId, error);
+ return;
+ }
+
+ QPA_HWC_TIMING_SAMPLE(setTime);
+
+ hwc2_compat_out_fences_t* fences;
+ error = hwc2_compat_display_get_release_fences(
|
[-]
[+]
|
Added |
_service:tar_git:qt5-qpa-hwcomposer-plugin-5.6.2.5.tar.bz2/hwcomposer/hwcomposer_backend_v20.h
^
|
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Thomas Perl <thomas.perl@jolla.com>
+**
+** This file is part of the hwcomposer plugin.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HWCOMPOSER_BACKEND_V20_H
+#define HWCOMPOSER_BACKEND_V20_H
+
+#ifdef HWC_PLUGIN_HAVE_HWCOMPOSER1_API
+
+#include "hwcomposer_backend.h"
+// libhybris access to the native hwcomposer window
+#include <hwcomposer_window.h>
+
+#include <hybris/hwc2/hwc2_compatibility_layer.h>
+
+#include <QBasicTimer>
+
+class HwcProcs_v20;
+class QWindow;
+
+class HwComposerBackend_v20 : public QObject, public HwComposerBackend {
+public:
+ HwComposerBackend_v20(hw_module_t *hwc_module, void *libminisf);
+ virtual ~HwComposerBackend_v20();
+
+ virtual EGLNativeDisplayType display();
+ virtual EGLNativeWindowType createWindow(int width, int height);
+ virtual void destroyWindow(EGLNativeWindowType window);
+ virtual void swap(EGLNativeDisplayType display, EGLSurface surface);
+ virtual void sleepDisplay(bool sleep);
+ virtual float refreshRate();
+
+ virtual bool requestUpdate(QEglFSWindow *window) Q_DECL_OVERRIDE;
+
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void handleVSyncEvent();
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+
+ void onHotplugReceived(int32_t sequenceId, hwc2_display_t display,
+ bool connected, bool primaryDisplay);
+
+ static int composerSequenceId;
+
+private:
+ hwc2_compat_device_t* hwc2_device;
+ hwc2_compat_display_t* hwc2_primary_display;
+ hwc2_compat_layer_t* hwc2_primary_layer;
+
+ bool m_displayOff;
+ QBasicTimer m_deliverUpdateTimeout;
+ QBasicTimer m_vsyncTimeout;
+ QSet<QWindow *> m_pendingUpdate;
+ HwcProcs_v20 *procs;
+};
+
+#endif /* HWC_PLUGIN_HAVE_HWCOMPOSER1_API */
+
+#endif /* HWCOMPOSER_BACKEND_V11_H */
|