mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Test that R_8 can be allocated if it's supported
Bug: 209458105 Test: atest VtsHalGraphicsMapperV4_0TargetTest (this) Change-Id: I927393bf9e4186d400e8b7cc0758095ec00ef13f
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <aidl/android/hardware/graphics/common/PixelFormat.h>
|
||||
#include <aidl/android/hardware/graphics/common/PlaneLayoutComponentType.h>
|
||||
|
||||
#include <android-base/logging.h>
|
||||
@@ -1204,6 +1205,40 @@ TEST_P(GraphicsMapperHidlTest, IsSupportedY16) {
|
||||
ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IMapper::isSupported with optional format R_8
|
||||
*/
|
||||
TEST_P(GraphicsMapperHidlTest, IsSupportedR8) {
|
||||
auto info = mDummyDescriptorInfo;
|
||||
info.format = static_cast<android::hardware::graphics::common::V1_2::PixelFormat>(
|
||||
aidl::android::hardware::graphics::common::PixelFormat::R_8);
|
||||
bool supported = false;
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info));
|
||||
|
||||
if (!supported) {
|
||||
GTEST_SUCCEED() << "R_8 is optional; unsupported so skipping allocation test";
|
||||
return;
|
||||
}
|
||||
|
||||
BufferDescriptor descriptor;
|
||||
ASSERT_NO_FATAL_FAILURE(descriptor = mGralloc->createDescriptor(info));
|
||||
|
||||
constexpr uint32_t count = 1;
|
||||
std::vector<const native_handle_t*> bufferHandles;
|
||||
uint32_t stride;
|
||||
ASSERT_NO_FATAL_FAILURE(bufferHandles =
|
||||
mGralloc->allocate(descriptor, count, false,
|
||||
Tolerance::kToleranceStrict, &stride));
|
||||
|
||||
EXPECT_LE(info.width, stride) << "invalid buffer stride";
|
||||
EXPECT_EQ(1u, bufferHandles.size());
|
||||
|
||||
for (auto bufferHandle : bufferHandles) {
|
||||
mGralloc->freeBuffer(bufferHandle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test IMapper::get(BufferId)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user