Loading graphics/mapper/2.0/Android.bp +58 −2 Original line number Diff line number Diff line cc_library_static { // This file is autogenerated by hidl-gen. Do not edit manually. genrule { name: "android.hardware.graphics.mapper@2.0_genc++", tools: ["hidl-gen"], cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.graphics.mapper@2.0", srcs: [ "types.hal", "IMapper.hal", ], out: [ "android/hardware/graphics/mapper/2.0/types.cpp", "android/hardware/graphics/mapper/2.0/MapperAll.cpp", ], } genrule { name: "android.hardware.graphics.mapper@2.0_genc++_headers", tools: ["hidl-gen"], cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.graphics.mapper@2.0", srcs: [ "types.hal", "IMapper.hal", ], out: [ "android/hardware/graphics/mapper/2.0/types.h", "android/hardware/graphics/mapper/2.0/IMapper.h", "android/hardware/graphics/mapper/2.0/IHwMapper.h", "android/hardware/graphics/mapper/2.0/BnMapper.h", "android/hardware/graphics/mapper/2.0/BpMapper.h", "android/hardware/graphics/mapper/2.0/BsMapper.h", ], } cc_library_shared { name: "android.hardware.graphics.mapper@2.0", export_include_dirs: ["include"], generated_sources: ["android.hardware.graphics.mapper@2.0_genc++"], generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"], export_generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"], shared_libs: [ "libhidlbase", "libhidltransport", "libhwbinder", "liblog", "libutils", "libcutils", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.common@1.0", "android.hidl.base@1.0", ], export_shared_lib_headers: [ "libhidlbase", "libhidltransport", "libhwbinder", "libutils", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.common@1.0", "android.hidl.base@1.0", ], } graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/IMapper.h→graphics/mapper/2.0/IMapper.hal +70 −151 Original line number Diff line number Diff line /* * Copyright 2016 The Android Open Source Project * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -14,165 +14,135 @@ * limitations under the License. */ #ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H #define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H package android.hardware.graphics.mapper@2.0; #include <type_traits> import android.hardware.graphics.common@1.0::PixelFormat; import android.hardware.graphics.allocator@2.0; #include <android/hardware/graphics/mapper/2.0/types.h> extern "C" { namespace android { namespace hardware { namespace graphics { namespace mapper { namespace V2_0 { struct Device { interface IMapper { struct Rect { int32_t left; int32_t top; int32_t width; int32_t height; }; static_assert(std::is_pod<Rect>::value, "Device::Rect is not POD"); /* * Create a mapper device. * * @return error is NONE upon success. Otherwise, * NOT_SUPPORTED when creation will never succeed. * BAD_RESOURCES when creation failed at this time. * @return device is the newly created mapper device. */ typedef Error (*createDevice)(Device** outDevice); /* * Destroy a mapper device. * * @return error is always NONE. * @param device is the mapper device to destroy. */ typedef Error (*destroyDevice)(Device* device); /* * Adds a reference to the given buffer handle. * * A buffer handle received from a remote process or exported by * IAllocator::exportHandle is unknown to this client-side library. There * is also no guarantee that the buffer's backing store will stay alive. * This function must be called at least once in both cases to intrdouce * the buffer handle to this client-side library and to secure the backing * store. It may also be called more than once to increase the reference * count if two components in the same process want to interact with the * buffer independently. * IAllocator::exportHandle is unknown to the mapper. There is also no * guarantee that the buffer's backing store will stay alive. This * function must be called at least once in both cases to intrdouce the * buffer handle to the mapper and to secure the backing store. It may * also be called more than once to increase the reference count if two * components in the same process want to interact with the buffer * independently. * * @param device is the mapper device. * @param bufferHandle is the buffer to which a reference must be added. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid * NO_RESOURCES when it is not possible to add a * reference to this buffer at this time */ typedef Error (*retain)(Device* device, const native_handle_t* bufferHandle); @entry @callflow(next="*") retain(handle bufferHandle) generates (Error error); /* * Removes a reference from the given buffer buffer. * * If no references remain, the buffer handle should be freed with * native_handle_close/native_handle_delete. When the last buffer handle * referring to a particular backing store is freed, that backing store * should also be freed. * If no references remain, the buffer handle must be freed with * native_handle_close/native_handle_delete by the mapper. When the last * buffer handle referring to a particular backing store is freed, that * backing store must also be freed. * * @param device is the mapper device. * @param bufferHandle is the buffer from which a reference must be * removed. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. */ typedef Error (*release)(Device* device, const native_handle_t* bufferHandle); @exit release(handle bufferHandle) generates (Error error); /* * Gets the width and height of the buffer in pixels. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get the dimensions. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return width is the width of the buffer in pixels. * @return height is the height of the buffer in pixels. */ typedef Error (*getDimensions)(Device* device, const native_handle_t* bufferHandle, uint32_t* outWidth, uint32_t* outHeight); @callflow(next="*") getDimensions(handle bufferHandle) generates (Error error, uint32_t width, uint32_t height); /* * Gets the format of the buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get format. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return format is the format of the buffer. */ typedef Error (*getFormat)(Device* device, const native_handle_t* bufferHandle, PixelFormat* outFormat); @callflow(next="*") getFormat(handle bufferHandle) generates (Error error, PixelFormat format); /* * Gets the number of layers of the buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get format. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return layerCount is the number of layers of the buffer. */ typedef Error (*getLayerCount)(Device* device, const native_handle_t* bufferHandle, uint32_t* outLayerCount); @callflow(next="*") getLayerCount(handle bufferHandle) generates (Error error, uint32_t layerCount); /* * Gets the producer usage flags which were used to allocate this buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get the producer usage * flags. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return usageMask contains the producer usage flags of the buffer. */ typedef Error (*getProducerUsageMask)(Device* device, const native_handle_t* bufferHandle, uint64_t* outUsageMask); @callflow(next="*") getProducerUsageMask(handle bufferHandle) generates (Error error, uint64_t usageMask); /* * Gets the consumer usage flags which were used to allocate this buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get the consumer usage * flags. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return usageMask contains the consumer usage flags of the buffer. */ typedef Error (*getConsumerUsageMask)(Device* device, const native_handle_t* bufferHandle, uint64_t* outUsageMask); @callflow(next="*") getConsumerUsageMask(handle bufferHandle) generates (Error error, uint64_t usageMask); /* * Gets a value that uniquely identifies the backing store of the given Loading @@ -190,9 +160,10 @@ struct Device { * BAD_BUFFER when the buffer handle is invalid. * @return store is the backing store identifier for this buffer. */ typedef Error (*getBackingStore)(Device* device, const native_handle_t* bufferHandle, BackingStore* outStore); @callflow(next="*") getBackingStore(handle bufferHandle) generates (Error error, BackingStore store); /* * Gets the stride of the buffer in pixels. Loading @@ -209,31 +180,10 @@ struct Device { * meaningful for the buffer format. * @return store is the stride in pixels. */ typedef Error (*getStride)(Device* device, const native_handle_t* bufferHandle, uint32_t* outStride); /* * Returns the number of flex layout planes which are needed to represent * the given buffer. This may be used to efficiently allocate only as many * plane structures as necessary before calling into lockFlex. * * If the given buffer cannot be locked as a flex format, this function * may return UNSUPPORTED (as lockFlex would). * * @param device is the mapper device. * @param bufferHandle is the buffer for which the number of planes should * be queried. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * UNSUPPORTED when the buffer's format cannot be * represented in a flex layout. * @return numPlanes is the number of flex planes required to describe the * given buffer. */ typedef Error (*getNumFlexPlanes)(Device* device, const native_handle_t* bufferHandle, uint32_t* outNumPlanes); @callflow(next="*") getStride(handle bufferHandle) generates (Error error, uint32_t stride); /* * Locks the given buffer for the specified CPU usage. Loading Loading @@ -264,7 +214,6 @@ struct Device { * the contents of the buffer (prior to locking). If it is already safe to * access the buffer contents, -1 may be passed instead. * * @param device is the mapper device. * @param bufferHandle is the buffer to lock. * @param producerUsageMask contains the producer usage flags to request; * either this or consumerUsagemask must be 0, and the other must Loading @@ -289,13 +238,14 @@ struct Device { * @return data will be filled with a CPU-accessible pointer to the buffer * data. */ typedef Error (*lock)(Device* device, const native_handle_t* bufferHandle, @callflow(next="unlock") lock(handle bufferHandle, uint64_t producerUsageMask, uint64_t consumerUsageMask, const Rect* accessRegion, int32_t acquireFence, void** outData); Rect accessRegion, handle acquireFence) generates (Error error, pointer data); /* * This is largely the same as lock(), except that instead of returning a Loading Loading @@ -337,13 +287,14 @@ struct Device { * @return flexLayout will be filled with the description of the planes in * the buffer. */ typedef Error (*lockFlex)(Device* device, const native_handle_t* bufferHandle, @callflow(next="unlock") lockFlex(handle bufferHandle, uint64_t producerUsageMask, uint64_t consumerUsageMask, const Rect* accessRegion, int32_t acquireFence, FlexLayout* outFlexLayout); Rect accessRegion, handle acquireFence) generates (Error error, FlexLayout layout); /* * This function indicates to the device that the client will be done with Loading @@ -365,40 +316,8 @@ struct Device { * @return releaseFence is a sync fence file descriptor as described * above. */ typedef Error (*unlock)(Device* device, const native_handle_t* bufferHandle, int32_t* outReleaseFence); }; static_assert(std::is_pod<Device>::value, "Device is not POD"); struct IMapper { Device::createDevice createDevice; Device::destroyDevice destroyDevice; Device::retain retain; Device::release release; Device::getDimensions getDimensions; Device::getFormat getFormat; Device::getLayerCount getLayerCount; Device::getProducerUsageMask getProducerUsageMask; Device::getConsumerUsageMask getConsumerUsageMask; Device::getBackingStore getBackingStore; Device::getStride getStride; Device::getNumFlexPlanes getNumFlexPlanes; Device::lock lock; Device::lockFlex lockFlex; Device::unlock unlock; @callflow(next="*") unlock(handle bufferHandle) generates (Error error, handle releaseFence); }; static_assert(std::is_pod<IMapper>::value, "IMapper is not POD"); } // namespace V2_0 } // namespace mapper } // namespace graphics } // namespace hardware } // namespace android const void* HALLIB_FETCH_Interface(const char* name); } // extern "C" #endif /* ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H */ graphics/mapper/2.0/default/Android.bp +6 −3 Original line number Diff line number Diff line // // Copyright (C) 2016 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); Loading @@ -13,17 +14,19 @@ // limitations under the License. cc_library_shared { name: "android.hardware.graphics.mapper.hallib", name: "android.hardware.graphics.mapper@2.0-impl", relative_install_path: "hw", srcs: ["GrallocMapper.cpp"], cppflags: ["-Wall", "-Wextra"], static_libs: ["android.hardware.graphics.mapper@2.0"], shared_libs: [ "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.mapper@2.0", "libbase", "libcutils", "libhardware", "libhidlbase", "libhidltransport", "libhwbinder", "liblog", "libutils", ], } graphics/mapper/2.0/default/GrallocMapper.cpp +244 −273 File changed.Preview size limit exceeded, changes collapsed. Show changes graphics/mapper/2.0/default/GrallocMapper.h 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC_MAPPER_H #define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC_MAPPER_H #include <android/hardware/graphics/mapper/2.0/IMapper.h> namespace android { namespace hardware { namespace graphics { namespace mapper { namespace V2_0 { namespace implementation { extern "C" IMapper* HIDL_FETCH_IMapper(const char* name); } // namespace implementation } // namespace V2_0 } // namespace mapper } // namespace graphics } // namespace hardware } // namespace android #endif // ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC_MAPPER_H Loading
graphics/mapper/2.0/Android.bp +58 −2 Original line number Diff line number Diff line cc_library_static { // This file is autogenerated by hidl-gen. Do not edit manually. genrule { name: "android.hardware.graphics.mapper@2.0_genc++", tools: ["hidl-gen"], cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.graphics.mapper@2.0", srcs: [ "types.hal", "IMapper.hal", ], out: [ "android/hardware/graphics/mapper/2.0/types.cpp", "android/hardware/graphics/mapper/2.0/MapperAll.cpp", ], } genrule { name: "android.hardware.graphics.mapper@2.0_genc++_headers", tools: ["hidl-gen"], cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.graphics.mapper@2.0", srcs: [ "types.hal", "IMapper.hal", ], out: [ "android/hardware/graphics/mapper/2.0/types.h", "android/hardware/graphics/mapper/2.0/IMapper.h", "android/hardware/graphics/mapper/2.0/IHwMapper.h", "android/hardware/graphics/mapper/2.0/BnMapper.h", "android/hardware/graphics/mapper/2.0/BpMapper.h", "android/hardware/graphics/mapper/2.0/BsMapper.h", ], } cc_library_shared { name: "android.hardware.graphics.mapper@2.0", export_include_dirs: ["include"], generated_sources: ["android.hardware.graphics.mapper@2.0_genc++"], generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"], export_generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"], shared_libs: [ "libhidlbase", "libhidltransport", "libhwbinder", "liblog", "libutils", "libcutils", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.common@1.0", "android.hidl.base@1.0", ], export_shared_lib_headers: [ "libhidlbase", "libhidltransport", "libhwbinder", "libutils", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.common@1.0", "android.hidl.base@1.0", ], }
graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/IMapper.h→graphics/mapper/2.0/IMapper.hal +70 −151 Original line number Diff line number Diff line /* * Copyright 2016 The Android Open Source Project * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -14,165 +14,135 @@ * limitations under the License. */ #ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H #define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H package android.hardware.graphics.mapper@2.0; #include <type_traits> import android.hardware.graphics.common@1.0::PixelFormat; import android.hardware.graphics.allocator@2.0; #include <android/hardware/graphics/mapper/2.0/types.h> extern "C" { namespace android { namespace hardware { namespace graphics { namespace mapper { namespace V2_0 { struct Device { interface IMapper { struct Rect { int32_t left; int32_t top; int32_t width; int32_t height; }; static_assert(std::is_pod<Rect>::value, "Device::Rect is not POD"); /* * Create a mapper device. * * @return error is NONE upon success. Otherwise, * NOT_SUPPORTED when creation will never succeed. * BAD_RESOURCES when creation failed at this time. * @return device is the newly created mapper device. */ typedef Error (*createDevice)(Device** outDevice); /* * Destroy a mapper device. * * @return error is always NONE. * @param device is the mapper device to destroy. */ typedef Error (*destroyDevice)(Device* device); /* * Adds a reference to the given buffer handle. * * A buffer handle received from a remote process or exported by * IAllocator::exportHandle is unknown to this client-side library. There * is also no guarantee that the buffer's backing store will stay alive. * This function must be called at least once in both cases to intrdouce * the buffer handle to this client-side library and to secure the backing * store. It may also be called more than once to increase the reference * count if two components in the same process want to interact with the * buffer independently. * IAllocator::exportHandle is unknown to the mapper. There is also no * guarantee that the buffer's backing store will stay alive. This * function must be called at least once in both cases to intrdouce the * buffer handle to the mapper and to secure the backing store. It may * also be called more than once to increase the reference count if two * components in the same process want to interact with the buffer * independently. * * @param device is the mapper device. * @param bufferHandle is the buffer to which a reference must be added. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid * NO_RESOURCES when it is not possible to add a * reference to this buffer at this time */ typedef Error (*retain)(Device* device, const native_handle_t* bufferHandle); @entry @callflow(next="*") retain(handle bufferHandle) generates (Error error); /* * Removes a reference from the given buffer buffer. * * If no references remain, the buffer handle should be freed with * native_handle_close/native_handle_delete. When the last buffer handle * referring to a particular backing store is freed, that backing store * should also be freed. * If no references remain, the buffer handle must be freed with * native_handle_close/native_handle_delete by the mapper. When the last * buffer handle referring to a particular backing store is freed, that * backing store must also be freed. * * @param device is the mapper device. * @param bufferHandle is the buffer from which a reference must be * removed. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. */ typedef Error (*release)(Device* device, const native_handle_t* bufferHandle); @exit release(handle bufferHandle) generates (Error error); /* * Gets the width and height of the buffer in pixels. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get the dimensions. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return width is the width of the buffer in pixels. * @return height is the height of the buffer in pixels. */ typedef Error (*getDimensions)(Device* device, const native_handle_t* bufferHandle, uint32_t* outWidth, uint32_t* outHeight); @callflow(next="*") getDimensions(handle bufferHandle) generates (Error error, uint32_t width, uint32_t height); /* * Gets the format of the buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get format. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return format is the format of the buffer. */ typedef Error (*getFormat)(Device* device, const native_handle_t* bufferHandle, PixelFormat* outFormat); @callflow(next="*") getFormat(handle bufferHandle) generates (Error error, PixelFormat format); /* * Gets the number of layers of the buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get format. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return layerCount is the number of layers of the buffer. */ typedef Error (*getLayerCount)(Device* device, const native_handle_t* bufferHandle, uint32_t* outLayerCount); @callflow(next="*") getLayerCount(handle bufferHandle) generates (Error error, uint32_t layerCount); /* * Gets the producer usage flags which were used to allocate this buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get the producer usage * flags. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return usageMask contains the producer usage flags of the buffer. */ typedef Error (*getProducerUsageMask)(Device* device, const native_handle_t* bufferHandle, uint64_t* outUsageMask); @callflow(next="*") getProducerUsageMask(handle bufferHandle) generates (Error error, uint64_t usageMask); /* * Gets the consumer usage flags which were used to allocate this buffer. * * See IAllocator::BufferDescriptorInfo for more information. * * @param device is the mapper device. * @param bufferHandle is the buffer from which to get the consumer usage * flags. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * @return usageMask contains the consumer usage flags of the buffer. */ typedef Error (*getConsumerUsageMask)(Device* device, const native_handle_t* bufferHandle, uint64_t* outUsageMask); @callflow(next="*") getConsumerUsageMask(handle bufferHandle) generates (Error error, uint64_t usageMask); /* * Gets a value that uniquely identifies the backing store of the given Loading @@ -190,9 +160,10 @@ struct Device { * BAD_BUFFER when the buffer handle is invalid. * @return store is the backing store identifier for this buffer. */ typedef Error (*getBackingStore)(Device* device, const native_handle_t* bufferHandle, BackingStore* outStore); @callflow(next="*") getBackingStore(handle bufferHandle) generates (Error error, BackingStore store); /* * Gets the stride of the buffer in pixels. Loading @@ -209,31 +180,10 @@ struct Device { * meaningful for the buffer format. * @return store is the stride in pixels. */ typedef Error (*getStride)(Device* device, const native_handle_t* bufferHandle, uint32_t* outStride); /* * Returns the number of flex layout planes which are needed to represent * the given buffer. This may be used to efficiently allocate only as many * plane structures as necessary before calling into lockFlex. * * If the given buffer cannot be locked as a flex format, this function * may return UNSUPPORTED (as lockFlex would). * * @param device is the mapper device. * @param bufferHandle is the buffer for which the number of planes should * be queried. * @return error is NONE upon success. Otherwise, * BAD_BUFFER when the buffer handle is invalid. * UNSUPPORTED when the buffer's format cannot be * represented in a flex layout. * @return numPlanes is the number of flex planes required to describe the * given buffer. */ typedef Error (*getNumFlexPlanes)(Device* device, const native_handle_t* bufferHandle, uint32_t* outNumPlanes); @callflow(next="*") getStride(handle bufferHandle) generates (Error error, uint32_t stride); /* * Locks the given buffer for the specified CPU usage. Loading Loading @@ -264,7 +214,6 @@ struct Device { * the contents of the buffer (prior to locking). If it is already safe to * access the buffer contents, -1 may be passed instead. * * @param device is the mapper device. * @param bufferHandle is the buffer to lock. * @param producerUsageMask contains the producer usage flags to request; * either this or consumerUsagemask must be 0, and the other must Loading @@ -289,13 +238,14 @@ struct Device { * @return data will be filled with a CPU-accessible pointer to the buffer * data. */ typedef Error (*lock)(Device* device, const native_handle_t* bufferHandle, @callflow(next="unlock") lock(handle bufferHandle, uint64_t producerUsageMask, uint64_t consumerUsageMask, const Rect* accessRegion, int32_t acquireFence, void** outData); Rect accessRegion, handle acquireFence) generates (Error error, pointer data); /* * This is largely the same as lock(), except that instead of returning a Loading Loading @@ -337,13 +287,14 @@ struct Device { * @return flexLayout will be filled with the description of the planes in * the buffer. */ typedef Error (*lockFlex)(Device* device, const native_handle_t* bufferHandle, @callflow(next="unlock") lockFlex(handle bufferHandle, uint64_t producerUsageMask, uint64_t consumerUsageMask, const Rect* accessRegion, int32_t acquireFence, FlexLayout* outFlexLayout); Rect accessRegion, handle acquireFence) generates (Error error, FlexLayout layout); /* * This function indicates to the device that the client will be done with Loading @@ -365,40 +316,8 @@ struct Device { * @return releaseFence is a sync fence file descriptor as described * above. */ typedef Error (*unlock)(Device* device, const native_handle_t* bufferHandle, int32_t* outReleaseFence); }; static_assert(std::is_pod<Device>::value, "Device is not POD"); struct IMapper { Device::createDevice createDevice; Device::destroyDevice destroyDevice; Device::retain retain; Device::release release; Device::getDimensions getDimensions; Device::getFormat getFormat; Device::getLayerCount getLayerCount; Device::getProducerUsageMask getProducerUsageMask; Device::getConsumerUsageMask getConsumerUsageMask; Device::getBackingStore getBackingStore; Device::getStride getStride; Device::getNumFlexPlanes getNumFlexPlanes; Device::lock lock; Device::lockFlex lockFlex; Device::unlock unlock; @callflow(next="*") unlock(handle bufferHandle) generates (Error error, handle releaseFence); }; static_assert(std::is_pod<IMapper>::value, "IMapper is not POD"); } // namespace V2_0 } // namespace mapper } // namespace graphics } // namespace hardware } // namespace android const void* HALLIB_FETCH_Interface(const char* name); } // extern "C" #endif /* ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H */
graphics/mapper/2.0/default/Android.bp +6 −3 Original line number Diff line number Diff line // // Copyright (C) 2016 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); Loading @@ -13,17 +14,19 @@ // limitations under the License. cc_library_shared { name: "android.hardware.graphics.mapper.hallib", name: "android.hardware.graphics.mapper@2.0-impl", relative_install_path: "hw", srcs: ["GrallocMapper.cpp"], cppflags: ["-Wall", "-Wextra"], static_libs: ["android.hardware.graphics.mapper@2.0"], shared_libs: [ "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.mapper@2.0", "libbase", "libcutils", "libhardware", "libhidlbase", "libhidltransport", "libhwbinder", "liblog", "libutils", ], }
graphics/mapper/2.0/default/GrallocMapper.cpp +244 −273 File changed.Preview size limit exceeded, changes collapsed. Show changes
graphics/mapper/2.0/default/GrallocMapper.h 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC_MAPPER_H #define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC_MAPPER_H #include <android/hardware/graphics/mapper/2.0/IMapper.h> namespace android { namespace hardware { namespace graphics { namespace mapper { namespace V2_0 { namespace implementation { extern "C" IMapper* HIDL_FETCH_IMapper(const char* name); } // namespace implementation } // namespace V2_0 } // namespace mapper } // namespace graphics } // namespace hardware } // namespace android #endif // ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC_MAPPER_H