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.allocator@4.0; 18 19import android.hardware.graphics.mapper@4.0; 20 21interface IAllocator { 22 /** 23 * Allocates buffers with the properties specified by the descriptor. 24 * 25 * Allocations should be optimized for usage bits provided in the 26 * descriptor. 27 * 28 * @param descriptor Properties of the buffers to allocate. This must be 29 * obtained from IMapper::createDescriptor(). 30 * @param count The number of buffers to allocate. 31 * @return error Error status of the call, which may be 32 * - `NONE` upon success. 33 * - `BAD_DESCRIPTOR` if the descriptor is invalid. 34 * - `NO_RESOURCES` if the allocation cannot be fulfilled at this time. 35 * - `UNSUPPORTED` if any of the properties encoded in the descriptor 36 * are not supported. 37 * @return stride The number of pixels between two consecutive rows of 38 * an allocated buffer, when the concept of consecutive rows is defined. 39 * Otherwise, it has no meaning. 40 * @return buffers Array of raw handles to the allocated buffers. 41 */ 42 allocate(BufferDescriptor descriptor, uint32_t count) 43 generates (Error error, 44 uint32_t stride, 45 vec<handle> buffers); 46}; 47 48