Tear down properly in kms plugin when exiting
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Tue, 17 Jul 2012 07:44:18 +0000 (10:44 +0300)
committerQt by Nokia <qt-info@nokia.com>
Wed, 18 Jul 2012 06:15:52 +0000 (08:15 +0200)
Change-Id: Idad060af4a8b4e68c2312cc2b69de39d2a58a1c4
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
src/plugins/platforms/kms/qkmsscreen.cpp

index f9b12d7..2f968a6 100644 (file)
@@ -71,6 +71,7 @@ QKmsScreen::QKmsScreen(QKmsDevice *device, int connectorId)
       m_depth(32),
       m_format(QImage::Format_Invalid),
       m_refreshTime(16000),
+      m_eglWindowSurface(EGL_NO_SURFACE),
       m_modeSet(false)
 {
     m_cursor = new QKmsCursor(this);
@@ -80,6 +81,13 @@ QKmsScreen::QKmsScreen(QKmsDevice *device, int connectorId)
 QKmsScreen::~QKmsScreen()
 {
     delete m_cursor;
+    drmModeSetCrtc(m_device->fd(), m_oldCrtc->crtc_id, m_oldCrtc->buffer_id,
+                   m_oldCrtc->x, m_oldCrtc->y,
+                   &m_connectorId, 1, &m_oldCrtc->mode);
+    drmModeFreeCrtc(m_oldCrtc);
+    if (m_eglWindowSurface != EGL_NO_SURFACE)
+        eglDestroySurface(m_device->eglDisplay(), m_eglWindowSurface);
+    gbm_surface_destroy(m_gbmSurface);
 }
 
 QRect QKmsScreen::geometry() const