summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Morell <rmorell@nvidia.com>2018-02-05 10:21:49 -0800
committerAaron Plattner <aplattner@nvidia.com>2018-04-11 14:17:31 -0700
commite68451dd0aefbeed58fb033dadc3759755d82ebb (patch)
treed1650fdd39e1b34cb102597f2e309a450bab8217
parent23e948876e00282dad064a0d064e202e72a6ba6e (diff)
nvidia-settings: Don't query target relationships for nonexistent targets
Currently, nvidia-settings will ask the X driver about the relationships between every type of target it knows about unconditionally. When support for Canoas targets in the X driver was removed (including the NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU attribute), this caused nvidia-settings to trigger a BadMatch error and abort (on GTK2) or print an error about failing to query relationships between targets (on GTK3). This change updates nvidia-settings to not bother to query for relationships for a target when no such targets exist in the system. In addition to fixing the BadMatch described above, it should reduce the startup latency due to fewer server round-trips in the common case.
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributesUtils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesUtils.c b/src/libXNVCtrlAttributes/NvCtrlAttributesUtils.c
index d358543..f20108d 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributesUtils.c
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributesUtils.c
@@ -491,6 +491,12 @@ static void add_target_relationships(CtrlTarget *target,
int len;
int i;
+ /* If no targets of this type exist in the system, don't bother querying
+ * the server about relationships. */
+ if (target->system->targets[target_type] == NULL) {
+ return;
+ }
+
status = NvCtrlGetBinaryAttribute(target, 0, attr,
(unsigned char **)(&pData), &len);
if ((status != NvCtrlSuccess) || !pData) {