SWDEV-530767 ocltst GL test work with GL context on 2nd GPU (#324)
Change-Id: Ia3dbc661b3b9b1de71a632969707318f208131cd
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
void OCLGLCommon::open(unsigned int test, char *units, double &conversion,
|
void OCLGLCommon::open(unsigned int test, char *units, double &conversion,
|
||||||
unsigned int deviceId) {
|
unsigned int &deviceId) {
|
||||||
// OpenCL Initialization
|
// OpenCL Initialization
|
||||||
OCLTestImp::open(test, units, conversion, deviceId);
|
OCLTestImp::open(test, units, conversion, deviceId);
|
||||||
CHECK_RESULT((error_ != CL_SUCCESS), "Error opening test (%d)", error_);
|
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_);
|
CHECK_RESULT((retVal == CL_SUCCESS), "Error opening test (%d)", error_);
|
||||||
|
|
||||||
createCLContextFromGLContext(hGL_);
|
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,
|
bool OCLGLCommon::IsGLEnabled(unsigned int test, char *units,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class OCLGLCommon : public OCLTestImp {
|
|||||||
// virtual interface //
|
// virtual interface //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
virtual void open(unsigned int test, char* units, double& conversion,
|
virtual void open(unsigned int test, char* units, double& conversion,
|
||||||
unsigned int deviceId);
|
unsigned int &deviceId);
|
||||||
virtual unsigned int close(void);
|
virtual unsigned int close(void);
|
||||||
static void gluPerspective(double fovy, double aspect, double zNear,
|
static void gluPerspective(double fovy, double aspect, double zNear,
|
||||||
double zFar);
|
double zFar);
|
||||||
|
|||||||
@@ -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);
|
free(interopDevices);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user