diff --git a/hipamd/vdi/hip_surface.cpp b/hipamd/vdi/hip_surface.cpp index 0cfa5ed8c0..5adaf418cf 100644 --- a/hipamd/vdi/hip_surface.cpp +++ b/hipamd/vdi/hip_surface.cpp @@ -23,72 +23,15 @@ #include "hip_internal.hpp" #include -namespace hip { - -static amd::Monitor surfaceLock("Guards surface objects"); - -struct hipSurface { - hipSurface(const hipResourceDesc* pResDesc): array(nullptr) - { - memcpy(&resDesc, pResDesc, sizeof(hipResourceDesc)); - } - - hipArray* array; - hipResourceDesc resDesc; -}; - -static std::unordered_map surfaceHash; - -}; - -using namespace hip; - hipError_t hipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject, const hipResourceDesc* pResDesc) { - HIP_INIT_API(NONE, pSurfObject, pResDesc); + HIP_INIT_API(hipCreateSurfaceObject, pSurfObject, pResDesc); - hipSurface* pSurface = new hipSurface(pResDesc); - assert(pSurface != nullptr); - - switch (pResDesc->resType) { - case hipResourceTypeArray: - pSurface->array = pResDesc->res.array.array; - break; - default: - break; - } - hipSurfaceObject_t surfObj; - hipError_t err = hipMalloc(reinterpret_cast(&surfObj), sizeof(hipArray)); - if (err != hipSuccess) { - delete pSurface; - HIP_RETURN(hipErrorOutOfMemory); - } - err = hipMemcpy(reinterpret_cast(surfObj), reinterpret_cast(pResDesc->res.array.array), sizeof(hipArray), - hipMemcpyHostToDevice); - if (err != hipSuccess) { - delete pSurface; - hipFree(reinterpret_cast(surfObj)); - HIP_RETURN(err); - } - *pSurfObject = surfObj; - - amd::ScopedLock lock(surfaceLock); - surfaceHash[*pSurfObject] = pSurface; - - HIP_RETURN(hipSuccess); + HIP_RETURN(hipErrorNotSupported); } - hipError_t hipDestroySurfaceObject(hipSurfaceObject_t surfaceObject) { - HIP_INIT_API(NONE, surfaceObject); + HIP_INIT_API(hipDestroySurfaceObject, surfaceObject); - amd::ScopedLock lock(surfaceLock); - hipSurface* pSurface = surfaceHash[surfaceObject]; - if (pSurface != nullptr) { - delete pSurface; - surfaceHash.erase(surfaceObject); - HIP_RETURN(hipFree(reinterpret_cast(surfaceObject))); - } - - HIP_RETURN(hipErrorInvalidValue); + HIP_RETURN(hipErrorNotSupported); }