client: When comparing ATI model names from OpenCL and IOKit on a Mac, substitute "AMD" for "ATI"

svn path=/trunk/boinc/; revision=25422
This commit is contained in:
Charlie Fenton 2012-03-14 09:05:10 +00:00
parent 6286e4d9db
commit 2919c802cd
2 changed files with 33 additions and 4 deletions

View File

@ -2620,3 +2620,11 @@ Charlie 14 Mar 2012
locale/fr/ locale/fr/
BOINC_Manager.po BOINC_Manager.po
Charlie 14 Mar 2012
- client: When comparing ATI model names from OpenCL and IOKit on a
Mac, substitute "AMD" for "ATI" because sometimes one API returns
"ATI" but the other API returns "AMD".
client/
coproc_detect.cpp

View File

@ -1603,6 +1603,8 @@ void COPROCS::get_ati_mem_size_from_opengl() {
int ati_gpu_index = 0; int ati_gpu_index = 0;
GLint rendererIDs[32]; GLint rendererIDs[32];
CFDataRef modelName[32]; CFDataRef modelName[32];
char opencl_name[1024], iokit_name[1024];
char *p;
if (log_flags.coproc_debug) { if (log_flags.coproc_debug) {
@ -1679,15 +1681,26 @@ void COPROCS::get_ati_mem_size_from_opengl() {
ati_opencls[ati_gpu_index].global_mem_size = deviceVRAM; ati_opencls[ati_gpu_index].global_mem_size = deviceVRAM;
if (log_flags.coproc_debug) { if (log_flags.coproc_debug) {
// For some GPUs, one API returns "ATI" but the other API returns
// "AMD" in the model name, so we normalize both to "AMD"
strlcpy(opencl_name, ati_opencls[ati_gpu_index].name, sizeof(opencl_name));
if ((p = strstr(opencl_name, "ATI")) != NULL) {
*++p='M';
*++p='D';
}
for (j=0; j<32; j++) { for (j=0; j<32; j++) {
if ((rendererID == rendererIDs[j]) && (modelName[j] != NULL)) { if ((rendererID == rendererIDs[j]) && (modelName[j] != NULL)) {
break; break;
} }
} }
if (j < 32) { if (j < 32) {
if (strcmp((char *)CFDataGetBytePtr(modelName[j]), strlcpy(iokit_name, (char *)CFDataGetBytePtr(modelName[j]), sizeof(iokit_name));
ati_opencls[ati_gpu_index].name) if ((p = strstr(iokit_name, "ATI")) != NULL) {
) { *++p='M';
*++p='D';
}
if (strcmp(iokit_name, opencl_name)) {
msg_printf(0, MSG_INFO, msg_printf(0, MSG_INFO,
"[coproc] get_ati_mem_size_from_opengl model name mismatch: %s vs %s\n", "[coproc] get_ati_mem_size_from_opengl model name mismatch: %s vs %s\n",
ati_opencls[ati_gpu_index].name, (char *)CFDataGetBytePtr(modelName[j]) ati_opencls[ati_gpu_index].name, (char *)CFDataGetBytePtr(modelName[j])
@ -1696,8 +1709,16 @@ void COPROCS::get_ati_mem_size_from_opengl() {
} else { } else {
// Could not get model name from IOKit, so use renderer name // Could not get model name from IOKit, so use renderer name
const GLubyte * strRend = glGetString (GL_RENDERER); const GLubyte * strRend = glGetString (GL_RENDERER);
if (strRend != NULL) {
strlcpy(iokit_name, (char *)strRend, sizeof(iokit_name));
if ((p = strstr(iokit_name, "ATI")) != NULL) {
*++p='M';
*++p='D';
}
}
if ((strRend == NULL) || if ((strRend == NULL) ||
(!strstr((char *)strRend, ati_opencls[ati_gpu_index].name))) { (!strstr(iokit_name, opencl_name))) {
msg_printf(0, MSG_INFO, msg_printf(0, MSG_INFO,
"[coproc] get_ati_mem_size_from_opengl model name to renderer mismatch: %s vs %s\n", "[coproc] get_ati_mem_size_from_opengl model name to renderer mismatch: %s vs %s\n",
strRend, ati_opencls[ati_gpu_index].name strRend, ati_opencls[ati_gpu_index].name