summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--samples/Makefile1
-rw-r--r--samples/nv-control-3dvisionpro.c106
-rw-r--r--samples/src.mk1
-rw-r--r--src/gtk+-2.x/ctkdisplayconfig-utils.c4
-rw-r--r--src/gtk+-2.x/ctkecc.c81
-rw-r--r--version.mk2
6 files changed, 163 insertions, 32 deletions
diff --git a/samples/Makefile b/samples/Makefile
index 3796158..35be348 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -69,6 +69,7 @@ SAMPLE_SOURCES += nv-control-dpy.c
SAMPLE_SOURCES += nv-control-targets.c
SAMPLE_SOURCES += nv-control-framelock.c
SAMPLE_SOURCES += nv-control-gvi.c
+SAMPLE_SOURCES += nv-control-3dvisionpro.c
##############################################################################
diff --git a/samples/nv-control-3dvisionpro.c b/samples/nv-control-3dvisionpro.c
new file mode 100644
index 0000000..8ffe86f
--- /dev/null
+++ b/samples/nv-control-3dvisionpro.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2011 NVIDIA, Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * nv-control-3dvisionpro.c - Sample application that displays
+ * the details of the glasses currently attached to the transceiver
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <X11/Xlib.h>
+
+#include "NVCtrlLib.h"
+
+int main(int argc, char* argv[])
+{
+ Display *dpy;
+ Bool ret;
+ int i, target_id = 0, glass_id, num_of_glasses = 0;
+ unsigned int *ptr;
+ char *glass_name;
+ int len;
+
+ if(argc > 2) {
+ printf("Too many Arguments\n");
+ return(0);
+ }
+
+ if(argc != 1) {
+ target_id = atoi(argv[1]);
+ }
+
+ /*
+ * open a connection to the X server indicated by the DISPLAY
+ * environment variable
+ */
+
+ dpy = XOpenDisplay(NULL);
+ if (!dpy) {
+ fprintf(stderr, "Cannot open display '%s'.\n", XDisplayName(NULL));
+ return 1;
+ }
+
+ /*
+ * query the ids of the glasses connected to the Transceiver
+ */
+
+ ret = XNVCTRLQueryTargetBinaryData(dpy, NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER, target_id,
+ 0, NV_CTRL_BINARY_DATA_GLASSES_PAIRED_TO_3D_VISION_PRO_TRANSCEIVER,
+ (unsigned char**) &ptr, &len);
+ if (ret) {
+ num_of_glasses = ptr[0];
+ printf("Total no. of glasses paired = %d\n", num_of_glasses);
+
+ if (num_of_glasses > 0) {
+ printf("\n");
+ printf("%-20s", "GlassId");
+ printf("%-s\n", "GlassName" );
+ }
+
+ for (i = 0; i < num_of_glasses; i++) {
+ glass_id = ptr[i+1];
+ ret = XNVCTRLQueryTargetStringAttribute (dpy, NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER, target_id,
+ glass_id, NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME, &glass_name);
+ if (ret) {
+ printf("%-20d", glass_id);
+ printf("%-s\n", glass_name);
+ }
+ else {
+ printf("Error retrieving GlassName for Glassid %d\n", glass_id);
+ }
+ XFree(glass_name);
+ }
+ XFree(ptr);
+ }
+
+ /*
+ * close the display connection
+ */
+
+ XCloseDisplay(dpy);
+
+ return 0;
+}
diff --git a/samples/src.mk b/samples/src.mk
index e76f2ba..8ae3d84 100644
--- a/samples/src.mk
+++ b/samples/src.mk
@@ -6,6 +6,7 @@ SAMPLES_SRC +=
SAMPLES_EXTRA_DIST += README
SAMPLES_EXTRA_DIST += nv-control-dvc.c
+SAMPLES_EXTRA_DIST += nv-control-3dvisionpro.c
SAMPLES_EXTRA_DIST += nv-control-dpy.c
SAMPLES_EXTRA_DIST += nv-control-info.c
SAMPLES_EXTRA_DIST += nv-control-events.c
diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c
index 04e5577..a32d7c5 100644
--- a/src/gtk+-2.x/ctkdisplayconfig-utils.c
+++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c
@@ -1111,8 +1111,8 @@ void screen_link_display(nvScreenPtr screen, nvDisplayPtr display)
if (!screen->displays) {
screen->displays = display;
} else {
- nvDisplayPtr last = screen->displays;
- while (last) {
+ nvDisplayPtr last;
+ for (last = screen->displays; last; last = last->next_in_screen) {
if (!last->next_in_screen) {
last->next_in_screen = display;
break;
diff --git a/src/gtk+-2.x/ctkecc.c b/src/gtk+-2.x/ctkecc.c
index 3596a71..405bcbb 100644
--- a/src/gtk+-2.x/ctkecc.c
+++ b/src/gtk+-2.x/ctkecc.c
@@ -71,6 +71,8 @@ static const char *__reset_default_config_button_help =
static void ecc_config_button_toggled(GtkWidget *, gpointer);
static void show_ecc_toggle_warning_dlg(CtkEcc *);
+static void ecc_configuration_update_received(GtkObject *, gpointer, gpointer);
+static void post_ecc_configuration_update(CtkEcc *, gboolean);
GType ctk_ecc_get_type(void)
{
@@ -156,11 +158,10 @@ static gboolean update_ecc_info(gpointer user_data)
{
CtkEcc *ctk_ecc = CTK_ECC(user_data);
int64_t val;
- gint ecc_config;
ReturnStatus ret;
if ( ctk_ecc->ecc_enabled == FALSE ) {
- goto end;
+ return FALSE;
}
/* Query ECC Errors */
@@ -184,36 +185,53 @@ static gboolean update_ecc_info(gpointer user_data)
}
set_label_value(ctk_ecc->aggregate_dbit_error, val);
}
-end:
- /* Query ECC configuration */
-
- if ( ctk_ecc->configuration_status ) {
- ret = NvCtrlGetAttribute(ctk_ecc->handle,
- NV_CTRL_GPU_ECC_CONFIGURATION,
- &ecc_config);
- if (ret != NvCtrlSuccess ||
- ecc_config != NV_CTRL_GPU_ECC_CONFIGURATION_ENABLED) {
- ecc_config = 0;
- } else {
- ecc_config = 1;
- }
- g_signal_handlers_block_by_func(G_OBJECT(ctk_ecc->configuration_status),
- G_CALLBACK(ecc_config_button_toggled),
- (gpointer) ctk_ecc);
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON(ctk_ecc->configuration_status),
- ecc_config);
- g_signal_handlers_unblock_by_func(G_OBJECT(ctk_ecc->configuration_status),
- G_CALLBACK(ecc_config_button_toggled),
- (gpointer) ctk_ecc);
- }
-
+
return TRUE;
} /* update_ecc_info() */
/*
+ * post_ecc_configuration_update() - this function update status bar string.
+ */
+
+static void post_ecc_configuration_update(CtkEcc *ctk_ecc, gboolean enabled)
+{
+ ctk_config_statusbar_message(ctk_ecc->ctk_config,
+ "ECC %s.",
+ enabled ? "enabled" : "disabled");
+} /* post_ecc_configuration_update() */
+
+
+
+/*
+ * ecc_configuration_update_received() - this function is called when the
+ * NV_CTRL_GPU_ECC_CONFIGURATION atribute is changed by another
+ * NV-CONTROL client.
+ */
+
+static void ecc_configuration_update_received(GtkObject *object,
+ gpointer arg1, gpointer user_data)
+{
+ CtkEventStruct *event_struct = (CtkEventStruct *) arg1;
+ CtkEcc *ctk_ecc = CTK_ECC(user_data);
+
+ g_signal_handlers_block_by_func(G_OBJECT(ctk_ecc->configuration_status),
+ G_CALLBACK(ecc_config_button_toggled),
+ (gpointer) ctk_ecc);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctk_ecc->configuration_status),
+ event_struct->value);
+
+ g_signal_handlers_unblock_by_func(G_OBJECT(ctk_ecc->configuration_status),
+ G_CALLBACK(ecc_config_button_toggled),
+ (gpointer) ctk_ecc);
+ /* Update status bar message */
+ post_ecc_configuration_update(ctk_ecc, event_struct->value);
+}
+
+
+
+/*
* reset_default_config_button_clicked() - callback function for reset default
* configuration button.
*/
@@ -329,9 +347,8 @@ static void ecc_config_button_toggled(GtkWidget *widget,
gtk_widget_set_sensitive(ctk_ecc->reset_default_config_button, TRUE);
- ctk_config_statusbar_message(ctk_ecc->ctk_config,
- "ECC %s.",
- enabled ? "enabled" : "disabled");
+ /* Update status bar message */
+ post_ecc_configuration_update(ctk_ecc, enabled);
} /* ecc_config_button_toggled() */
@@ -516,11 +533,17 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
ctk_ecc->configuration_status, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(hbox2), 5);
gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctk_ecc->configuration_status),
+ ecc_enabled);
ctk_config_set_tooltip(ctk_config, ctk_ecc->configuration_status,
__configuration_status_help);
g_signal_connect(G_OBJECT(ctk_ecc->configuration_status), "clicked",
G_CALLBACK(ecc_config_button_toggled),
(gpointer) ctk_ecc);
+ g_signal_connect(G_OBJECT(ctk_event),
+ CTK_EVENT_NAME(NV_CTRL_GPU_ECC_CONFIGURATION),
+ G_CALLBACK(ecc_configuration_update_received),
+ (gpointer) ctk_ecc);
gtk_widget_set_sensitive(ctk_ecc->configuration_status, ecc_config_supported);
hbox = gtk_hbox_new(FALSE, 0);
diff --git a/version.mk b/version.mk
index db2538f..dcf5ed6 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 285.05.09
+NVIDIA_VERSION = 290.03