blob: b7dbed4c018eee28887ae821a83d1fbbf0384a6d [file] [log] [blame]
Michael Butler2d4d6d92017-03-01 15:32:30 -08001/*
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
Dan Shibc404e62019-12-11 10:23:03 -080017#pragma once
Michael Butler2d4d6d92017-03-01 15:32:30 -080018
19#define LOG_TAG "renderscript_hidl_hal_test"
20#include <android-base/logging.h>
21
22#include <android/hardware/renderscript/1.0/IContext.h>
23#include <android/hardware/renderscript/1.0/IDevice.h>
24#include <android/hardware/renderscript/1.0/types.h>
25
Michael Butler2d4d6d92017-03-01 15:32:30 -080026#include <gtest/gtest.h>
Dan Shibc404e62019-12-11 10:23:03 -080027#include <hidl/GtestPrinter.h>
28#include <hidl/ServiceManagement.h>
Michael Butler2d4d6d92017-03-01 15:32:30 -080029
30using ::android::hardware::renderscript::V1_0::Allocation;
31using ::android::hardware::renderscript::V1_0::AllocationAdapter;
32using ::android::hardware::renderscript::V1_0::AllocationCubemapFace;
33using ::android::hardware::renderscript::V1_0::AllocationMipmapControl;
34using ::android::hardware::renderscript::V1_0::AllocationUsageType;
Michael Butler54fa8d42017-03-17 13:02:53 -070035using ::android::hardware::renderscript::V1_0::Closure;
Michael Butler2d4d6d92017-03-01 15:32:30 -080036using ::android::hardware::renderscript::V1_0::IContext;
37using ::android::hardware::renderscript::V1_0::IDevice;
38using ::android::hardware::renderscript::V1_0::ContextType;
39using ::android::hardware::renderscript::V1_0::DataType;
40using ::android::hardware::renderscript::V1_0::DataKind;
41using ::android::hardware::renderscript::V1_0::Element;
42using ::android::hardware::renderscript::V1_0::MessageToClientType;
43using ::android::hardware::renderscript::V1_0::NativeWindow;
44using ::android::hardware::renderscript::V1_0::ObjectBase;
45using ::android::hardware::renderscript::V1_0::OpaqueHandle;
46using ::android::hardware::renderscript::V1_0::Ptr;
47using ::android::hardware::renderscript::V1_0::Sampler;
48using ::android::hardware::renderscript::V1_0::SamplerValue;
49using ::android::hardware::renderscript::V1_0::Script;
50using ::android::hardware::renderscript::V1_0::ScriptFieldID;
51using ::android::hardware::renderscript::V1_0::ScriptGroup;
52using ::android::hardware::renderscript::V1_0::ScriptGroup2;
53using ::android::hardware::renderscript::V1_0::ScriptIntrinsicID;
54using ::android::hardware::renderscript::V1_0::ScriptInvokeID;
55using ::android::hardware::renderscript::V1_0::ScriptKernelID;
56using ::android::hardware::renderscript::V1_0::Size;
57using ::android::hardware::renderscript::V1_0::ThreadPriorities;
58using ::android::hardware::renderscript::V1_0::Type;
59using ::android::hardware::renderscript::V1_0::YuvFormat;
60using ::android::hardware::Return;
61using ::android::hardware::Void;
62using ::android::hardware::hidl_vec;
63using ::android::hardware::hidl_string;
64using ::android::sp;
65
Michael Butler54fa8d42017-03-17 13:02:53 -070066// bitcode slots
67extern const int mExportVarIdx_var_int;
68extern const int mExportVarIdx_var_long;
69extern const int mExportVarIdx_var_float;
70extern const int mExportVarIdx_var_double;
71extern const int mExportVarIdx_var_allocation;
72extern const int mExportVarIdx_var_uint32_t;
73extern const int mExportVarIdx_var_point2;
74extern const int mExportVarIdx_var_int_ptr;
75// bitcode invoke slots
76//extern const int mExportForEachIdx_root;
77extern const int mExportForEachIdx_increment;
78// bitcode reduce slots
79extern const int mExportReduceIdx_summation;
80// bitcode invoke slots
81extern const int mExportFuncIdx_function;
82extern const int mExportFuncIdx_functionV;
83extern const int mExportFuncIdx_setBuffer;
84extern const int mExportFuncIdx_setAllocation;
85// bitcode
Michael Butler2d4d6d92017-03-01 15:32:30 -080086typedef signed char int8_t;
87extern const int8_t bitCode[];
88extern const int bitCodeLength;
89
90// The main test class for RENDERSCRIPT HIDL HAL.
Dan Shibc404e62019-12-11 10:23:03 -080091class RenderscriptHidlTest : public ::testing::TestWithParam<std::string> {
92 public:
Michael Butler2d4d6d92017-03-01 15:32:30 -080093 virtual void SetUp() override;
94 virtual void TearDown() override;
95
96 sp<IContext> context;
97
98private:
99 sp<IDevice> device;
100};