commit 2982c6d24ebd97cda8f0770e312b6fd6381e5b9e Author: Kristian Høgsberg Date: Fri Dec 16 11:16:34 2011 -0500 protocol: Move duplicated pixel format definitions to wl_buffer The mechanism by which a buffer factory interface (ie, an interface that creates buffers, such as wl_shm or wl_drm) negotiate pixel contents used to be private to the interface. As such, wl_shm had its own pixel format and so did wl_drm. The idea was to avoid imposing certain pixel formats or enumerations on such interfaces, indeed a buffer interface might not even use pixels (wl_svg, create a buffer from an svg streamed through an fd). Now, pixel buffer are the common case and there are only so many pixel formats, so it makes sense to define a common namespace for pixel formats, so pixel based buffer factory interface don't have to reinvent that wheel. The big shared enumeration doesn't imply that a buffer factory interface have to support all formats, it just provides a namespace to pick from. The wl_shm and wl_drm interfaces uses a format event, sent at bind time, to indicate the specific pixel formats they support. This patch also adds a format field to struct wl_buffer, which lets the compositor know the format of the buffer. The compositor needs to know whether the buffer has an alpha channel, and in case of shm or scanout the exact pixel format. diff --git a/protocol/wayland.xml b/protocol/wayland.xml index b80f25e..c422d68 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -107,18 +107,13 @@ - - - - - - + data contained in the buffer. The format argument is one of + the wl_buffer format codes advertised in the format event. --> @@ -138,6 +133,76 @@ It has a size, visual and contents, but not a location on the screen. --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +