diff options
Diffstat (limited to 'libs/gralloc/types')
-rw-r--r-- | libs/gralloc/types/Android.bp | 18 | ||||
-rw-r--r-- | libs/gralloc/types/Gralloc4.cpp | 16 | ||||
-rw-r--r-- | libs/gralloc/types/fuzzer/Android.bp | 14 | ||||
-rw-r--r-- | libs/gralloc/types/include/gralloctypes/Gralloc4.h | 196 | ||||
-rw-r--r-- | libs/gralloc/types/tests/Android.bp | 9 |
5 files changed, 206 insertions, 47 deletions
diff --git a/libs/gralloc/types/Android.bp b/libs/gralloc/types/Android.bp index a0032aecb9..66fb295a19 100644 --- a/libs/gralloc/types/Android.bp +++ b/libs/gralloc/types/Android.bp @@ -12,15 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_native_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["frameworks_native_license"], -} - cc_library { name: "libgralloctypes", defaults: ["libbinder_ndk_host_user"], @@ -30,11 +21,6 @@ cc_library { "-Wno-enum-compare", ], host_supported: true, - target: { - darwin: { - enabled: false, - } - }, vendor_available: true, vndk: { @@ -52,14 +38,14 @@ cc_library { ], shared_libs: [ - "android.hardware.graphics.common-V2-ndk_platform", + "android.hardware.graphics.common-ndk_platform", "android.hardware.graphics.mapper@4.0", "libhidlbase", "liblog", ], export_shared_lib_headers: [ - "android.hardware.graphics.common-V2-ndk_platform", + "android.hardware.graphics.common-ndk_platform", "android.hardware.graphics.mapper@4.0", "libhidlbase", ], diff --git a/libs/gralloc/types/Gralloc4.cpp b/libs/gralloc/types/Gralloc4.cpp index e2f072a7ab..53c68b7230 100644 --- a/libs/gralloc/types/Gralloc4.cpp +++ b/libs/gralloc/types/Gralloc4.cpp @@ -706,35 +706,35 @@ status_t encodePlaneLayout(const PlaneLayout& input, OutputHidlVec* output) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.offsetInBytes), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.offsetInBytes), output); if (err) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.sampleIncrementInBits), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.sampleIncrementInBits), output); if (err) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.strideInBytes), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.strideInBytes), output); if (err) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.widthInSamples), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.widthInSamples), output); if (err) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.heightInSamples), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.heightInSamples), output); if (err) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.totalSizeInBytes), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.totalSizeInBytes), output); if (err) { return err; } - err = encodeInteger<int64_t>(static_cast<int64_t>(input.horizontalSubsampling), output); + err = encodeInteger<int64_t>(static_cast<int32_t>(input.horizontalSubsampling), output); if (err) { return err; } - return encodeInteger<int64_t>(static_cast<int64_t>(input.verticalSubsampling), output); + return encodeInteger<int64_t>(static_cast<int32_t>(input.verticalSubsampling), output); } status_t decodePlaneLayout(InputHidlVec* input, PlaneLayout* output) { diff --git a/libs/gralloc/types/fuzzer/Android.bp b/libs/gralloc/types/fuzzer/Android.bp index 6689771a24..84448839a1 100644 --- a/libs/gralloc/types/fuzzer/Android.bp +++ b/libs/gralloc/types/fuzzer/Android.bp @@ -1,21 +1,7 @@ -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_native_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["frameworks_native_license"], -} - cc_fuzz { name: "libgralloctypes_fuzzer", defaults: ["libbinder_ndk_host_user"], host_supported: true, - target: { - darwin: { - enabled: false, - } - }, fuzz_config: { cc: ["marissaw@google.com"], diff --git a/libs/gralloc/types/include/gralloctypes/Gralloc4.h b/libs/gralloc/types/include/gralloctypes/Gralloc4.h index 2f418acca5..1a7c2c946a 100644 --- a/libs/gralloc/types/include/gralloctypes/Gralloc4.h +++ b/libs/gralloc/types/include/gralloctypes/Gralloc4.h @@ -32,6 +32,202 @@ #include <android/hardware/graphics/mapper/4.0/IMapper.h> namespace android { + +/** + * 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 std::vector<aidl::android::hardware::graphics::common::Rect>& lhs, + const std::vector<aidl::android::hardware::graphics::common::Rect>& 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::Rect>& lhs, + const std::vector<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.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 gralloc4 { #define GRALLOC4_STANDARD_METADATA_TYPE "android.hardware.graphics.common.StandardMetadataType" diff --git a/libs/gralloc/types/tests/Android.bp b/libs/gralloc/types/tests/Android.bp index 66eb0aa2fe..b939c1db59 100644 --- a/libs/gralloc/types/tests/Android.bp +++ b/libs/gralloc/types/tests/Android.bp @@ -14,15 +14,6 @@ // limitations under the License. // -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "frameworks_native_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["frameworks_native_license"], -} - cc_test { name: "GrallocTypes_test", shared_libs: [ |