1 /*
2  * Copyright (C) 2018 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 ANDROID_HARDWARE_RENDERSCRIPT_V1_0_DEVICE_H
18 #define ANDROID_HARDWARE_RENDERSCRIPT_V1_0_DEVICE_H
19 
20 #include "cpp/rsDispatch.h"
21 #include "dlfcn.h"
22 #include <android/hardware/renderscript/1.0/IDevice.h>
23 #include <hidl/MQDescriptor.h>
24 #include <hidl/Status.h>
25 
26 namespace android {
27 namespace hardware {
28 namespace renderscript {
29 namespace V1_0 {
30 namespace implementation {
31 
32 using ::android::hardware::renderscript::V1_0::ContextType;
33 using ::android::hardware::renderscript::V1_0::IContext;
34 using ::android::hardware::renderscript::V1_0::IDevice;
35 using ::android::hidl::base::V1_0::IBase;
36 using ::android::hardware::Return;
37 using ::android::sp;
38 
39 struct Device : public IDevice {
40     Device();
41     static dispatchTable& getHal();
42 
43     // Methods from ::android::hardware::renderscript::V1_0::IDevice follow.
44     Return<sp<IContext>> contextCreate(uint32_t sdkVersion, ContextType ct, int32_t flags) override;
45 
46     // Methods from ::android::hidl::base::V1_0::IBase follow.
47 
48  private:
49     static dispatchTable mDispatchHal;
50 };
51 
52 extern "C" IDevice* HIDL_FETCH_IDevice(const char* name);
53 
54 }  // namespace implementation
55 }  // namespace V1_0
56 }  // namespace renderscript
57 }  // namespace hardware
58 }  // namespace android
59 
60 #endif  // ANDROID_HARDWARE_RENDERSCRIPT_V1_0_DEVICE_H
61