1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
18 #define VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
19 
20 #define LOG_TAG "renderscript_hidl_hal_test"
21 #include <android-base/logging.h>
22 
23 #include <android/hardware/renderscript/1.0/IContext.h>
24 #include <android/hardware/renderscript/1.0/IDevice.h>
25 #include <android/hardware/renderscript/1.0/types.h>
26 
27 #include <VtsHalHidlTargetTestBase.h>
28 #include <gtest/gtest.h>
29 
30 using ::android::hardware::renderscript::V1_0::Allocation;
31 using ::android::hardware::renderscript::V1_0::AllocationAdapter;
32 using ::android::hardware::renderscript::V1_0::AllocationCubemapFace;
33 using ::android::hardware::renderscript::V1_0::AllocationMipmapControl;
34 using ::android::hardware::renderscript::V1_0::AllocationUsageType;
35 using ::android::hardware::renderscript::V1_0::Closure;
36 using ::android::hardware::renderscript::V1_0::IContext;
37 using ::android::hardware::renderscript::V1_0::IDevice;
38 using ::android::hardware::renderscript::V1_0::ContextType;
39 using ::android::hardware::renderscript::V1_0::DataType;
40 using ::android::hardware::renderscript::V1_0::DataKind;
41 using ::android::hardware::renderscript::V1_0::Element;
42 using ::android::hardware::renderscript::V1_0::MessageToClientType;
43 using ::android::hardware::renderscript::V1_0::NativeWindow;
44 using ::android::hardware::renderscript::V1_0::ObjectBase;
45 using ::android::hardware::renderscript::V1_0::OpaqueHandle;
46 using ::android::hardware::renderscript::V1_0::Ptr;
47 using ::android::hardware::renderscript::V1_0::Sampler;
48 using ::android::hardware::renderscript::V1_0::SamplerValue;
49 using ::android::hardware::renderscript::V1_0::Script;
50 using ::android::hardware::renderscript::V1_0::ScriptFieldID;
51 using ::android::hardware::renderscript::V1_0::ScriptGroup;
52 using ::android::hardware::renderscript::V1_0::ScriptGroup2;
53 using ::android::hardware::renderscript::V1_0::ScriptIntrinsicID;
54 using ::android::hardware::renderscript::V1_0::ScriptInvokeID;
55 using ::android::hardware::renderscript::V1_0::ScriptKernelID;
56 using ::android::hardware::renderscript::V1_0::Size;
57 using ::android::hardware::renderscript::V1_0::ThreadPriorities;
58 using ::android::hardware::renderscript::V1_0::Type;
59 using ::android::hardware::renderscript::V1_0::YuvFormat;
60 using ::android::hardware::Return;
61 using ::android::hardware::Void;
62 using ::android::hardware::hidl_vec;
63 using ::android::hardware::hidl_string;
64 using ::android::sp;
65 
66 // bitcode slots
67 extern const int mExportVarIdx_var_int;
68 extern const int mExportVarIdx_var_long;
69 extern const int mExportVarIdx_var_float;
70 extern const int mExportVarIdx_var_double;
71 extern const int mExportVarIdx_var_allocation;
72 extern const int mExportVarIdx_var_uint32_t;
73 extern const int mExportVarIdx_var_point2;
74 extern const int mExportVarIdx_var_int_ptr;
75 // bitcode invoke slots
76 //extern const int mExportForEachIdx_root;
77 extern const int mExportForEachIdx_increment;
78 // bitcode reduce slots
79 extern const int mExportReduceIdx_summation;
80 // bitcode invoke slots
81 extern const int mExportFuncIdx_function;
82 extern const int mExportFuncIdx_functionV;
83 extern const int mExportFuncIdx_setBuffer;
84 extern const int mExportFuncIdx_setAllocation;
85 // bitcode
86 typedef signed char int8_t;
87 extern const int8_t bitCode[];
88 extern const int bitCodeLength;
89 
90 // The main test class for RENDERSCRIPT HIDL HAL.
91 class RenderscriptHidlTest : public ::testing::VtsHalHidlTargetTestBase {
92 public:
93     virtual void SetUp() override;
94     virtual void TearDown() override;
95 
96     sp<IContext>   context;
97 
98 private:
99     sp<IDevice>    device;
100 };
101 
102 #endif // VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
103