summaryrefslogtreecommitdiffstats
path: root/renderscript
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2017-05-16 15:36:54 -0700
committerMiao Wang <miaowang@google.com>2017-06-02 23:17:31 +0000
commit41d8a44280e95b593883b28c1c043b4d26e90a40 (patch)
tree11e77f390a743f0b2589fe472d17dedad91a88f1 /renderscript
parenta64eb7c6980130136b9e503e5fb7a4d943aa09c5 (diff)
downloadandroid_hardware_interfaces-41d8a44280e95b593883b28c1c043b4d26e90a40.tar.gz
android_hardware_interfaces-41d8a44280e95b593883b28c1c043b4d26e90a40.tar.bz2
android_hardware_interfaces-41d8a44280e95b593883b28c1c043b4d26e90a40.zip
[RenderScript] Use OVERRIDE_RS_DRIVER string in the default
implementation. Bug: 37035983 Test: mm Test: manually push to sailfish & angler, verify GPU driver successfully load, and tests are passing. Change-Id: Ic55c74228e7eae599702365c513009aa3454656b Merged-In: Ic55c74228e7eae599702365c513009aa3454656b
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.cpp189
3 files changed, 144 insertions, 66 deletions
diff --git a/renderscript/1.0/default/Android.bp b/renderscript/1.0/default/Android.bp
index 29b781e0d..823603ac6 100644
--- a/renderscript/1.0/default/Android.bp
+++ b/renderscript/1.0/default/Android.bp
@@ -19,4 +19,11 @@ cc_library_shared {
"android.hardware.renderscript@1.0",
"android.hidl.base@1.0",
],
+
+ product_variables: {
+ override_rs_driver: {
+ cflags: ["-DOVERRIDE_RS_DRIVER=%s"],
+ },
+ },
+
}
diff --git a/renderscript/1.0/default/Context.cpp b/renderscript/1.0/default/Context.cpp
index 389b6e7bc..fbfc6522c 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) {
uint32_t _sdkVersion = sdkVersion;
RsContextType _ct = static_cast<RsContextType>(ct);
int32_t _flags = flags;
- mContext = Device::getHal().ContextCreate(_dev, _version, _sdkVersion, _ct, _flags);
+ const char* driverName = nullptr;
+
+#ifdef OVERRIDE_RS_DRIVER
+#define XSTR(S) #S
+#define STR(S) XSTR(S)
+#define OVERRIDE_RS_DRIVER_STRING STR(OVERRIDE_RS_DRIVER)
+ static std::string driverString(OVERRIDE_RS_DRIVER_STRING);
+ driverName = driverString.c_str();
+#undef XSTR
+#undef STR
+#endif // OVERRIDE_RS_DRIVER
+ mContext = Device::getHal().ContextCreateVendor(_dev, _version, _sdkVersion,
+ _ct, _flags, driverName);
}
diff --git a/renderscript/1.0/default/Device.cpp b/renderscript/1.0/default/Device.cpp
index 86cf8ebb5..3aae06097 100644
--- a/renderscript/1.0/default/Device.cpp
+++ b/renderscript/1.0/default/Device.cpp
@@ -42,91 +42,150 @@ dispatchTable loadHAL() {
void* handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
dispatchTable dispatchHal = {
- .SetNativeLibDir = (SetNativeLibDirFnPtr)nullptr,
-
- .Allocation1DData = (Allocation1DDataFnPtr)dlsym(handle, "rsAllocation1DData"),
- .Allocation1DElementData = (Allocation1DElementDataFnPtr)nullptr,
- .Allocation1DRead = (Allocation1DReadFnPtr)dlsym(handle, "rsAllocation1DRead"),
- .Allocation2DData = (Allocation2DDataFnPtr)dlsym(handle, "rsAllocation2DData"),
- .Allocation2DRead = (Allocation2DReadFnPtr)dlsym(handle, "rsAllocation2DRead"),
- .Allocation3DData = (Allocation3DDataFnPtr)dlsym(handle, "rsAllocation3DData"),
- .Allocation3DRead = (Allocation3DReadFnPtr)dlsym(handle, "rsAllocation3DRead"),
- .AllocationAdapterCreate = (AllocationAdapterCreateFnPtr)dlsym(handle, "rsAllocationAdapterCreate"),
- .AllocationAdapterOffset = (AllocationAdapterOffsetFnPtr)dlsym(handle, "rsAllocationAdapterOffset"),
- .AllocationCopy2DRange = (AllocationCopy2DRangeFnPtr)dlsym(handle, "rsAllocationCopy2DRange"),
- .AllocationCopy3DRange = (AllocationCopy3DRangeFnPtr)dlsym(handle, "rsAllocationCopy3DRange"),
- .AllocationCopyToBitmap = (AllocationCopyToBitmapFnPtr)dlsym(handle, "rsAllocationCopyToBitmap"),
- .AllocationCreateFromBitmap = (AllocationCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCreateFromBitmap"),
- .AllocationCreateStrided = (AllocationCreateStridedFnPtr)dlsym(handle, "rsAllocationCreateStrided"),
- .AllocationCreateTyped = (AllocationCreateTypedFnPtr)dlsym(handle, "rsAllocationCreateTyped"),
- .AllocationCubeCreateFromBitmap = (AllocationCubeCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCubeCreateFromBitmap"),
- .AllocationElementData = (AllocationElementDataFnPtr)dlsym(handle, "rsAllocationElementData"),
- .AllocationElementRead = (AllocationElementReadFnPtr)dlsym(handle, "rsAllocationElementRead"),
- .AllocationGenerateMipmaps = (AllocationGenerateMipmapsFnPtr)dlsym(handle, "rsAllocationGenerateMipmaps"),
- .AllocationGetPointer = (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer"),
- .AllocationGetSurface = (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface"),
- .AllocationGetType = (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType"),
- .AllocationIoReceive = (AllocationIoReceiveFnPtr)dlsym(handle, "rsAllocationIoReceive"),
- .AllocationIoSend = (AllocationIoSendFnPtr)dlsym(handle, "rsAllocationIoSend"),
- .AllocationRead = (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead"),
- .AllocationResize1D = (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D"),
- .AllocationSetSurface = (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface"),
- .AllocationSetupBufferQueue = (AllocationSetupBufferQueueFnPtr)dlsym(handle, "rsAllocationSetupBufferQueue"),
- .AllocationShareBufferQueue = (AllocationShareBufferQueueFnPtr)dlsym(handle, "rsAllocationShareBufferQueue"),
- .AllocationSyncAll = (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll"),
+ .SetNativeLibDir = (SetNativeLibDirFnPtr) nullptr,
+
+ .Allocation1DData =
+ (Allocation1DDataFnPtr)dlsym(handle, "rsAllocation1DData"),
+ .Allocation1DElementData = (Allocation1DElementDataFnPtr) nullptr,
+ .Allocation1DRead =
+ (Allocation1DReadFnPtr)dlsym(handle, "rsAllocation1DRead"),
+ .Allocation2DData =
+ (Allocation2DDataFnPtr)dlsym(handle, "rsAllocation2DData"),
+ .Allocation2DRead =
+ (Allocation2DReadFnPtr)dlsym(handle, "rsAllocation2DRead"),
+ .Allocation3DData =
+ (Allocation3DDataFnPtr)dlsym(handle, "rsAllocation3DData"),
+ .Allocation3DRead =
+ (Allocation3DReadFnPtr)dlsym(handle, "rsAllocation3DRead"),
+ .AllocationAdapterCreate = (AllocationAdapterCreateFnPtr)dlsym(
+ handle, "rsAllocationAdapterCreate"),
+ .AllocationAdapterOffset = (AllocationAdapterOffsetFnPtr)dlsym(
+ handle, "rsAllocationAdapterOffset"),
+ .AllocationCopy2DRange = (AllocationCopy2DRangeFnPtr)dlsym(
+ handle, "rsAllocationCopy2DRange"),
+ .AllocationCopy3DRange = (AllocationCopy3DRangeFnPtr)dlsym(
+ handle, "rsAllocationCopy3DRange"),
+ .AllocationCopyToBitmap = (AllocationCopyToBitmapFnPtr)dlsym(
+ handle, "rsAllocationCopyToBitmap"),
+ .AllocationCreateFromBitmap = (AllocationCreateFromBitmapFnPtr)dlsym(
+ handle, "rsAllocationCreateFromBitmap"),
+ .AllocationCreateStrided = (AllocationCreateStridedFnPtr)dlsym(
+ handle, "rsAllocationCreateStrided"),
+ .AllocationCreateTyped = (AllocationCreateTypedFnPtr)dlsym(
+ handle, "rsAllocationCreateTyped"),
+ .AllocationCubeCreateFromBitmap =
+ (AllocationCubeCreateFromBitmapFnPtr)dlsym(
+ handle, "rsAllocationCubeCreateFromBitmap"),
+ .AllocationElementData = (AllocationElementDataFnPtr)dlsym(
+ handle, "rsAllocationElementData"),
+ .AllocationElementRead = (AllocationElementReadFnPtr)dlsym(
+ handle, "rsAllocationElementRead"),
+ .AllocationGenerateMipmaps = (AllocationGenerateMipmapsFnPtr)dlsym(
+ handle, "rsAllocationGenerateMipmaps"),
+ .AllocationGetPointer =
+ (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer"),
+ .AllocationGetSurface =
+ (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface"),
+ .AllocationGetType =
+ (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType"),
+ .AllocationIoReceive =
+ (AllocationIoReceiveFnPtr)dlsym(handle, "rsAllocationIoReceive"),
+ .AllocationIoSend =
+ (AllocationIoSendFnPtr)dlsym(handle, "rsAllocationIoSend"),
+ .AllocationRead =
+ (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead"),
+ .AllocationResize1D =
+ (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D"),
+ .AllocationSetSurface =
+ (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface"),
+ .AllocationSetupBufferQueue = (AllocationSetupBufferQueueFnPtr)dlsym(
+ handle, "rsAllocationSetupBufferQueue"),
+ .AllocationShareBufferQueue = (AllocationShareBufferQueueFnPtr)dlsym(
+ handle, "rsAllocationShareBufferQueue"),
+ .AllocationSyncAll =
+ (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll"),
.AssignName = (AssignNameFnPtr)dlsym(handle, "rsAssignName"),
.ClosureCreate = (ClosureCreateFnPtr)dlsym(handle, "rsClosureCreate"),
.ClosureSetArg = (ClosureSetArgFnPtr)dlsym(handle, "rsClosureSetArg"),
- .ClosureSetGlobal = (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal"),
- .ContextCreate = (ContextCreateFnPtr)dlsym(handle, "rsContextCreate"),
- .ContextDeinitToClient = (ContextDeinitToClientFnPtr)dlsym(handle, "rsContextDeinitToClient"),
- .ContextDestroy = (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy"),
+ .ClosureSetGlobal =
+ (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal"),
+ .ContextCreateVendor =
+ (ContextCreateVendorFnPtr)dlsym(handle, "rsContextCreateVendor"),
+ .ContextDeinitToClient = (ContextDeinitToClientFnPtr)dlsym(
+ handle, "rsContextDeinitToClient"),
+ .ContextDestroy =
+ (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy"),
.ContextDump = (ContextDumpFnPtr)dlsym(handle, "rsContextDump"),
.ContextFinish = (ContextFinishFnPtr)dlsym(handle, "rsContextFinish"),
- .ContextGetMessage = (ContextGetMessageFnPtr)dlsym(handle, "rsContextGetMessage"),
- .ContextInitToClient = (ContextInitToClientFnPtr)dlsym(handle, "rsContextInitToClient"),
- .ContextPeekMessage = (ContextPeekMessageFnPtr)dlsym(handle, "rsContextPeekMessage"),
- .ContextSendMessage = (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage"),
- .ContextSetCacheDir = (ContextSetCacheDirFnPtr)dlsym(handle, "rsContextSetCacheDir"),
- .ContextSetPriority = (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority"),
- .DeviceCreate = (DeviceCreateFnPtr)nullptr,
- .DeviceDestroy = (DeviceDestroyFnPtr)nullptr,
- .DeviceSetConfig = (DeviceSetConfigFnPtr)nullptr,
- .ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"),
+ .ContextGetMessage =
+ (ContextGetMessageFnPtr)dlsym(handle, "rsContextGetMessage"),
+ .ContextInitToClient =
+ (ContextInitToClientFnPtr)dlsym(handle, "rsContextInitToClient"),
+ .ContextPeekMessage =
+ (ContextPeekMessageFnPtr)dlsym(handle, "rsContextPeekMessage"),
+ .ContextSendMessage =
+ (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage"),
+ .ContextSetCacheDir =
+ (ContextSetCacheDirFnPtr)dlsym(handle, "rsContextSetCacheDir"),
+ .ContextSetPriority =
+ (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority"),
+ .DeviceCreate = (DeviceCreateFnPtr) nullptr,
+ .DeviceDestroy = (DeviceDestroyFnPtr) nullptr,
+ .DeviceSetConfig = (DeviceSetConfigFnPtr) nullptr,
+ .ElementCreate2 =
+ (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"),
.ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate"),
- .ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"),
- .ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"),
+ .ElementGetNativeData =
+ (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"),
+ .ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(
+ handle, "rsaElementGetSubElements"),
.GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName"),
- .InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"),
+ .InvokeClosureCreate =
+ (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"),
.ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy"),
.SamplerCreate = (SamplerCreateFnPtr)dlsym(handle, "rsSamplerCreate"),
- .ScriptBindAllocation = (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation"),
+ .ScriptBindAllocation =
+ (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation"),
.ScriptCCreate = (ScriptCCreateFnPtr)dlsym(handle, "rsScriptCCreate"),
- .ScriptFieldIDCreate = (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate"),
- .ScriptForEach = (ScriptForEachFnPtr)nullptr,
- .ScriptForEachMulti = (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti"),
+ .ScriptFieldIDCreate =
+ (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate"),
+ .ScriptForEach = (ScriptForEachFnPtr) nullptr,
+ .ScriptForEachMulti =
+ (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti"),
.ScriptGetVarV = (ScriptGetVarVFnPtr)dlsym(handle, "rsScriptGetVarV"),
- .ScriptGroup2Create = (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create"),
- .ScriptGroupCreate = (ScriptGroupCreateFnPtr)dlsym(handle, "rsScriptGroupCreate"),
- .ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"),
- .ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"),
- .ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"),
- .ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"),
+ .ScriptGroup2Create =
+ (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create"),
+ .ScriptGroupCreate =
+ (ScriptGroupCreateFnPtr)dlsym(handle, "rsScriptGroupCreate"),
+ .ScriptGroupExecute =
+ (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"),
+ .ScriptGroupSetInput =
+ (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"),
+ .ScriptGroupSetOutput =
+ (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"),
+ .ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(
+ handle, "rsScriptIntrinsicCreate"),
.ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke"),
- .ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"),
+ .ScriptInvokeIDCreate =
+ (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"),
.ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV"),
- .ScriptKernelIDCreate = (ScriptKernelIDCreateFnPtr)dlsym(handle, "rsScriptKernelIDCreate"),
+ .ScriptKernelIDCreate =
+ (ScriptKernelIDCreateFnPtr)dlsym(handle, "rsScriptKernelIDCreate"),
.ScriptReduce = (ScriptReduceFnPtr)dlsym(handle, "rsScriptReduce"),
- .ScriptSetTimeZone = (ScriptSetTimeZoneFnPtr)dlsym(handle, "rsScriptSetTimeZone"),
+ .ScriptSetTimeZone =
+ (ScriptSetTimeZoneFnPtr)dlsym(handle, "rsScriptSetTimeZone"),
.ScriptSetVarD = (ScriptSetVarDFnPtr)dlsym(handle, "rsScriptSetVarD"),
.ScriptSetVarF = (ScriptSetVarFFnPtr)dlsym(handle, "rsScriptSetVarF"),
.ScriptSetVarI = (ScriptSetVarIFnPtr)dlsym(handle, "rsScriptSetVarI"),
.ScriptSetVarJ = (ScriptSetVarJFnPtr)dlsym(handle, "rsScriptSetVarJ"),
- .ScriptSetVarObj = (ScriptSetVarObjFnPtr)dlsym(handle, "rsScriptSetVarObj"),
- .ScriptSetVarVE = (ScriptSetVarVEFnPtr)dlsym(handle, "rsScriptSetVarVE"),
+ .ScriptSetVarObj =
+ (ScriptSetVarObjFnPtr)dlsym(handle, "rsScriptSetVarObj"),
+ .ScriptSetVarVE =
+ (ScriptSetVarVEFnPtr)dlsym(handle, "rsScriptSetVarVE"),
.ScriptSetVarV = (ScriptSetVarVFnPtr)dlsym(handle, "rsScriptSetVarV"),
.TypeCreate = (TypeCreateFnPtr)dlsym(handle, "rsTypeCreate"),
- .TypeGetNativeData = (TypeGetNativeDataFnPtr)dlsym(handle, "rsaTypeGetNativeData"),
+ .TypeGetNativeData =
+ (TypeGetNativeDataFnPtr)dlsym(handle, "rsaTypeGetNativeData"),
};
return dispatchHal;