modesetting: Fix page flipping harder under DRI 3.2.

Non-atomic kms drivers like radeon-kms (or nouveau-kms with
default setting of "atomic ioctl disabled") don't export
any formats, so num_formats == 0.

Some atomic drivers (nouveau-kms with boot param nouveau.atomic=1,
or intel-kms on, e.g., Linux 4.13) expose num_formats == 0, or
don't expose any modifiers, so num_modifiers == 0.

Let the drmmode_is_format_supported() check pass in these cases
to allow page flipping, as it works just fine.

Tested on NV-96 for nouveau, HD-5770 for radeon, Intel Ivybridge
with Linux 4.13 and drm-next to fix page flipping.

Fixes: 9d147305b4 ("modesetting: Check if buffer format is supported when flipping")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Mario Kleiner 2018-04-04 03:49:02 +02:00 committed by Adam Jackson
parent 44e7098367
commit ce2a4313dd

View File

@ -100,13 +100,17 @@ drmmode_is_format_supported(ScrnInfoPtr scrn, uint32_t format, uint64_t modifier
if (!crtc->enabled)
continue;
if (drmmode_crtc->num_formats == 0)
continue;
for (i = 0; i < drmmode_crtc->num_formats; i++) {
drmmode_format_ptr iter = &drmmode_crtc->formats[i];
if (iter->format != format)
continue;
if (modifier == DRM_FORMAT_MOD_INVALID) {
if (modifier == DRM_FORMAT_MOD_INVALID ||
iter->num_modifiers == 0) {
found = TRUE;
break;
}