summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2008-02-12 21:28:59 -0800
committerAaron Plattner <aplattner@nvidia.com>2008-02-12 21:28:59 -0800
commit443e57f0d39837e5c2607d008e50fae85e7ab5dd (patch)
treee9fa4ff24ecefbcd616f8dcc93e79554177282d0 /src
parentd69ebbd8d67a7c4bdba1190c75d21a87071339e2 (diff)
100.14.09100.14.09
Diffstat (limited to 'src')
-rw-r--r--src/gtk+-2.x/ctkgvo.c107
-rw-r--r--src/gtk+-2.x/ctkserver.c14
-rw-r--r--src/libXNVCtrl/NVCtrl.h2
-rw-r--r--src/libXNVCtrl/libXNVCtrl.abin17180 -> 17180 bytes
4 files changed, 77 insertions, 46 deletions
diff --git a/src/gtk+-2.x/ctkgvo.c b/src/gtk+-2.x/ctkgvo.c
index da79328..be71c69 100644
--- a/src/gtk+-2.x/ctkgvo.c
+++ b/src/gtk+-2.x/ctkgvo.c
@@ -117,8 +117,7 @@ static void set_gvo_sensitivity(CtkGvo *ctk_gvo,
static void get_video_format_details(CtkGvo *ctk_gvo);
-static void update_gvo_current_info(CtkGvo *ctk_gvo, gint w, gint h,
- gint state);
+static void update_gvo_current_info(CtkGvo *ctk_gvo, guint lock_owner);
static void update_delay_spin_buttons(CtkGvo *ctk_gvo);
@@ -301,10 +300,6 @@ static const FormatName syncFormatNames[] = {
#define SET_SENSITIVITY_EXCLUDE_DETECT_BUTTON 0x0002
#define SET_SENSITIVITY_EXCLUDE_ROI_BUTTONS 0x0004
-#define CURRENT_SDI_STATE_INACTIVE 0
-#define CURRENT_SDI_STATE_IN_USE_BY_X 1
-#define CURRENT_SDI_STATE_IN_USE_BY_GLX 2
-
#define DEFAULT_DETECT_INPUT_TIME_INTERVAL 2000
#define UPDATE_GVO_BANNER_TIME_INTERVAL 200
#define DEFAULT_GVO_PROBE_TIME_INTERVAL 1000
@@ -1859,7 +1854,6 @@ static void toggle_sdi_output_button(GtkWidget *button, gpointer user_data)
static void post_toggle_sdi_output_button(CtkGvo *ctk_gvo, gboolean enabled)
{
- gint w, h;
GList *children;
GList *child;
@@ -1883,8 +1877,7 @@ static void post_toggle_sdi_output_button(CtkGvo *ctk_gvo, gboolean enabled)
ctk_gvo->output_video_format,
ctk_gvo->output_data_format);
- get_video_format_resolution(ctk_gvo->output_video_format, &w, &h);
- update_gvo_current_info(ctk_gvo, w, h, CURRENT_SDI_STATE_IN_USE_BY_X);
+ update_gvo_current_info(ctk_gvo, NV_CTRL_GVO_LOCK_OWNER_CLONE);
} else {
gtk_container_add(GTK_CONTAINER(ctk_gvo->toggle_sdi_output_button),
@@ -1894,15 +1887,11 @@ static void post_toggle_sdi_output_button(CtkGvo *ctk_gvo, gboolean enabled)
NV_CTRL_GVO_VIDEO_FORMAT_NONE,
ctk_gvo->output_data_format);
- update_gvo_current_info(ctk_gvo, 0, 0, CURRENT_SDI_STATE_INACTIVE);
+ update_gvo_current_info(ctk_gvo, NV_CTRL_GVO_LOCK_OWNER_NONE);
}
ctk_gvo->sdi_output_enabled = enabled;
-
- set_gvo_sensitivity(ctk_gvo, !enabled,
- SET_SENSITIVITY_EXCLUDE_ENABLE_BUTTON |
- SET_SENSITIVITY_EXCLUDE_ROI_BUTTONS);
ctk_config_statusbar_message(ctk_gvo->ctk_config, "SDI Output %s.",
enabled ? "enabled" : "disabled");
@@ -2352,32 +2341,47 @@ static void get_video_format_details(CtkGvo *ctk_gvo)
/*
- * update_gvo_current_info() -
+ * update_gvo_current_info() - Updates the state information to reflect
+ * the GVO device's current state.
*/
-static void update_gvo_current_info(CtkGvo *ctk_gvo, gint w, gint h,
- gint state)
+static void update_gvo_current_info(CtkGvo *ctk_gvo, guint lock_owner)
{
+ int width;
+ int height;
gchar res_string[64], state_string[64];
+ gboolean sensitive = FALSE;
+ guint flags = 0;
if (!ctk_gvo->current_resolution_label) return;
if (!ctk_gvo->current_state_label) return;
+
+ /* Get the current video format sizes */
+ get_video_format_resolution(ctk_gvo->output_video_format, &width, &height);
- switch (state) {
+ switch (lock_owner) {
- case CURRENT_SDI_STATE_INACTIVE:
+ case NV_CTRL_GVO_LOCK_OWNER_NONE:
snprintf(res_string, 64, "Inactive");
snprintf(state_string, 64, "Inactive");
+ sensitive = TRUE;
break;
-
- case CURRENT_SDI_STATE_IN_USE_BY_X:
- snprintf(res_string, 64, "%d x %d", w, h);
- snprintf(state_string, 64, "In Use by X");
+
+ case NV_CTRL_GVO_LOCK_OWNER_CLONE:
+ snprintf(res_string, 64, "%d x %d", width, height);
+ snprintf(state_string, 64, "In use by X (Clone mode)");
+ flags = SET_SENSITIVITY_EXCLUDE_ENABLE_BUTTON |
+ SET_SENSITIVITY_EXCLUDE_ROI_BUTTONS;
break;
- case CURRENT_SDI_STATE_IN_USE_BY_GLX:
- snprintf(res_string, 64, "%d x %d", w, h);
- snprintf(state_string, 64, "In Use by GLX");
+ case NV_CTRL_GVO_LOCK_OWNER_X_SCREEN:
+ snprintf(res_string, 64, "%d x %d", width, height);
+ snprintf(state_string, 64, "In use by X");
+ break;
+
+ case NV_CTRL_GVO_LOCK_OWNER_GLX:
+ snprintf(res_string, 64, "%d x %d", width, height);
+ snprintf(state_string, 64, "In use by GLX");
break;
default:
@@ -2390,11 +2394,34 @@ static void update_gvo_current_info(CtkGvo *ctk_gvo, gint w, gint h,
gtk_label_set_text(GTK_LABEL(ctk_gvo->current_state_label),
state_string);
+ set_gvo_sensitivity(ctk_gvo, sensitive, flags);
+
} /* update_gvo_current_info() */
/*
+ * query_gvo_current_info() - Queries the state of the GVO device
+ * from the X server and updates the information on the page.
+ */
+
+static void query_gvo_current_info(CtkGvo *ctk_gvo)
+{
+ ReturnStatus ret;
+ gint lock_owner;
+
+ ret = NvCtrlGetAttribute(ctk_gvo->handle,
+ NV_CTRL_GVO_LOCK_OWNER, &lock_owner);
+
+ if (ret == NvCtrlSuccess) {
+ update_gvo_current_info(ctk_gvo, lock_owner);
+ }
+
+} /* query_gvo_current_info() */
+
+
+
+/*
* update_delay_spin_buttons() -
*/
@@ -2615,11 +2642,6 @@ static void register_for_gvo_events(CtkGvo *ctk_gvo)
CTK_EVENT_NAME(NV_CTRL_GVO_X_SCREEN_PAN_Y),
G_CALLBACK(gvo_event_received),
(gpointer) ctk_gvo);
-
- g_signal_connect(G_OBJECT(ctk_gvo->ctk_event),
- CTK_EVENT_NAME(NV_CTRL_GVO_GLX_LOCKED),
- G_CALLBACK(gvo_event_received),
- (gpointer) ctk_gvo);
g_signal_connect(G_OBJECT(ctk_gvo->ctk_event),
CTK_EVENT_NAME(NV_CTRL_GVO_DISPLAY_X_SCREEN),
@@ -2630,6 +2652,11 @@ static void register_for_gvo_events(CtkGvo *ctk_gvo)
CTK_EVENT_NAME(NV_CTRL_GVO_COMPOSITE_TERMINATION),
G_CALLBACK(gvo_event_received),
(gpointer) ctk_gvo);
+
+ g_signal_connect(G_OBJECT(ctk_gvo->ctk_event),
+ CTK_EVENT_NAME(NV_CTRL_GVO_LOCK_OWNER),
+ G_CALLBACK(gvo_event_received),
+ (gpointer) ctk_gvo);
}
@@ -2643,7 +2670,6 @@ static void gvo_event_received(GtkObject *object,
GtkWidget *widget;
gint attribute = event_struct->attribute;
gint value = event_struct->value;
- gint w, h;
switch (attribute) {
case NV_CTRL_GVO_SYNC_MODE:
@@ -2664,6 +2690,7 @@ static void gvo_event_received(GtkObject *object,
(CTK_DROP_DOWN_MENU(widget), value);
post_output_video_format_changed(ctk_gvo, value);
+ query_gvo_current_info(ctk_gvo);
g_signal_handlers_unblock_by_func
(G_OBJECT(widget),
@@ -2746,24 +2773,16 @@ static void gvo_event_received(GtkObject *object,
(gpointer) ctk_gvo);
break;
- case NV_CTRL_GVO_GLX_LOCKED:
- if (value == NV_CTRL_GVO_GLX_LOCKED_TRUE) {
- get_video_format_resolution(ctk_gvo->output_video_format, &w, &h);
- update_gvo_current_info(ctk_gvo, w, h,
- CURRENT_SDI_STATE_IN_USE_BY_GLX);
- set_gvo_sensitivity(ctk_gvo, FALSE, 0);
- } else {
- update_gvo_current_info(ctk_gvo, 0, 0, CURRENT_SDI_STATE_INACTIVE);
- set_gvo_sensitivity(ctk_gvo, TRUE, 0);
- }
+ case NV_CTRL_GVO_LOCK_OWNER:
+ update_gvo_current_info(ctk_gvo, value);
break;
case NV_CTRL_GVO_DISPLAY_X_SCREEN:
/*
* XXX explicitly re-query this value, since a change may not
- * actually have been successfully applied (if GLX already had
- * GVO locked)
+ * actually have been successfully applied (if GLX or some other
+ * mode already had GVO locked)
*/
ret = NvCtrlGetAttribute(ctk_gvo->handle,
diff --git a/src/gtk+-2.x/ctkserver.c b/src/gtk+-2.x/ctkserver.c
index 77367ea..28f42d6 100644
--- a/src/gtk+-2.x/ctkserver.c
+++ b/src/gtk+-2.x/ctkserver.c
@@ -260,6 +260,7 @@ GtkWidget* ctk_server_new(NvCtrlAttributeHandle *handle,
gchar *server_version;
gchar *vendor_str;
gchar *vendor_ver;
+ gchar *nv_control_server_version;
gchar *num_screens;
ReturnStatus ret;
@@ -327,6 +328,13 @@ GtkWidget* ctk_server_new(NvCtrlAttributeHandle *handle,
vendor_ver = get_server_vendor_version(handle);
+ /* NV_CTRL_STRING_NV_CONTROL_VERSION */
+
+ ret = NvCtrlGetStringAttribute(handle,
+ NV_CTRL_STRING_NV_CONTROL_VERSION,
+ &nv_control_server_version);
+ if (ret != NvCtrlSuccess) nv_control_server_version = NULL;
+
/* # Logical X Screens */
if (xinerama_enabled) {
@@ -408,7 +416,7 @@ GtkWidget* ctk_server_new(NvCtrlAttributeHandle *handle,
hseparator = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5);
- table = gtk_table_new(11, 2, FALSE);
+ table = gtk_table_new(15, 2, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
gtk_table_set_row_spacings(GTK_TABLE(table), 3);
gtk_table_set_col_spacings(GTK_TABLE(table), 15);
@@ -425,6 +433,9 @@ GtkWidget* ctk_server_new(NvCtrlAttributeHandle *handle,
0, 0.5, "Server Vendor Version:", 0, 0.5, vendor_ver);
/* separator */
add_table_row(table, 10,
+ 0, 0, "NV-Control Version:", 0, 0, nv_control_server_version);
+ /* separator */
+ add_table_row(table, 14,
0, 0, "X Screens:", 0, 0, num_screens);
@@ -469,6 +480,7 @@ GtkWidget* ctk_server_new(NvCtrlAttributeHandle *handle,
g_free(server_version);
g_free(vendor_str);
g_free(vendor_ver);
+ XFree(nv_control_server_version);
g_free(num_screens);
gtk_widget_show_all(GTK_WIDGET(object));
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index 389fe9b..ed882cf 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -3056,7 +3056,7 @@
#define NV_CTRL_GVO_LOCK_OWNER_NONE 0
#define NV_CTRL_GVO_LOCK_OWNER_GLX 1
#define NV_CTRL_GVO_LOCK_OWNER_CLONE 2
-#define NV_CTRL_GVO_LOCK_OWNER_TWINVIEW 3
+#define NV_CTRL_GVO_LOCK_OWNER_X_SCREEN 3
#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_GVO_LOCK_OWNER
diff --git a/src/libXNVCtrl/libXNVCtrl.a b/src/libXNVCtrl/libXNVCtrl.a
index dc1389b..e832bc9 100644
--- a/src/libXNVCtrl/libXNVCtrl.a
+++ b/src/libXNVCtrl/libXNVCtrl.a
Binary files differ