[platforms/drm] Add better warnings in DrmBuffer if things fail

For virtual machines with Cirrus device the drmModeAddFB fails. So
far there was no error message at all, we only saw it failed.

With this change the drmModeAddFB is checked for error and a warning
is shown. Also further debug messages are added for other cases where
things can fail.

Reviewed-By: Eike Hein
icc-effect-5.14.5
Martin Gräßlin 2016-07-15 08:34:06 +02:00
parent f0aeda0738
commit 1c275a02c8
1 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// system
#include <sys/mman.h>
#include <errno.h>
// drm
#include <xf86drm.h>
#if HAVE_GBM
@ -44,13 +45,16 @@ DrmBuffer::DrmBuffer(DrmBackend *backend, const QSize &size)
createArgs.width = size.width();
createArgs.height = size.height();
if (drmIoctl(m_backend->fd(), DRM_IOCTL_MODE_CREATE_DUMB, &createArgs) != 0) {
qCWarning(KWIN_DRM) << "DRM_IOCTL_MODE_CREATE_DUMB failed";
return;
}
m_handle = createArgs.handle;
m_bufferSize = createArgs.size;
m_stride = createArgs.pitch;
drmModeAddFB(m_backend->fd(), size.width(), size.height(), 24, 32,
m_stride, createArgs.handle, &m_bufferId);
if (drmModeAddFB(m_backend->fd(), size.width(), size.height(), 24, 32,
m_stride, createArgs.handle, &m_bufferId) != 0) {
qCWarning(KWIN_DRM) << "drmModeAddFB failed with errno" << errno;
}
}