blob: fa69987c0b6e81957d9b66cb1d71342db8f13d83 [file] [log] [blame]
Marissa Wall65341642019-06-20 13:21:06 -07001/*
2 * Copyright 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.graphics.mapper@4.0;
18
19import android.hardware.graphics.common@1.2::BufferUsage;
20import android.hardware.graphics.common@1.2::PixelFormat;
21import android.hardware.graphics.common@1.2::Rect;
22
23interface IMapper {
24 struct BufferDescriptorInfo {
25 /**
Marissa Wallbf9f6d32019-11-05 14:58:52 -080026 * The name of the buffer. Useful for debugging/tracing.
27 */
28 string name;
29
30 /**
Marissa Wall65341642019-06-20 13:21:06 -070031 * The width specifies how many columns of pixels must be in the
32 * allocated buffer, but does not necessarily represent the offset in
33 * columns between the same column in adjacent rows. The rows may be
34 * padded.
35 */
36 uint32_t width;
37
Marissa Wall88d87fa2019-11-05 14:57:51 -080038 /**
39 * The height specifies how many rows of pixels must be in the
40 * allocated buffer.
41 */
Marissa Wall65341642019-06-20 13:21:06 -070042 uint32_t height;
43
Marissa Wall88d87fa2019-11-05 14:57:51 -080044 /**
45 * The number of image layers that must be in the allocated buffer.
46 */
Marissa Wall65341642019-06-20 13:21:06 -070047 uint32_t layerCount;
48
Marissa Wall88d87fa2019-11-05 14:57:51 -080049 /**
50 * Buffer pixel format.
51 */
Marissa Wall65341642019-06-20 13:21:06 -070052 PixelFormat format;
53
54 /**
55 * Buffer usage mask; valid flags can be found in the definition of
56 * BufferUsage.
57 */
58 bitfield<BufferUsage> usage;
59 };
60
61 struct Rect {
62 int32_t left;
63 int32_t top;
64 int32_t width;
65 int32_t height;
66 };
67
68 /**
69 * Creates a buffer descriptor. The descriptor can be used with IAllocator
70 * to allocate buffers.
71 *
72 * Since the buffer descriptor fully describes a buffer, any device
73 * dependent or device independent checks must be performed here whenever
74 * possible. Specifically, when layered buffers are not supported, this
75 * function must return `UNSUPPORTED` if `description.layers` is great than
76 * 1.
77 *
78 * @param description Attributes of the descriptor.
79 * @return error Error status of the call, which may be
80 * - `NONE` upon success.
81 * - `BAD_VALUE` if any of the specified attributes are invalid or
82 * inconsistent.
83 * - `NO_RESOURCES` if the creation cannot be fullfilled due to
84 * unavailability of resources.
85 * - `UNSUPPORTED` when any of the specified attributes are not
86 * supported.
87 * @return descriptor Newly created buffer descriptor.
88 */
89 createDescriptor(BufferDescriptorInfo description)
90 generates (Error error,
91 BufferDescriptor descriptor);
92
93 /**
94 * Imports a raw buffer handle to create an imported buffer handle for use
95 * with the rest of the mapper or with other in-process libraries.
96 *
97 * A buffer handle is considered raw when it is cloned (e.g., with
98 * `native_handle_clone()`) from another buffer handle locally, or when it
99 * is received from another HAL server/client or another process. A raw
100 * buffer handle must not be used to access the underlying graphic
101 * buffer. It must be imported to create an imported handle first.
102 *
103 * This function must at least validate the raw handle before creating the
104 * imported handle. It must also support importing the same raw handle
105 * multiple times to create multiple imported handles. The imported handle
106 * must be considered valid everywhere in the process, including in
107 * another instance of the mapper.
108 *
109 * Because of passthrough HALs, a raw buffer handle received from a HAL
110 * may actually have been imported in the process. importBuffer() must treat
111 * such a handle as if it is raw and must not return `BAD_BUFFER`. The
112 * returned handle is independent from the input handle as usual, and
113 * freeBuffer() must be called on it when it is no longer needed.
114 *
115 * @param rawHandle Raw buffer handle to import.
116 * @return error Error status of the call, which may be
117 * - `NONE` upon success.
118 * - `BAD_BUFFER` if the raw handle is invalid.
119 * - `NO_RESOURCES` if the raw handle cannot be imported due to
120 * unavailability of resources.
121 * @return buffer Imported buffer handle that has the type
122 * `buffer_handle_t` which is a handle type.
123 */
124 importBuffer(handle rawHandle) generates (Error error, pointer buffer);
125
126 /**
127 * Frees a buffer handle. Buffer handles returned by importBuffer() must be
128 * freed with this function when no longer needed.
129 *
130 * This function must free up all resources allocated by importBuffer() for
131 * the imported handle. For example, if the imported handle was created
132 * with `native_handle_create()`, this function must call
133 * `native_handle_close()` and `native_handle_delete()`.
134 *
135 * @param buffer Imported buffer handle.
136 * @return error Error status of the call, which may be
137 * - `NONE` upon success.
138 * - `BAD_BUFFER` if the buffer is invalid.
139 */
140 freeBuffer(pointer buffer) generates (Error error);
141
142 /**
143 * Validates that the buffer can be safely accessed by a caller who assumes
144 * the specified @p description and @p stride. This must at least validate
145 * that the buffer size is large enough. Validating the buffer against
146 * individual buffer attributes is optional.
147 *
148 * @param buffer Buffer to validate against.
149 * @param description Attributes of the buffer.
150 * @param stride Stride returned by IAllocator::allocate().
151 * @return error Error status of the call, which may be
152 * - `NONE` upon success.
153 * - `BAD_BUFFER` if the buffer is invalid.
154 * - `BAD_VALUE` if the buffer cannot be safely accessed.
155 */
156 validateBufferSize(pointer buffer,
157 BufferDescriptorInfo description,
158 uint32_t stride)
159 generates (Error error);
160
161 /**
162 * Calculates the transport size of a buffer. An imported buffer handle is a
163 * raw buffer handle with the process-local runtime data appended. This
164 * function, for example, allows a caller to omit the process-local runtime
165 * data at the tail when serializing the imported buffer handle.
166 *
167 * Note that a client might or might not omit the process-local runtime data
168 * when sending an imported buffer handle. The mapper must support both
169 * cases on the receiving end.
170 *
171 * @param buffer Buffer to get the transport size from.
172 * @return error Error status of the call, which may be
173 * - `NONE` upon success.
174 * - `BAD_BUFFER` if the buffer is invalid.
175 * @return numFds The number of file descriptors needed for transport.
176 * @return numInts The number of integers needed for transport.
177 */
178 getTransportSize(pointer buffer)
179 generates (Error error,
180 uint32_t numFds,
181 uint32_t numInts);
182
183 /**
184 * Locks the given buffer for the specified CPU usage.
185 *
186 * Locking the same buffer simultaneously from multiple threads is
187 * permitted, but if any of the threads attempt to lock the buffer for
188 * writing, the behavior is undefined, except that it must not cause
189 * process termination or block the client indefinitely. Leaving the
190 * buffer content in an indeterminate state or returning an error are both
191 * acceptable.
192 *
193 * 1D buffers (width = size in bytes, height = 1, pixel_format = BLOB) must
194 * "lock in place". The buffers must be directly accessible via mapping.
195 *
196 * The client must not modify the content of the buffer outside of
197 * @p accessRegion, and the device need not guarantee that content outside
198 * of @p accessRegion is valid for reading. The result of reading or writing
199 * outside of @p accessRegion is undefined, except that it must not cause
200 * process termination.
201 *
Marissa Wall9c5ebfc2019-11-05 14:59:27 -0800202 * This function can lock both single-planar and multi-planar formats. The caller
203 * should use get() to get information about the buffer they are locking.
204 * get() can be used to get information about the planes, offsets, stride,
205 * etc.
206 *
207 * This function must also work on buffers with
208 * `AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_*` if supported by the device, as well
209 * as with any other formats requested by multimedia codecs when they are
210 * configured with a flexible-YUV-compatible color format.
211 *
Marissa Wall65341642019-06-20 13:21:06 -0700212 * On success, @p data must be filled with a pointer to the locked buffer
213 * memory. This address will represent the top-left corner of the entire
214 * buffer, even if @p accessRegion does not begin at the top-left corner.
215 *
Marissa Wallaa181ae2019-10-14 13:17:17 -0700216 * The locked buffer must adhere to the format requested at allocation time
217 * in the BufferDescriptorInfo.
218 *
Marissa Wall65341642019-06-20 13:21:06 -0700219 * @param buffer Buffer to lock.
220 * @param cpuUsage CPU usage flags to request. See +ndk
221 * libnativewindow#AHardwareBuffer_UsageFlags for possible values.
222 * @param accessRegion Portion of the buffer that the client intends to
223 * access.
224 * @param acquireFence Handle containing a file descriptor referring to a
225 * sync fence object, which will be signaled when it is safe for the
226 * mapper to lock the buffer. @p acquireFence may be an empty fence if
227 * it is already safe to lock.
228 * @return error Error status of the call, which may be
229 * - `NONE` upon success.
230 * - `BAD_BUFFER` if the buffer is invalid or is incompatible with this
231 * function.
232 * - `BAD_VALUE` if @p cpuUsage is 0, contains non-CPU usage flags, or
Marissa Walla6a2af82019-11-06 12:49:23 -0800233 * is incompatible with the buffer. Also if the @p accessRegion is
234 * outside the bounds of the buffer or the accessRegion is invalid.
Marissa Wall65341642019-06-20 13:21:06 -0700235 * - `NO_RESOURCES` if the buffer cannot be locked at this time. Note
236 * that locking may succeed at a later time.
237 * @return data CPU-accessible pointer to the buffer data.
Marissa Wall65341642019-06-20 13:21:06 -0700238 */
239 lock(pointer buffer,
240 uint64_t cpuUsage,
241 Rect accessRegion,
242 handle acquireFence)
243 generates (Error error,
Marissa Wall9c5ebfc2019-11-05 14:59:27 -0800244 pointer data);
Marissa Wall65341642019-06-20 13:21:06 -0700245
246 /**
247 * Unlocks a buffer to indicate all CPU accesses to the buffer have
248 * completed.
249 *
250 * @param buffer Buffer to unlock.
251 * @return error Error status of the call, which may be
252 * - `NONE` upon success.
253 * - `BAD_BUFFER` if the buffer is invalid or not locked.
254 * @return releaseFence Handle containing a file descriptor referring to a
255 * sync fence object. The sync fence object will be signaled when the
256 * mapper has completed any pending work. @p releaseFence may be an
257 * empty fence.
258 */
259 unlock(pointer buffer) generates (Error error, handle releaseFence);
260
261 /**
Marissa Wall2c45bb12019-10-18 13:31:36 -0700262 * Flushes the contents of a locked buffer.
263 *
264 * This function flushes the CPUs caches for the range of all the buffer's
265 * planes and metadata. This should behave similarly to unlock() except the
266 * buffer should remain mapped to the CPU.
267 *
268 * The client is still responsible for calling unlock() when it is done
269 * with all CPU accesses to the buffer.
270 *
271 * If non-CPU blocks are simultaneously writing the buffer, the locked
272 * copy should still be flushed but what happens is undefined except that
273 * it should not cause any crashes.
274 *
275 * @param buffer Buffer to flush.
276 * @return error Error status of the call, which may be
277 * - `NONE` upon success.
278 * - `BAD_BUFFER` if the buffer is invalid or not locked.
279 * @return releaseFence Handle containing a file descriptor referring to a
280 * sync fence object. The sync fence object will be signaled when the
281 * mapper has completed any pending work. @p releaseFence may be an
282 * empty fence.
283 */
284 flushLockedBuffer(pointer buffer) generates (Error error, handle releaseFence);
285
286 /**
287 * Rereads the contents of a locked buffer.
288 *
289 * This should fetch the most recent copy of the locked buffer.
290 *
291 * It may reread locked copies of the buffer in other processes.
292 *
293 * The client is still responsible for calling unlock() when it is done
294 * with all CPU accesses to the buffer.
295 *
296 * @param buffer Buffer to reread.
297 * @return error Error status of the call, which may be
298 * - `NONE` upon success.
299 * - `BAD_BUFFER` if the buffer is invalid or not locked.
300 * - `NO_RESOURCES` if the buffer cannot be reread at this time. Note
301 * that rereading may succeed at a later time.
302 */
303 rereadLockedBuffer(pointer buffer) generates(Error error);
304
305 /**
Marissa Wall65341642019-06-20 13:21:06 -0700306 * Test whether the given BufferDescriptorInfo is allocatable.
307 *
308 * If this function returns true, it means that a buffer with the given
309 * description can be allocated on this implementation, unless resource
310 * exhaustion occurs. If this function returns false, it means that the
311 * allocation of the given description will never succeed.
312 *
313 * @param description the description of the buffer
314 * @return supported whether the description is supported
315 */
316 isSupported(BufferDescriptorInfo description)
317 generates (Error error,
318 bool supported);
319
Marissa Wall88d87fa2019-11-05 14:57:51 -0800320
321 /**
322 * Description for get(...), set(...) and getFromBufferDescriptorInfo(...)
323 *
324 * ------------ Overview -----------------------------------
325 * Gralloc 4 adds support for getting and setting buffer metadata on a buffer.
326 *
327 * To get buffer metadata, the client passes in a buffer handle and a token that
328 * represents the type of buffer metadata they would like to get. IMapper returns
329 * a byte stream that contains the buffer metadata. To set the buffer metadata, the
330 * client passes in a buffer handle and a token that represents the type of buffer
331 * metadata they would like to set and a byte stream that contains the buffer metadata
332 * they are setting.
333 *
334 * Buffer metadata is global for a buffer. When the metadata is set on the buffer
335 * in a process, the updated metadata should be available to all other processes.
336 * Please see "Storing and Propagating Metadata" below for more details.
337 *
338 * The getter and setter functions have been optimized for easy vendor extension.
339 * They do not require a formal HIDL extension to add support for getting and setting
340 * vendor defined buffer metadata. In order to allow easy extension, the types used
341 * here are not typical HIDL types. See "Buffer Metadata Token" and
342 * "Buffer Metadata Stream" below for more details.
343 *
344 * ------------ Storing and Propagating Metadata -----------
345 * Buffer metadata must be global. Any changes to the metadata must be propagated
346 * to all other processes immediately. Vendors may chose how they would like support
347 * this functionality.
348 *
349 * We recommend supporting this functionality by allocating an extra page of shared
350 * memory and storing it in the buffer's native_handle_t. The buffer metadata can
351 * be stored in the extra page of shared memory. Set operations are automatically
352 * propagated to all other processes.
353 *
354 * ------------ Buffer Metadata Synchronization ------------
355 * There are no explicit buffer metadata synchronization primitives. Many devices
356 * before gralloc 4 already support getting and setting of global buffer metadata
357 * with no explicit synchronization primitives. Adding synchronization primitives
358 * would just add unnecessary complexity.
359 *
360 * The general rule is if a process has permission to write to a buffer, they
361 * have permission to write to the buffer's metadata. If a process has permission
362 * to read from a buffer, they have permission to read the buffer's metadata.
363 *
364 * There is one exception to this rule. Fences CANNOT be used to protect a buffer's
Marissa Wall0129f432019-11-18 12:48:24 -0800365 * metadata. A process should finish writing to a buffer's metadata before
Marissa Wall88d87fa2019-11-05 14:57:51 -0800366 * sending the buffer to another process that will read or write to the buffer.
367 * This exception is needed because sometimes userspace needs to read the
368 * buffer's metadata before the buffer's contents are ready.
369 *
370 * As a simple example: an app renders to a buffer and then displays the buffer.
371 * In this example when the app renders to the buffer, both the buffer and its
372 * metadata need to be updated. The app's process queues up its work on the GPU
373 * and gets back an acquire fence. The app's process must update the buffer's
374 * metadata before enqueuing the buffer to SurfaceFlinger. The app process CANNOT
375 * update the buffer's metadata after enqueuing the buffer. When HardwareComposer
376 * receives the buffer, it is immediately safe to read the buffer's metadata
377 * and use it to program the display driver. To read the buffer's contents,
378 * display driver must still wait on the acquire fence.
379 *
380 * ------------ Buffer Metadata Token ----------------------
381 * In order to allow arbitrary vendor defined metadata, we could not use a
382 * HIDL enum as the buffer metadata token. Extending a HIDL enum requires a full
383 * HIDL extension. We also could not use a simple non-HIDL enum because vendor
384 * defined enums from different vendors could collide. Instead we have defined
385 * a struct that has a string representing the enum type and an int that
386 * represents the enum value. The string protects different enum values from
387 * colliding.
388 *
389 * The token struct (MetadataType) is defined as a HIDL struct since it
390 * is passed into a HIDL function. The standard buffer metadata types are NOT
391 * defined as a HIDL enum because it would have required a new IMapper version
392 * just to add future standard buffer metadata types. By putting the enum in the
393 * stable AIDL (hardware/interfaces/graphics/common/aidl/android/hardware/
394 * graphics/common/StandardMetadataType.aidl), vendors will be able to optionally
395 * choose to support future standard buffer metadata types without upgrading
396 * HIDL versions. For more information see the description of "struct MetadataType".
397 *
398 * ------------ Buffer Metadata Stream ---------------------
399 * The buffer metadata is get and set as a byte stream (vec<uint8_t>). By getting
400 * and setting buffer metadata as a byte stream, vendors can use the standard
401 * getters and setter functions defined here. Vendors do NOT need to add their own
402 * getters and setter functions for each new type of buffer metadata.
403 *
404 * Converting buffer metadata into a byte stream can be non-trivial. For the standard
405 * buffer metadata types defined in StandardMetadataType.aidl, there are also
406 * support functions that will encode the buffer metadata into a byte stream
407 * and decode the buffer metadata from a byte stream. We STRONGLY recommend using
408 * these support functions. The framework will use them when getting and setting
409 * metadata. The support functions are defined in
410 * frameworks/native/libs/gralloc/types/include/gralloctypes/Gralloc4.h.
411 */
412
413 /**
414 * MetadataType represents the different types of buffer metadata that could be
415 * associated with a buffer. It is used by IMapper to help get and set buffer metadata
416 * on the buffer's native handle.
417 *
418 * Standard buffer metadata will have the name field set to
419 * "android.hardware.graphics.common.StandardMetadataType" and will contain values
420 * from StandardMetadataType.aidl.
421 *
422 * This struct should be "extended" by devices that use a proprietary or non-standard
423 * buffer metadata. To extend the struct, first create a custom @VendorStability vendor
424 * AIDL interface that defines the new type(s) you would like to support. Set the
425 * struct's name field to the custom aidl interface's name
426 * (eg. "vendor.mycompanyname.graphics.common.MetadataType"). Set the struct's value
427 * field to the custom @VendorStabilty vendor AIDL interface.
428 *
429 * Each company should create their own StandardMetadataType.aidl extension. The name
430 * field prevents values from different companies from colliding.
431 */
432 struct MetadataType {
433 string name;
434 int64_t value;
435 };
436
437 /**
438 * Gets the buffer metadata for a given MetadataType.
439 *
440 * Buffer metadata can be changed after allocation so clients should avoid "caching"
441 * the buffer metadata. For example, if the video resolution changes and the buffers
442 * are not reallocated, several buffer metadata values may change without warning.
443 * Clients should not expect the values to be constant. They should requery them every
444 * frame. The only exception is buffer metadata that is determined at allocation
445 * time. For StandardMetadataType values, only BUFFER_ID, NAME, WIDTH,
446 * HEIGHT, LAYER_COUNT, PIXEL_FORMAT_REQUESTED and USAGE are safe to cache because
447 * they are determined at allocation time.
448 *
449 * @param buffer Buffer containing desired metadata
450 * @param metadataType MetadataType for the metadata value being queried
451 * @return error Error status of the call, which may be
452 * - `NONE` upon success.
453 * - `BAD_BUFFER` if the raw handle is invalid.
454 * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of
455 * resources.
456 * - `UNSUPPORTED` when metadataType is unknown/unsupported.
457 * IMapper must support getting all StandardMetadataType.aidl values defined
458 * at the time the device first launches.
459 * @return metadata Vector of bytes representing the buffer metadata associated with
460 * the MetadataType.
461 */
462 get(pointer buffer, MetadataType metadataType)
463 generates (Error error,
464 vec<uint8_t> metadata);
465
466 /**
467 * Sets the global value for a given MetadataType.
468 *
469 * Metadata fields are not required to be settable. This function can
470 * return Error::UNSUPPORTED whenever it doesn't support setting a
471 * particular Metadata field.
472 *
473 * The framework may attempt to set the following StandardMetadataType
474 * values: DATASPACE, PER_FRAME_METADATA, PER_FRAME_METADATA_BLOB and BLEND_MODE.
475 * We strongly encourage everyone to support setting as many of those fields as
476 * possible. If a device's Composer implementation supports a field, it should be
477 * supported here. Over time these metadata fields will be moved out of
478 * Composer/BufferQueue/etc. and into the buffer's Metadata fields.
479 * If a device's IMapper doesn't support setting those Metadata fields,
480 * eventually the device may not longer be able to support these fields.
481 *
482 * @param buffer Buffer receiving desired metadata
483 * @param metadataType MetadataType for the metadata value being set
484 * @param metadata Vector of bytes representing the value associated with
485 * @return error Error status of the call, which may be
486 * - `NONE` upon success.
487 * - `BAD_BUFFER` if the raw handle is invalid.
488 * - `BAD_VALUE` when the field is constant and can never be set (such as
489 * BUFFER_ID, NAME, WIDTH, HEIGHT, LAYER_COUNT, PIXEL_FORMAT_REQUESTED and
490 * USAGE)
491 * - `NO_RESOURCES` if the set cannot be fullfilled due to unavailability of
492 * resources.
493 * - `UNSUPPORTED` when metadataType is unknown/unsupported or setting
494 * it is unsupported. Unsupported should also be returned if the metadata
495 * is malformed.
496 */
497 set(pointer buffer, MetadataType metadataType, vec<uint8_t> metadata)
498 generates (Error error);
499
500 /**
501 * Given a BufferDescriptorInfo, gets the starting value of a given
502 * MetadataType. This can be used to query basic information about a buffer
503 * before the buffer is allocated.
504 *
505 * @param description Attributes of the descriptor.
506 * @param metadataType MetadataType for the metadata value being queried
507 * @return error Error status of the call, which may be
508 * - `NONE` upon success.
509 * - `BAD_VALUE` if any of the specified BufferDescriptorInfo attributes
510 * are invalid.
511 * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of
512 * resources.
513 * - `UNSUPPORTED` when any of the description attributes are unsupported or
514 * if the metadataType is unknown/unsupported. This should also be
515 * returned if the requested metadata is not defined until a buffer has been
516 * allocated.
517 * @return metadata Vector of bytes representing the value associated with
518 * the MetadataType value.
519 */
520 getFromBufferDescriptorInfo(BufferDescriptorInfo description,
521 MetadataType metadataType)
522 generates (Error error,
523 vec<uint8_t> metadata);
Marissa Wall0001a5d2019-11-11 10:50:05 -0800524
525 struct MetadataTypeDescription {
526 MetadataType metadataType;
527 /**
528 * description should contain a string representation of the MetadataType.
529 *
530 * For example: "MyExampleMetadataType is a 64-bit timestamp in nanoseconds
531 * that indicates when a buffer is decoded. It is set by the media HAL after
532 * a buffer is decoded. It is used by the display HAL for hardware
533 * synchronization".
534 *
535 * This field is required for any non-StandardMetadataTypes.
536 */
537 string description;
538 /**
539 * isGettable represents if the MetadataType can be get.
540 */
541 bool isGettable;
542 /**
543 * isSettable represents if the MetadataType can be set.
544 */
545 bool isSettable;
546 };
547
548 /**
549 * Lists all the MetadataTypes supported by IMapper as well as a description
550 * of each supported MetadataType. For StandardMetadataTypes, the description
551 * string can be left empty.
552 *
553 * @return error Error status of the call, which may be
554 * - `NONE` upon success.
555 * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of
556 * resources.
557 * @return descriptions Vector of MetadataTypeDescriptions that represent the
558 * MetadataTypes supported by the device.
559 */
560 listSupportedMetadataTypes()
561 generates (Error error, vec<MetadataTypeDescription> descriptions);
Marissa Wall0cf07562019-11-07 09:17:43 -0800562
563 struct MetadataDump {
564 /**
565 * The type of metadata being dumped.
566 */
567 MetadataType metadataType;
568 /**
569 * The byte stream representation of the metadata. If the metadata is not
570 * gettable, the vector must be empty.
571 */
572 vec<uint8_t> metadata;
573 };
574
575 struct BufferDump {
576 /**
577 * A vector of all the metadata that is being dumped for a particular buffer.
578 */
579 vec<MetadataDump> metadataDump;
580 };
581
582 /**
583 * Dumps a buffer's metadata.
584 *
585 * @param buffer Buffer that is being dumped
586 * @return error Error status of the call, which may be
587 * - `NONE` upon success.
588 * - `BAD_BUFFER` if the raw handle is invalid.
589 * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of
590 * resources.
591 * @return bufferDump Struct representing the metadata being dumped
592 */
593 dumpBuffer(pointer buffer)
594 generates (Error error, BufferDump bufferDump);
595
596 /**
597 * Dumps the metadata for all the buffers in the current process.
598 *
599 * @return error Error status of the call, which may be
600 * - `NONE` upon success.
601 * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of
602 * resources.
603 * @return bufferDumps Vector of structs representing the buffers being dumped
604 */
605 dumpBuffers()
606 generates (Error error, vec<BufferDump> bufferDumps);
Marissa Wall65341642019-06-20 13:21:06 -0700607};
608