[backends/hwcomposer] Add a failsafe timer for vsync events
Apparently we don't get a vsync event for the first frame during startup which blocks the compositor till the end of days. Thus a timer is added which calls vsync after 1 sec if we didn't get an event.
This commit is contained in:
parent
801e60b290
commit
70e744fe26
2 changed files with 11 additions and 0 deletions
|
@ -28,6 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KWayland/Server/display.h>
|
#include <KWayland/Server/display.h>
|
||||||
#include <KWayland/Server/output_interface.h>
|
#include <KWayland/Server/output_interface.h>
|
||||||
#include <KWayland/Server/seat_interface.h>
|
#include <KWayland/Server/seat_interface.h>
|
||||||
|
// Qt
|
||||||
|
#include <QTimer>
|
||||||
// hybris/android
|
// hybris/android
|
||||||
#include <hardware/hardware.h>
|
#include <hardware/hardware.h>
|
||||||
#include <hardware/hwcomposer.h>
|
#include <hardware/hwcomposer.h>
|
||||||
|
@ -41,8 +43,12 @@ namespace KWin
|
||||||
|
|
||||||
HwcomposerBackend::HwcomposerBackend(QObject *parent)
|
HwcomposerBackend::HwcomposerBackend(QObject *parent)
|
||||||
: AbstractBackend(parent)
|
: AbstractBackend(parent)
|
||||||
|
, m_vsyncFailSafeTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
handleOutputs();
|
handleOutputs();
|
||||||
|
m_vsyncFailSafeTimer->setSingleShot(true);
|
||||||
|
m_vsyncFailSafeTimer->setInterval(1000);
|
||||||
|
connect(m_vsyncFailSafeTimer, &QTimer::timeout, this, &HwcomposerBackend::vsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
HwcomposerBackend::~HwcomposerBackend()
|
HwcomposerBackend::~HwcomposerBackend()
|
||||||
|
@ -192,12 +198,14 @@ void HwcomposerBackend::present()
|
||||||
}
|
}
|
||||||
m_pageFlipPending = true;
|
m_pageFlipPending = true;
|
||||||
if (Compositor::self()) {
|
if (Compositor::self()) {
|
||||||
|
m_vsyncFailSafeTimer->start();
|
||||||
Compositor::self()->aboutToSwapBuffers();
|
Compositor::self()->aboutToSwapBuffers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HwcomposerBackend::vsync()
|
void HwcomposerBackend::vsync()
|
||||||
{
|
{
|
||||||
|
m_vsyncFailSafeTimer->stop();
|
||||||
if (m_pageFlipPending) {
|
if (m_pageFlipPending) {
|
||||||
m_pageFlipPending = false;
|
m_pageFlipPending = false;
|
||||||
if (Compositor::self()) {
|
if (Compositor::self()) {
|
||||||
|
|
|
@ -32,6 +32,8 @@ typedef struct hwc_composer_device_1 hwc_composer_device_1_t;
|
||||||
|
|
||||||
class HWComposerNativeWindowBuffer;
|
class HWComposerNativeWindowBuffer;
|
||||||
|
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -76,6 +78,7 @@ private:
|
||||||
bool m_outputBlank = true;
|
bool m_outputBlank = true;
|
||||||
bool m_pageFlipPending = false;
|
bool m_pageFlipPending = false;
|
||||||
int m_refreshRate = 60000;
|
int m_refreshRate = 60000;
|
||||||
|
QTimer *m_vsyncFailSafeTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HwcomposerWindow : public HWComposerNativeWindow
|
class HwcomposerWindow : public HWComposerNativeWindow
|
||||||
|
|
Loading…
Reference in a new issue