Compare commits

...

3 Commits

Author SHA1 Message Date
4233ecd539 wayland: Add documentation to wayland_shell_init
Especially preventing the confusion that it might only initalize the
wl_shell interface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/871
2019-10-21 13:48:37 +02:00
355d486502 wayland: Add documentation to the WaylandBuffer object
https://gitlab.gnome.org/GNOME/mutter/merge_requests/871
2019-10-21 13:48:33 +02:00
84415f936c wayland: Add documentation for dma-buf namespace
It's not always clear how the dma-buf functions work (e.g. where memory
is allocated) without actually going in-depth in the code. This just
adds a few commments to more quickly gain understanding.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/871
2019-10-21 13:48:29 +02:00
3 changed files with 78 additions and 0 deletions

View File

@ -22,6 +22,30 @@
* Jasper St. Pierre <jstpierre@mecheye.net>
*/
/**
* SECTION:meta-wayland-buffer
* @title: MetaWaylandBuffer
* @short_description: A wrapper for wayland buffers
*
* #MetaWaylandBuffer is a general wrapper around wl_buffer, the basic way of
* passing rendered data from Wayland clients to the compositor. Note there are
* multiple ways of passing a buffer to the compositor, as specified by
* #MetaWaylandBufferType.
*/
/**
* MetaWaylandBufferType:
* @META_WAYLAND_BUFFER_TYPE_UNKNOWN: Unknown type.
* @META_WAYLAND_BUFFER_TYPE_SHM: wl_buffer backed by shared memory
* @META_WAYLAND_BUFFER_TYPE_EGL_IMAGE: wl_buffer backed by an EGLImage
* @META_WAYLAND_BUFFER_TYPE_EGL_STREAM: wl_buffer backed by an EGLStream (NVIDIA-specific)
* @META_WAYLAND_BUFFER_TYPE_DMA_BUF: wl_buffer backed by a dma_buf
*
* Specifies the backing memory for a #MetaWaylandBuffer. Depending on the type
* of buffer, this will lead to different handling for the compositor. For
* example, a shared-memory buffer will still need to be uploaded to the GPU.
*/
#include "config.h"
#include "wayland/meta-wayland-buffer.h"
@ -449,6 +473,15 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
return FALSE;
}
/**
* meta_wayland_buffer_create_snippet:
* @buffer: A #MetaWaylandBuffer object
*
* If needed, this method creates a #CoglSnippet to make sure the buffer can be
* dealt with appropriately in a #CoglPipeline that renders it.
*
* Returns: (transfer full) (nullable): A new #CoglSnippet, or %NULL.
*/
CoglSnippet *
meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer)
{
@ -582,6 +615,11 @@ meta_wayland_buffer_class_init (MetaWaylandBufferClass *klass)
object_class->finalize = meta_wayland_buffer_finalize;
/**
* MetaWaylandBuffer::resource-destroyed:
*
* Called when the underlying wl_resource was destroyed.
*/
signals[RESOURCE_DESTROYED] = g_signal_new ("resource-destroyed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,

View File

@ -25,6 +25,16 @@
* Daniel Stone <daniels@collabora.com>
*/
/**
* SECTION:meta-wayland-dma-buf
* @title: MetaWaylandDmaBuf
* @short_description: Handles passing dma_bufs in Wayland
*
* The MetaWaylandDmaBuf namespace contains several objects and functions to
* handle dma_buf buffers that are passed through from clients in Wayland (e.g.
* using the linux_dmabuf_unstable_v1 protocol).
*/
#include "config.h"
#include "wayland/meta-wayland-dma-buf.h"
@ -260,6 +270,17 @@ static const struct wl_buffer_interface dma_buf_buffer_impl =
buffer_destroy,
};
/**
* meta_wayland_dma_buf_from_buffer:
* @buffer: A #MetaWaylandBuffer object
*
* Fetches the associated #MetaWaylandDmaBufBuffer from the wayland buffer.
* This does not *create* a new object, as this happens in the create_params
* request of linux_dmabuf_unstable_v1.
*
* Returns: (transfer none): The corresponding #MetaWaylandDmaBufBuffer (or
* %NULL if it wasn't a dma_buf-based wayland buffer)
*/
MetaWaylandDmaBufBuffer *
meta_wayland_dma_buf_from_buffer (MetaWaylandBuffer *buffer)
{
@ -513,6 +534,18 @@ dma_buf_bind (struct wl_client *client,
send_modifiers (resource, DRM_FORMAT_RGB565);
}
/**
* meta_wayland_dma_buf_init:
* @compositor: The #MetaWaylandCompositor
*
* Creates the global Wayland object that exposes the linux_dmabuf_unstable_v1
* protocol. When a client binds to the resource, Mutter will make sure to
* also send the supported DRM format modifiers.
*
* Returns: Whether the initialization was succesfull. If this is %FALSE,
* clients won't be able to use the linux_dmabuf_unstable_v1 protocol to pass
* buffers.
*/
gboolean
meta_wayland_dma_buf_init (MetaWaylandCompositor *compositor)
{

View File

@ -1478,6 +1478,13 @@ meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
x, y);
}
/**
* meta_wayland_shell_init:
* @compositor: The #MetaWaylandCompositor object
*
* Initializes the Wayland interfaces providing features that deal with
* desktop-specific conundrums, like XDG shell, wl_shell (deprecated), etc.
*/
void
meta_wayland_shell_init (MetaWaylandCompositor *compositor)
{