Loading renderscript/1.0/vts/functional/VtsCopyTests.cpp +18 −35 Original line number Diff line number Diff line Loading @@ -43,9 +43,7 @@ TEST_F(RenderscriptHidlTest, Simple1DCopyTest) { context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data); context->allocation1DRead(allocation, 0, 0, (uint32_t)dataOut.size(), (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float)); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } /* Loading Loading @@ -76,9 +74,7 @@ TEST_F(RenderscriptHidlTest, Simple2DCopyTest) { _data, 0); context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 128, 128, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } /* Loading Loading @@ -108,9 +104,7 @@ TEST_F(RenderscriptHidlTest, Simple3DCopyTest) { context->allocation3DWrite(allocation, 0, 0, 0, 0, 32, 32, 32, _data, 0); context->allocation3DRead(allocation, 0, 0, 0, 0, 32, 32, 32, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } /* Loading Loading @@ -139,18 +133,14 @@ TEST_F(RenderscriptHidlTest, SimpleBitmapTest) { AllocationMipmapControl::NONE, _data, (int)AllocationUsageType::SCRIPT); EXPECT_NE(allocation, Allocation(0)); EXPECT_NE(Allocation(0), allocation); context->allocationCopyToBitmap(allocation, (Ptr)dataOut1.data(), (Size)dataOut1.size()*sizeof(float)); bool same1 = std::all_of(dataOut1.begin(), dataOut1.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same1); EXPECT_EQ(dataIn, dataOut1); context->allocationRead(allocation, (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(float)); bool same2 = std::all_of(dataOut2.begin(), dataOut2.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same2); EXPECT_EQ(dataIn, dataOut2); } /* Loading Loading @@ -368,24 +358,20 @@ TEST_F(RenderscriptHidlTest, SimpleCubemapTest) { /* * This test creates a complex element type (uint8_t, uint32_t) out of known * elements. It then verifies the element structure was created correctly. * Finally, the test creates a 128-wide, 1-dimension allocation of this type * and transfers memory to and from this structure. * Finally, the test creates a 1-wide, 1-dimension allocation of this type * and transfers memory to and from a single cell of this Allocation. * * Calls: elementCreate, elementComplexCreate, elementGetSubElements, * typeCreate, allocationCreateTyped, allocationElementWrite, * allocationElementRead * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, ComplexElementTest) { Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1); Element element2 = context->elementCreate(DataType::UNSIGNED_32, DataKind::USER, false, 1); hidl_vec<Element> eins = {element1, element2}; hidl_vec<hidl_string> names = {hidl_string("first"), hidl_string("second")}; hidl_vec<Size> arraySizesPtr = {sizeof(uint8_t), sizeof(uint32_t)}; hidl_vec<Size> arraySizesPtr = {1, 1}; Element element3 = context->elementComplexCreate(eins, names, arraySizesPtr); EXPECT_NE(Element(0), element3); Loading @@ -400,28 +386,25 @@ TEST_F(RenderscriptHidlTest, ComplexElementTest) { namesOut.push_back(_names[1]); arraySizesOut = _arraySizes; }); EXPECT_NE(Element(0), ids[0]); EXPECT_NE(Element(0), ids[1]); EXPECT_EQ(element1, ids[0]); EXPECT_EQ(element2, ids[1]); EXPECT_EQ("first", namesOut[0]); EXPECT_EQ("second", namesOut[1]); EXPECT_EQ(sizeof(uint8_t), arraySizesOut[0]); EXPECT_EQ(sizeof(uint32_t), arraySizesOut[1]); EXPECT_EQ(Size(1), arraySizesOut[0]); EXPECT_EQ(Size(1), arraySizesOut[1]); // 128 x (uint8_t, uint32_t) Type type = context->typeCreate(element3, 128, 0, 0, false, false, YuvFormat::YUV_NONE); // 128 x (uint8_t, uint32_t) // 1 x (uint8_t, uint32_t) Type type = context->typeCreate(element3, 1, 0, 0, false, false, YuvFormat::YUV_NONE); // 1 x (uint8_t, uint32_t) Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)AllocationUsageType::SCRIPT, (Ptr)nullptr); std::vector<uint32_t> dataIn(128), dataOut(128); std::vector<uint32_t> dataIn(1), dataOut(1); std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; }); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t)); context->allocationElementWrite(allocation, 0, 0, 0, 0, _data, 1); context->allocationElementRead(allocation, 0, 0, 0, 0, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint32_t), 1); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](uint32_t x){ static uint32_t val = 0; return x == val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } */ renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h +21 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ using ::android::hardware::renderscript::V1_0::AllocationAdapter; using ::android::hardware::renderscript::V1_0::AllocationCubemapFace; using ::android::hardware::renderscript::V1_0::AllocationMipmapControl; using ::android::hardware::renderscript::V1_0::AllocationUsageType; using ::android::hardware::renderscript::V1_0::Closure; using ::android::hardware::renderscript::V1_0::IContext; using ::android::hardware::renderscript::V1_0::IDevice; using ::android::hardware::renderscript::V1_0::ContextType; Loading Loading @@ -62,7 +63,26 @@ using ::android::hardware::hidl_vec; using ::android::hardware::hidl_string; using ::android::sp; // bitcode variables // bitcode slots extern const int mExportVarIdx_var_int; extern const int mExportVarIdx_var_long; extern const int mExportVarIdx_var_float; extern const int mExportVarIdx_var_double; extern const int mExportVarIdx_var_allocation; extern const int mExportVarIdx_var_uint32_t; extern const int mExportVarIdx_var_point2; extern const int mExportVarIdx_var_int_ptr; // bitcode invoke slots //extern const int mExportForEachIdx_root; extern const int mExportForEachIdx_increment; // bitcode reduce slots extern const int mExportReduceIdx_summation; // bitcode invoke slots extern const int mExportFuncIdx_function; extern const int mExportFuncIdx_functionV; extern const int mExportFuncIdx_setBuffer; extern const int mExportFuncIdx_setAllocation; // bitcode typedef signed char int8_t; extern const int8_t bitCode[]; extern const int bitCodeLength; Loading renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp +51 −42 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include "VtsHalRenderscriptV1_0TargetTest.h" #include <system/window.h> /* * ContextCreateAndDestroy: Loading Loading @@ -81,7 +82,7 @@ TEST_F(RenderscriptHidlTest, MetadataTest) { elementMetadata = _metadata; }); EXPECT_EQ(DataType::FLOAT_32, (DataType)elementMetadata[0]); EXPECT_EQ(DataKind::USER, (DataKind)elementMetadata[1]); EXPECT_EQ(false, ((uint32_t)elementMetadata[2] == 1) ? true : false); EXPECT_EQ(false, elementMetadata[2]); EXPECT_EQ(1u, (uint32_t)elementMetadata[3]); EXPECT_EQ(0u, (uint32_t)elementMetadata[4]); Loading Loading @@ -134,21 +135,17 @@ TEST_F(RenderscriptHidlTest, ResizeTest) { * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite, * allocationGetNativeWindow, allocationSetNativeWindow, allocationIoSend, * allocationIoReceive, allocation2DRead * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, NativeWindowIoTest) { // uint8x4 Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4); // 512 x 512 x uint8x4 Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE); std::vector<uint32_t> dataIn(512*512), dataOut(512*512); std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (uint32_t)val++; }); std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; }); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t)); // 512 x 512 x float1 // 512 x 512 x uint8x4 Allocation allocationRecv = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_INPUT), Loading @@ -157,21 +154,20 @@ TEST_F(RenderscriptHidlTest, NativeWindowIoTest) { (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_OUTPUT), (Ptr)nullptr); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); NativeWindow nativeWindow = context->allocationGetNativeWindow(allocationRecv); EXPECT_NE(NativeWindow(0), nativeWindow); ((ANativeWindow *)nativeWindow)->incStrong(nullptr); context->allocationSetNativeWindow(allocationSend, nativeWindow); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); context->allocationIoSend(allocationSend); context->allocationIoReceive(allocationRecv); context->allocation2DRead(allocationRecv, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint32_t), 0); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](uint32_t x){ static int val = 0; return x == (uint32_t)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } */ /* * Three allocations are created, two with IO_INPUT and one with IO_OUTPUT. The Loading @@ -180,21 +176,17 @@ TEST_F(RenderscriptHidlTest, NativeWindowIoTest) { * Calls: elementCreate, typeCreate, allocationCreateTyped, * allocationCreateFromBitmap, allocationSetupBufferQueue, * allocationShareBufferQueue * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, BufferQueueTest) { // float1 Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1); // 512 x 512 x float1 // uint8x4 Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4); // 512 x 512 x uint8x4 Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE); std::vector<float> dataIn(512*512), dataOut1(512*512), dataOut2(512*512); std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; }); std::vector<uint32_t> dataIn(512*512), dataOut1(512*512), dataOut2(512*512); std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; }); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float)); // 512 x 512 x float1 _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t)); // 512 x 512 x uint8x4 Allocation allocationRecv1 = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_INPUT), Loading @@ -203,16 +195,37 @@ TEST_F(RenderscriptHidlTest, BufferQueueTest) { (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_INPUT), (Ptr)nullptr); Allocation allocationSend = context->allocationCreateFromBitmap(type, AllocationMipmapControl::NONE, _data, Allocation allocationSend = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_OUTPUT)); | AllocationUsageType::IO_INPUT), (Ptr)nullptr); context->allocationSetupBufferQueue(allocationRecv1, 2); context->allocationShareBufferQueue(allocationRecv1, allocationRecv2); // TODO: test the buffer queue context->allocationShareBufferQueue(allocationRecv2, allocationRecv1); NativeWindow nativeWindow1 = context->allocationGetNativeWindow(allocationRecv1); EXPECT_NE(NativeWindow(0), nativeWindow1); NativeWindow nativeWindow2 = context->allocationGetNativeWindow(allocationRecv2); EXPECT_EQ(nativeWindow2, nativeWindow1); ((ANativeWindow *)nativeWindow1)->incStrong(nullptr); context->allocationSetNativeWindow(allocationSend, nativeWindow1); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); context->allocationIoSend(allocationSend); context->allocationIoReceive(allocationRecv1); context->allocation2DRead(allocationRecv1, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, (Ptr)dataOut1.data(), (Size)dataOut1.size()*sizeof(uint32_t), 0); EXPECT_EQ(dataIn, dataOut1); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); context->allocationIoSend(allocationSend); context->allocationIoReceive(allocationRecv2); context->allocation2DRead(allocationRecv2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(uint32_t), 0); EXPECT_EQ(dataIn, dataOut2); } */ /* * This test sets up the message queue, sends a message, peeks at the message, Loading @@ -220,33 +233,29 @@ TEST_F(RenderscriptHidlTest, BufferQueueTest) { * * Calls: contextInitToClient, contextSendMessage, contextPeekMessage, * contextGetMessage, contextDeinitToClient, contextLog * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, ContextMessageTest) { context->contextInitToClient(); std::string messageOut = "correct"; const char * message = "correct"; std::vector<char> messageSend(message, message + sizeof(message)); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)const_cast<char*>(messageOut.c_str()), messageOut.length()); _data.setToExternal((uint8_t*)messageSend.data(), messageSend.size()); context->contextSendMessage(0, _data); MessageToClientType messageType; size_t size; uint32_t subID; context->contextPeekMessage([&](MessageToClientType _type, Size _size, uint32_t _subID){ messageType = _type; size = (uint32_t)_size; subID = _subID; }); std::vector<char> messageIn(size, '\0'); context->contextGetMessage(messageIn.data(), messageIn.size(), std::vector<char> messageRecv(size, '\0'); context->contextGetMessage(messageRecv.data(), messageRecv.size(), [&](MessageToClientType _type, Size _size){ messageType = _type; size = (uint32_t)_size; }); EXPECT_EQ(messageOut, messageIn.data()); EXPECT_EQ(messageSend, messageRecv); context->contextDeinitToClient(); context->contextLog(); } */ /* * Call through a bunch of APIs and make sure they don’t crash. Assign the name Loading Loading
renderscript/1.0/vts/functional/VtsCopyTests.cpp +18 −35 Original line number Diff line number Diff line Loading @@ -43,9 +43,7 @@ TEST_F(RenderscriptHidlTest, Simple1DCopyTest) { context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data); context->allocation1DRead(allocation, 0, 0, (uint32_t)dataOut.size(), (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float)); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } /* Loading Loading @@ -76,9 +74,7 @@ TEST_F(RenderscriptHidlTest, Simple2DCopyTest) { _data, 0); context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 128, 128, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } /* Loading Loading @@ -108,9 +104,7 @@ TEST_F(RenderscriptHidlTest, Simple3DCopyTest) { context->allocation3DWrite(allocation, 0, 0, 0, 0, 32, 32, 32, _data, 0); context->allocation3DRead(allocation, 0, 0, 0, 0, 32, 32, 32, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } /* Loading Loading @@ -139,18 +133,14 @@ TEST_F(RenderscriptHidlTest, SimpleBitmapTest) { AllocationMipmapControl::NONE, _data, (int)AllocationUsageType::SCRIPT); EXPECT_NE(allocation, Allocation(0)); EXPECT_NE(Allocation(0), allocation); context->allocationCopyToBitmap(allocation, (Ptr)dataOut1.data(), (Size)dataOut1.size()*sizeof(float)); bool same1 = std::all_of(dataOut1.begin(), dataOut1.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same1); EXPECT_EQ(dataIn, dataOut1); context->allocationRead(allocation, (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(float)); bool same2 = std::all_of(dataOut2.begin(), dataOut2.end(), [](float x){ static int val = 0; return x == (float)val++; }); EXPECT_EQ(true, same2); EXPECT_EQ(dataIn, dataOut2); } /* Loading Loading @@ -368,24 +358,20 @@ TEST_F(RenderscriptHidlTest, SimpleCubemapTest) { /* * This test creates a complex element type (uint8_t, uint32_t) out of known * elements. It then verifies the element structure was created correctly. * Finally, the test creates a 128-wide, 1-dimension allocation of this type * and transfers memory to and from this structure. * Finally, the test creates a 1-wide, 1-dimension allocation of this type * and transfers memory to and from a single cell of this Allocation. * * Calls: elementCreate, elementComplexCreate, elementGetSubElements, * typeCreate, allocationCreateTyped, allocationElementWrite, * allocationElementRead * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, ComplexElementTest) { Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1); Element element2 = context->elementCreate(DataType::UNSIGNED_32, DataKind::USER, false, 1); hidl_vec<Element> eins = {element1, element2}; hidl_vec<hidl_string> names = {hidl_string("first"), hidl_string("second")}; hidl_vec<Size> arraySizesPtr = {sizeof(uint8_t), sizeof(uint32_t)}; hidl_vec<Size> arraySizesPtr = {1, 1}; Element element3 = context->elementComplexCreate(eins, names, arraySizesPtr); EXPECT_NE(Element(0), element3); Loading @@ -400,28 +386,25 @@ TEST_F(RenderscriptHidlTest, ComplexElementTest) { namesOut.push_back(_names[1]); arraySizesOut = _arraySizes; }); EXPECT_NE(Element(0), ids[0]); EXPECT_NE(Element(0), ids[1]); EXPECT_EQ(element1, ids[0]); EXPECT_EQ(element2, ids[1]); EXPECT_EQ("first", namesOut[0]); EXPECT_EQ("second", namesOut[1]); EXPECT_EQ(sizeof(uint8_t), arraySizesOut[0]); EXPECT_EQ(sizeof(uint32_t), arraySizesOut[1]); EXPECT_EQ(Size(1), arraySizesOut[0]); EXPECT_EQ(Size(1), arraySizesOut[1]); // 128 x (uint8_t, uint32_t) Type type = context->typeCreate(element3, 128, 0, 0, false, false, YuvFormat::YUV_NONE); // 128 x (uint8_t, uint32_t) // 1 x (uint8_t, uint32_t) Type type = context->typeCreate(element3, 1, 0, 0, false, false, YuvFormat::YUV_NONE); // 1 x (uint8_t, uint32_t) Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)AllocationUsageType::SCRIPT, (Ptr)nullptr); std::vector<uint32_t> dataIn(128), dataOut(128); std::vector<uint32_t> dataIn(1), dataOut(1); std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; }); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t)); context->allocationElementWrite(allocation, 0, 0, 0, 0, _data, 1); context->allocationElementRead(allocation, 0, 0, 0, 0, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint32_t), 1); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](uint32_t x){ static uint32_t val = 0; return x == val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } */
renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h +21 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ using ::android::hardware::renderscript::V1_0::AllocationAdapter; using ::android::hardware::renderscript::V1_0::AllocationCubemapFace; using ::android::hardware::renderscript::V1_0::AllocationMipmapControl; using ::android::hardware::renderscript::V1_0::AllocationUsageType; using ::android::hardware::renderscript::V1_0::Closure; using ::android::hardware::renderscript::V1_0::IContext; using ::android::hardware::renderscript::V1_0::IDevice; using ::android::hardware::renderscript::V1_0::ContextType; Loading Loading @@ -62,7 +63,26 @@ using ::android::hardware::hidl_vec; using ::android::hardware::hidl_string; using ::android::sp; // bitcode variables // bitcode slots extern const int mExportVarIdx_var_int; extern const int mExportVarIdx_var_long; extern const int mExportVarIdx_var_float; extern const int mExportVarIdx_var_double; extern const int mExportVarIdx_var_allocation; extern const int mExportVarIdx_var_uint32_t; extern const int mExportVarIdx_var_point2; extern const int mExportVarIdx_var_int_ptr; // bitcode invoke slots //extern const int mExportForEachIdx_root; extern const int mExportForEachIdx_increment; // bitcode reduce slots extern const int mExportReduceIdx_summation; // bitcode invoke slots extern const int mExportFuncIdx_function; extern const int mExportFuncIdx_functionV; extern const int mExportFuncIdx_setBuffer; extern const int mExportFuncIdx_setAllocation; // bitcode typedef signed char int8_t; extern const int8_t bitCode[]; extern const int bitCodeLength; Loading
renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp +51 −42 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include "VtsHalRenderscriptV1_0TargetTest.h" #include <system/window.h> /* * ContextCreateAndDestroy: Loading Loading @@ -81,7 +82,7 @@ TEST_F(RenderscriptHidlTest, MetadataTest) { elementMetadata = _metadata; }); EXPECT_EQ(DataType::FLOAT_32, (DataType)elementMetadata[0]); EXPECT_EQ(DataKind::USER, (DataKind)elementMetadata[1]); EXPECT_EQ(false, ((uint32_t)elementMetadata[2] == 1) ? true : false); EXPECT_EQ(false, elementMetadata[2]); EXPECT_EQ(1u, (uint32_t)elementMetadata[3]); EXPECT_EQ(0u, (uint32_t)elementMetadata[4]); Loading Loading @@ -134,21 +135,17 @@ TEST_F(RenderscriptHidlTest, ResizeTest) { * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite, * allocationGetNativeWindow, allocationSetNativeWindow, allocationIoSend, * allocationIoReceive, allocation2DRead * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, NativeWindowIoTest) { // uint8x4 Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4); // 512 x 512 x uint8x4 Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE); std::vector<uint32_t> dataIn(512*512), dataOut(512*512); std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (uint32_t)val++; }); std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; }); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t)); // 512 x 512 x float1 // 512 x 512 x uint8x4 Allocation allocationRecv = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_INPUT), Loading @@ -157,21 +154,20 @@ TEST_F(RenderscriptHidlTest, NativeWindowIoTest) { (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_OUTPUT), (Ptr)nullptr); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); NativeWindow nativeWindow = context->allocationGetNativeWindow(allocationRecv); EXPECT_NE(NativeWindow(0), nativeWindow); ((ANativeWindow *)nativeWindow)->incStrong(nullptr); context->allocationSetNativeWindow(allocationSend, nativeWindow); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); context->allocationIoSend(allocationSend); context->allocationIoReceive(allocationRecv); context->allocation2DRead(allocationRecv, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint32_t), 0); bool same = std::all_of(dataOut.begin(), dataOut.end(), [](uint32_t x){ static int val = 0; return x == (uint32_t)val++; }); EXPECT_EQ(true, same); EXPECT_EQ(dataIn, dataOut); } */ /* * Three allocations are created, two with IO_INPUT and one with IO_OUTPUT. The Loading @@ -180,21 +176,17 @@ TEST_F(RenderscriptHidlTest, NativeWindowIoTest) { * Calls: elementCreate, typeCreate, allocationCreateTyped, * allocationCreateFromBitmap, allocationSetupBufferQueue, * allocationShareBufferQueue * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, BufferQueueTest) { // float1 Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1); // 512 x 512 x float1 // uint8x4 Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4); // 512 x 512 x uint8x4 Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE); std::vector<float> dataIn(512*512), dataOut1(512*512), dataOut2(512*512); std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; }); std::vector<uint32_t> dataIn(512*512), dataOut1(512*512), dataOut2(512*512); std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; }); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float)); // 512 x 512 x float1 _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t)); // 512 x 512 x uint8x4 Allocation allocationRecv1 = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_INPUT), Loading @@ -203,16 +195,37 @@ TEST_F(RenderscriptHidlTest, BufferQueueTest) { (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_INPUT), (Ptr)nullptr); Allocation allocationSend = context->allocationCreateFromBitmap(type, AllocationMipmapControl::NONE, _data, Allocation allocationSend = context->allocationCreateTyped(type, AllocationMipmapControl::NONE, (int)(AllocationUsageType::SCRIPT | AllocationUsageType::IO_OUTPUT)); | AllocationUsageType::IO_INPUT), (Ptr)nullptr); context->allocationSetupBufferQueue(allocationRecv1, 2); context->allocationShareBufferQueue(allocationRecv1, allocationRecv2); // TODO: test the buffer queue context->allocationShareBufferQueue(allocationRecv2, allocationRecv1); NativeWindow nativeWindow1 = context->allocationGetNativeWindow(allocationRecv1); EXPECT_NE(NativeWindow(0), nativeWindow1); NativeWindow nativeWindow2 = context->allocationGetNativeWindow(allocationRecv2); EXPECT_EQ(nativeWindow2, nativeWindow1); ((ANativeWindow *)nativeWindow1)->incStrong(nullptr); context->allocationSetNativeWindow(allocationSend, nativeWindow1); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); context->allocationIoSend(allocationSend); context->allocationIoReceive(allocationRecv1); context->allocation2DRead(allocationRecv1, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, (Ptr)dataOut1.data(), (Size)dataOut1.size()*sizeof(uint32_t), 0); EXPECT_EQ(dataIn, dataOut1); context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, _data, 0); context->allocationIoSend(allocationSend); context->allocationIoReceive(allocationRecv2); context->allocation2DRead(allocationRecv2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512, (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(uint32_t), 0); EXPECT_EQ(dataIn, dataOut2); } */ /* * This test sets up the message queue, sends a message, peeks at the message, Loading @@ -220,33 +233,29 @@ TEST_F(RenderscriptHidlTest, BufferQueueTest) { * * Calls: contextInitToClient, contextSendMessage, contextPeekMessage, * contextGetMessage, contextDeinitToClient, contextLog * * This test currently has a bug, and should be fixed by 3/17. * TODO(butlermichael) */ /* TEST_F(RenderscriptHidlTest, ContextMessageTest) { context->contextInitToClient(); std::string messageOut = "correct"; const char * message = "correct"; std::vector<char> messageSend(message, message + sizeof(message)); hidl_vec<uint8_t> _data; _data.setToExternal((uint8_t*)const_cast<char*>(messageOut.c_str()), messageOut.length()); _data.setToExternal((uint8_t*)messageSend.data(), messageSend.size()); context->contextSendMessage(0, _data); MessageToClientType messageType; size_t size; uint32_t subID; context->contextPeekMessage([&](MessageToClientType _type, Size _size, uint32_t _subID){ messageType = _type; size = (uint32_t)_size; subID = _subID; }); std::vector<char> messageIn(size, '\0'); context->contextGetMessage(messageIn.data(), messageIn.size(), std::vector<char> messageRecv(size, '\0'); context->contextGetMessage(messageRecv.data(), messageRecv.size(), [&](MessageToClientType _type, Size _size){ messageType = _type; size = (uint32_t)_size; }); EXPECT_EQ(messageOut, messageIn.data()); EXPECT_EQ(messageSend, messageRecv); context->contextDeinitToClient(); context->contextLog(); } */ /* * Call through a bunch of APIs and make sure they don’t crash. Assign the name Loading