Chia-I Wu | 12b806b | 2017-09-22 10:44:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | |
| 17 | package android.hardware.graphics.mapper@2.1; |
| 18 | |
| 19 | import android.hardware.graphics.mapper@2.0::Error; |
| 20 | import android.hardware.graphics.mapper@2.0::IMapper; |
| 21 | |
| 22 | interface IMapper extends android.hardware.graphics.mapper@2.0::IMapper { |
| 23 | /** |
| 24 | * Validate that the buffer can be safely accessed by a caller who assumes |
| 25 | * the specified descriptorInfo and stride. This must at least validate |
| 26 | * that the buffer size is large enough. Validating the buffer against |
| 27 | * individual buffer attributes is optional. |
| 28 | * |
| 29 | * @param buffer is the buffer to validate against. |
| 30 | * @param descriptorInfo specifies the attributes of the buffer. |
| 31 | * @param stride is the buffer stride returned by IAllocator::allocate. |
| 32 | * @return error is NONE upon success. Otherwise, |
| 33 | * BAD_BUFFER when the buffer is invalid. |
| 34 | * BAD_VALUE when buffer cannot be safely accessed |
| 35 | */ |
| 36 | validateBufferSize(pointer buffer, |
| 37 | BufferDescriptorInfo descriptorInfo, |
| 38 | uint32_t stride) |
| 39 | generates (Error error); |
| 40 | |
| 41 | /** |
| 42 | * Get the transport size of a buffer. An imported buffer handle is a raw |
| 43 | * buffer handle with the process-local runtime data appended. This |
| 44 | * function, for example, allows a caller to omit the process-local |
| 45 | * runtime data at the tail when serializing the imported buffer handle. |
| 46 | * |
| 47 | * Note that a client might or might not omit the process-local runtime |
| 48 | * data when sending an imported buffer handle. The mapper must support |
| 49 | * both cases on the receiving end. |
| 50 | * |
| 51 | * @param buffer is the buffer to get the transport size from. |
| 52 | * @return error is NONE upon success. Otherwise, |
| 53 | * BAD_BUFFER when the buffer is invalid. |
| 54 | * @return numFds is the number of file descriptors needed for transport. |
| 55 | * @return numInts is the number of integers needed for transport. |
| 56 | */ |
| 57 | getTransportSize(pointer buffer) |
| 58 | generates (Error error, |
| 59 | uint32_t numFds, |
| 60 | uint32_t numInts); |
| 61 | }; |