From af5d67251baef2a86c22f9565cd36985e888165c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 10 Jun 2022 17:01:35 +0200 Subject: [PATCH] cogl/scanout: Add 'scanout-failed' signal This will later be emitted when a scanout failed, e.g. by the not-test commit failing for some reason, or drmModePageFlip() failing even if the pre-conditions for scanout in the simple KMS backend passed. Part-of: --- cogl/cogl/cogl-scanout.c | 23 +++++++++++++++++++++++ cogl/cogl/cogl-scanout.h | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/cogl/cogl/cogl-scanout.c b/cogl/cogl/cogl-scanout.c index cfd4bfd7e..11b6b2bd2 100644 --- a/cogl/cogl/cogl-scanout.c +++ b/cogl/cogl/cogl-scanout.c @@ -29,11 +29,27 @@ #include "cogl-scanout.h" +enum +{ + SCANOUT_FAILED, + + N_SIGNALS +}; + +static guint signals[N_SIGNALS]; + G_DEFINE_INTERFACE (CoglScanout, cogl_scanout, G_TYPE_OBJECT) static void cogl_scanout_default_init (CoglScanoutInterface *iface) { + signals[SCANOUT_FAILED] = + g_signal_new ("scanout-failed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 1, + COGL_TYPE_ONSCREEN); } gboolean @@ -54,3 +70,10 @@ cogl_scanout_blit_to_framebuffer (CoglScanout *scanout, else return FALSE; } + +void +cogl_scanout_notify_failed (CoglScanout *scanout, + CoglOnscreen *onscreen) +{ + g_signal_emit (scanout, signals[SCANOUT_FAILED], 0, onscreen); +} diff --git a/cogl/cogl/cogl-scanout.h b/cogl/cogl/cogl-scanout.h index d458a84fe..22e6266aa 100644 --- a/cogl/cogl/cogl-scanout.h +++ b/cogl/cogl/cogl-scanout.h @@ -30,6 +30,7 @@ #include "cogl/cogl-types.h" #include "cogl/cogl-framebuffer.h" +#include "cogl/cogl-onscreen.h" #include @@ -56,4 +57,8 @@ gboolean cogl_scanout_blit_to_framebuffer (CoglScanout *scanout, int y, GError **error); +COGL_EXPORT +void cogl_scanout_notify_failed (CoglScanout *scanout, + CoglOnscreen *onscreen); + #endif /* COGL_SCANOUT_H */