summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-12-02 10:39:35 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-12-03 00:06:21 +0000
commitf30b88846566bc1254e5e6d61077092cdaeba409 (patch)
tree2b5041bbf2fd7913617b60e2cd5ecfc9955006ff /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms
parent8d0854c2bd7cf371883726cacb3f8c8549a11eac (diff)
eglfs: allow forcing an overlay plane
Add a QT_QPA_EGLFS_KMS_PLANE_INDEX environment variable that applies both to the GBM and EGLDevice backends. When set to a value between 0 and the number of planes on the connector - 1, the chosen overlay plane will be used for output, meaning there will be a drmModeSetPlane to configure, and, in case of EGLDevice, the plane's corresponding EGL layer will get chosen instead of the CRTC's. Task-number: QTBUG-57386 Change-Id: I12c89472ea5730987052f39211fadc597d1302ef Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs/deviceintegration/eglfs_kms')
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index bed775ff81..d4df0dc66e 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -181,24 +181,41 @@ void QEglFSKmsGbmScreen::flip()
FrameBuffer *fb = framebufferForBufferObject(m_gbm_bo_next);
- if (!output().mode_set) {
- int ret = drmModeSetCrtc(device()->fd(),
- output().crtc_id,
+ QEglFSKmsOutput &op(output());
+ const int fd = device()->fd();
+ const uint32_t w = op.modes[op.mode].hdisplay;
+ const uint32_t h = op.modes[op.mode].vdisplay;
+
+ if (!op.mode_set) {
+ int ret = drmModeSetCrtc(fd,
+ op.crtc_id,
fb->fb,
0, 0,
- &output().connector_id, 1,
- &output().modes[output().mode]);
+ &op.connector_id, 1,
+ &op.modes[op.mode]);
- if (ret) {
- qErrnoWarning("Could not set DRM mode!");
+ if (ret == -1) {
+ qErrnoWarning(errno, "Could not set DRM mode!");
} else {
- output().mode_set = true;
+ op.mode_set = true;
setPowerState(PowerStateOn);
+
+ if (!op.plane_set) {
+ op.plane_set = true;
+ if (op.wants_plane) {
+ int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id,
+ uint32_t(-1), 0,
+ 0, 0, w, h,
+ 0 << 16, 0 << 16, w << 16, h << 16);
+ if (ret == -1)
+ qErrnoWarning(errno, "drmModeSetPlane failed");
+ }
+ }
}
}
- int ret = drmModePageFlip(device()->fd(),
- output().crtc_id,
+ int ret = drmModePageFlip(fd,
+ op.crtc_id,
fb->fb,
DRM_MODE_PAGE_FLIP_EVENT,
this);