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