Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/gpu_display/protocol/viewporter.xml
5392 views
1
<?xml version="1.0" encoding="UTF-8"?>
2
<protocol name="viewporter">
3
4
<copyright>
5
Copyright © 2013-2016 Collabora, Ltd.
6
7
Permission is hereby granted, free of charge, to any person obtaining a
8
copy of this software and associated documentation files (the "Software"),
9
to deal in the Software without restriction, including without limitation
10
the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
and/or sell copies of the Software, and to permit persons to whom the
12
Software is furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice (including the next
15
paragraph) shall be included in all copies or substantial portions of the
16
Software.
17
18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24
DEALINGS IN THE SOFTWARE.
25
</copyright>
26
27
<interface name="wp_viewporter" version="1">
28
<description summary="surface cropping and scaling">
29
The global interface exposing surface cropping and scaling
30
capabilities is used to instantiate an interface extension for a
31
wl_surface object. This extended interface will then allow
32
cropping and scaling the surface contents, effectively
33
disconnecting the direct relationship between the buffer and the
34
surface size.
35
</description>
36
37
<request name="destroy" type="destructor">
38
<description summary="unbind from the cropping and scaling interface">
39
Informs the server that the client will not be using this
40
protocol object anymore. This does not affect any other objects,
41
wp_viewport objects included.
42
</description>
43
</request>
44
45
<enum name="error">
46
<entry name="viewport_exists" value="0"
47
summary="the surface already has a viewport object associated"/>
48
</enum>
49
50
<request name="get_viewport">
51
<description summary="extend surface interface for crop and scale">
52
Instantiate an interface extension for the given wl_surface to
53
crop and scale its content. If the given wl_surface already has
54
a wp_viewport object associated, the viewport_exists
55
protocol error is raised.
56
</description>
57
<arg name="id" type="new_id" interface="wp_viewport"
58
summary="the new viewport interface id"/>
59
<arg name="surface" type="object" interface="wl_surface"
60
summary="the surface"/>
61
</request>
62
</interface>
63
64
<interface name="wp_viewport" version="1">
65
<description summary="crop and scale interface to a wl_surface">
66
An additional interface to a wl_surface object, which allows the
67
client to specify the cropping and scaling of the surface
68
contents.
69
70
This interface works with two concepts: the source rectangle (src_x,
71
src_y, src_width, src_height), and the destination size (dst_width,
72
dst_height). The contents of the source rectangle are scaled to the
73
destination size, and content outside the source rectangle is ignored.
74
This state is double-buffered, and is applied on the next
75
wl_surface.commit.
76
77
The two parts of crop and scale state are independent: the source
78
rectangle, and the destination size. Initially both are unset, that
79
is, no scaling is applied. The whole of the current wl_buffer is
80
used as the source, and the surface size is as defined in
81
wl_surface.attach.
82
83
If the destination size is set, it causes the surface size to become
84
dst_width, dst_height. The source (rectangle) is scaled to exactly
85
this size. This overrides whatever the attached wl_buffer size is,
86
unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
87
has no content and therefore no size. Otherwise, the size is always
88
at least 1x1 in surface local coordinates.
89
90
If the source rectangle is set, it defines what area of the wl_buffer is
91
taken as the source. If the source rectangle is set and the destination
92
size is not set, then src_width and src_height must be integers, and the
93
surface size becomes the source rectangle size. This results in cropping
94
without scaling. If src_width or src_height are not integers and
95
destination size is not set, the bad_size protocol error is raised when
96
the surface state is applied.
97
98
The coordinate transformations from buffer pixel coordinates up to
99
the surface-local coordinates happen in the following order:
100
1. buffer_transform (wl_surface.set_buffer_transform)
101
2. buffer_scale (wl_surface.set_buffer_scale)
102
3. crop and scale (wp_viewport.set*)
103
This means, that the source rectangle coordinates of crop and scale
104
are given in the coordinates after the buffer transform and scale,
105
i.e. in the coordinates that would be the surface-local coordinates
106
if the crop and scale was not applied.
107
108
If src_x or src_y are negative, the bad_value protocol error is raised.
109
Otherwise, if the source rectangle is partially or completely outside of
110
the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
111
when the surface state is applied. A NULL wl_buffer does not raise the
112
out_of_buffer error.
113
114
The x, y arguments of wl_surface.attach are applied as normal to
115
the surface. They indicate how many pixels to remove from the
116
surface size from the left and the top. In other words, they are
117
still in the surface-local coordinate system, just like dst_width
118
and dst_height are.
119
120
If the wl_surface associated with the wp_viewport is destroyed,
121
all wp_viewport requests except 'destroy' raise the protocol error
122
no_surface.
123
124
If the wp_viewport object is destroyed, the crop and scale
125
state is removed from the wl_surface. The change will be applied
126
on the next wl_surface.commit.
127
</description>
128
129
<request name="destroy" type="destructor">
130
<description summary="remove scaling and cropping from the surface">
131
The associated wl_surface's crop and scale state is removed.
132
The change is applied on the next wl_surface.commit.
133
</description>
134
</request>
135
136
<enum name="error">
137
<entry name="bad_value" value="0"
138
summary="negative or zero values in width or height"/>
139
<entry name="bad_size" value="1"
140
summary="destination size is not integer"/>
141
<entry name="out_of_buffer" value="2"
142
summary="source rectangle extends outside of the content area"/>
143
<entry name="no_surface" value="3"
144
summary="the wl_surface was destroyed"/>
145
</enum>
146
147
<request name="set_source">
148
<description summary="set the source rectangle for cropping">
149
Set the source rectangle of the associated wl_surface. See
150
wp_viewport for the description, and relation to the wl_buffer
151
size.
152
153
If all of x, y, width and height are -1.0, the source rectangle is
154
unset instead. Any other set of values where width or height are zero
155
or negative, or x or y are negative, raise the bad_value protocol
156
error.
157
158
The crop and scale state is double-buffered state, and will be
159
applied on the next wl_surface.commit.
160
</description>
161
<arg name="x" type="fixed" summary="source rectangle x"/>
162
<arg name="y" type="fixed" summary="source rectangle y"/>
163
<arg name="width" type="fixed" summary="source rectangle width"/>
164
<arg name="height" type="fixed" summary="source rectangle height"/>
165
</request>
166
167
<request name="set_destination">
168
<description summary="set the surface size for scaling">
169
Set the destination size of the associated wl_surface. See
170
wp_viewport for the description, and relation to the wl_buffer
171
size.
172
173
If width is -1 and height is -1, the destination size is unset
174
instead. Any other pair of values for width and height that
175
contains zero or negative values raises the bad_value protocol
176
error.
177
178
The crop and scale state is double-buffered state, and will be
179
applied on the next wl_surface.commit.
180
</description>
181
<arg name="width" type="int" summary="surface width"/>
182
<arg name="height" type="int" summary="surface height"/>
183
</request>
184
</interface>
185
186
</protocol>
187
188