From 3f986a00cda7b513c2847cc9ae4fc61f7a598fbe Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Thu, 13 Apr 2017 17:42:07 -0700 Subject: [PATCH] Added missing RenderScript HIDL API call to VTS test. ScriptGroupSetInput was never called, so it was added to the ScriptGroupTest. After this CL gets merged, all RenderScript HIDL API calls will be tested. Bug: 35915961 Test: mm on oc-dev, runs and passes on oc-dev Change-Id: I9153895ac55be757eef59e81837a9518fa9e85ab --- .../1.0/vts/functional/VtsScriptTests.cpp | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/renderscript/1.0/vts/functional/VtsScriptTests.cpp b/renderscript/1.0/vts/functional/VtsScriptTests.cpp index fed7c6eb92..8268dcce58 100644 --- a/renderscript/1.0/vts/functional/VtsScriptTests.cpp +++ b/renderscript/1.0/vts/functional/VtsScriptTests.cpp @@ -323,27 +323,30 @@ TEST_F(RenderscriptHidlTest, ScriptBindTest) { /* * This test groups together two RenderScript intrinsic kernels to run one after - * the other asynchronously with respect to the client. The test configures YuvToRGB(A) and Blur, - * and links them together such that Blur will execute after YuvToRGB(A) and use its result. The - * test checks the data returned to make sure it was changed after passing through the entire - * ScriptGroup. + * the other asynchronously with respect to the client. The test configures + * Blend and Blur, and links them together such that Blur will execute after + * Blend and use its result. The test checks the data returned to make sure it + * was changed after passing through the entire ScriptGroup. * * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite, * scriptIntrinsicCreate, scriptKernelIDCreate, scriptFieldIDCreate, - * scriptGroupCreate, scriptSetVarObj, scriptGroupSetOutput, scriptGroupExecute, - * contextFinish, allocation2DRead + * scriptGroupCreate, scriptGroupSetInput, scriptGroupSetOutput, + * scriptGroupExecute, contextFinish, allocation2DRead */ TEST_F(RenderscriptHidlTest, ScriptGroupTest) { - std::vector dataIn(256*256*1, 128), dataOut(256*256*4, 0), zeros(256*256*4, 0); + std::vector dataIn(256 * 256 * 4, 128), dataOut(256 * 256 * 4, 0), + zeros(256 * 256 * 4, 0); hidl_vec _dataIn, _dataOut; _dataIn.setToExternal(dataIn.data(), dataIn.size()); _dataOut.setToExternal(dataOut.data(), dataOut.size()); // 256 x 256 YUV pixels - Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_YUV, true, 1); + Element element1 = context->elementCreate(DataType::UNSIGNED_8, + DataKind::PIXEL_RGBA, true, 4); ASSERT_NE(Element(0), element1); - Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, YuvFormat::YUV_420_888); + Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, + YuvFormat::YUV_NONE); ASSERT_NE(Type(0), type1); Allocation allocation1 = context->allocationCreateTyped(type1, AllocationMipmapControl::NONE, @@ -370,11 +373,12 @@ TEST_F(RenderscriptHidlTest, ScriptGroupTest) { _dataOut, 0); // create scripts - Script yuv2rgb = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_YUV_TO_RGB, element1); - ASSERT_NE(Script(0), yuv2rgb); + Script blend = + context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLEND, element1); + ASSERT_NE(Script(0), blend); - ScriptKernelID yuv2rgbKID = context->scriptKernelIDCreate(yuv2rgb, 0, 2); - ASSERT_NE(ScriptKernelID(0), yuv2rgbKID); + ScriptKernelID blendKID = context->scriptKernelIDCreate(blend, 1, 3); + ASSERT_NE(ScriptKernelID(0), blendKID); Script blur = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLUR, element2); ASSERT_NE(Script(0), blur); @@ -386,15 +390,15 @@ TEST_F(RenderscriptHidlTest, ScriptGroupTest) { ASSERT_NE(ScriptFieldID(0), blurFID); // ScriptGroup - hidl_vec kernels = {yuv2rgbKID, blurKID}; - hidl_vec srcK = {yuv2rgbKID}; + hidl_vec kernels = {blendKID, blurKID}; + hidl_vec srcK = {blendKID}; hidl_vec dstK = {ScriptKernelID(0)}; hidl_vec dstF = {blurFID}; hidl_vec types = {type2}; ScriptGroup scriptGroup = context->scriptGroupCreate(kernels, srcK, dstK, dstF, types); ASSERT_NE(ScriptGroup(0), scriptGroup); - context->scriptSetVarObj(yuv2rgb, 0, (ObjectBase)allocation1); + context->scriptGroupSetInput(scriptGroup, blendKID, allocation1); context->scriptGroupSetOutput(scriptGroup, blurKID, allocation2); context->scriptGroupExecute(scriptGroup); context->contextFinish();