Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdd83456 authored by Miao Wang's avatar Miao Wang
Browse files

[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
parent f94eb06d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -18,4 +18,11 @@ cc_library_shared {
        "libutils",
        "android.hardware.renderscript@1.0",
    ],

    product_variables: {
        override_rs_driver: {
            cflags: ["-DOVERRIDE_RS_DRIVER=%s"],
        },
    },

}
+13 −1
Original line number Diff line number Diff line
@@ -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);
}


+41 −24
Original line number Diff line number Diff line
@@ -51,18 +51,30 @@ dispatchTable loadHAL() {
        .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"),
        .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"),
@@ -71,15 +83,18 @@ dispatchTable loadHAL() {
        .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"),
        .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"),
        .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"),
@@ -95,7 +110,8 @@ dispatchTable loadHAL() {
        .ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"),
        .ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate"),
        .ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"),
        .ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"),
        .ElementGetSubElements =
            (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"),
        .GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName"),
        .InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"),
        .ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy"),
@@ -111,7 +127,8 @@ dispatchTable loadHAL() {
        .ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"),
        .ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"),
        .ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"),
        .ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"),
        .ScriptIntrinsicCreate =
            (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"),
        .ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke"),
        .ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"),
        .ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV"),