Commit 97f0ae18 authored by Aaron Plattner's avatar Aaron Plattner

290.03

parent 9a47f16b
......@@ -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
##############################################################################
......
/*
* 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;
}
......@@ -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
......
......@@ -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;
......
......@@ -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,35 +185,52 @@ 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);
......
NVIDIA_VERSION = 285.05.09
NVIDIA_VERSION = 290.03
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment