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 <m.tretter@pengutronix.de>
This commit is contained in:
Michael Tretter 2021-11-11 15:18:51 +01:00 committed by Daniel Stone
parent 48b39d31ef
commit 575804c7e1

View File

@ -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;