From d65b1ec47fe43fbc40682ccdf0ea840e51e20e7c Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 2 Jun 2016 14:15:36 -0400 Subject: [PATCH] P4 to Git Change 1275749 by wchau@wchau_WIN_OCL_HSA on 2016/06/02 13:38:16 SWDEV-89502 - [OCL] Support AMD DVR Core functionalities. Add OCL support for DOPP for desktop and present texture (OCL RT changes) Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#50 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h#11 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#25 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#316 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#124 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#403 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.hpp#16 edit --- opencl/api/opencl/amdocl/cl_gl.cpp | 12 +++ opencl/api/opencl/amdocl/cl_svm.cpp | 74 +++++++++++-------- .../khronos/headers/opencl1.2/CL/cl_ext.h | 3 + .../khronos/headers/opencl2.0/CL/cl_ext.h | 3 + .../khronos/headers/opencl2.1/CL/cl_ext.h | 3 + 5 files changed, 63 insertions(+), 32 deletions(-) diff --git a/opencl/api/opencl/amdocl/cl_gl.cpp b/opencl/api/opencl/amdocl/cl_gl.cpp index 6389d11971..2ab4014e58 100644 --- a/opencl/api/opencl/amdocl/cl_gl.cpp +++ b/opencl/api/opencl/amdocl/cl_gl.cpp @@ -24,6 +24,10 @@ #include "device/device.hpp" +/* The pixel internal format for DOPP texture defined in gl_enum.h */ +#define GL_BGR8_ATI 0x8083 +#define GL_BGRA8_ATI 0x8088 + #include #include @@ -1085,6 +1089,14 @@ CL_FLOAT switch(gliInternalFormat) { + case GL_BGR8_ATI: + case GL_BGRA8_ATI: + pclImageFormat->image_channel_order = CL_BGRA; + pclImageFormat->image_channel_data_type = CL_UNORM_INT8;//CL_UNSIGNED_INT8; + *piBytesPerPixel = 4; + bRetVal = true; + break; + case GL_ALPHA8: pclImageFormat->image_channel_order = CL_A; pclImageFormat->image_channel_data_type = CL_UNORM_INT8;//CL_UNSIGNED_INT8; diff --git a/opencl/api/opencl/amdocl/cl_svm.cpp b/opencl/api/opencl/amdocl/cl_svm.cpp index 241c6e2239..62fc51e980 100644 --- a/opencl/api/opencl/amdocl/cl_svm.cpp +++ b/opencl/api/opencl/amdocl/cl_svm.cpp @@ -1041,53 +1041,63 @@ RUNTIME_ENTRY(cl_int, clSetKernelExecInfo, ( return CL_INVALID_KERNEL; } - if (param_name != CL_KERNEL_EXEC_INFO_SVM_PTRS && - param_name != CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM) { - return CL_INVALID_VALUE; - } - if (param_value == NULL) { return CL_INVALID_VALUE; } const amd::Kernel* amdKernel = as_amd(kernel); - if (param_name == CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM) { + switch (param_name) { + case CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM: if (param_value_size != sizeof(cl_bool)) { return CL_INVALID_VALUE; } - - const bool flag = *(static_cast(param_value)); - const amd::Context* amdContext = &amdKernel->program().context(); - bool foundFineGrainedSystemDevice = false; - const std::vector& devices = amdContext->devices(); - std::vector::const_iterator it; - for (it = devices.begin(); it != devices.end(); ++it) { - if ((*it)->info().svmCapabilities_ & - CL_DEVICE_SVM_FINE_GRAIN_SYSTEM) { - foundFineGrainedSystemDevice = true; - break; - } + else { + const bool flag = *(static_cast(param_value)); + const amd::Context* amdContext = &amdKernel->program().context(); + bool foundFineGrainedSystemDevice = false; + const std::vector& devices = amdContext->devices(); + std::vector::const_iterator it; + for (it = devices.begin(); it != devices.end(); ++it) { + if ((*it)->info().svmCapabilities_ & + CL_DEVICE_SVM_FINE_GRAIN_SYSTEM) { + foundFineGrainedSystemDevice = true; + break; + } + } + if (flag && !foundFineGrainedSystemDevice) { + return CL_INVALID_OPERATION; + } + amdKernel->parameters().setSvmSystemPointersSupport(flag ? FGS_YES : FGS_NO); } - if (flag && !foundFineGrainedSystemDevice) { - return CL_INVALID_OPERATION; - } - amdKernel->parameters().setSvmSystemPointersSupport(flag ? FGS_YES : FGS_NO); - } - else { + break; + case CL_KERNEL_EXEC_INFO_SVM_PTRS: if (param_value_size == 0 || !amd::isMultipleOf(param_value_size, - sizeof(void*))) { + sizeof(void*))) { return CL_INVALID_VALUE; } - - size_t count = param_value_size/sizeof(void*); - void* const* execInfoArray = reinterpret_cast(param_value); - for (size_t i = 0; i < count; i++) { - if (NULL == execInfoArray[i]) { - return CL_INVALID_VALUE; + else { + size_t count = param_value_size/sizeof(void*); + void* const* execInfoArray = reinterpret_cast(param_value); + for (size_t i = 0; i < count; i++) { + if (NULL == execInfoArray[i]) { + return CL_INVALID_VALUE; + } } + amdKernel->parameters().addSvmPtr(execInfoArray, count); } - amdKernel->parameters().addSvmPtr(execInfoArray, count); + break; + case CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD: + if (param_value_size != sizeof(cl_bool)) { + return CL_INVALID_VALUE; + } + else { + const bool newVcopFlag = (*(reinterpret_cast(param_value))) ? true: false; + amdKernel->parameters().setExecNewVcop(newVcopFlag); + } + break; + default: + return CL_INVALID_VALUE; } return CL_SUCCESS; diff --git a/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h b/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h index 8d46a40c58..fbfd56e1f3 100644 --- a/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h +++ b/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h @@ -266,6 +266,9 @@ typedef cl_int (CL_CALLBACK * intercept_callback_fn)(cl_event, cl_int *); **************************/ #define CL_QUEUE_THREAD_HANDLE_AMD 0x403E +/* cl_kernel_exec_info for DVR DOPP texture support */ +#define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD 0x4120 + /*************************************** * cl-gl depth buffer interop extension * ****************************************/ diff --git a/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h b/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h index 5c90d688c3..8a9a773679 100644 --- a/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h +++ b/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h @@ -230,6 +230,9 @@ typedef cl_int (CL_CALLBACK * intercept_callback_fn)(cl_event, cl_int *); **************************/ #define CL_QUEUE_THREAD_HANDLE_AMD 0x403E +/* cl_kernel_exec_info for DVR DOPP texture support */ +#define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD 0x4120 + /*************************************** * cl-gl depth buffer interop extension * ****************************************/ diff --git a/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h b/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h index 139a22d002..9e73a69dda 100644 --- a/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h +++ b/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h @@ -229,6 +229,9 @@ typedef cl_int (CL_CALLBACK * intercept_callback_fn)(cl_event, cl_int *); **************************/ #define CL_QUEUE_THREAD_HANDLE_AMD 0x403E +/* cl_kernel_exec_info for DVR DOPP texture support */ +#define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD 0x4120 + /*************************************** * cl-gl depth buffer interop extension * ****************************************/