static int process_config_file_attributes(const Options *op, const char *file, ParsedAttributeWrapper *w, const char *display_name, CtrlSystemList *systems) { int i; NvVerbosity old_verbosity = nv_get_verbosity(); /* Override the verbosity in the default behavior so * nvidia-settings isn't so alarmist when loading the RC file. */ if (__dynamic_verbosity) { nv_set_verbosity(NV_VERBOSITY_NONE); } /* * make sure that all ParsedAttributes have displays (this will do * nothing if we already have a display name */ for (i = 0; w[i].line != -1; i++) { nv_assign_default_display(&w[i].a, display_name); } /* connect to all the systems referenced in the config file */ for (i = 0; w[i].line != -1; i++) { w[i].system = NvCtrlConnectToSystem(w[i].a.display, systems); } /* now process each attribute, passing in the correct system */ for (i = 0; w[i].line != -1; i++) { nv_process_parsed_attribute(op, &w[i].a, w[i].system, NV_TRUE, NV_FALSE, "on line %d of configuration file " "'%s'", w[i].line, file); /* * We do not fail if processing the attribute failed. If the * GPU or the X config changed (for example stereo is * disabled), some attributes written in the config file may * not be advertised by the NVCTRL extension (for example the * control to force stereo) */ } /* Reset the default verbosity */ if (__dynamic_verbosity) { nv_set_verbosity(old_verbosity); } return NV_TRUE; } /* process_config_file_attributes() */
static int process_config_file_attributes(const char *file, ParsedAttributeWrapper *w, const char *display_name) { int i, j, ret, found, n = 0; CtrlHandles **h = NULL; /* * make sure that all ParsedAttributes have displays (this will do * nothing if we already have a display name */ for (i = 0; w[i].line != -1; i++) { nv_assign_default_display(&w[i].a, display_name); } /* build the list of CtrlHandles */ for (i = 0; w[i].line != -1; i++) { found = NV_FALSE; for (j = 0; j < n; j++) { if (nv_strcasecmp(h[j]->display, w[i].a.display)) { w[i].h = h[j]; found = NV_TRUE; break; } } /* * no handle found for this display, need to create a new * handle. * * XXX we should really just build a list of what ctrl_handles * we need, and what attributes on which ctrl_handles, so that * we don't have to pass NV_CTRL_ATTRIBUTES_ALL_SUBSYSTEMS to * NvCtrlAttributeInit (done in nv_alloc_ctrl_handles()) * unless we really need it. */ if (!found) { h = realloc(h, sizeof(CtrlHandles *) * (n + 1)); h[n] = nv_alloc_ctrl_handles(w[i].a.display); w[i].h = h[n]; n++; } } /* now process each attribute, passing in the correct CtrlHandles */ for (i = 0; w[i].line != -1; i++) { ret = nv_process_parsed_attribute(&w[i].a, w[i].h, NV_TRUE, NV_FALSE, "on line %d of configuration file " "'%s'", w[i].line, file); /* * We do not fail if processing the attribute failed. If the * GPU or the X config changed (for example stereo is * disabled), some attributes written in the config file may * not be advertised by the the NVCTRL extension (for example * the control to force stereo) */ } /* free all the CtrlHandles we allocated */ for (i = 0; i < n; i++) { nv_free_ctrl_handles(h[i]); } if (h) free(h); return NV_TRUE; } /* process_config_file_attributes() */