1 /* 2 * Copyright (C) 2020 Google LLC. All rights reserved. 3 * 4 * Copyright (C) 2008 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef GRALLOC_VENDOR_INTERFACE_H 20 #define GRALLOC_VENDOR_INTERFACE_H 21 22 #include <cutils/native_handle.h> 23 #include <sys/types.h> 24 #include <cstdint> 25 #include <system/graphics-base-v1.0.h> 26 #include <android/hardware/graphics/mapper/4.0/IMapper.h> 27 28 29 namespace android::hardware::graphics::allocator::priv { 30 31 struct Descriptor; 32 Descriptor *createDescriptor(); 33 void deleteDescriptor(Descriptor *descriptor); 34 35 void setProducerUsage(Descriptor &descriptor, uint64_t usage); 36 void setConsumerUsage(Descriptor &descriptor, uint64_t usage); 37 void setPlaneCount(Descriptor &descriptor, int count); 38 void setPlane(Descriptor &descriptor, int index, int fd, size_t size, off_t offset, int stride_byte); 39 void setWidth(Descriptor &descriptor, int width); 40 void setHeight(Descriptor &descriptor, int height); 41 void setStridePixel(Descriptor &descriptor, int stride_pixel); 42 void setFormat(Descriptor &descriptor, int format); 43 44 buffer_handle_t createNativeHandle(const Descriptor &descriptor); 45 46 int freeImportedHandle(void *handle); 47 48 } // namespace android::hardware::graphics::allocator::priv 49 50 #endif 51