modesetting: Only log 1 error for consecutive flip failures

Only log 1 error for consecutive flip failures, instead of filling the
log and the disk with errors for each attempted flip.

Despite our best efforts we may end up with a BO which gets refused
when we try to import it as a framebuffer, see e.g. :
https://bugs.freedesktop.org/show_bug.cgi?id=111306
This should not happen, but as the above bugs shows sometimes it does
and chances are it will happen again.

Note ideally we should check if the import is possible at
ms_present_check_flip time, like the amdgpu code is doing since:
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/35
but that requires a chunk of refactoring work on the modesetting driver,
so for now this will have to do.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2019-08-08 21:56:59 +02:00
parent 3dc838f77d
commit c69b37e8da
2 changed files with 10 additions and 2 deletions

View File

@ -123,6 +123,7 @@ typedef struct {
Bool dri2_flipping;
Bool present_flipping;
Bool flip_bo_import_failed;
Bool dri2_enable;
Bool present_enable;

View File

@ -285,9 +285,16 @@ ms_do_pageflip(ScreenPtr screen,
new_front_bo.height = new_front->drawable.height;
if (drmmode_bo_import(&ms->drmmode, &new_front_bo,
&ms->drmmode.fb_id)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: Import BO failed: %s\n",
log_prefix, strerror(errno));
if (!ms->drmmode.flip_bo_import_failed) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: Import BO failed: %s\n",
log_prefix, strerror(errno));
ms->drmmode.flip_bo_import_failed = TRUE;
}
goto error_out;
} else {
if (ms->drmmode.flip_bo_import_failed &&
new_front != screen->GetScreenPixmap(screen))
ms->drmmode.flip_bo_import_failed = FALSE;
}
flags = DRM_MODE_PAGE_FLIP_EVENT;