From ddfd744d83344fe694f162baca68154c43448d21 Mon Sep 17 00:00:00 2001 From: Lionel CHAZALLON Date: Thu, 8 Mar 2018 07:37:36 +0100 Subject: eglfs/kms: Add framebuffer scaling ability with KMS atomic This commit will add the possibility to have a different sizes between framebuffer and videomode using DRM atomic, which is not possible with DRM legacy. The main goal of this change is to allow to get decent performance on embedded devices which can support high resolution display (ie UHD), and which don't have a GPU able to achieve decent framerate in such resolutions. This patch adds a "size" member to the output configuration in KMS configuration file. The GBM framebuffer will be created with that size and the GBM screen will report that size so that EGLFS can do everything normally. Scaling planes with different size than the video mode size is not something supported consistently with DRM legacy, so that feature will be only available when using the DRM atomic API. This was tested on Rock64 device, both with drm legacy and atomic. Change-Id: I8ba5bae35e61fcb7d9fc58234504bdfd647b43f6 Reviewed-by: Laszlo Agocs Reviewed-by: Lionel CHAZALLON --- .../eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp | 8 ++++++++ .../eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp | 2 +- .../eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp | 5 ++--- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index e773e85433..679d1f0069 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -299,6 +299,14 @@ void QEglFSKmsGbmScreen::flip() if (request) { drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->framebufferPropertyId, fb->fb); drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcPropertyId, op.crtc_id); + drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->srcwidthPropertyId, + output().size.width() << 16); + drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->srcheightPropertyId, + output().size.height() << 16); + drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcwidthPropertyId, + m_output.modes[m_output.mode].hdisplay); + drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcheightPropertyId, + m_output.modes[m_output.mode].vdisplay); } #endif } else { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index 531b73d1dc..1626c86239 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -112,7 +112,7 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.forced_plane_id); int ret = drmModeSetPlane(fd, op.forced_plane_id, op.crtc_id, uint32_t(-1), 0, 0, 0, w, h, - 0 << 16, 0 << 16, w << 16, h << 16); + 0 << 16, 0 << 16, op.size.width() << 16, op.size.height() << 16); if (ret == -1) qErrnoWarning(errno, "drmModeSetPlane failed"); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index 5e45b42abe..e5354d97bd 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -113,10 +113,9 @@ QRect QEglFSKmsScreen::rawGeometry() const if (m_headless) return QRect(QPoint(0, 0), m_device->screenConfig()->headlessSize()); - const int mode = m_output.mode; return QRect(m_pos.x(), m_pos.y(), - m_output.modes[mode].hdisplay, - m_output.modes[mode].vdisplay); + m_output.size.width(), + m_output.size.height()); } int QEglFSKmsScreen::depth() const -- cgit v1.2.3