From 2703a2edee8d6a2b9ff0001d35a22999af520ef5 Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 14 Oct 2014 19:15:37 -0400 Subject: [PATCH] P4 to Git Change 1087490 by gandryey@gera-dev-w7 on 2014/10/14 19:07:04 EPR #403341 - [Regression][OCL] P2P SDI to GPU (RGBA) and P2P SDI to GPU (RGB) show corruption on sdi output - Enable GL Acquire/Release calls for more resource types. GL can enable color compression, but compute doesn't support it. Thus decompression can be required. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#194 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.h#41 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp#18 edit [ROCm/clr commit: b4f7a4274beaa9bd10833fbaa59d0799252658f8] --- .../rocclr/runtime/device/gpu/gpuresource.cpp | 22 ++---------- .../device/gpu/gslbe/src/rt/GSLDevice.h | 4 +-- .../device/gpu/gslbe/src/rt/GSLDeviceGL.cpp | 35 ++++++++++++++----- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp index 1c0fd10c3b..4b5cc14665 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp @@ -1446,17 +1446,8 @@ bool Resource::gslGLAcquire() { bool retVal = true; - if (cal()->type_ == OGLInterop) { - //release is required only for depth resources - switch ((int)cal()->format_) { - case CM_SURF_FMT_DEPTH24_STEN8: - case CM_SURF_FMT_DEPTH32F_X24_STEN8: - case CM_SURF_FMT_DEPTH32F: - case CM_SURF_FMT_DEPTH16: - retVal = dev().resGLAcquire(glPlatformContext_,glInteropMbRes_, glType_); - break; - } + retVal = dev().resGLAcquire(glPlatformContext_,glInteropMbRes_, glType_); } return retVal; } @@ -1465,17 +1456,8 @@ bool Resource::gslGLRelease() { bool retVal = true; - if (cal()->type_ == OGLInterop) { - //release is required only for depth resources - switch ((int)cal()->format_) { - case CM_SURF_FMT_DEPTH24_STEN8: - case CM_SURF_FMT_DEPTH32F_X24_STEN8: - case CM_SURF_FMT_DEPTH32F: - case CM_SURF_FMT_DEPTH16: - retVal = dev().resGLRelease(glPlatformContext_,glInteropMbRes_); - break; - } + retVal = dev().resGLRelease(glPlatformContext_,glInteropMbRes_, glType_); } return retVal; } diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h index 121f6c26cb..f9f911c94c 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h @@ -86,9 +86,9 @@ public: CALvoid* GLdeviceContext, gslMemObject mem, gslMemObject mem_base, CALvoid* mbResHandle, CALuint type) const; //! @brief Decompresses depth/MSAA surfaces.This function is called on every 'clEnqeueuAcquireGLObject'. - bool resGLAcquire( CALvoid* GLplatformContext,CALvoid* mbResHandle, CALuint type) const; + bool resGLAcquire( CALvoid* GLplatformContext, CALvoid* mbResHandle, CALuint type) const; //! @brief This function is called on every 'clEnqeueuReleaseGLObject'. - bool resGLRelease(CALvoid* GLplatformContext,CALvoid* mbResHandle) const; + bool resGLRelease(CALvoid* GLplatformContext, CALvoid* mbResHandle, CALuint type) const; gsl::gsAdaptor* getNative() const; CALuint getElfMachine() const { return m_elfmachine; }; diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp index 0dd86aa9b7..7f9d87eea7 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp @@ -761,20 +761,23 @@ CALGSLDevice::resGLAcquire(CALvoid* GLplatformContext, //! @note: GSL device isn't thread safe amd::ScopedLock k(gslDeviceOps()); - GLResource hRes; + GLResource hRes = {0}; osAssert(mbResHandle); hRes.mbResHandle = (GLuintp)mbResHandle; - switch(type) + switch(type) { case CAL_RES_GL_BUFFER_TYPE_TEXTURE: hRes.type = GL_RESOURCE_ATTACH_TEXTURE_AMD; - break; + break; case CAL_RES_GL_BUFFER_TYPE_RENDERBUFFER: hRes.type = GL_RESOURCE_ATTACH_RENDERBUFFER_AMD; break; - break; + case CAL_RES_GL_BUFFER_TYPE_VERTEXBUFFER: + hRes.type = GL_RESOURCE_ATTACH_VERTEXBUFFER_AMD; + break; default: - return false; + // @note: No acquire for GL_RESOURCE_ATTACH_FRAMEBUFFER_AMD + return true; } bool status = false; #ifdef ATI_OS_LINUX @@ -796,15 +799,31 @@ CALGSLDevice::resGLAcquire(CALvoid* GLplatformContext, bool CALGSLDevice::resGLRelease(CALvoid* GLplatformContext, - CALvoid* mbResHandle) const + CALvoid* mbResHandle, + CALuint type) const { //! @note: GSL device isn't thread safe amd::ScopedLock k(gslDeviceOps()); - GLResource hRes; + GLResource hRes = {0}; osAssert(mbResHandle); bool status = false; hRes.mbResHandle = (GLuintp)mbResHandle; + switch(type) + { + case CAL_RES_GL_BUFFER_TYPE_TEXTURE: + hRes.type = GL_RESOURCE_ATTACH_TEXTURE_AMD; + break; + case CAL_RES_GL_BUFFER_TYPE_RENDERBUFFER: + hRes.type = GL_RESOURCE_ATTACH_RENDERBUFFER_AMD; + break; + case CAL_RES_GL_BUFFER_TYPE_VERTEXBUFFER: + hRes.type = GL_RESOURCE_ATTACH_VERTEXBUFFER_AMD; + break; + default: + // @note: No release for GL_RESOURCE_ATTACH_FRAMEBUFFER_AMD + return true; + } #ifdef ATI_OS_LINUX //TODO : make sure the application GL context is current. if not no @@ -836,7 +855,7 @@ CALGSLDevice::resGLFree ( //! @note: GSL device isn't thread safe amd::ScopedLock k(gslDeviceOps()); - GLResource hRes; + GLResource hRes = {0}; osAssert(mbResHandle); hRes.mbResHandle = (GLuintp)mbResHandle;