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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
This commit is contained in:
Jonas Ådahl 2022-06-10 17:01:35 +02:00 committed by Marge Bot
parent 625a9e274a
commit af5d67251b
2 changed files with 28 additions and 0 deletions

View File

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

View File

@ -30,6 +30,7 @@
#include "cogl/cogl-types.h"
#include "cogl/cogl-framebuffer.h"
#include "cogl/cogl-onscreen.h"
#include <glib-object.h>
@ -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 */