From 575804c7e1b62d618a4ae7bf69110167d3e4f59b Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Thu, 11 Nov 2021 15:18:51 +0100 Subject: [PATCH] backend-drm: use linear buffers if gbm and kms device differ If we are using multiple GPUs and are not able to use modifiers to ensure that the formats are compatible, we have to use linear buffers for the transfer. Signed-off-by: Michael Tretter --- libweston/backend-drm/drm-gbm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c index 963c31a1..c74970dd 100644 --- a/libweston/backend-drm/drm-gbm.c +++ b/libweston/backend-drm/drm-gbm.c @@ -194,6 +194,15 @@ create_gbm_surface(struct gbm_device *gbm, struct drm_output *output) } #endif + /* + * If we cannot use modifiers to allocate the GBM surface and the GBM + * device differs from the KMS display device (because we are rendering + * on a different GPU), we have to use linear buffers to make sure that + * the allocated GBM surface is correctly displayed on the KMS device. + */ + if (gbm_device_get_fd(gbm) != output->device->drm.fd) + output->gbm_bo_flags |= GBM_BO_USE_LINEAR; + /* We may allocate with no modifiers in the following situations: * * 1. old GBM version, so HAVE_GBM_MODIFIERS is false;