libweston: Add a new helper weston_view_has_valid_buffer

Helper to determine if the buffer attached to the view is valid.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 6336c58..794253f 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -1852,6 +1852,18 @@
 	return ret;
 }
 
+/** Check if the view has a valid buffer available
+ *
+ * @param ev The view to check if it has a valid buffer.
+ *
+ * Returns true if the view has a valid buffer or false otherwise.
+ */
+WL_EXPORT bool
+weston_view_has_valid_buffer(struct weston_view *ev)
+{
+	return ev->surface->buffer_ref.buffer != NULL;
+}
+
 /* Check if a surface has a view assigned to it
  *
  * The indicator is set manually when mapping