summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiao Wang2017-06-02 18:16:05 -0500
committerGerrit Code Review2017-06-02 18:16:07 -0500
commit292cddf6be7df898aa13bbdf3e7296524f12b5c9 (patch)
tree963c1a3520dee8ef82a1f31f105b33ae8721e3c3 /renderscript
parent0c49ae609f40494e5c58321b116787619424aeb3 (diff)
parentfdd834565cb5a506a842309b8e7cae71cdd41b5b (diff)
downloadplatform-hardware-interfaces-292cddf6be7df898aa13bbdf3e7296524f12b5c9.tar.gz
platform-hardware-interfaces-292cddf6be7df898aa13bbdf3e7296524f12b5c9.tar.xz
platform-hardware-interfaces-292cddf6be7df898aa13bbdf3e7296524f12b5c9.zip
Merge "[RenderScript] Use OVERRIDE_RS_DRIVER string in the default implementation."
Diffstat (limited to 'renderscript')
-rw-r--r--renderscript/1.0/default/Android.bp7
-rw-r--r--renderscript/1.0/default/Context.cpp14
-rw-r--r--renderscript/1.0/default/Device.cpp65
3 files changed, 61 insertions, 25 deletions
diff --git a/renderscript/1.0/default/Android.bp b/renderscript/1.0/default/Android.bp
index c4bd1b36..b9969697 100644
--- a/renderscript/1.0/default/Android.bp
+++ b/renderscript/1.0/default/Android.bp
@@ -18,4 +18,11 @@ cc_library_shared {
18 "libutils", 18 "libutils",
19 "android.hardware.renderscript@1.0", 19 "android.hardware.renderscript@1.0",
20 ], 20 ],
21
22 product_variables: {
23 override_rs_driver: {
24 cflags: ["-DOVERRIDE_RS_DRIVER=%s"],
25 },
26 },
27
21} 28}
diff --git a/renderscript/1.0/default/Context.cpp b/renderscript/1.0/default/Context.cpp
index 389b6e7b..c2d7507f 100644
--- a/renderscript/1.0/default/Context.cpp
+++ b/renderscript/1.0/default/Context.cpp
@@ -16,7 +16,19 @@ Context::Context(uint32_t sdkVersion, ContextType ct, int32_t flags) {
16 uint32_t _sdkVersion = sdkVersion; 16 uint32_t _sdkVersion = sdkVersion;
17 RsContextType _ct = static_cast<RsContextType>(ct); 17 RsContextType _ct = static_cast<RsContextType>(ct);
18 int32_t _flags = flags; 18 int32_t _flags = flags;
19 mContext = Device::getHal().ContextCreate(_dev, _version, _sdkVersion, _ct, _flags); 19 const char* driverName = nullptr;
20
21#ifdef OVERRIDE_RS_DRIVER
22#define XSTR(S) #S
23#define STR(S) XSTR(S)
24#define OVERRIDE_RS_DRIVER_STRING STR(OVERRIDE_RS_DRIVER)
25 static std::string driverString(OVERRIDE_RS_DRIVER_STRING);
26 driverName = driverString.c_str();
27#undef XSTR
28#undef STR
29#endif // OVERRIDE_RS_DRIVER
30 mContext =
31 Device::getHal().ContextCreateVendor(_dev, _version, _sdkVersion, _ct, _flags, driverName);
20} 32}
21 33
22 34
diff --git a/renderscript/1.0/default/Device.cpp b/renderscript/1.0/default/Device.cpp
index 86cf8ebb..406602e4 100644
--- a/renderscript/1.0/default/Device.cpp
+++ b/renderscript/1.0/default/Device.cpp
@@ -42,27 +42,39 @@ dispatchTable loadHAL() {
42 void* handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); 42 void* handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
43 43
44 dispatchTable dispatchHal = { 44 dispatchTable dispatchHal = {
45 .SetNativeLibDir = (SetNativeLibDirFnPtr)nullptr, 45 .SetNativeLibDir = (SetNativeLibDirFnPtr) nullptr,
46 46
47 .Allocation1DData = (Allocation1DDataFnPtr)dlsym(handle, "rsAllocation1DData"), 47 .Allocation1DData = (Allocation1DDataFnPtr)dlsym(handle, "rsAllocation1DData"),
48 .Allocation1DElementData = (Allocation1DElementDataFnPtr)nullptr, 48 .Allocation1DElementData = (Allocation1DElementDataFnPtr) nullptr,
49 .Allocation1DRead = (Allocation1DReadFnPtr)dlsym(handle, "rsAllocation1DRead"), 49 .Allocation1DRead = (Allocation1DReadFnPtr)dlsym(handle, "rsAllocation1DRead"),
50 .Allocation2DData = (Allocation2DDataFnPtr)dlsym(handle, "rsAllocation2DData"), 50 .Allocation2DData = (Allocation2DDataFnPtr)dlsym(handle, "rsAllocation2DData"),
51 .Allocation2DRead = (Allocation2DReadFnPtr)dlsym(handle, "rsAllocation2DRead"), 51 .Allocation2DRead = (Allocation2DReadFnPtr)dlsym(handle, "rsAllocation2DRead"),
52 .Allocation3DData = (Allocation3DDataFnPtr)dlsym(handle, "rsAllocation3DData"), 52 .Allocation3DData = (Allocation3DDataFnPtr)dlsym(handle, "rsAllocation3DData"),
53 .Allocation3DRead = (Allocation3DReadFnPtr)dlsym(handle, "rsAllocation3DRead"), 53 .Allocation3DRead = (Allocation3DReadFnPtr)dlsym(handle, "rsAllocation3DRead"),
54 .AllocationAdapterCreate = (AllocationAdapterCreateFnPtr)dlsym(handle, "rsAllocationAdapterCreate"), 54 .AllocationAdapterCreate =
55 .AllocationAdapterOffset = (AllocationAdapterOffsetFnPtr)dlsym(handle, "rsAllocationAdapterOffset"), 55 (AllocationAdapterCreateFnPtr)dlsym(handle, "rsAllocationAdapterCreate"),
56 .AllocationCopy2DRange = (AllocationCopy2DRangeFnPtr)dlsym(handle, "rsAllocationCopy2DRange"), 56 .AllocationAdapterOffset =
57 .AllocationCopy3DRange = (AllocationCopy3DRangeFnPtr)dlsym(handle, "rsAllocationCopy3DRange"), 57 (AllocationAdapterOffsetFnPtr)dlsym(handle, "rsAllocationAdapterOffset"),
58 .AllocationCopyToBitmap = (AllocationCopyToBitmapFnPtr)dlsym(handle, "rsAllocationCopyToBitmap"), 58 .AllocationCopy2DRange =
59 .AllocationCreateFromBitmap = (AllocationCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCreateFromBitmap"), 59 (AllocationCopy2DRangeFnPtr)dlsym(handle, "rsAllocationCopy2DRange"),
60 .AllocationCreateStrided = (AllocationCreateStridedFnPtr)dlsym(handle, "rsAllocationCreateStrided"), 60 .AllocationCopy3DRange =
61 .AllocationCreateTyped = (AllocationCreateTypedFnPtr)dlsym(handle, "rsAllocationCreateTyped"), 61 (AllocationCopy3DRangeFnPtr)dlsym(handle, "rsAllocationCopy3DRange"),
62 .AllocationCubeCreateFromBitmap = (AllocationCubeCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCubeCreateFromBitmap"), 62 .AllocationCopyToBitmap =
63 .AllocationElementData = (AllocationElementDataFnPtr)dlsym(handle, "rsAllocationElementData"), 63 (AllocationCopyToBitmapFnPtr)dlsym(handle, "rsAllocationCopyToBitmap"),
64 .AllocationElementRead = (AllocationElementReadFnPtr)dlsym(handle, "rsAllocationElementRead"), 64 .AllocationCreateFromBitmap =
65 .AllocationGenerateMipmaps = (AllocationGenerateMipmapsFnPtr)dlsym(handle, "rsAllocationGenerateMipmaps"), 65 (AllocationCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCreateFromBitmap"),
66 .AllocationCreateStrided =
67 (AllocationCreateStridedFnPtr)dlsym(handle, "rsAllocationCreateStrided"),
68 .AllocationCreateTyped =
69 (AllocationCreateTypedFnPtr)dlsym(handle, "rsAllocationCreateTyped"),
70 .AllocationCubeCreateFromBitmap =
71 (AllocationCubeCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCubeCreateFromBitmap"),
72 .AllocationElementData =
73 (AllocationElementDataFnPtr)dlsym(handle, "rsAllocationElementData"),
74 .AllocationElementRead =
75 (AllocationElementReadFnPtr)dlsym(handle, "rsAllocationElementRead"),
76 .AllocationGenerateMipmaps =
77 (AllocationGenerateMipmapsFnPtr)dlsym(handle, "rsAllocationGenerateMipmaps"),
66 .AllocationGetPointer = (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer"), 78 .AllocationGetPointer = (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer"),
67 .AllocationGetSurface = (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface"), 79 .AllocationGetSurface = (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface"),
68 .AllocationGetType = (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType"), 80 .AllocationGetType = (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType"),
@@ -71,15 +83,18 @@ dispatchTable loadHAL() {
71 .AllocationRead = (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead"), 83 .AllocationRead = (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead"),
72 .AllocationResize1D = (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D"), 84 .AllocationResize1D = (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D"),
73 .AllocationSetSurface = (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface"), 85 .AllocationSetSurface = (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface"),
74 .AllocationSetupBufferQueue = (AllocationSetupBufferQueueFnPtr)dlsym(handle, "rsAllocationSetupBufferQueue"), 86 .AllocationSetupBufferQueue =
75 .AllocationShareBufferQueue = (AllocationShareBufferQueueFnPtr)dlsym(handle, "rsAllocationShareBufferQueue"), 87 (AllocationSetupBufferQueueFnPtr)dlsym(handle, "rsAllocationSetupBufferQueue"),
88 .AllocationShareBufferQueue =
89 (AllocationShareBufferQueueFnPtr)dlsym(handle, "rsAllocationShareBufferQueue"),
76 .AllocationSyncAll = (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll"), 90 .AllocationSyncAll = (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll"),
77 .AssignName = (AssignNameFnPtr)dlsym(handle, "rsAssignName"), 91 .AssignName = (AssignNameFnPtr)dlsym(handle, "rsAssignName"),
78 .ClosureCreate = (ClosureCreateFnPtr)dlsym(handle, "rsClosureCreate"), 92 .ClosureCreate = (ClosureCreateFnPtr)dlsym(handle, "rsClosureCreate"),
79 .ClosureSetArg = (ClosureSetArgFnPtr)dlsym(handle, "rsClosureSetArg"), 93 .ClosureSetArg = (ClosureSetArgFnPtr)dlsym(handle, "rsClosureSetArg"),
80 .ClosureSetGlobal = (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal"), 94 .ClosureSetGlobal = (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal"),
81 .ContextCreate = (ContextCreateFnPtr)dlsym(handle, "rsContextCreate"), 95 .ContextCreateVendor = (ContextCreateVendorFnPtr)dlsym(handle, "rsContextCreateVendor"),
82 .ContextDeinitToClient = (ContextDeinitToClientFnPtr)dlsym(handle, "rsContextDeinitToClient"), 96 .ContextDeinitToClient =
97 (ContextDeinitToClientFnPtr)dlsym(handle, "rsContextDeinitToClient"),
83 .ContextDestroy = (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy"), 98 .ContextDestroy = (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy"),
84 .ContextDump = (ContextDumpFnPtr)dlsym(handle, "rsContextDump"), 99 .ContextDump = (ContextDumpFnPtr)dlsym(handle, "rsContextDump"),
85 .ContextFinish = (ContextFinishFnPtr)dlsym(handle, "rsContextFinish"), 100 .ContextFinish = (ContextFinishFnPtr)dlsym(handle, "rsContextFinish"),
@@ -89,13 +104,14 @@ dispatchTable loadHAL() {
89 .ContextSendMessage = (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage"), 104 .ContextSendMessage = (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage"),
90 .ContextSetCacheDir = (ContextSetCacheDirFnPtr)dlsym(handle, "rsContextSetCacheDir"), 105 .ContextSetCacheDir = (ContextSetCacheDirFnPtr)dlsym(handle, "rsContextSetCacheDir"),
91 .ContextSetPriority = (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority"), 106 .ContextSetPriority = (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority"),
92 .DeviceCreate = (DeviceCreateFnPtr)nullptr, 107 .DeviceCreate = (DeviceCreateFnPtr) nullptr,
93 .DeviceDestroy = (DeviceDestroyFnPtr)nullptr, 108 .DeviceDestroy = (DeviceDestroyFnPtr) nullptr,
94 .DeviceSetConfig = (DeviceSetConfigFnPtr)nullptr, 109 .DeviceSetConfig = (DeviceSetConfigFnPtr) nullptr,
95 .ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"), 110 .ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"),
96 .ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate"), 111 .ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate"),
97 .ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"), 112 .ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"),
98 .ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"), 113 .ElementGetSubElements =
114 (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"),
99 .GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName"), 115 .GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName"),
100 .InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"), 116 .InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"),
101 .ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy"), 117 .ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy"),
@@ -103,7 +119,7 @@ dispatchTable loadHAL() {
103 .ScriptBindAllocation = (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation"), 119 .ScriptBindAllocation = (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation"),
104 .ScriptCCreate = (ScriptCCreateFnPtr)dlsym(handle, "rsScriptCCreate"), 120 .ScriptCCreate = (ScriptCCreateFnPtr)dlsym(handle, "rsScriptCCreate"),
105 .ScriptFieldIDCreate = (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate"), 121 .ScriptFieldIDCreate = (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate"),
106 .ScriptForEach = (ScriptForEachFnPtr)nullptr, 122 .ScriptForEach = (ScriptForEachFnPtr) nullptr,
107 .ScriptForEachMulti = (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti"), 123 .ScriptForEachMulti = (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti"),
108 .ScriptGetVarV = (ScriptGetVarVFnPtr)dlsym(handle, "rsScriptGetVarV"), 124 .ScriptGetVarV = (ScriptGetVarVFnPtr)dlsym(handle, "rsScriptGetVarV"),
109 .ScriptGroup2Create = (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create"), 125 .ScriptGroup2Create = (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create"),
@@ -111,7 +127,8 @@ dispatchTable loadHAL() {
111 .ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"), 127 .ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"),
112 .ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"), 128 .ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"),
113 .ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"), 129 .ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"),
114 .ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"), 130 .ScriptIntrinsicCreate =
131 (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"),
115 .ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke"), 132 .ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke"),
116 .ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"), 133 .ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"),
117 .ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV"), 134 .ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV"),