compositor: add surface-shooting API
This is an optional API that will be implemented by the renderers. It
allows to fetch the current contents of a surface, essentially the
buffer contents from a client buffer, converted to an RGBA format.
This is meant as a debugging API. The implementations may be heavy and
cause a stall, so they are not intended to be used often during normal
operations.
Renderers are expected to convert whatever data a surface has to a
single RGBA format.
Changes in v2:
- remove stride and format arguments from the API
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/src/compositor.h b/src/compositor.h
index e356e33..2d70ad1 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -571,6 +571,17 @@
float red, float green,
float blue, float alpha);
void (*destroy)(struct weston_compositor *ec);
+
+
+ /** See weston_surface_get_content_size() */
+ void (*surface_get_content_size)(struct weston_surface *surface,
+ int *width, int *height);
+
+ /** See weston_surface_copy_content() */
+ int (*surface_copy_content)(struct weston_surface *surface,
+ void *target, size_t size,
+ int src_x, int src_y,
+ int width, int height);
};
enum weston_capability {
@@ -1262,6 +1273,16 @@
int (*desc)(struct weston_surface *,
char *, size_t));
+void
+weston_surface_get_content_size(struct weston_surface *surface,
+ int *width, int *height);
+
+int
+weston_surface_copy_content(struct weston_surface *surface,
+ void *target, size_t size,
+ int src_x, int src_y,
+ int width, int height);
+
struct weston_buffer *
weston_buffer_from_resource(struct wl_resource *resource);