4
* A Low Level GPU Graphics and Utilities API
6
* Copyright (C) 2012 Intel Corporation.
8
* Permission is hereby granted, free of charge, to any person
9
* obtaining a copy of this software and associated documentation
10
* files (the "Software"), to deal in the Software without
11
* restriction, including without limitation the rights to use, copy,
12
* modify, merge, publish, distribute, sublicense, and/or sell copies
13
* of the Software, and to permit persons to whom the Software is
14
* furnished to do so, subject to the following conditions:
16
* The above copyright notice and this permission notice shall be
17
* included in all copies or substantial portions of the Software.
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
#ifndef __COGL_WAYLAND_SERVER_H
31
#define __COGL_WAYLAND_SERVER_H
33
#include <wayland-server.h>
35
/* NB: this is a top-level header that can be included directly but we
36
* want to be careful not to define __COGL_H_INSIDE__ when this is
37
* included internally while building Cogl itself since
38
* __COGL_H_INSIDE__ is used in headers to guard public vs private api
41
#ifndef COGL_COMPILATION
43
/* Note: When building Cogl .gir we explicitly define
44
* __COGL_H_INSIDE__ */
45
#ifndef __COGL_H_INSIDE__
46
#define __COGL_H_INSIDE__
47
#define __COGL_MUST_UNDEF_COGL_H_INSIDE__
50
#endif /* COGL_COMPILATION */
52
#include <cogl/cogl-context.h>
53
#include <cogl/cogl-texture-2d.h>
58
* cogl_wayland_display_set_compositor_display:
59
* @display: a #CoglDisplay
60
* @wayland_display: A compositor's Wayland display pointer
62
* Informs Cogl of a compositor's Wayland display pointer. This
63
* enables Cogl to register private wayland extensions required to
64
* pass buffers between the clients and compositor.
70
cogl_wayland_display_set_compositor_display (CoglDisplay *display,
71
struct wl_display *wayland_display);
74
* cogl_wayland_texture_2d_new_from_buffer:
75
* @ctx: A #CoglContext
76
* @buffer: A Wayland resource for a buffer
77
* @error: A #CoglError for exceptions
79
* Uploads the @buffer referenced by the given Wayland resource to a
80
* #CoglTexture2D. The buffer resource may refer to a wl_buffer or a
83
* <note>The results are undefined for passing an invalid @buffer
85
* <note>It is undefined if future updates to @buffer outside the
86
* control of Cogl will affect the allocated #CoglTexture2D. In some
87
* cases the contents of the buffer are copied (such as shm buffers),
88
* and in other cases the underlying storage is re-used directly (such
89
* as drm buffers)</note>
91
* Returns: A newly allocated #CoglTexture2D, or if Cogl could not
92
* validate the @buffer in some way (perhaps because of
93
* an unsupported format) it will return %NULL and set
100
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
101
struct wl_resource *buffer,
105
* cogl_wayland_texture_set_region_from_shm_buffer:
106
* @texture: a #CoglTexture
107
* @width: The width of the region to copy
108
* @height: The height of the region to copy
109
* @shm_buffer: The source buffer
110
* @src_x: The X offset within the source bufer to copy from
111
* @src_y: The Y offset within the source bufer to copy from
112
* @dst_x: The X offset within the texture to copy to
113
* @dst_y: The Y offset within the texture to copy to
114
* @level: The mipmap level of the texture to copy to
115
* @error: A #CoglError to return exceptional errors
117
* Sets the pixels in a rectangular subregion of @texture from a
118
* Wayland SHM buffer. Generally this would be used in response to
119
* wl_surface.damage event in a compositor in order to update the
120
* texture with the damaged region. This is just a convenience wrapper
121
* around getting the SHM buffer pointer and calling
122
* cogl_texture_set_region(). See that function for a description of
123
* the level parameter.
125
* <note>Since the storage for a #CoglTexture is allocated lazily then
126
* if the given @texture has not previously been allocated then this
127
* api can return %FALSE and throw an exceptional @error if there is
128
* not enough memory to allocate storage for @texture.</note>
130
* Return value: %TRUE if the subregion upload was successful, and
133
* Stability: unstable
136
cogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture,
141
struct wl_shm_buffer *
150
/* The gobject introspection scanner seems to parse public headers in
151
* isolation which means we need to be extra careful about how we
152
* define and undefine __COGL_H_INSIDE__ used to detect when internal
153
* headers are incorrectly included by developers. In the gobject
154
* introspection case we have to manually define __COGL_H_INSIDE__ as
155
* a commandline argument for the scanner which means we must be
156
* careful not to undefine it in a header...
158
#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__
159
#undef __COGL_H_INSIDE__
160
#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__
163
#endif /* __COGL_WAYLAND_SERVER_H */