From c69b37e8da87c9f76dbf4add7340a77ea443c760 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 8 Aug 2019 21:56:59 +0200 Subject: [PATCH] modesetting: Only log 1 error for consecutive flip failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Hans de Goede --- hw/xfree86/drivers/modesetting/drmmode_display.h | 1 + hw/xfree86/drivers/modesetting/pageflip.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h index 75c3195e4..2711a5776 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.h +++ b/hw/xfree86/drivers/modesetting/drmmode_display.h @@ -123,6 +123,7 @@ typedef struct { Bool dri2_flipping; Bool present_flipping; + Bool flip_bo_import_failed; Bool dri2_enable; Bool present_enable; diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c index 830ec7599..cb11bd4f9 100644 --- a/hw/xfree86/drivers/modesetting/pageflip.c +++ b/hw/xfree86/drivers/modesetting/pageflip.c @@ -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;