Loading libs/gralloc/types/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ cc_library { export_shared_lib_headers: [ "android.hardware.graphics.mapper@4.0", "libhidlbase", "vintf-graphics-common-ndk_platform", ], Loading libs/gralloc/types/Gralloc4.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #define LOG_TAG "libgralloctypes" #include <cstring> #include <cinttypes> #include <limits> Loading Loading @@ -797,10 +799,6 @@ status_t decodeCta861_3Helper(InputHidlVec* inputHidlVec, Cta861_3* outCta861_3) /** * Public API functions */ PlaneLayoutComponentType getStandardPlaneLayoutComponentTypeValue( const ExtendableType& planeLayoutComponentType) { return static_cast<PlaneLayoutComponentType>(planeLayoutComponentType.value); } status_t encodeBufferId(uint64_t bufferId, hidl_vec<uint8_t>* outBufferId) { return encode(MetadataType_BufferId, bufferId, outBufferId, encodeInteger); Loading Loading @@ -1028,6 +1026,11 @@ ChromaSiting getStandardChromaSitingValue(const ExtendableType& chromaSiting) { return static_cast<ChromaSiting>(chromaSiting.value); } PlaneLayoutComponentType getStandardPlaneLayoutComponentTypeValue( const ExtendableType& planeLayoutComponentType) { return static_cast<PlaneLayoutComponentType>(planeLayoutComponentType.value); } std::string getCompressionName(const ExtendableType& compression) { if (!isStandardCompression(compression)) { std::ostringstream stream; Loading libs/gralloc/types/include/gralloctypes/Gralloc4.h +180 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,186 @@ #include <aidl/android/hardware/graphics/common/XyColor.h> #include <android/hardware/graphics/mapper/4.0/IMapper.h> /** * Define equality operators for Stable AIDL types. */ inline bool operator==(const aidl::android::hardware::graphics::common::ExtendableType& lhs, const aidl::android::hardware::graphics::common::ExtendableType& rhs) { return !std::strcmp(lhs.name.c_str(), rhs.name.c_str()) && lhs.value == rhs.value; } inline bool operator!=(const aidl::android::hardware::graphics::common::ExtendableType& lhs, const aidl::android::hardware::graphics::common::ExtendableType& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::PlaneLayoutComponent& lhs, const aidl::android::hardware::graphics::common::PlaneLayoutComponent& rhs) { if (lhs.type.name != rhs.type.name) { return false; } if (lhs.type.value != rhs.type.value) { return false; } if (lhs.sizeInBits != rhs.sizeInBits) { return false; } if (lhs.offsetInBits != rhs.offsetInBits) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::PlaneLayoutComponent& lhs, const aidl::android::hardware::graphics::common::PlaneLayoutComponent& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::Rect& lhs, const aidl::android::hardware::graphics::common::Rect& rhs) { if (lhs.left != rhs.left) { return false; } if (lhs.top != rhs.top) { return false; } if (lhs.right != rhs.right) { return false; } if (lhs.bottom != rhs.bottom) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::Rect& lhs, const aidl::android::hardware::graphics::common::Rect& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::PlaneLayout& lhs, const aidl::android::hardware::graphics::common::PlaneLayout& rhs) { if (lhs.offsetInBytes != rhs.offsetInBytes) { return false; } if (lhs.sampleIncrementInBits != rhs.sampleIncrementInBits) { return false; } if (lhs.strideInBytes != rhs.strideInBytes) { return false; } if (lhs.widthInSamples != rhs.widthInSamples) { return false; } if (lhs.heightInSamples != rhs.heightInSamples) { return false; } if (lhs.totalSizeInBytes != rhs.totalSizeInBytes) { return false; } if (lhs.horizontalSubsampling != rhs.horizontalSubsampling) { return false; } if (lhs.verticalSubsampling != rhs.verticalSubsampling) { return false; } if (lhs.crop != rhs.crop) { return false; } if (lhs.components.size() != rhs.components.size()) { return false; } for (size_t i = 0; i < lhs.components.size(); i++) { if (lhs.components[i] != rhs.components[i]) { return false; } } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::PlaneLayout& lhs, const aidl::android::hardware::graphics::common::PlaneLayout& rhs) { return !(lhs == rhs); } inline bool operator==(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& lhs, const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& rhs) { if (lhs.size() != rhs.size()) { return false; } for (size_t i = 0; i < lhs.size(); i++) { if (lhs[i] != rhs[i]) { return false; } } return true; } inline bool operator!=(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& lhs, const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::XyColor& lhs, const aidl::android::hardware::graphics::common::XyColor& rhs) { if (lhs.x != rhs.x) { return false; } if (lhs.y != rhs.y) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::XyColor& lhs, const aidl::android::hardware::graphics::common::XyColor& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::Smpte2086& lhs, const aidl::android::hardware::graphics::common::Smpte2086& rhs) { if (lhs.primaryRed != rhs.primaryRed) { return false; } if (lhs.primaryGreen != rhs.primaryGreen) { return false; } if (lhs.primaryBlue != rhs.primaryBlue) { return false; } if (lhs.whitePoint != rhs.whitePoint) { return false; } if (lhs.maxLuminance != rhs.maxLuminance) { return false; } if (lhs.minLuminance != rhs.minLuminance) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::Smpte2086& lhs, const aidl::android::hardware::graphics::common::Smpte2086& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::Cta861_3& lhs, const aidl::android::hardware::graphics::common::Cta861_3& rhs) { if (lhs.maxContentLightLevel != rhs.maxContentLightLevel) { return false; } if (lhs.maxFrameAverageLightLevel != rhs.maxFrameAverageLightLevel) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::Cta861_3& lhs, const aidl::android::hardware::graphics::common::Cta861_3& rhs) { return !(lhs == rhs); } namespace android { namespace gralloc4 { Loading libs/gralloc/types/tests/Android.bp 0 → 100644 +25 −0 Original line number Diff line number Diff line // // Copyright 2019 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. // cc_test { name: "GrallocTypes_test", shared_libs: [ "libgralloctypes", "libhidlbase", ], srcs: ["Gralloc4_test.cpp"], cflags: ["-Wall", "-Werror"], } Loading
libs/gralloc/types/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ cc_library { export_shared_lib_headers: [ "android.hardware.graphics.mapper@4.0", "libhidlbase", "vintf-graphics-common-ndk_platform", ], Loading
libs/gralloc/types/Gralloc4.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #define LOG_TAG "libgralloctypes" #include <cstring> #include <cinttypes> #include <limits> Loading Loading @@ -797,10 +799,6 @@ status_t decodeCta861_3Helper(InputHidlVec* inputHidlVec, Cta861_3* outCta861_3) /** * Public API functions */ PlaneLayoutComponentType getStandardPlaneLayoutComponentTypeValue( const ExtendableType& planeLayoutComponentType) { return static_cast<PlaneLayoutComponentType>(planeLayoutComponentType.value); } status_t encodeBufferId(uint64_t bufferId, hidl_vec<uint8_t>* outBufferId) { return encode(MetadataType_BufferId, bufferId, outBufferId, encodeInteger); Loading Loading @@ -1028,6 +1026,11 @@ ChromaSiting getStandardChromaSitingValue(const ExtendableType& chromaSiting) { return static_cast<ChromaSiting>(chromaSiting.value); } PlaneLayoutComponentType getStandardPlaneLayoutComponentTypeValue( const ExtendableType& planeLayoutComponentType) { return static_cast<PlaneLayoutComponentType>(planeLayoutComponentType.value); } std::string getCompressionName(const ExtendableType& compression) { if (!isStandardCompression(compression)) { std::ostringstream stream; Loading
libs/gralloc/types/include/gralloctypes/Gralloc4.h +180 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,186 @@ #include <aidl/android/hardware/graphics/common/XyColor.h> #include <android/hardware/graphics/mapper/4.0/IMapper.h> /** * Define equality operators for Stable AIDL types. */ inline bool operator==(const aidl::android::hardware::graphics::common::ExtendableType& lhs, const aidl::android::hardware::graphics::common::ExtendableType& rhs) { return !std::strcmp(lhs.name.c_str(), rhs.name.c_str()) && lhs.value == rhs.value; } inline bool operator!=(const aidl::android::hardware::graphics::common::ExtendableType& lhs, const aidl::android::hardware::graphics::common::ExtendableType& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::PlaneLayoutComponent& lhs, const aidl::android::hardware::graphics::common::PlaneLayoutComponent& rhs) { if (lhs.type.name != rhs.type.name) { return false; } if (lhs.type.value != rhs.type.value) { return false; } if (lhs.sizeInBits != rhs.sizeInBits) { return false; } if (lhs.offsetInBits != rhs.offsetInBits) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::PlaneLayoutComponent& lhs, const aidl::android::hardware::graphics::common::PlaneLayoutComponent& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::Rect& lhs, const aidl::android::hardware::graphics::common::Rect& rhs) { if (lhs.left != rhs.left) { return false; } if (lhs.top != rhs.top) { return false; } if (lhs.right != rhs.right) { return false; } if (lhs.bottom != rhs.bottom) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::Rect& lhs, const aidl::android::hardware::graphics::common::Rect& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::PlaneLayout& lhs, const aidl::android::hardware::graphics::common::PlaneLayout& rhs) { if (lhs.offsetInBytes != rhs.offsetInBytes) { return false; } if (lhs.sampleIncrementInBits != rhs.sampleIncrementInBits) { return false; } if (lhs.strideInBytes != rhs.strideInBytes) { return false; } if (lhs.widthInSamples != rhs.widthInSamples) { return false; } if (lhs.heightInSamples != rhs.heightInSamples) { return false; } if (lhs.totalSizeInBytes != rhs.totalSizeInBytes) { return false; } if (lhs.horizontalSubsampling != rhs.horizontalSubsampling) { return false; } if (lhs.verticalSubsampling != rhs.verticalSubsampling) { return false; } if (lhs.crop != rhs.crop) { return false; } if (lhs.components.size() != rhs.components.size()) { return false; } for (size_t i = 0; i < lhs.components.size(); i++) { if (lhs.components[i] != rhs.components[i]) { return false; } } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::PlaneLayout& lhs, const aidl::android::hardware::graphics::common::PlaneLayout& rhs) { return !(lhs == rhs); } inline bool operator==(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& lhs, const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& rhs) { if (lhs.size() != rhs.size()) { return false; } for (size_t i = 0; i < lhs.size(); i++) { if (lhs[i] != rhs[i]) { return false; } } return true; } inline bool operator!=(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& lhs, const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::XyColor& lhs, const aidl::android::hardware::graphics::common::XyColor& rhs) { if (lhs.x != rhs.x) { return false; } if (lhs.y != rhs.y) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::XyColor& lhs, const aidl::android::hardware::graphics::common::XyColor& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::Smpte2086& lhs, const aidl::android::hardware::graphics::common::Smpte2086& rhs) { if (lhs.primaryRed != rhs.primaryRed) { return false; } if (lhs.primaryGreen != rhs.primaryGreen) { return false; } if (lhs.primaryBlue != rhs.primaryBlue) { return false; } if (lhs.whitePoint != rhs.whitePoint) { return false; } if (lhs.maxLuminance != rhs.maxLuminance) { return false; } if (lhs.minLuminance != rhs.minLuminance) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::Smpte2086& lhs, const aidl::android::hardware::graphics::common::Smpte2086& rhs) { return !(lhs == rhs); } inline bool operator==(const aidl::android::hardware::graphics::common::Cta861_3& lhs, const aidl::android::hardware::graphics::common::Cta861_3& rhs) { if (lhs.maxContentLightLevel != rhs.maxContentLightLevel) { return false; } if (lhs.maxFrameAverageLightLevel != rhs.maxFrameAverageLightLevel) { return false; } return true; } inline bool operator!=(const aidl::android::hardware::graphics::common::Cta861_3& lhs, const aidl::android::hardware::graphics::common::Cta861_3& rhs) { return !(lhs == rhs); } namespace android { namespace gralloc4 { Loading
libs/gralloc/types/tests/Android.bp 0 → 100644 +25 −0 Original line number Diff line number Diff line // // Copyright 2019 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. // cc_test { name: "GrallocTypes_test", shared_libs: [ "libgralloctypes", "libhidlbase", ], srcs: ["Gralloc4_test.cpp"], cflags: ["-Wall", "-Werror"], }