summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2010-02-26 16:19:05 -0800
committerAaron Plattner <aplattner@nvidia.com>2010-02-26 16:19:05 -0800
commitb68cd854d2ef73e5f15cce11afed0e5872504dd7 (patch)
treebb3534e18f8d28cc6c0b7a3bd680ce75baa7b25a
parent7856cfbd4523191f87e2f41952f6ac88565a9142 (diff)
-rw-r--r--src/gtk+-2.x/ctkecc.c77
-rw-r--r--src/gtk+-2.x/ctkecc.h2
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributes.c62
-rw-r--r--src/parse.c2
4 files changed, 70 insertions, 73 deletions
diff --git a/src/gtk+-2.x/ctkecc.c b/src/gtk+-2.x/ctkecc.c
index 01c5f46..1207379 100644
--- a/src/gtk+-2.x/ctkecc.c
+++ b/src/gtk+-2.x/ctkecc.c
@@ -48,18 +48,10 @@ static const char *__ecc_status_help =
"Returns the current hardware ECC setting "
"for the targeted GPU.";
-static const char *__sbit_error_help =
-"Returns the number of single-bit ECC errors detected by "
-"the targeted GPU since the last POST.";
-
static const char *__dbit_error_help =
"Returns the number of double-bit ECC errors detected by "
"the targeted GPU since the last POST.";
-static const char *__aggregate_sbit_error_help =
-"Returns the number of single-bit ECC errors detected by the "
-"targeted GPU since the last counter reset.";
-
static const char *__aggregate_dbit_error_help =
"Returns the number of double-bit ECC errors detected by the "
"targeted GPU since the last counter reset.";
@@ -172,16 +164,6 @@ static gboolean update_ecc_info(gpointer user_data)
/* Query ECC Errors */
- if ( ctk_ecc->sbit_error ) {
- ret = NvCtrlGetAttribute64(ctk_ecc->handle,
- NV_CTRL_GPU_ECC_SINGLE_BIT_ERRORS,
- &val);
- if ( ret != NvCtrlSuccess ) {
- val = 0;
- }
- set_label_value(ctk_ecc->sbit_error, val);
- }
-
if ( ctk_ecc->dbit_error ) {
ret = NvCtrlGetAttribute64(ctk_ecc->handle,
NV_CTRL_GPU_ECC_DOUBLE_BIT_ERRORS,
@@ -192,16 +174,6 @@ static gboolean update_ecc_info(gpointer user_data)
set_label_value(ctk_ecc->dbit_error, val);
}
- if ( ctk_ecc->aggregate_sbit_error ) {
- ret = NvCtrlGetAttribute64(ctk_ecc->handle,
- NV_CTRL_GPU_ECC_AGGREGATE_SINGLE_BIT_ERRORS,
- &val);
- if ( ret != NvCtrlSuccess ) {
- val = 0;
- }
- set_label_value(ctk_ecc->aggregate_sbit_error, val);
- }
-
if ( ctk_ecc->aggregate_dbit_error ) {
ret = NvCtrlGetAttribute64(ctk_ecc->handle,
NV_CTRL_GPU_ECC_AGGREGATE_DOUBLE_BIT_ERRORS,
@@ -335,12 +307,12 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
CtkEcc *ctk_ecc;
GtkWidget *hbox, *hbox2, *vbox, *hsep, *hseparator, *table;
GtkWidget *banner, *label, *eventbox;
- int64_t sbit_error, dbit_error, aggregate_sbit_error;
+ int64_t dbit_error;
int64_t aggregate_dbit_error;
gint ecc_config_supported;
gint val, row = 0;
- gboolean sbit_error_available, dbit_error_available;
- gboolean aggregate_sbit_error_available, aggregate_dbit_error_available;
+ gboolean dbit_error_available;
+ gboolean aggregate_dbit_error_available;
gboolean ecc_enabled;
ReturnStatus ret;
gchar *ecc_enabled_string;
@@ -368,13 +340,11 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
ctk_ecc->handle = handle;
ctk_ecc->ctk_config = ctk_config;
- sbit_error_available = TRUE;
dbit_error_available = TRUE;
- aggregate_sbit_error_available = TRUE;
aggregate_dbit_error_available = TRUE;
- sbit_error = dbit_error = 0;
- aggregate_sbit_error = aggregate_dbit_error = 0;
+ dbit_error = 0;
+ aggregate_dbit_error = 0;
/* Query ECC Status */
@@ -391,24 +361,12 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
/* Query ECC errors */
- ret = NvCtrlGetAttribute64(handle, NV_CTRL_GPU_ECC_SINGLE_BIT_ERRORS,
- &sbit_error);
- if ( ret != NvCtrlSuccess ) {
- sbit_error_available = FALSE;
- }
-
ret = NvCtrlGetAttribute64(handle, NV_CTRL_GPU_ECC_DOUBLE_BIT_ERRORS,
&dbit_error);
if ( ret != NvCtrlSuccess ) {
dbit_error_available = FALSE;
}
ret = NvCtrlGetAttribute64(handle,
- NV_CTRL_GPU_ECC_AGGREGATE_SINGLE_BIT_ERRORS,
- &aggregate_sbit_error);
- if ( ret != NvCtrlSuccess ) {
- aggregate_sbit_error_available = FALSE;
- }
- ret = NvCtrlGetAttribute64(handle,
NV_CTRL_GPU_ECC_AGGREGATE_DOUBLE_BIT_ERRORS,
&aggregate_dbit_error);
if ( ret != NvCtrlSuccess ) {
@@ -474,12 +432,7 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
/* Add ECC Errors */
- if ( sbit_error_available && dbit_error_available ) {
- ctk_ecc->sbit_error =
- add_table_int_row(ctk_config, table, __sbit_error_help,
- "Single-bit ECC Errors:", sbit_error,
- row, ecc_enabled);
- row += 1;
+ if ( dbit_error_available ) {
ctk_ecc->dbit_error =
add_table_int_row(ctk_config, table, __dbit_error_help,
"Double-bit ECC Errors:", dbit_error,
@@ -487,13 +440,7 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
row += 3; // add vertical padding between rows
}
- if ( aggregate_sbit_error_available && aggregate_dbit_error_available ) {
- ctk_ecc->aggregate_sbit_error =
- add_table_int_row(ctk_config, table, __aggregate_sbit_error_help,
- "Aggregate Single-bit ECC Errors:",
- aggregate_sbit_error,
- row, ecc_enabled);
- row += 1;
+ if ( aggregate_dbit_error_available ) {
ctk_ecc->aggregate_dbit_error =
add_table_int_row(ctk_config, table, __aggregate_dbit_error_help,
"Aggregate Double-bit ECC Errors:",
@@ -530,7 +477,7 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
/* Add buttons */
- if ( sbit_error_available && dbit_error_available ) {
+ if ( dbit_error_available ) {
ctk_ecc->clear_button = gtk_button_new_with_label("Clear ECC Errors");
gtk_box_pack_end(GTK_BOX(hbox), ctk_ecc->clear_button, FALSE, FALSE, 0);
ctk_config_set_tooltip(ctk_config, ctk_ecc->clear_button,
@@ -541,7 +488,7 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
(gpointer) ctk_ecc);
}
- if ( aggregate_sbit_error_available && aggregate_dbit_error_available ) {
+ if ( aggregate_dbit_error_available ) {
ctk_ecc->clear_aggregate_button =
gtk_button_new_with_label("Clear Aggregate ECC Errors");
gtk_box_pack_end(GTK_BOX(hbox), ctk_ecc->clear_aggregate_button,
@@ -601,15 +548,9 @@ GtkTextBuffer *ctk_ecc_create_help(GtkTextTagTable *table,
ctk_help_heading(b, &i, "ECC");
ctk_help_para(b, &i, __ecc_status_help);
- ctk_help_heading(b, &i, "Single-bit ECC Errors");
- ctk_help_para(b, &i, __sbit_error_help);
-
ctk_help_heading(b, &i, "Double-bit ECC Errors");
ctk_help_para(b, &i, __dbit_error_help);
- ctk_help_heading(b, &i, "Aggregate Single-bit ECC Errors");
- ctk_help_para(b, &i, __aggregate_sbit_error_help);
-
ctk_help_heading(b, &i, "Aggregate Double-bit ECC Errors");
ctk_help_para(b, &i, __aggregate_dbit_error_help);
diff --git a/src/gtk+-2.x/ctkecc.h b/src/gtk+-2.x/ctkecc.h
index cd9086d..1b187bb 100644
--- a/src/gtk+-2.x/ctkecc.h
+++ b/src/gtk+-2.x/ctkecc.h
@@ -60,9 +60,7 @@ struct _CtkEcc
CtkConfig *ctk_config;
GtkWidget* status;
- GtkWidget* sbit_error;
GtkWidget* dbit_error;
- GtkWidget* aggregate_sbit_error;
GtkWidget* aggregate_dbit_error;
GtkWidget* ecc_config_supported;
GtkWidget* clear_button;
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributes.c b/src/libXNVCtrlAttributes/NvCtrlAttributes.c
index 682ad8f..a5602fe 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributes.c
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributes.c
@@ -696,6 +696,27 @@ NvCtrlGetValidDisplayAttributeValues(NvCtrlAttributeHandle *handle,
/*
+ * GetValidStringDisplayAttributeValuesExtraAttr() -fill the
+ * NVCTRLAttributeValidValuesRec strucure for extra string atrributes i.e.
+ * NvCtrlNvControl*, NvCtrlGlx*, NvCtrlXrandr*, NvCtrlVidMode*, or NvCtrlXv*.
+ */
+
+static ReturnStatus
+GetValidStringDisplayAttributeValuesExtraAttr(NVCTRLAttributeValidValuesRec
+ *val)
+{
+ if (val) {
+ memset(val, 0, sizeof(NVCTRLAttributeValidValuesRec));
+ val->type = ATTRIBUTE_TYPE_STRING;
+ val->permissions = ATTRIBUTE_TYPE_READ | ATTRIBUTE_TYPE_X_SCREEN;
+ return NvCtrlSuccess;
+ } else {
+ return NvCtrlBadArgument;
+ }
+} /* GetValidStringDisplayAttributeValuesExtraAttr() */
+
+
+/*
* NvCtrlGetValidStringDisplayAttributeValues() -fill the
* NVCTRLAttributeValidValuesRec strucure for String atrributes
*/
@@ -715,7 +736,46 @@ NvCtrlGetValidStringDisplayAttributeValues(NvCtrlAttributeHandle *handle,
attr, val);
}
- return NvCtrlBadArgument;
+ /*
+ * The below string attributes are only available for X screen target
+ * types
+ */
+
+ if (h->target_type != NV_CTRL_TARGET_TYPE_X_SCREEN) {
+ return NvCtrlAttributeNotAvailable;
+ }
+
+ if ((attr >= NV_CTRL_STRING_NV_CONTROL_BASE) &&
+ (attr <= NV_CTRL_STRING_NV_CONTROL_LAST_ATTRIBUTE)) {
+ if (!h->nv) return NvCtrlMissingExtension;
+ return GetValidStringDisplayAttributeValuesExtraAttr(val);
+ }
+
+ if ((attr >= NV_CTRL_STRING_GLX_BASE) &&
+ (attr <= NV_CTRL_STRING_GLX_LAST_ATTRIBUTE)) {
+ if (!h->glx) return NvCtrlMissingExtension;
+ return GetValidStringDisplayAttributeValuesExtraAttr(val);
+ }
+
+ if ((attr >= NV_CTRL_STRING_XRANDR_BASE) &&
+ (attr <= NV_CTRL_STRING_XRANDR_LAST_ATTRIBUTE)) {
+ if (!h->xrandr) return NvCtrlMissingExtension;
+ return GetValidStringDisplayAttributeValuesExtraAttr(val);
+ }
+
+ if ((attr >= NV_CTRL_STRING_XF86VIDMODE_BASE) &&
+ (attr <= NV_CTRL_STRING_XF86VIDMODE_LAST_ATTRIBUTE)) {
+ if (!h->vm) return NvCtrlMissingExtension;
+ return GetValidStringDisplayAttributeValuesExtraAttr(val);
+ }
+
+ if ((attr >= NV_CTRL_STRING_XV_BASE) &&
+ (attr <= NV_CTRL_STRING_XV_LAST_ATTRIBUTE)) {
+ if (!h->xv) return NvCtrlMissingExtension;
+ return GetValidStringDisplayAttributeValuesExtraAttr(val);
+ }
+
+ return NvCtrlNoAttribute;
} /* NvCtrlGetValidStringDisplayAttributeValues() */
diff --git a/src/parse.c b/src/parse.c
index 952b209..1fd1912 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -166,9 +166,7 @@ AttributeTableEntry attributeTable[] = {
{ "ECCConfigurationSupported", NV_CTRL_GPU_ECC_CONFIGURATION_SUPPORTED, N, "Reports whether ECC whether the ECC configuration setting can be changed." },
{ "ECCConfiguration", NV_CTRL_GPU_ECC_CONFIGURATION, N, "Returns the current ECC configuration setting." },
{ "ECCDefaultConfiguration", NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION, N, "Returns the default ECC configuration setting." },
- { "ECCSingleBitErrors", NV_CTRL_GPU_ECC_SINGLE_BIT_ERRORS, N, "Returns the number of single-bit ECC errors detected by the targeted GPU since the last POST." },
{ "ECCDoubleBitErrors", NV_CTRL_GPU_ECC_DOUBLE_BIT_ERRORS, N, "Returns the number of double-bit ECC errors detected by the targeted GPU since the last POST." },
- { "ECCAggregateSingleBitErrors", NV_CTRL_GPU_ECC_AGGREGATE_SINGLE_BIT_ERRORS, N, "Returns the number of double-bit ECC errors detected by the targeted GPU since the last counter reset." },
{ "ECCAggregateDoubleBitErrors", NV_CTRL_GPU_ECC_AGGREGATE_DOUBLE_BIT_ERRORS, N, "Returns the number of double-bit ECC errors detected by the targeted GPU since the last counter reset." },
{ "GPUFanControlState", NV_CTRL_GPU_COOLER_MANUAL_CONTROL, N, "The current fan control state; the value of this attribute controls the availability of additional fan control attributes. Note that this attribute is unavailable unless fan control support has been enabled by setting the \"Coolbits\" X config option." },
{ "GPUCurrentFanSpeed", NV_CTRL_THERMAL_COOLER_LEVEL, N, "Returns the GPU fan's current speed." },