SWDEV-530767 ocltst GL test work with GL context on 2nd GPU (#324)

Change-Id: Ia3dbc661b3b9b1de71a632969707318f208131cd
Этот коммит содержится в:
Xie, AlexBin
2025-06-27 12:25:23 -04:00
коммит произвёл GitHub
родитель 592c25e936
Коммит ef26fcdbd2
3 изменённых файлов: 19 добавлений и 2 удалений
+3 -1
Просмотреть файл
@@ -24,7 +24,7 @@
#include <cstring>
void OCLGLCommon::open(unsigned int test, char *units, double &conversion,
unsigned int deviceId) {
unsigned int &deviceId) {
// OpenCL Initialization
OCLTestImp::open(test, units, conversion, deviceId);
CHECK_RESULT((error_ != CL_SUCCESS), "Error opening test (%d)", error_);
@@ -51,6 +51,8 @@ void OCLGLCommon::open(unsigned int test, char *units, double &conversion,
CHECK_RESULT((retVal == CL_SUCCESS), "Error opening test (%d)", error_);
createCLContextFromGLContext(hGL_);
// Device id may change to match the GL context. Return the id to caller
deviceId = _deviceId;
}
bool OCLGLCommon::IsGLEnabled(unsigned int test, char *units,
+1 -1
Просмотреть файл
@@ -45,7 +45,7 @@ class OCLGLCommon : public OCLTestImp {
// virtual interface //
///////////////////////
virtual void open(unsigned int test, char* units, double& conversion,
unsigned int deviceId);
unsigned int &deviceId);
virtual unsigned int close(void);
static void gluPerspective(double fovy, double aspect, double zNear,
double zFar);
+15
Просмотреть файл
@@ -169,6 +169,21 @@ bool OCLGLCommon::checkAssociationDeviceWithGLContext(OCLGLHandle& hGL) {
}
}
// If the current device id does not work for CL GL interop,
// fall back to other devices.
if (!ret) {
for (unsigned int i = 0; i < numDevices; i++) {
for (unsigned int j = 0; j < deviceCount_; j++) {
if (interopDevices[i] == devices_[j]) {
// Found an OpenCL device work with current GL context.
_deviceId = j;
ret = true;
break;
}
}
}
}
free(interopDevices);
return ret;
}