From 46e1ede687ba2dcab8d92d49833758c74617c37b Mon Sep 17 00:00:00 2001
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Thu, 16 Mar 2023 18:16:13 +0800
Subject: [PATCH] wayland/buffer: Avoid spamming the log when a buffer is not
 scanoutable

It's not really an error and we recover seamlessly.

If someone really wants to check if/why direct scanout is failing then
they can still use `env MUTTER_DEBUG=render,kms`.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2702
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2918>
---
 src/wayland/meta-wayland-buffer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 628aeee1c..bd0a17af0 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -877,10 +877,9 @@ meta_wayland_buffer_try_acquire_scanout (MetaWaylandBuffer *buffer,
       return NULL;
     }
 
-  g_return_val_if_fail (scanout, NULL);
-
-  g_signal_connect (scanout, "scanout-failed",
-                    G_CALLBACK (on_scanout_failed), buffer);
+  if (scanout)
+    g_signal_connect (scanout, "scanout-failed",
+                      G_CALLBACK (on_scanout_failed), buffer);
 
   return scanout;
 }