summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2012-07-13 09:46:37 -0700
committerAaron Plattner <aplattner@nvidia.com>2012-07-13 09:46:37 -0700
commitbcf86318652976de8afadabc4d02d7976b24f6b5 (patch)
treeaf09f0418ed1be06737266dfb73ab4c4af3b9514
parentf8cb90d08f42c9c475bab5d7fa99108b0374bdae (diff)
304.22304.22
-rw-r--r--doc/Makefile8
-rw-r--r--doc/version.mk2
-rw-r--r--samples/Makefile2
-rw-r--r--samples/version.mk2
-rw-r--r--src/Makefile2
-rw-r--r--src/common-utils/common-utils.c60
-rw-r--r--src/common-utils/common-utils.h2
-rw-r--r--src/common-utils/nvgetopt.c3
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice.c22
-rw-r--r--src/gtk+-2.x/ctkevent.c13
-rw-r--r--src/gtk+-2.x/ctkframelock.c323
-rw-r--r--src/gtk+-2.x/ctkframelock.h3
-rw-r--r--src/gtk+-2.x/ctkslimm.c74
-rw-r--r--src/gtk+-2.x/ctkwindow.c2
-rw-r--r--src/gtk+-2.x/ctkxvideo.c636
-rw-r--r--src/gtk+-2.x/ctkxvideo.h10
-rw-r--r--src/libXNVCtrl/NVCtrl.c26
-rw-r--r--src/libXNVCtrl/NVCtrl.h23
-rw-r--r--src/libXNVCtrl/NVCtrlLib.h3
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributes.c29
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributes.h26
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h48
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributesXv.c443
-rw-r--r--src/parse.c52
-rw-r--r--src/parse.h1
-rw-r--r--src/query-assign.c98
-rw-r--r--src/query-assign.h12
-rw-r--r--src/version.mk2
-rw-r--r--utils.mk37
-rw-r--r--version.mk2
30 files changed, 552 insertions, 1414 deletions
diff --git a/doc/Makefile b/doc/Makefile
index 40f1472..901627b 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -56,9 +56,11 @@ endif
GEN_MANPAGE_OPTS = $(OUTPUTDIR)/gen-manpage-opts
OPTIONS_1_INC = $(OUTPUTDIR)/options.1.inc
-CFLAGS += -I $(COMMON_UTILS_DIR)
-CFLAGS += -I ../src/libXNVCtrlAttributes
+common_cflags += -I $(COMMON_UTILS_DIR)
+common_cflags += -I ../src/libXNVCtrlAttributes
+CFLAGS += $(common_cflags)
+HOST_CFLAGS += $(common_cflags)
##############################################################################
# build rules
@@ -93,7 +95,7 @@ GEN_MANPAGE_OPTS_SRC += $(COMMON_UTILS_DIR)/gen-manpage-opts-helper.c
GEN_MANPAGE_OPTS_OBJS = $(call BUILD_OBJECT_LIST,$(GEN_MANPAGE_OPTS_SRC))
$(foreach src, $(GEN_MANPAGE_OPTS_SRC), \
- $(eval $(call DEFINE_OBJECT_RULE,HOST_CC,$(src))))
+ $(eval $(call DEFINE_OBJECT_RULE,HOST,$(src))))
$(GEN_MANPAGE_OPTS): $(GEN_MANPAGE_OPTS_OBJS)
$(call quiet_cmd,HOST_LINK) \
diff --git a/doc/version.mk b/doc/version.mk
index 527bb7c..11c1292 100644
--- a/doc/version.mk
+++ b/doc/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 302.17
+NVIDIA_VERSION = 304.22
diff --git a/samples/Makefile b/samples/Makefile
index 8fc8e4b..ac7fb69 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -79,7 +79,7 @@ SAMPLE_SOURCES += nv-control-3dvisionpro.c
.PHONY: all clean clobber install
# define the rule to build each object file
-$(foreach src, $(SAMPLE_SOURCES), $(eval $(call DEFINE_OBJECT_RULE,CC,$(src))))
+$(foreach src, $(SAMPLE_SOURCES), $(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
# define the rule to link each sample app from its corresponding object file
define link_sample_from_object
diff --git a/samples/version.mk b/samples/version.mk
index 527bb7c..11c1292 100644
--- a/samples/version.mk
+++ b/samples/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 302.17
+NVIDIA_VERSION = 304.22
diff --git a/src/Makefile b/src/Makefile
index c7e79b3..8a2ff04 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -163,7 +163,7 @@ $(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_ARCHIVE)
$(call quiet_cmd,STRIP_CMD) $@
# define the rule to build each object file
-$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,CC,$(src))))
+$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
# define the rule to generate $(STAMP_C)
$(eval $(call DEFINE_STAMP_C_RULE, $(OBJS),$(NVIDIA_SETTINGS_PROGRAM_NAME)))
diff --git a/src/common-utils/common-utils.c b/src/common-utils/common-utils.c
index 98b92fe..a8ee75a 100644
--- a/src/common-utils/common-utils.c
+++ b/src/common-utils/common-utils.c
@@ -586,3 +586,63 @@ void fmt(FILE *stream, const char *prefix, const char *fmt, ...)
}
NV_VFORMAT(stream, TRUE, prefix, fmt);
}
+
+
+/*
+ * Read from the given FILE stream until a newline, EOF, or nul
+ * terminator is encountered, writing data into a growable buffer.
+ * The eof parameter is set to TRUE when EOF is encountered. In all
+ * cases, the returned string is null-terminated.
+ *
+ * XXX this function will be rather slow because it uses fgetc() to
+ * pull each character off the stream one at a time; this is done so
+ * that each character can be examined as it's read so that we can
+ * appropriately deal with EOFs and newlines. A better implementation
+ * would use fgets(), but that would still require us to parse each
+ * read line, checking for newlines or guessing if we hit an EOF.
+ */
+char *fget_next_line(FILE *fp, int *eof)
+{
+ char *buf = NULL, *tmpbuf;
+ char *c = NULL;
+ int len = 0, buflen = 0;
+ int ret;
+
+ const int __fget_next_line_len = 32;
+
+ if (eof) {
+ *eof = FALSE;
+ }
+
+ while (1) {
+ if (buflen == len) { /* buffer isn't big enough -- grow it */
+ buflen += __fget_next_line_len;
+ tmpbuf = nvalloc(buflen);
+ if (buf) {
+ memcpy(tmpbuf, buf, len);
+ nvfree(buf);
+ }
+ buf = tmpbuf;
+ c = buf + len;
+ }
+
+ ret = fgetc(fp);
+
+ if ((ret == EOF) && (eof)) {
+ *eof = TRUE;
+ }
+
+ if ((ret == EOF) || (ret == '\n') || (ret == '\0')) {
+ *c = '\0';
+ return buf;
+ }
+
+ *c = (char) ret;
+
+ len++;
+ c++;
+
+ } /* while (1) */
+
+ return NULL; /* should never get here */
+}
diff --git a/src/common-utils/common-utils.h b/src/common-utils/common-utils.h
index e0d9314..c5cd411 100644
--- a/src/common-utils/common-utils.h
+++ b/src/common-utils/common-utils.h
@@ -65,6 +65,8 @@ void fmterr(const char *fmt, ...);
void fmtwarn(const char *fmt, ...);
void fmt(FILE *stream, const char *prefix, const char *fmt, ...);
+char *fget_next_line(FILE *fp, int *eof);
+
/*
* NV_VSNPRINTF(): macro that assigns buf using vsnprintf(). This is
* correct for differing semantics of the vsnprintf() return value:
diff --git a/src/common-utils/nvgetopt.c b/src/common-utils/nvgetopt.c
index f04cef3..1c6c9b8 100644
--- a/src/common-utils/nvgetopt.c
+++ b/src/common-utils/nvgetopt.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
+#include <limits.h>
#include "nvgetopt.h"
#include "common-utils.h"
@@ -401,7 +402,7 @@ void nvgetopt_print_help(const NVGetoptOption *options,
* prepend the single character version of the option,
* possibly with an argument; e.g., "-f" or "-f BAR"
*/
- if (isalpha(o->val)) {
+ if (o->val <= UCHAR_MAX && o->val >= 0 && isalpha(o->val)) {
char scratch[16];
char *tmp;
snprintf(scratch, sizeof(scratch), "%c", o->val);
diff --git a/src/gtk+-2.x/ctkdisplaydevice.c b/src/gtk+-2.x/ctkdisplaydevice.c
index 647de1c..2919514 100644
--- a/src/gtk+-2.x/ctkdisplaydevice.c
+++ b/src/gtk+-2.x/ctkdisplaydevice.c
@@ -529,21 +529,17 @@ static void update_link(CtkDisplayDevice *ctk_object)
(val == NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED)) {
link = "Disabled";
} else {
- const char *bw = "unknown bandwidth";
-
- if (ret == NvCtrlSuccess) {
- switch (val) {
- case NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS:
- bw = "1.62 Gbps";
- break;
- case NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS:
- bw = "2.70 Gbps";
- break;
- }
+ if (ret != NvCtrlSuccess) {
+ val = 0;
}
- snprintf(tmp, 32, "%d lane%s @ %s", lanes, lanes == 1 ? "" : "s",
- bw);
+ if (val > 0) {
+ snprintf(tmp, 32, "%d lane%s @ %.2f Gbps", lanes, lanes == 1 ? "" : "s",
+ val * 0.27);
+ } else {
+ snprintf(tmp, 32, "%d lane%s @ unknown bandwidth", lanes,
+ lanes == 1 ? "" : "s");
+ }
link = tmp;
}
} else {
diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c
index 70eb3f5..172f784 100644
--- a/src/gtk+-2.x/ctkevent.c
+++ b/src/gtk+-2.x/ctkevent.c
@@ -327,6 +327,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_SIGNAL(NV_CTRL_GVO_AUDIO_BLANKING);
MAKE_SIGNAL(NV_CTRL_CURRENT_METAMODE_ID);
MAKE_SIGNAL(NV_CTRL_DISPLAY_ENABLED);
+ MAKE_SIGNAL(NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE);
#undef MAKE_SIGNAL
/*
@@ -336,7 +337,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
* knows about.
*/
-#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_DISPLAY_ENABLED
+#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE
#warning "There are attributes that do not emit signals!"
#endif
@@ -560,14 +561,14 @@ GtkObject *ctk_event_new(NvCtrlAttributeHandle *handle)
static gboolean ctk_event_prepare(GSource *source, gint *timeout)
{
+ CtkEventSource *event_source = (CtkEventSource *) source;
*timeout = -1;
-
+
/*
- * XXX We could check if any events are pending on the Display
- * connection
+ * Check if any events are pending on the Display connection
*/
-
- return FALSE;
+
+ return XPending(event_source->dpy);
}
diff --git a/src/gtk+-2.x/ctkframelock.c b/src/gtk+-2.x/ctkframelock.c
index b93617c..5ac8ae5 100644
--- a/src/gtk+-2.x/ctkframelock.c
+++ b/src/gtk+-2.x/ctkframelock.c
@@ -178,7 +178,8 @@ struct _nvDisplayDataRec {
GtkWidget *rate_label;
GtkWidget *rate_text;
- guint rate;
+ /* Rate in milliHz */
+ guint rate_mHz;
guint rate_precision;
GtkWidget *stereo_label;
@@ -218,6 +219,8 @@ struct _nvFrameLockDataRec {
GtkWidget *delay_text;
GtkWidget *house_label;
+ GtkWidget *house_sync_rate_label;
+ GtkWidget *house_sync_rate_text;
GtkWidget *house_hbox; /* LED */
GtkWidget *port0_label;
@@ -287,9 +290,11 @@ static const char * __sync_edge_combo_help =
"The Sync Edge drop-down allows you to select which edge the master "
"frame lock device will use to decode the incoming house sync signal.";
-static const char * __video_mode_combo_help =
+static const char * __video_mode_help =
"The Video Mode drop-down allows you to select which video mode the server "
-"G-Sync device will use to decode the incoming house sync signal.";
+"G-Sync device will use to decode the incoming house sync signal. On some "
+"G-Sync devices, this will be auto-detected and will be reported as "
+"read-only information.";
static const char * __detect_video_mode_button_help =
"The Detect Video Mode button will attempt to automatically detect the format "
@@ -1185,7 +1190,15 @@ static void list_entry_update_gpu_controls(CtkFramelock *ctk_framelock,
static gboolean framelock_refresh_rates_compatible(int server, int client)
{
- int range = ABS(((int64_t)(server - client) * 1000000) / client);
+ int range;
+
+ /* client can be 0, e.g. if querying NV_CTRL_REFRESH_RATE{,_3} fails,
+ * or if the display device is disabled. */
+ if (client == 0) {
+ return FALSE;
+ }
+
+ range = ABS(((int64_t)(server - client) * 1000000) / client);
/* Framelock can be achieved if the range between refresh rates is less
* than 50 ppm */
@@ -1247,7 +1260,8 @@ static void list_entry_update_display_controls(CtkFramelock *ctk_framelock,
*/
sensitive = (data->slaveable &&
(!server_data ||
- framelock_refresh_rates_compatible(server_data->rate, data->rate)));
+ framelock_refresh_rates_compatible(server_data->rate_mHz,
+ data->rate_mHz)));
gtk_widget_set_sensitive(data->rate_label, sensitive);
gtk_widget_set_sensitive(data->rate_text, sensitive);
gtk_widget_set_sensitive(data->label, sensitive);
@@ -2065,9 +2079,10 @@ static nvListEntryPtr list_entry_new_with_framelock(nvFrameLockDataPtr data)
}
entry->data = (gpointer)(data);
entry->data_type = ENTRY_DATA_FRAMELOCK;
+ entry->ctk_event = CTK_EVENT(ctk_event_new(data->handle));
/* Pack the data's widgets into the list entry data hbox */
-
+
gtk_box_pack_start(GTK_BOX(entry->label_hbox), data->label,
FALSE, FALSE, 5);
@@ -2076,34 +2091,34 @@ static nvListEntryPtr list_entry_new_with_framelock(nvFrameLockDataPtr data)
padding = gtk_hbox_new(FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
-
+
gtk_box_pack_end(GTK_BOX(entry->data_hbox), frame, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), hbox);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->receiving_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->receiving_label, FALSE, FALSE, 0);
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->rate_label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->rate_text, FALSE, FALSE, 0);
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->house_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->house_label, FALSE, FALSE, 0);
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->port0_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->port0_label, FALSE, FALSE, 0);
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->port1_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->port1_label, FALSE, FALSE, 0);
@@ -2124,6 +2139,16 @@ static nvListEntryPtr list_entry_new_with_framelock(nvFrameLockDataPtr data)
gtk_box_pack_start(GTK_BOX(data->extra_info_hbox), vseparator,
FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(data->extra_info_hbox),
+ data->house_sync_rate_label,
+ FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(data->extra_info_hbox),
+ data->house_sync_rate_text,
+ FALSE, FALSE, 0);
+ vseparator = gtk_vseparator_new();
+ gtk_box_pack_start(GTK_BOX(data->extra_info_hbox), vseparator,
+ FALSE, FALSE, 0);
+
gtk_box_pack_start(GTK_BOX(data->extra_info_hbox), data->revision_label,
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(data->extra_info_hbox), data->revision_text,
@@ -2156,24 +2181,25 @@ static nvListEntryPtr list_entry_new_with_gpu(nvGPUDataPtr data)
}
entry->data = (gpointer)(data);
entry->data_type = ENTRY_DATA_GPU;
+ entry->ctk_event = CTK_EVENT(ctk_event_new(data->handle));
/* Pack the data's widgets into the list entry data hbox */
-
+
gtk_box_pack_start(GTK_BOX(entry->label_hbox), data->label,
FALSE, FALSE, 5);
frame = gtk_frame_new(NULL);
hbox = gtk_hbox_new(FALSE, 5);
padding = gtk_hbox_new(FALSE, 0);
-
+
gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
-
+
gtk_box_pack_end(GTK_BOX(entry->data_hbox), frame, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), hbox);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->timing_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->timing_label, FALSE, FALSE, 0);
-
+
gtk_box_pack_end(GTK_BOX(hbox), padding, FALSE, FALSE, 0);
return entry;
@@ -2204,7 +2230,7 @@ static nvListEntryPtr list_entry_new_with_display(nvDisplayDataPtr data)
entry->data_type = ENTRY_DATA_DISPLAY;
/* Pack the data's widgets into the list entry data hbox */
-
+
gtk_box_pack_start(GTK_BOX(entry->label_hbox), data->label,
FALSE, FALSE, 5);
@@ -2216,28 +2242,28 @@ static nvListEntryPtr list_entry_new_with_display(nvDisplayDataPtr data)
gtk_box_pack_end(GTK_BOX(entry->data_hbox), frame, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), hbox);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->stereo_hbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->stereo_label, FALSE, FALSE, 0);
-
+
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->rate_label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->rate_text, FALSE, FALSE, 0);
-
+
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->server_checkbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->server_label, FALSE, FALSE, 0);
-
+
vseparator = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), vseparator, FALSE, FALSE, 0);
-
+
gtk_box_pack_start(GTK_BOX(hbox), data->client_checkbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), data->client_label, FALSE, FALSE, 0);
-
+
gtk_box_pack_end(GTK_BOX(hbox), padding, FALSE, FALSE, 0);
return entry;
@@ -3581,6 +3607,21 @@ static void list_entry_update_framelock_status(CtkFramelock *ctk_framelock,
snprintf(str, 32, "%.2f uS", fvalue); // 10.2f
gtk_label_set_text(GTK_LABEL(data->delay_text), str);
+ /* Incomming signal rate */
+ gtk_widget_set_sensitive(data->house_sync_rate_label, framelock_enabled);
+ gtk_widget_set_sensitive(data->house_sync_rate_text, framelock_enabled);
+
+ ret =
+ NvCtrlGetAttribute(data->handle,
+ NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE,
+ &rate);
+ if (ret == NvCtrlSuccess) {
+ snprintf(str, 32, "%d.%.4d Hz", (rate / 10000), (rate % 10000));
+ } else {
+ snprintf(str, 32, "Unknown");
+ }
+ gtk_label_set_text(GTK_LABEL(data->house_sync_rate_text), str);
+
/* House Sync and Ports are always active */
update_image(data->house_hbox,
(house ? ctk_framelock->led_green_pixbuf :
@@ -3955,12 +3996,39 @@ static void update_house_sync_controls(CtkFramelock *ctk_framelock)
house_format = NV_CTRL_FRAMELOCK_VIDEO_MODE_NONE;
if (house_format > NV_CTRL_FRAMELOCK_VIDEO_MODE_HDTV)
house_format = NV_CTRL_FRAMELOCK_VIDEO_MODE_HDTV;
-
- gtk_entry_set_text
- (GTK_ENTRY(GTK_COMBO(ctk_framelock->video_mode_combo)->entry),
- houseFormatStrings[house_format]);
+ if (!ctk_framelock->video_mode_read_only) {
+ gtk_entry_set_text
+ (GTK_ENTRY(GTK_COMBO(ctk_framelock->video_mode_widget)->entry),
+ houseFormatStrings[house_format]);
+ } else {
+ gtk_label_set_text(GTK_LABEL(ctk_framelock->video_mode_widget),
+ houseFormatStrings[house_format]);
+ }
+
+ }
+}
+
+
+
+static void update_display_rate_txt(nvDisplayDataPtr data,
+ guint rate_mHz, int precision)
+{
+ float fvalue;
+ char str[32];
+
+ /* Don't overwrite REFRESH_RATE_3 with REFRESH_RATE data */
+ if (precision < data->rate_precision) {
+ return;
}
+
+ data->rate_precision = precision;
+ data->rate_mHz = rate_mHz;
+
+ fvalue = ((float)(data->rate_mHz)) / 1000.0f;
+ snprintf(str, 32, "%.*f Hz", precision, fvalue);
+
+ gtk_label_set_text(GTK_LABEL(data->rate_text), str);
}
@@ -3983,6 +4051,8 @@ static void gpu_state_received(GtkObject *object,
CtkFramelock *ctk_framelock = gpu_entry->tree->ctk_framelock;
gboolean sensitive;
gboolean checked;
+ int rateMultiplier = 1;
+ int precision = 3;
switch (event->attribute) {
case NV_CTRL_FRAMELOCK_MASTER:
@@ -4195,32 +4265,21 @@ static void gpu_state_received(GtkObject *object,
case NV_CTRL_REFRESH_RATE:
+ rateMultiplier = 10;
+ precision = 2;
+ /* fallthrough */
case NV_CTRL_REFRESH_RATE_3:
/* Update the display device's refresh rate */
display_entry = get_display_on_gpu(gpu_entry, event->display_mask);
if (display_entry && display_entry->data) {
- float fvalue;
- char str[32];
-
display_data =
(nvDisplayDataPtr)(display_entry->data);
- display_data->rate = event->value;
- if (event->attribute == NV_CTRL_REFRESH_RATE_3 &&
- display_data->rate_precision == 3) {
- fvalue = ((float)(display_data->rate)) / 1000.0f;
- snprintf(str, 32, "%.3f Hz", fvalue);
- } else if (display_data->rate_precision == 2 ){
- fvalue = ((float)(display_data->rate)) / 100.0f;
- snprintf(str, 32, "%.2f Hz", fvalue);
- } else {
- // wrong signal (got 2 but support 3 or got 3 but
- // don't support it);
- break;
- }
- gtk_label_set_text(GTK_LABEL(display_data->rate_text), str);
+ update_display_rate_txt(display_data,
+ event->value * rateMultiplier,
+ precision);
}
-
+
/* Make sure the framelock controls are in a consistent state */
update_framelock_controls(ctk_framelock);
break;
@@ -4328,19 +4387,24 @@ static void framelock_state_received(GtkObject *object,
if (house_format > NV_CTRL_FRAMELOCK_VIDEO_MODE_HDTV)
house_format = NV_CTRL_FRAMELOCK_VIDEO_MODE_HDTV;
- g_signal_handlers_block_by_func
- (G_OBJECT(GTK_COMBO(ctk_framelock->video_mode_combo)->entry),
- G_CALLBACK(changed_video_mode),
- (gpointer) ctk_framelock);
+ if (!ctk_framelock->video_mode_read_only) {
+ g_signal_handlers_block_by_func
+ (G_OBJECT(GTK_COMBO(ctk_framelock->video_mode_widget)->entry),
+ G_CALLBACK(changed_video_mode),
+ (gpointer) ctk_framelock);
- gtk_entry_set_text
- (GTK_ENTRY(GTK_COMBO(ctk_framelock->video_mode_combo)->entry),
- houseFormatStrings[house_format]);
-
- g_signal_handlers_unblock_by_func
- (G_OBJECT(GTK_COMBO(ctk_framelock->video_mode_combo)->entry),
- G_CALLBACK(changed_video_mode),
- (gpointer) ctk_framelock);
+ gtk_entry_set_text
+ (GTK_ENTRY(GTK_COMBO(ctk_framelock->video_mode_widget)->entry),
+ houseFormatStrings[house_format]);
+
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT(GTK_COMBO(ctk_framelock->video_mode_widget)->entry),
+ G_CALLBACK(changed_video_mode),
+ (gpointer) ctk_framelock);
+ } else {
+ gtk_label_set_text(GTK_LABEL(ctk_framelock->video_mode_widget),
+ houseFormatStrings[house_format]);
+ }
break;
default:
@@ -4487,6 +4551,7 @@ GtkWidget* ctk_framelock_new(NvCtrlAttributeHandle *handle,
ctk_framelock->attribute_handle = handle;
ctk_framelock->ctk_config = ctk_config;
ctk_framelock->parent_window = GTK_WINDOW(parent_window);
+ ctk_framelock->video_mode_read_only = TRUE;
/* create the watch cursor */
@@ -4585,28 +4650,42 @@ GtkWidget* ctk_framelock_new(NvCtrlAttributeHandle *handle,
/* Create combo boxes */
- combo = gtk_combo_new();
- glist = NULL;
- glist = g_list_append
- (glist,
- houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO]);
- glist = g_list_append
- (glist,
- houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_BI_LEVEL]);
- glist = g_list_append
- (glist,
- houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_TRI_LEVEL]);
- glist = g_list_append
- (glist, houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL]);
-
- gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
- gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), FALSE);
- g_signal_connect(G_OBJECT(GTK_EDITABLE(GTK_COMBO(combo)->entry)),
- "changed", G_CALLBACK(changed_video_mode),
- (gpointer) ctk_framelock);
- ctk_config_set_tooltip(ctk_config, combo,
- __video_mode_combo_help);
- ctk_framelock->video_mode_combo = combo;
+ /* Select video mode widget dropdown/label depending on
+ * video mode is read-only.
+ */
+ ret = NvCtrlGetValidAttributeValues(ctk_framelock->attribute_handle,
+ NV_CTRL_FRAMELOCK_VIDEO_MODE,
+ &valid);
+ if ((ret == NvCtrlSuccess) && (valid.permissions & ATTRIBUTE_TYPE_WRITE)) {
+ ctk_framelock->video_mode_read_only = FALSE;
+ }
+
+ if (!ctk_framelock->video_mode_read_only) {
+ combo = gtk_combo_new();
+ glist = NULL;
+ glist = g_list_append
+ (glist,
+ houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO]);
+ glist = g_list_append
+ (glist,
+ houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_BI_LEVEL]);
+ glist = g_list_append
+ (glist,
+ houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_TRI_LEVEL]);
+ glist = g_list_append
+ (glist, houseFormatStrings[NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL]);
+
+ gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
+ gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), FALSE);
+ g_signal_connect(G_OBJECT(GTK_EDITABLE(GTK_COMBO(combo)->entry)),
+ "changed", G_CALLBACK(changed_video_mode),
+ (gpointer) ctk_framelock);
+ ctk_framelock->video_mode_widget = combo;
+ } else {
+ ctk_framelock->video_mode_widget = gtk_label_new("None");
+ }
+ ctk_config_set_tooltip(ctk_config, ctk_framelock->video_mode_widget,
+ __video_mode_help);
combo = gtk_combo_new();
@@ -4827,7 +4906,7 @@ GtkWidget* ctk_framelock_new(NvCtrlAttributeHandle *handle,
gtk_container_add(GTK_CONTAINER(frame2), hbox);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5);
- gtk_box_pack_start(GTK_BOX(hbox), ctk_framelock->video_mode_combo,
+ gtk_box_pack_start(GTK_BOX(hbox), ctk_framelock->video_mode_widget,
FALSE, FALSE, 5);
gtk_box_pack_start(GTK_BOX(hbox), ctk_framelock->video_mode_detect,
FALSE, TRUE, 5);
@@ -5026,14 +5105,12 @@ static void add_display_devices(CtkFramelock *ctk_framelock,
nvGPUDataPtr gpu_data;
nvListEntryPtr entry;
ReturnStatus ret;
-
+
unsigned int enabled_displays;
unsigned int display_mask;
unsigned int master_mask;
unsigned int slaves_mask;
- gfloat fvalue; /* To print the refresh rate */
- gchar rr_str[32];
nvListEntryPtr server_entry = NULL;
@@ -5097,11 +5174,14 @@ static void add_display_devices(CtkFramelock *ctk_framelock,
/* Cache the server/clients masks */
gpu_data->server_mask = master_mask;
gpu_data->clients_mask = slaves_mask;
-
+
/* Add all enabled displays found on the GPU */
display_mask = 1;
while (display_mask) {
+ int rate;
+ int precision;
+
if (display_mask & enabled_displays) {
/* Create the display structure */
@@ -5110,11 +5190,11 @@ static void add_display_devices(CtkFramelock *ctk_framelock,
if (!display_data) {
goto fail;
}
-
+
/* Setup the display information */
display_data->handle = gpu_data->handle;
display_data->device_mask = display_mask;
-
+
ret = NvCtrlGetDisplayAttribute(gpu_data->handle,
display_mask,
NV_CTRL_FRAMELOCK_MASTERABLE,
@@ -5123,30 +5203,8 @@ static void add_display_devices(CtkFramelock *ctk_framelock,
goto fail;
}
- // If we can't get either percision, then fail
- if (NvCtrlSuccess !=
- (ret = NvCtrlGetDisplayAttribute(gpu_data->handle,
- display_mask,
- NV_CTRL_REFRESH_RATE_3,
- (int *)&(display_data->rate)))) {
- ret = NvCtrlGetDisplayAttribute(gpu_data->handle,
- display_mask,
- NV_CTRL_REFRESH_RATE,
- (int *)&(display_data->rate));
- fvalue = ((float)(display_data->rate)) / 100.0f;
- snprintf(rr_str, 32, "%.2f Hz", fvalue);
- display_data->rate_precision = 2;
- } else {
- fvalue = ((float)(display_data->rate)) / 1000.0f;
- snprintf(rr_str, 32, "%.3f Hz", fvalue);
- display_data->rate_precision = 3;
- }
- if (ret != NvCtrlSuccess) {
- goto fail;
- }
-
display_data->label = gtk_label_new("");
-
+
display_data->server_label = gtk_label_new("Server");
display_data->server_checkbox = gtk_check_button_new();
ctk_config_set_tooltip(ctk_framelock->ctk_config,
@@ -5158,9 +5216,10 @@ static void add_display_devices(CtkFramelock *ctk_framelock,
ctk_config_set_tooltip(ctk_framelock->ctk_config,
display_data->client_checkbox,
__client_checkbox_help);
-
+
+
display_data->rate_label = gtk_label_new("Refresh:");
- display_data->rate_text = gtk_label_new(rr_str);
+ display_data->rate_text = gtk_label_new("");
display_data->stereo_label = gtk_label_new("Stereo");
display_data->stereo_hbox = gtk_hbox_new(FALSE, 0);
@@ -5170,10 +5229,31 @@ static void add_display_devices(CtkFramelock *ctk_framelock,
update_entry_label(ctk_framelock, entry);
list_entry_update_status(ctk_framelock, entry);
-
+
/* Add display to GPU entry */
list_entry_add_child(gpu_entry, entry);
-
+
+
+ /* Refresh Rate */
+ ret = NvCtrlGetDisplayAttribute(display_data->handle,
+ display_data->device_mask,
+ NV_CTRL_REFRESH_RATE_3, &rate);
+ if (ret != NvCtrlSuccess) {
+ ret = NvCtrlGetDisplayAttribute(display_data->handle,
+ display_data->device_mask,
+ NV_CTRL_REFRESH_RATE, &rate);
+ if (ret != NvCtrlSuccess) {
+ rate = 0;
+ precision = 0;
+ } else {
+ rate = rate * 10;
+ precision = 2;
+ }
+ } else {
+ precision = 3;
+ }
+ update_display_rate_txt(display_data, rate, precision);
+
/* Setup state */
if (!display_data->masterable) {
gtk_widget_set_sensitive(display_data->server_label, FALSE);
@@ -5318,8 +5398,6 @@ static void add_gpu_devices(CtkFramelock *ctk_framelock,
&(gpu_data->enabled));
ctk_framelock->framelock_enabled |= gpu_data->enabled;
- entry->ctk_event = CTK_EVENT(ctk_event_new(gpu_data->handle));
-
for (i = 0; i < ARRAY_LEN(__GPUSignals); i++) {
g_signal_connect(G_OBJECT(entry->ctk_event),
__GPUSignals[i],
@@ -5425,6 +5503,10 @@ static void add_framelock_devices(CtkFramelock *ctk_framelock,
framelock_data->house_label = gtk_label_new("House");
framelock_data->house_hbox = gtk_hbox_new(FALSE, 0);
+
+ framelock_data->house_sync_rate_label =
+ gtk_label_new("House Sync Rate:");
+ framelock_data->house_sync_rate_text = gtk_label_new("");
framelock_data->port0_label = gtk_label_new("Port 0");
framelock_data->port0_hbox = gtk_hbox_new(FALSE, 0);
@@ -5454,9 +5536,6 @@ static void add_framelock_devices(CtkFramelock *ctk_framelock,
list_tree_add_entry((nvListTreePtr)(ctk_framelock->tree),
entry);
- entry->ctk_event =
- CTK_EVENT(ctk_event_new(framelock_data->handle));
-
for (i = 0; i < ARRAY_LEN(__FrameLockSignals); i++) {
g_signal_connect(G_OBJECT(entry->ctk_event),
__FrameLockSignals[i],
@@ -5926,7 +6005,7 @@ GtkTextBuffer *ctk_framelock_create_help(GtkTextTagTable *table)
"only.");
ctk_help_heading(b, &i, "Video Mode");
- ctk_help_para(b, &i, __video_mode_combo_help);
+ ctk_help_para(b, &i, __video_mode_help);
ctk_help_heading(b, &i, "Video Mode Detect");
ctk_help_para(b, &i, __detect_video_mode_button_help);
diff --git a/src/gtk+-2.x/ctkframelock.h b/src/gtk+-2.x/ctkframelock.h
index 259ac4f..ac21f22 100644
--- a/src/gtk+-2.x/ctkframelock.h
+++ b/src/gtk+-2.x/ctkframelock.h
@@ -80,11 +80,12 @@ struct _CtkFramelock
GtkWidget *sync_edge_frame;
GtkWidget *sync_edge_combo;
GtkWidget *video_mode_frame;
- GtkWidget *video_mode_combo;
+ GtkWidget *video_mode_widget;
GtkWidget *video_mode_detect;
gint current_detect_format;
guint video_mode_detect_timer;
+ gboolean video_mode_read_only;
/* Dialogs */
GtkWidget *add_devices_dialog;
diff --git a/src/gtk+-2.x/ctkslimm.c b/src/gtk+-2.x/ctkslimm.c
index 93bc4b6..e2b0f79 100644
--- a/src/gtk+-2.x/ctkslimm.c
+++ b/src/gtk+-2.x/ctkslimm.c
@@ -26,6 +26,7 @@
#include "msg.h"
#include "parse.h"
+#include "common-utils.h"
#include "ctkbanner.h"
@@ -70,24 +71,53 @@ typedef struct DpyLocRec { // Display Location
-/**
+/**
* The gridConfigs array enumerates the display grid configurations
* that are presently supported.
*
**/
static GridConfig gridConfigs[] = {
- {2, 2, FALSE}, // rows, columns, valid
- {2, 3, FALSE},
- {2, 4, FALSE},
- {3, 1, FALSE},
- {3, 2, FALSE},
- {1, 3, FALSE},
- {2, 1, FALSE},
- {1, 2, FALSE},
- {4, 1, FALSE},
- {1, 4, FALSE},
- {0, 0, FALSE}
+ {4, 4, FALSE}, // rows, columns, valid
+ {5, 3, FALSE},
+ {3, 5, FALSE},
+ {3, 4, FALSE},
+ {4, 3, FALSE},
+ {3, 3, FALSE},
+ {2, 8, FALSE},
+ {8, 2, FALSE},
+ {2, 7, FALSE},
+ {7, 2, FALSE},
+ {2, 6, FALSE},
+ {6, 2, FALSE},
+ {2, 5, FALSE},
+ {5, 2, FALSE},
+ {1, 16, FALSE},
+ {16, 1, FALSE},
+ {1, 15, FALSE},
+ {15, 1, FALSE},
+ {1, 14, FALSE},
+ {14, 1, FALSE},
+ {1, 13, FALSE},
+ {13, 1, FALSE},
+ {1, 12, FALSE},
+ {12, 1, FALSE},
+ {1, 11, FALSE},
+ {11, 1, FALSE},
+ {1, 10, FALSE},
+ {10, 1, FALSE},
+ {1, 9, FALSE},
+ {9, 1, FALSE},
+ {2, 2, FALSE},
+ {2, 3, FALSE},
+ {2, 4, FALSE},
+ {3, 1, FALSE},
+ {3, 2, FALSE},
+ {1, 3, FALSE},
+ {2, 1, FALSE},
+ {1, 2, FALSE},
+ {4, 1, FALSE},
+ {1, 4, FALSE},
};
GType ctk_slimm_get_type()
@@ -136,7 +166,7 @@ static void remove_slimm_options(XConfigPtr xconf)
static GridConfig *get_ith_valid_grid_config(int idx)
{
int i, count = 0;
- for (i = 0; gridConfigs[i].rows; i++) {
+ for (i = 0; i < ARRAY_LEN(gridConfigs); i++) {
if (!gridConfigs[i].valid) continue;
if (count == idx) return &gridConfigs[i];
count++;
@@ -840,14 +870,14 @@ static Bool parse_slimm_layout(CtkSLIMM *ctk_slimm,
/* Make space for the display location array */
if (!locs) {
- for (loc_idx = 0; gridConfigs[loc_idx].rows; loc_idx++ ) {
+ for (loc_idx = 0; loc_idx < ARRAY_LEN(gridConfigs); loc_idx++ ) {
if ( max_rows < gridConfigs[loc_idx].rows) {
max_rows = gridConfigs[loc_idx].rows;
}
if ( max_cols < gridConfigs[loc_idx].columns) {
max_cols = gridConfigs[loc_idx].columns;
}
- if (max_locs <
+ if (max_locs <
(gridConfigs[loc_idx].rows * gridConfigs[loc_idx].columns)) {
max_locs =
gridConfigs[loc_idx].rows * gridConfigs[loc_idx].columns;
@@ -1010,10 +1040,10 @@ static Bool parse_slimm_layout(CtkSLIMM *ctk_slimm,
goto fail;
}
}
-
+
/* Make sure this is a known/supported grid config */
found = 0;
- for (i = 0; gridConfigs[i].rows; i++) {
+ for (i = 0; i < ARRAY_LEN(gridConfigs); i++) {
if ((gridConfigs[i].rows == rows) &&
(gridConfigs[i].columns == cols)) {
*grid_config_id = i;
@@ -1333,7 +1363,7 @@ GtkWidget* ctk_slimm_new(NvCtrlAttributeHandle *handle,
nvGpuPtr gpu;
int num_displays = 0;
int min_displays = 0;
- GridConfig *grid;
+ int i;
int num_valid = 0;
for (gpu = layout->gpus; gpu; gpu = gpu->next_in_layout) {
@@ -1341,7 +1371,9 @@ GtkWidget* ctk_slimm_new(NvCtrlAttributeHandle *handle,
}
/* Mark configs that have enough displays as valid */
- for (grid = gridConfigs; grid->rows; grid++) {
+ for (i = 0; i < ARRAY_LEN(gridConfigs); i++) {
+ GridConfig *grid = &(gridConfigs[i]);
+
if (!min_displays ||
(min_displays > (grid->rows * grid->columns))) {
min_displays = grid->rows * grid->columns;
@@ -1351,7 +1383,7 @@ GtkWidget* ctk_slimm_new(NvCtrlAttributeHandle *handle,
num_valid++;
}
}
-
+
/* Make sure we have enough dislays for the minimum config */
if (num_valid <= 0) {
err_str = g_strdup_printf("Not enough display devices to "
@@ -1476,7 +1508,7 @@ GtkWidget* ctk_slimm_new(NvCtrlAttributeHandle *handle,
grid_menu_selected_id = 0;
count = 0;
- for (iter = 0; gridConfigs[iter].rows; iter++) {
+ for (iter = 0; iter < ARRAY_LEN(gridConfigs); iter++) {
/* Don't show invalid configs */
if (!gridConfigs[iter].valid) continue;
tmp = g_strdup_printf("%d x %d grid",
diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c
index f8dec3e..52d14ba 100644
--- a/src/gtk+-2.x/ctkwindow.c
+++ b/src/gtk+-2.x/ctkwindow.c
@@ -561,7 +561,7 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf,
/* create the container widget for the "pages" */
hbox = gtk_hbox_new(FALSE, 0);
- gtk_paned_pack2(GTK_PANED(hpane), hbox, TRUE, TRUE);
+ gtk_paned_pack2(GTK_PANED(hpane), hbox, TRUE, FALSE);
ctk_window->page_viewer = hbox;
ctk_window->page = NULL;
diff --git a/src/gtk+-2.x/ctkxvideo.c b/src/gtk+-2.x/ctkxvideo.c
index f5313c3..a7f8a4f 100644
--- a/src/gtk+-2.x/ctkxvideo.c
+++ b/src/gtk+-2.x/ctkxvideo.c
@@ -18,6 +18,7 @@
*/
#include <stdlib.h>
+#include <stdio.h>
#include <gtk/gtk.h>
#include "NvCtrlAttributes.h"
@@ -29,58 +30,9 @@
#include "ctkhelp.h"
-static const char *__xv_overlay_saturation_help =
-"The Video Overlay Saturation slider controls "
-"the saturation level for the Overlay Xv Adaptor.";
-
-static const char *__xv_overlay_contrast_help =
-"The Video Overlay Contrast slider controls "
-"the contrast level for the Overlay Xv Adaptor.";
-
-static const char *__xv_overlay_brightness_help =
-"The Video Overlay Brightness slider controls "
-"the brightness level for the Overlay Xv Adaptor.";
-
-static const char *__xv_overlay_hue_help =
-"The Video Overlay Hue slider controls "
-"the hue level for the Overlay Xv Adaptor.";
-
-static const char *__xv_texture_sync_to_vblank_help =
-"The Video Texture Sync To VBlank checkbox "
-"toggles syncing XvPutVideo(3X) and XvPutStill(3X) to "
-"the vertical retrace of your display device "
-"for the Texture Xv Adaptor.";
-
-static const char *__xv_texture_contrast_help =
-"The Video Texture Contrast slider controls "
-"the contrast level for the Texture Xv Adaptor.";
-
-static const char *__xv_texture_brightness_help =
-"The Video Texture Brightness slider controls "
-"the brightness level for the Texture Xv Adaptor.";
-
-static const char *__xv_texture_hue_help =
-"The Video Texture Hue slider controls "
-"the hue level for the Texture Xv Adaptor.";
-
-static const char *__xv_texture_saturation_help =
-"The Video Texture Saturation slider controls "
-"the saturation level for the Texture Xv Adaptor.";
-
-static const char *__xv_blitter_sync_to_vblank_help =
-"The Video Blitter Sync To VBlank checkbox "
-"toggles syncing XvPutVideo(3X) and XvPutStill(3X) to "
-"the vertical retrace of your display device "
-"for the Blitter Xv Adaptor.";
-
static const char *__xv_sync_to_display_help =
"This controls which display device will be synched to when "
"XVideo Sync To VBlank is enabled.";
-
-static const char *__reset_button_help =
-"The Reset Hardware Defaults button restores "
-"the XVideo settings to their default values.";
-
static void xv_sync_to_display_changed(GtkWidget *widget, gpointer user_data);
@@ -98,45 +50,6 @@ static void xv_sync_to_display_changed(GtkWidget *widget, gpointer user_data);
static void xv_sync_to_display_update_received(GtkObject *object, gpointer arg1,
gpointer user_data);
-static GtkWidget *create_slider(CtkXVideo *ctk_xvideo,
- GtkWidget *vbox,
- GtkWidget *button,
- const gchar *name,
- const char *help,
- gint attribute,
- unsigned int bit);
-
-static void reset_slider(CtkXVideo *ctk_xvideo,
- GtkWidget *slider,
- gint attribute);
-
-static void slider_changed(GtkAdjustment *adjustment, gpointer user_data);
-
-static GtkWidget *create_check_button(CtkXVideo *ctk_xvideo,
- GtkWidget *vbox,
- GtkWidget *button,
- const gchar *name,
- const char *help,
- gint attribute,
- unsigned int bit);
-
-static void check_button_toggled(GtkWidget *widget, gpointer user_data);
-
-
-static void post_check_button_toggled(CtkXVideo *ctk_xvideo,
- gchar *str,
- gboolean enabled);
-
-static void sensitize_radio_buttons(CtkXVideo *ctk_xvideo);
-
-static void reset_check_button(CtkXVideo *ctk_xvideo,
- GtkWidget *check_button,
- gint attribute);
-
-static void set_button_sensitive(GtkButton *button);
-
-static void reset_defaults(GtkButton *button, gpointer user_data);
-
static void post_xv_sync_to_display_changed(CtkXVideo *ctk_xvideo,
gboolean enabled,
gchar *label);
@@ -150,18 +63,7 @@ static void xv_sync_to_display_radio_button_enabled_add(CtkXVideo *ctk_xvideo,
#define FRAME_PADDING 5
-#define __XV_OVERLAY_SATURATION (1 << 1)
-#define __XV_OVERLAY_CONTRAST (1 << 2)
-#define __XV_OVERLAY_BRIGHTNESS (1 << 3)
-#define __XV_OVERLAY_HUE (1 << 4)
-#define __XV_TEXTURE_SYNC_TO_VBLANK (1 << 5)
-#define __XV_TEXTURE_CONTRAST (1 << 6)
-#define __XV_TEXTURE_BRIGHTNESS (1 << 7)
-#define __XV_TEXTURE_SATURATION (1 << 8)
-#define __XV_TEXTURE_HUE (1 << 9)
-#define __XV_BLITTER_SYNC_TO_VBLANK (1 << 10)
-#define __XV_SYNC_TO_DISPLAY (1 << 11)
-
+#define __XV_SYNC_TO_DISPLAY 1
GType ctk_xvideo_get_type(
@@ -370,7 +272,6 @@ static void nv_ctrl_enabled_displays(GtkObject *object, gpointer arg1,
if (mask & remove_devices_mask)
xv_sync_to_display_radio_button_remove(ctk_xvideo, mask);
}
- sensitize_radio_buttons(ctk_xvideo);
gtk_widget_show_all(ctk_xvideo->xv_sync_to_display_button_box);
} /* nv_ctrl_enabled_displays() */
@@ -472,10 +373,7 @@ GtkWidget* ctk_xvideo_new(NvCtrlAttributeHandle *handle,
GtkWidget *banner;
GtkWidget *frame;
GtkWidget *alignment;
- GtkWidget *hbox;
- GtkWidget *label;
GtkWidget *vbox;
- GtkWidget *button;
int sync_mask;
int xv_overlay_present, xv_texture_present, xv_blitter_present;
ReturnStatus ret;
@@ -517,127 +415,11 @@ GtkWidget* ctk_xvideo_new(NvCtrlAttributeHandle *handle,
gtk_box_set_spacing(GTK_BOX(ctk_xvideo), 10);
- /* Create button, but don't pack it, yet */
-
- label = gtk_label_new("Reset Hardware Defaults");
- hbox = gtk_hbox_new(FALSE, 0);
- button = gtk_button_new();
-
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 15);
- gtk_container_add(GTK_CONTAINER(button), hbox);
-
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(reset_defaults), (gpointer) ctk_xvideo);
-
- ctk_config_set_tooltip(ctk_config, button, __reset_button_help);
-
/* Video film banner */
banner = ctk_banner_image_new(BANNER_ARTWORK_XVIDEO);
gtk_box_pack_start(GTK_BOX(object), banner, FALSE, FALSE, 0);
-
- /* XVideo Overlay sliders */
-
- if (xv_overlay_present) {
-
- frame = gtk_frame_new("Video Overlay Adaptor");
- gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0);
-
- vbox = gtk_vbox_new(FALSE, 5);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
-
- ctk_xvideo->overlay_saturation =
- create_slider(ctk_xvideo, vbox, button, "Saturation",
- __xv_overlay_saturation_help,
- NV_CTRL_ATTR_XV_OVERLAY_SATURATION,
- __XV_OVERLAY_SATURATION);
-
- ctk_xvideo->overlay_contrast =
- create_slider(ctk_xvideo, vbox, button, "Contrast",
- __xv_overlay_contrast_help,
- NV_CTRL_ATTR_XV_OVERLAY_CONTRAST,
- __XV_OVERLAY_CONTRAST);
-
- ctk_xvideo->overlay_brightness =
- create_slider(ctk_xvideo, vbox, button, "Brightness",
- __xv_overlay_brightness_help,
- NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS,
- __XV_OVERLAY_BRIGHTNESS);
-
- ctk_xvideo->overlay_hue =
- create_slider(ctk_xvideo, vbox, button, "Hue",
- __xv_overlay_hue_help,
- NV_CTRL_ATTR_XV_OVERLAY_HUE,
- __XV_OVERLAY_HUE);
- }
-
- /* XVideo Texture */
-
- if (xv_texture_present) {
-
- frame = gtk_frame_new("Video Texture Adaptor");
- gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0);
-
- vbox = gtk_vbox_new(FALSE, 5);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
-
- ctk_xvideo->texture_sync_to_blank =
- create_check_button(ctk_xvideo, vbox, button, "Sync to VBlank",
- __xv_texture_sync_to_vblank_help,
- NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK,
- __XV_TEXTURE_SYNC_TO_VBLANK);
-
- ctk_xvideo->texture_brightness =
- create_slider(ctk_xvideo, vbox, button, "Brightness",
- __xv_texture_brightness_help,
- NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS,
- __XV_TEXTURE_BRIGHTNESS);
-
- ctk_xvideo->texture_contrast =
- create_slider(ctk_xvideo, vbox, button, "Contrast",
- __xv_texture_contrast_help,
- NV_CTRL_ATTR_XV_TEXTURE_CONTRAST,
- __XV_TEXTURE_CONTRAST);
-
- ctk_xvideo->texture_hue =
- create_slider(ctk_xvideo, vbox, button, "Hue",
- __xv_texture_hue_help,
- NV_CTRL_ATTR_XV_TEXTURE_HUE,
- __XV_TEXTURE_HUE);
-
- ctk_xvideo->texture_saturation =
- create_slider(ctk_xvideo, vbox, button, "Saturation",
- __xv_texture_saturation_help,
- NV_CTRL_ATTR_XV_TEXTURE_SATURATION,
- __XV_TEXTURE_SATURATION);
-
- }
-
- /* XVideo Blitter */
-
- if (xv_blitter_present) {
-
- frame = gtk_frame_new("Video Blitter Adaptor Settings");
- gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0);
-
- vbox = gtk_vbox_new(FALSE, 5);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
-
- ctk_xvideo->blitter_sync_to_blank =
- create_check_button(ctk_xvideo,
- vbox,
- button,
- "Sync to VBlank",
- __xv_blitter_sync_to_vblank_help,
- NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK,
- __XV_BLITTER_SYNC_TO_VBLANK);
-
- }
-
/* Sync to display selection */
if (xv_texture_present || xv_blitter_present) {
ret = NvCtrlGetAttribute(handle,
@@ -714,7 +496,6 @@ GtkWidget* ctk_xvideo_new(NvCtrlAttributeHandle *handle,
CTK_EVENT_NAME(NV_CTRL_ENABLED_DISPLAYS),
G_CALLBACK(nv_ctrl_enabled_displays),
(gpointer) ctk_xvideo);
- sensitize_radio_buttons(ctk_xvideo);
if (current != -1)
xv_sync_to_display_update_radio_buttons(ctk_xvideo, current);
@@ -723,11 +504,7 @@ GtkWidget* ctk_xvideo_new(NvCtrlAttributeHandle *handle,
}
}
- /* Reset button */
-
- sensitize_radio_buttons(ctk_xvideo);
alignment = gtk_alignment_new(1, 1, 0, 0);
- gtk_container_add(GTK_CONTAINER(alignment), button);
gtk_box_pack_start(GTK_BOX(object), alignment, TRUE, TRUE, 0);
/* finally, show the widget */
@@ -738,362 +515,6 @@ GtkWidget* ctk_xvideo_new(NvCtrlAttributeHandle *handle,
} /* ctk_xvideo_new() */
-
-
-/*
- * create_slider() -
- */
-
-static GtkWidget *create_slider(CtkXVideo *ctk_xvideo,
- GtkWidget *vbox,
- GtkWidget *button,
- const gchar *name,
- const char *help,
- gint attribute,
- unsigned int bit)
-{
- GtkObject *adjustment;
- GtkWidget *scale, *widget;
- gint min, max, val, step_incr, page_incr;
- NVCTRLAttributeValidValuesRec range;
- ReturnStatus ret;
-
- /* get the attribute value */
-
- ret = NvCtrlGetAttribute(ctk_xvideo->handle, attribute, &val);
-
- if (ret != NvCtrlSuccess) return NULL;
-
- /* get the range for the attribute */
-
- NvCtrlGetValidAttributeValues(ctk_xvideo->handle, attribute, &range);
-
- if (range.type != ATTRIBUTE_TYPE_RANGE) return NULL;
-
- min = range.u.range.min;
- max = range.u.range.max;
-
- step_incr = ((max) - (min))/250;
- if (step_incr <= 0) step_incr = 1;
-
- page_incr = ((max) - (min))/25;
- if (page_incr <= 0) page_incr = 1;
-
- /* create the slider */
-
- adjustment = gtk_adjustment_new(val, min, max,
- step_incr, page_incr, 0.0);
-
- g_object_set_data(G_OBJECT(adjustment), "xvideo_attribute",
- GINT_TO_POINTER(attribute));
-
- g_signal_connect(G_OBJECT(adjustment), "value_changed",
- G_CALLBACK(slider_changed),
- (gpointer) ctk_xvideo);
-
- g_signal_connect_swapped(G_OBJECT(adjustment), "value_changed",
- G_CALLBACK(set_button_sensitive),
- (gpointer) button);
-
- scale = ctk_scale_new(GTK_ADJUSTMENT(adjustment), name,
- ctk_xvideo->ctk_config, G_TYPE_INT);
-
- gtk_box_pack_start(GTK_BOX(vbox), scale, TRUE, TRUE, 0);
-
- ctk_xvideo->active_attributes |= bit;
-
- widget = CTK_SCALE(scale)->gtk_scale;
-
- ctk_config_set_tooltip(ctk_xvideo->ctk_config, widget, help);
-
- return scale;
-
-} /* create_slider() */
-
-
-
-/*
- * reset_slider() -
- */
-
-static void reset_slider(CtkXVideo *ctk_xvideo,
- GtkWidget *slider,
- gint attribute)
-{
- GtkAdjustment *adjustment;
- gint val;
-
- if (!slider) return;
-
- adjustment = CTK_SCALE(slider)->gtk_adjustment;
-
- NvCtrlGetAttribute(ctk_xvideo->handle, attribute, &val);
-
- g_signal_handlers_block_matched
- (G_OBJECT(adjustment), G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
- G_CALLBACK(slider_changed), NULL);
-
- gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustment), val);
-
- g_signal_handlers_unblock_matched
- (G_OBJECT(adjustment), G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
- G_CALLBACK(slider_changed), NULL);
-
-} /* reset_slider() */
-
-
-
-/*
- * slider_changed() -
- */
-
-static void slider_changed(GtkAdjustment *adjustment, gpointer user_data)
-{
- CtkXVideo *ctk_xvideo = CTK_XVIDEO(user_data);
- gint attribute, value;
- gchar *str;
-
- user_data = g_object_get_data(G_OBJECT(adjustment), "xvideo_attribute");
- attribute = GPOINTER_TO_INT(user_data);
- value = (gint) adjustment->value;
-
- NvCtrlSetAttribute(ctk_xvideo->handle, attribute, value);
-
- switch (attribute) {
- case NV_CTRL_ATTR_XV_OVERLAY_SATURATION: str = "Overlay Saturation"; break;
- case NV_CTRL_ATTR_XV_OVERLAY_CONTRAST: str = "Overlay Contrast"; break;
- case NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS: str = "Overlay Brightness"; break;
- case NV_CTRL_ATTR_XV_OVERLAY_HUE: str = "Overlay Hue"; break;
- case NV_CTRL_ATTR_XV_TEXTURE_CONTRAST: str = "Texture Contrast"; break;
- case NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS: str = "Texture Brightness"; break;
- case NV_CTRL_ATTR_XV_TEXTURE_HUE: str = "Texture Hue"; break;
- case NV_CTRL_ATTR_XV_TEXTURE_SATURATION: str = "Texture Saturation"; break;
-
- default:
- return;
- }
-
- ctk_config_statusbar_message(ctk_xvideo->ctk_config,
- "Set XVideo %s to %d.", str, value);
-
-} /* slider_changed() */
-
-
-
-/*
- * create_check_button() -
- */
-
-static GtkWidget *create_check_button(CtkXVideo *ctk_xvideo,
- GtkWidget *vbox,
- GtkWidget *button,
- const gchar *name,
- const char *help,
- gint attribute,
- unsigned int bit)
-{
- GtkWidget *check_button;
- ReturnStatus ret;
- int val;
-
- /* get the attribute value */
-
- ret = NvCtrlGetAttribute(ctk_xvideo->handle, attribute, &val);
-
- if (ret != NvCtrlSuccess) return NULL;
-
- check_button = gtk_check_button_new_with_label(name);
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), val);
-
- g_signal_connect(G_OBJECT(check_button), "toggled",
- G_CALLBACK(check_button_toggled),
- (gpointer) ctk_xvideo);
-
- g_signal_connect_swapped(G_OBJECT(check_button), "toggled",
- G_CALLBACK(set_button_sensitive),
- (gpointer) button);
-
- g_object_set_data(G_OBJECT(check_button), "xvideo_attribute",
- GINT_TO_POINTER(attribute));
-
- ctk_config_set_tooltip(ctk_xvideo->ctk_config, check_button, name);
-
- gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0);
-
- ctk_xvideo->active_attributes |= bit;
-
- ctk_config_set_tooltip(ctk_xvideo->ctk_config, check_button, help);
-
- return check_button;
-
-} /* create_check_button() */
-
-
-
-/*
- * check_button_toggled() -
- */
-
-static void check_button_toggled(GtkWidget *widget, gpointer user_data)
-{
- CtkXVideo *ctk_xvideo = CTK_XVIDEO(user_data);
- gint attribute, enabled;
- gchar *str;
-
- user_data = g_object_get_data(G_OBJECT(widget), "xvideo_attribute");
- attribute = GPOINTER_TO_INT(user_data);
-
- enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
-
- NvCtrlSetAttribute(ctk_xvideo->handle, attribute, enabled);
-
- switch (attribute) {
- case NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK:
- str = "Texture Sync To VBlank"; break;
- case NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK:
- str = "Blitter Sync To VBlank"; break;
-
- default:
- return;
- }
- sensitize_radio_buttons(ctk_xvideo);
- post_check_button_toggled(ctk_xvideo, str, enabled);
-} /* check_button_toggled() */
-
-/*
- * post_check_button_toggled()
- */
-
-static void post_check_button_toggled(CtkXVideo *ctk_xvideo, gchar *str, gboolean enabled)
-{
- ctk_config_statusbar_message(ctk_xvideo->ctk_config, "%s XVideo %s.",
- enabled ? "Enabled" : "Disabled", str);
-} /* post_check_button_toggled() */
-
-/*
- * sensitize_radio_buttons()
- */
-static void sensitize_radio_buttons(CtkXVideo *ctk_xvideo)
-{
- int i;
- gboolean enabled;
-
- if (!ctk_xvideo->blitter_sync_to_blank &&
- !ctk_xvideo->texture_sync_to_blank) return;
-
- enabled = FALSE;
- if (ctk_xvideo->blitter_sync_to_blank) {
- enabled |= gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON(ctk_xvideo->blitter_sync_to_blank));
- }
- if (ctk_xvideo->texture_sync_to_blank) {
- enabled |= gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON(ctk_xvideo->texture_sync_to_blank));
- }
- for (i = 0; i < 24; i++) {
- GtkWidget *b = ctk_xvideo->xv_sync_to_display_buttons[i];
- if (!b) continue;
- gtk_widget_set_sensitive(b, enabled);
- }
-} /* sensitize_radio_buttons() */
-
-
-/*
- * reset_check_button() -
- */
-
-static void reset_check_button(CtkXVideo *ctk_xvideo,
- GtkWidget *check_button,
- gint attribute)
-{
- gint val;
-
- if (!check_button) return;
-
- NvCtrlGetAttribute(ctk_xvideo->handle, attribute, &val);
-
- g_signal_handlers_block_matched
- (G_OBJECT(check_button), G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
- G_CALLBACK(check_button_toggled), NULL);
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), val);
-
- g_signal_handlers_unblock_matched
- (G_OBJECT(check_button), G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
- G_CALLBACK(check_button_toggled), NULL);
- sensitize_radio_buttons(ctk_xvideo);
-
-} /* reset_check_button() */
-
-
-
-static void set_button_sensitive(GtkButton *button)
-{
- gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE);
-}
-
-
-
-
-static void reset_defaults(GtkButton *button, gpointer user_data)
-{
- CtkXVideo *ctk_xvideo = CTK_XVIDEO(user_data);
-
- /*
- * XXX should we expose separate buttons for each adaptor's
- * defaults?
- */
-
- NvCtrlSetAttribute(ctk_xvideo->handle,
- NV_CTRL_ATTR_XV_OVERLAY_SET_DEFAULTS, 1);
-
- NvCtrlSetAttribute(ctk_xvideo->handle,
- NV_CTRL_ATTR_XV_TEXTURE_SET_DEFAULTS, 1);
-
- NvCtrlSetAttribute(ctk_xvideo->handle,
- NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS, 1);
-
-
- reset_slider(ctk_xvideo, ctk_xvideo->overlay_saturation,
- NV_CTRL_ATTR_XV_OVERLAY_SATURATION);
-
- reset_slider(ctk_xvideo, ctk_xvideo->overlay_contrast,
- NV_CTRL_ATTR_XV_OVERLAY_CONTRAST);
-
- reset_slider(ctk_xvideo, ctk_xvideo->overlay_brightness,
- NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS);
-
- reset_slider(ctk_xvideo, ctk_xvideo->overlay_hue,
- NV_CTRL_ATTR_XV_OVERLAY_HUE);
-
- reset_check_button(ctk_xvideo, ctk_xvideo->texture_sync_to_blank,
- NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK);
-
- reset_slider(ctk_xvideo, ctk_xvideo->texture_contrast,
- NV_CTRL_ATTR_XV_TEXTURE_CONTRAST);
-
- reset_slider(ctk_xvideo, ctk_xvideo->texture_brightness,
- NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS);
-
- reset_slider(ctk_xvideo, ctk_xvideo->texture_hue,
- NV_CTRL_ATTR_XV_TEXTURE_HUE);
-
- reset_slider(ctk_xvideo, ctk_xvideo->texture_saturation,
- NV_CTRL_ATTR_XV_TEXTURE_SATURATION);
-
-
- reset_check_button(ctk_xvideo, ctk_xvideo->blitter_sync_to_blank,
- NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK);
-
-
- gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
-
- ctk_config_statusbar_message
- (CTK_CONFIG(ctk_xvideo->ctk_config),
- "Reset XVideo hardware defaults.");
-}
-
GtkTextBuffer *ctk_xvideo_create_help(GtkTextTagTable *table,
CtkXVideo *ctk_xvideo)
{
@@ -1108,65 +529,12 @@ GtkTextBuffer *ctk_xvideo_create_help(GtkTextTagTable *table,
ctk_help_para(b, &i, "The X Server XVideo Settings page uses the XVideo "
"X extension.");
-
- if (ctk_xvideo->active_attributes & __XV_OVERLAY_SATURATION) {
- ctk_help_heading(b, &i, "Video Overlay Saturation");
- ctk_help_para(b, &i, __xv_overlay_saturation_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_OVERLAY_CONTRAST) {
- ctk_help_heading(b, &i, "Video Overlay Contrast");
- ctk_help_para(b, &i, __xv_overlay_contrast_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_OVERLAY_BRIGHTNESS) {
- ctk_help_heading(b, &i, "Video Overlay Brightness");
- ctk_help_para(b, &i, __xv_overlay_brightness_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_OVERLAY_HUE) {
- ctk_help_heading(b, &i, "Video Overlay Hue");
- ctk_help_para(b, &i, __xv_overlay_hue_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_TEXTURE_SYNC_TO_VBLANK) {
- ctk_help_heading(b, &i, "Video Texture Sync To VBlank");
- ctk_help_para(b, &i, __xv_texture_sync_to_vblank_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_TEXTURE_BRIGHTNESS) {
- ctk_help_heading(b, &i, "Video Texture Brightness");
- ctk_help_para(b, &i, __xv_texture_brightness_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_TEXTURE_CONTRAST) {
- ctk_help_heading(b, &i, "Video Texture Contrast");
- ctk_help_para(b, &i, __xv_texture_contrast_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_TEXTURE_HUE) {
- ctk_help_heading(b, &i, "Video Texture Hue");
- ctk_help_para(b, &i, __xv_texture_hue_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_TEXTURE_SATURATION) {
- ctk_help_heading(b, &i, "Video Texture Saturation");
- ctk_help_para(b, &i, __xv_texture_saturation_help);
- }
-
- if (ctk_xvideo->active_attributes & __XV_BLITTER_SYNC_TO_VBLANK) {
- ctk_help_heading(b, &i, "Video Blitter Sync To VBlank");
- ctk_help_para(b, &i, __xv_blitter_sync_to_vblank_help);
- }
if (ctk_xvideo->active_attributes & __XV_SYNC_TO_DISPLAY) {
ctk_help_heading(b, &i, "Sync to this display device");
ctk_help_para(b, &i, __xv_sync_to_display_help);
}
- ctk_help_heading(b, &i, "Reset Hardware Defaults");
- ctk_help_para(b, &i, __reset_button_help);
-
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkxvideo.h b/src/gtk+-2.x/ctkxvideo.h
index 08db2b8..56025fd 100644
--- a/src/gtk+-2.x/ctkxvideo.h
+++ b/src/gtk+-2.x/ctkxvideo.h
@@ -54,16 +54,6 @@ struct _CtkXVideo
NvCtrlAttributeHandle *handle;
CtkConfig *ctk_config;
- GtkWidget *overlay_saturation;
- GtkWidget *overlay_contrast;
- GtkWidget *overlay_brightness;
- GtkWidget *overlay_hue;
- GtkWidget *texture_contrast;
- GtkWidget *texture_brightness;
- GtkWidget *texture_hue;
- GtkWidget *texture_saturation;
- GtkWidget *texture_sync_to_blank;
- GtkWidget *blitter_sync_to_blank;
GtkWidget *xv_sync_to_display_buttons[24];
GtkWidget *xv_sync_to_display_button_box;
unsigned int active_attributes;
diff --git a/src/libXNVCtrl/NVCtrl.c b/src/libXNVCtrl/NVCtrl.c
index 6eacc95..fe6240f 100644
--- a/src/libXNVCtrl/NVCtrl.c
+++ b/src/libXNVCtrl/NVCtrl.c
@@ -45,7 +45,9 @@
#define NVCTRL_EXT_EXISTS 1
#define NVCTRL_EXT_NEED_TARGET_SWAP 2
#define NVCTRL_EXT_64_BIT_ATTRIBUTES 4
-#define NVCTRL_EXT_NEED_CHECK (1 << (sizeof(XPointer) - 1))
+/* SetAttributeAndGetStatus supports target type other than X_SCREEN */
+#define NVCTRL_EXT_HAS_TARGET_SET_GET 8
+#define NVCTRL_EXT_NEED_CHECK (~(uintptr_t)0)
static XExtensionInfo _nvctrl_ext_info_data;
static XExtensionInfo *nvctrl_ext_info = &_nvctrl_ext_info_data;
@@ -56,9 +58,12 @@ static /* const */ char *nvctrl_extension_name = NV_CONTROL_NAME;
#define XNVCTRLSimpleCheckExtension(dpy,i) \
XextSimpleCheckExtension (dpy, i, nvctrl_extension_name)
-static int close_display();
static uintptr_t version_flags(Display *dpy, XExtDisplayInfo *info);
-static Bool wire_to_event();
+static Bool wire_to_event(Display *dpy, XEvent *host, xEvent *wire);
+
+// This is needed to define nvctrl_extension_hooks
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
+
static /* const */ XExtensionHooks nvctrl_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
@@ -79,8 +84,6 @@ static XEXT_GENERATE_FIND_DISPLAY (find_display, nvctrl_ext_info,
NV_CONTROL_EVENTS,
(XPointer)NVCTRL_EXT_NEED_CHECK)
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
-
/*
* NV-CONTROL versions 1.8 and 1.9 pack the target_type and target_id
* fields in reversed order. In order to talk to one of these servers,
@@ -136,6 +139,9 @@ static uintptr_t version_flags(Display *dpy, XExtDisplayInfo *info)
if (major == 1 && (minor == 8 || minor == 9)) {
data |= NVCTRL_EXT_NEED_TARGET_SWAP;
}
+ if ((major > 1) || ((major == 1) && (minor > 18))) {
+ data |= NVCTRL_EXT_HAS_TARGET_SET_GET;
+ }
if ((major > 1) || ((major == 1) && (minor > 20))) {
data |= NVCTRL_EXT_64_BIT_ATTRIBUTES;
}
@@ -291,10 +297,20 @@ Bool XNVCTRLSetTargetAttributeAndGetStatus (
xnvCtrlSetAttributeAndGetStatusReq *req;
xnvCtrlSetAttributeAndGetStatusReply rep;
Bool success;
+ uintptr_t flags;
if(!XextHasExtension(info))
return False;
+ flags = version_flags(dpy, info);
+
+ if (!(flags & NVCTRL_EXT_EXISTS))
+ return False;
+
+ if (!(flags & NVCTRL_EXT_HAS_TARGET_SET_GET) &&
+ target_type != NV_CTRL_TARGET_TYPE_X_SCREEN)
+ return False;
+
XNVCTRLCheckExtension (dpy, info, False);
LockDisplay (dpy);
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index 1bb62ce..4f60cd0 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -2276,14 +2276,15 @@
/*
* NV_CTRL_DISPLAYPORT_LINK_RATE - returns the negotiated lane bandwidth of the
- * DisplayPort main link.
+ * DisplayPort main link. The numerical value of this attribute is the link
+ * rate in bps divided by 27000000.
* This attribute is only available for DisplayPort flat panels.
*/
#define NV_CTRL_DISPLAYPORT_LINK_RATE 291 /* R-DG */
#define NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED 0x0
-#define NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS 0x6
-#define NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS 0xA
+#define NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS 0x6 /* deprecated */
+#define NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS 0xA /* deprecated */
/*
* NV_CTRL_STEREO_EYES_EXCHANGE - Controls whether or not the left and right
@@ -3184,8 +3185,18 @@
#define NV_CTRL_DISPLAY_ENABLED_TRUE 1
#define NV_CTRL_DISPLAY_ENABLED_FALSE 0
+/*
+ * NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE: this is the rate
+ * of an incomming house sync signal to the frame lock board, in milliHz.
+ *
+ * This attribute may be queried through XNVCTRLQueryTargetAttribute()
+ * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
+ * target.
+ */
+#define NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE 389 /* R--F */
+
-#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_DISPLAY_ENABLED
+#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE
/**************************************************************************/
@@ -3483,8 +3494,6 @@
* the Monitor section of the X config file
* "option" - HorizSync is from the "HorizSync" NVIDIA X
* config option
- * "twinview" - HorizSync is from the "SecondMonitorHorizSync"
- * NVIDIA X config option
* "builtin" - HorizSync is from NVIDIA X driver builtin
* default values
*
@@ -3518,8 +3527,6 @@
* the Monitor section of the X config file
* "option" - VertRefresh is from the "VertRefresh" NVIDIA X
* config option
- * "twinview" - VertRefresh is from the "SecondMonitorVertRefresh"
- * NVIDIA X config option
* "builtin" - VertRefresh is from NVIDIA X driver builtin
* default values
*
diff --git a/src/libXNVCtrl/NVCtrlLib.h b/src/libXNVCtrl/NVCtrlLib.h
index 6bad9ba..f2f4bd6 100644
--- a/src/libXNVCtrl/NVCtrlLib.h
+++ b/src/libXNVCtrl/NVCtrlLib.h
@@ -421,7 +421,8 @@ Bool XNVCTRLQueryValidTargetAttributeValues (
*
* Returns True if the attribute exists. Returns False otherwise. If
* XNVCTRLQueryAttributePermissions returns True, permissions will
- * indicate the permission flags for the attribute.
+ * indicate the permission flags for the attribute. It excludes read
+ * and write permissions.
*/
Bool XNVCTRLQueryAttributePermissions (
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributes.c b/src/libXNVCtrlAttributes/NvCtrlAttributes.c
index 3e7ec39..1c2a78b 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributes.c
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributes.c
@@ -26,8 +26,6 @@
#include "parse.h"
-#include <X11/extensions/xf86vmode.h>
-#include <X11/extensions/Xvlib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -531,9 +529,7 @@ ReturnStatus
NvCtrlGetDisplayAttribute64(NvCtrlAttributeHandle *handle,
unsigned int display_mask, int attr, int64_t *val)
{
- ReturnStatus status;
NvCtrlAttributePrivateHandle *h;
- int value_32;
h = (NvCtrlAttributePrivateHandle *) handle;
@@ -545,11 +541,11 @@ NvCtrlGetDisplayAttribute64(NvCtrlAttributeHandle *handle,
case NV_CTRL_ATTR_EXT_VM_PRESENT:
*val = (h->vm) ? True : False; break;
case NV_CTRL_ATTR_EXT_XV_OVERLAY_PRESENT:
- *val = (h->xv && h->xv->overlay) ? True : False; break;
+ *val = h->xv && h->xv->overlay; break;
case NV_CTRL_ATTR_EXT_XV_TEXTURE_PRESENT:
- *val = (h->xv && h->xv->texture) ? True : False; break;
+ *val = h->xv && h->xv->texture; break;
case NV_CTRL_ATTR_EXT_XV_BLITTER_PRESENT:
- *val = (h->xv && h->xv->blitter) ? True : False; break;
+ *val = h->xv && h->xv->blitter; break;
default:
return NvCtrlNoAttribute;
}
@@ -563,13 +559,6 @@ NvCtrlGetDisplayAttribute64(NvCtrlAttributeHandle *handle,
return NvCtrlNvControlGetAttribute(h, display_mask, attr, val);
}
- if ((attr >= NV_CTRL_ATTR_XV_BASE) &&
- (attr <= NV_CTRL_ATTR_XV_LAST_ATTRIBUTE)) {
- status = NvCtrlXvGetAttribute(h, attr, &value_32);
- *val = value_32;
- return status;
- }
-
return NvCtrlNoAttribute;
} /* NvCtrlGetDisplayAttribute64() */
@@ -602,12 +591,6 @@ NvCtrlSetDisplayAttribute(NvCtrlAttributeHandle *handle,
return NvCtrlNvControlSetAttribute(h, display_mask, attr, val);
}
- if ((attr >= NV_CTRL_ATTR_XV_BASE) &&
- (attr <= NV_CTRL_ATTR_XV_LAST_ATTRIBUTE)) {
-
- return NvCtrlXvSetAttribute(h, attr, val);
- }
-
return NvCtrlNoAttribute;
} /* NvCtrlSetDisplayAttribute() */
@@ -666,12 +649,6 @@ NvCtrlGetValidDisplayAttributeValues(NvCtrlAttributeHandle *handle,
attr, val);
}
- if ((attr >= NV_CTRL_ATTR_XV_BASE) &&
- (attr <= NV_CTRL_ATTR_XV_LAST_ATTRIBUTE)) {
-
- return NvCtrlXvGetValidAttributeValues(h, attr, val);
- }
-
return NvCtrlNoAttribute;
} /* NvCtrlGetValidDisplayAttributeValues() */
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributes.h b/src/libXNVCtrlAttributes/NvCtrlAttributes.h
index c8beb87..8da3aa5 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributes.h
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributes.h
@@ -96,34 +96,10 @@ typedef void NvCtrlAttributeHandle;
#define NV_CTRL_ATTR_NV_LAST_ATTRIBUTE \
(NV_CTRL_ATTR_NV_MINOR_VERSION)
-#define NV_CTRL_ATTR_XV_BASE \
- (NV_CTRL_ATTR_NV_LAST_ATTRIBUTE + 1)
-
-#define NV_CTRL_ATTR_XV_OVERLAY_SATURATION (NV_CTRL_ATTR_XV_BASE + 0)
-#define NV_CTRL_ATTR_XV_OVERLAY_CONTRAST (NV_CTRL_ATTR_XV_BASE + 1)
-#define NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS (NV_CTRL_ATTR_XV_BASE + 2)
-#define NV_CTRL_ATTR_XV_OVERLAY_HUE (NV_CTRL_ATTR_XV_BASE + 3)
-#define NV_CTRL_ATTR_XV_OVERLAY_SET_DEFAULTS (NV_CTRL_ATTR_XV_BASE + 4)
-#define NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK (NV_CTRL_ATTR_XV_BASE + 5)
-#define NV_CTRL_ATTR_XV_TEXTURE_CONTRAST (NV_CTRL_ATTR_XV_BASE + 6)
-#define NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS (NV_CTRL_ATTR_XV_BASE + 7)
-#define NV_CTRL_ATTR_XV_TEXTURE_SATURATION (NV_CTRL_ATTR_XV_BASE + 8)
-#define NV_CTRL_ATTR_XV_TEXTURE_HUE (NV_CTRL_ATTR_XV_BASE + 9)
-#define NV_CTRL_ATTR_XV_TEXTURE_SET_DEFAULTS (NV_CTRL_ATTR_XV_BASE + 10)
-#define NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK (NV_CTRL_ATTR_XV_BASE + 11)
-#define NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS (NV_CTRL_ATTR_XV_BASE + 12)
-
-
-#define NV_CTRL_ATTR_XV_LAST_ATTRIBUTE \
- (NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS)
-
-#define NV_CTRL_ATTR_XV_NUM \
- (NV_CTRL_ATTR_XV_LAST_ATTRIBUTE - NV_CTRL_ATTR_XV_BASE + 1)
-
/* GLX */
#define NV_CTRL_ATTR_GLX_BASE \
- (NV_CTRL_ATTR_XV_LAST_ATTRIBUTE + 1)
+ (NV_CTRL_ATTR_NV_LAST_ATTRIBUTE + 1)
#define NV_CTRL_ATTR_GLX_FBCONFIG_ATTRIBS (NV_CTRL_ATTR_GLX_BASE + 0)
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h b/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h
index 728f3e9..5daa455 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h
@@ -23,7 +23,6 @@
#include "NvCtrlAttributes.h"
#include "NVCtrl.h"
#include <GL/glx.h> /* GLX #defines */
-#include <X11/extensions/Xvlib.h> /* Xv */
#define EXTENSION_NV_CONTROL 0x1
@@ -99,42 +98,12 @@ struct __NvCtrlVidModeAttributes {
float gamma[3];
};
-struct __NvCtrlXvAttribute {
- Atom atom;
- NVCTRLAttributeValidValuesRec range;
-};
-
-struct __NvCtrlXvOverlayAttributes {
- unsigned int port;
- NvCtrlXvAttribute *saturation;
- NvCtrlXvAttribute *contrast;
- NvCtrlXvAttribute *brightness;
- NvCtrlXvAttribute *hue;
- NvCtrlXvAttribute *defaults;
-};
-
-struct __NvCtrlXvTextureAttributes {
- unsigned int port;
- NvCtrlXvAttribute *sync_to_vblank;
- NvCtrlXvAttribute *contrast;
- NvCtrlXvAttribute *brightness;
- NvCtrlXvAttribute *hue;
- NvCtrlXvAttribute *saturation;
- NvCtrlXvAttribute *defaults;
-};
-
-struct __NvCtrlXvBlitterAttributes {
- unsigned int port;
- NvCtrlXvAttribute *sync_to_vblank;
- NvCtrlXvAttribute *defaults;
-};
-
struct __NvCtrlXvAttributes {
unsigned int major_version;
unsigned int minor_version;
- NvCtrlXvOverlayAttributes *overlay; /* XVideo info (overlay) */
- NvCtrlXvTextureAttributes *texture; /* XVideo info (texture) */
- NvCtrlXvBlitterAttributes *blitter; /* XVideo info (blitter) */
+ Bool overlay;
+ Bool texture;
+ Bool blitter;
};
struct __NvCtrlXrandrAttributes {
@@ -175,20 +144,9 @@ void
NvCtrlXvAttributesClose (NvCtrlAttributePrivateHandle *);
ReturnStatus
-NvCtrlXvGetAttribute (NvCtrlAttributePrivateHandle *, int, int *);
-
-ReturnStatus
-NvCtrlXvSetAttribute (NvCtrlAttributePrivateHandle *, int, int);
-
-ReturnStatus
NvCtrlXvGetStringAttribute (NvCtrlAttributePrivateHandle *,
unsigned int, int, char **);
-ReturnStatus
-NvCtrlXvGetValidAttributeValues(NvCtrlAttributePrivateHandle *, int,
- NVCTRLAttributeValidValuesRec *);
-
-
/* GLX extension attribute functions */
Bool
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesXv.c b/src/libXNVCtrlAttributes/NvCtrlAttributesXv.c
index 3defc70..d8902b5 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributesXv.c
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributesXv.c
@@ -28,18 +28,6 @@
#include "msg.h"
-static NvCtrlXvAttribute *getXvAttribute (NvCtrlAttributePrivateHandle *,
- XvPortID, const char *);
-
-static Bool checkAdaptor(NvCtrlAttributePrivateHandle *h,
- unsigned int attribute);
-
-static unsigned int getXvPort(NvCtrlAttributePrivateHandle *h,
- unsigned int attribute);
-
-static NvCtrlXvAttribute *getXvAttributePtr(NvCtrlAttributePrivateHandle *h,
- unsigned int attribute);
-
typedef struct __libXvInfoRec {
/* libXv.so library handle */
@@ -47,9 +35,6 @@ typedef struct __libXvInfoRec {
int ref_count; /* # users of the library */
/* libXv functions used */
- int (* XvGetPortAttribute) (Display *, XvPortID, Atom, int *);
- int (* XvSetPortAttribute) (Display *, XvPortID, Atom, int);
- XvAttribute * (* XvQueryPortAttributes) (Display *, XvPortID, int *);
int (* XvQueryExtension) (Display *, unsigned int *,
unsigned int *, unsigned int *,
unsigned int *, unsigned int *);
@@ -104,16 +89,6 @@ static Bool open_libxv(void)
NV_DLSYM(__libXv->handle, "XvQueryAdaptors");
if ((error_str = dlerror()) != NULL) goto fail;
- __libXv->XvGetPortAttribute =
- NV_DLSYM(__libXv->handle, "XvGetPortAttribute");
- if ((error_str = dlerror()) != NULL) goto fail;
-
- __libXv->XvSetPortAttribute =
- NV_DLSYM(__libXv->handle, "XvSetPortAttribute");
- if ((error_str = dlerror()) != NULL) goto fail;
-
- __libXv->XvQueryPortAttributes =
- NV_DLSYM(__libXv->handle, "XvQueryPortAttributes");
if ((error_str = dlerror()) != NULL) goto fail;
@@ -208,9 +183,6 @@ NvCtrlXvAttributes * NvCtrlInitXvAttributes(NvCtrlAttributePrivateHandle *h)
&event_base, &error_base);
if (ret != Success) goto fail;
- /* XXX do we have a minimum Xv version? */
-
-
/* Get the list of adaptors */
ret = __libXv->XvQueryAdaptors(h->dpy, RootWindow(h->dpy, h->target_id),
&nadaptors, &ainfo);
@@ -221,111 +193,15 @@ NvCtrlXvAttributes * NvCtrlInitXvAttributes(NvCtrlAttributePrivateHandle *h)
if ((strcmp(ainfo[i].name, "NV17 Video Overlay") == 0) ||
(strcmp(ainfo[i].name, "NV10 Video Overlay") == 0)) {
-
- NvCtrlXvOverlayAttributes *attrs;
-
- attrs = malloc(sizeof(NvCtrlXvOverlayAttributes));
- if ( !attrs ) {
- error_str = "Out of memory.";
- goto fail;
- }
-
- attrs->port = ainfo[i].base_id;
- attrs->saturation = getXvAttribute(h, attrs->port,
- "XV_SATURATION");
- attrs->contrast = getXvAttribute(h, attrs->port,
- "XV_CONTRAST");
- attrs->brightness = getXvAttribute(h, attrs->port,
- "XV_BRIGHTNESS");
- attrs->hue = getXvAttribute(h, attrs->port,
- "XV_HUE");
- attrs->defaults = getXvAttribute(h, attrs->port,
- "XV_SET_DEFAULTS");
-
- if (!attrs->saturation ||
- !attrs->contrast ||
- !attrs->brightness ||
- !attrs->hue ||
- !attrs->defaults) {
-
- if (attrs->saturation) free(attrs->saturation);
- if (attrs->contrast) free(attrs->contrast);
- if (attrs->brightness) free(attrs->brightness);
- if (attrs->hue) free(attrs->hue);
- if (attrs->defaults) free(attrs->defaults);
-
- free(attrs);
- attrs = NULL;
-
- } else {
- xv->overlay = attrs;
- }
+ xv->overlay = True;
}
if (strcmp(ainfo[i].name, "NV17 Video Texture") == 0) {
-
- NvCtrlXvTextureAttributes *attrs;
-
- attrs = malloc(sizeof(NvCtrlXvTextureAttributes));
- if ( !attrs ) {
- error_str = "Out of memory.";
- goto fail;
- }
-
- attrs->port = ainfo[i].base_id;
- attrs->sync_to_vblank = getXvAttribute(h, attrs->port,
- "XV_SYNC_TO_VBLANK");
- attrs->contrast = getXvAttribute(h, attrs->port,
- "XV_CONTRAST");
- attrs->brightness = getXvAttribute(h, attrs->port,
- "XV_BRIGHTNESS");
- attrs->saturation = getXvAttribute(h, attrs->port,
- "XV_SATURATION");
- attrs->hue = getXvAttribute(h, attrs->port,
- "XV_HUE");
- attrs->defaults = getXvAttribute(h, attrs->port,
- "XV_SET_DEFAULTS");
- if (!attrs->sync_to_vblank ||
- !attrs->defaults) {
-
- if (attrs->sync_to_vblank) free(attrs->sync_to_vblank);
- if (attrs->defaults) free(attrs->defaults);
-
- free(attrs);
- attrs = NULL;
-
- } else {
- xv->texture = attrs;
- }
+ xv->texture = True;
}
if (strcmp(ainfo[i].name, "NV05 Video Blitter") == 0) {
-
- NvCtrlXvBlitterAttributes *attrs;
-
- attrs = malloc(sizeof(NvCtrlXvBlitterAttributes));
- if ( !attrs ) {
- error_str = "Out of memory.";
- goto fail;
- }
-
- attrs->port = ainfo[i].base_id;
- attrs->sync_to_vblank = getXvAttribute(h, attrs->port,
- "XV_SYNC_TO_VBLANK");
- attrs->defaults = getXvAttribute(h, attrs->port,
- "XV_SET_DEFAULTS");
- if (!attrs->sync_to_vblank ||
- !attrs->defaults) {
-
- if (attrs->sync_to_vblank) free(attrs->sync_to_vblank);
- if (attrs->defaults) free(attrs->defaults);
-
- free(attrs);
- attrs = NULL;
-
- } else {
- xv->blitter = attrs;
- }
+ xv->blitter = True;
}
}
@@ -340,93 +216,14 @@ NvCtrlXvAttributes * NvCtrlInitXvAttributes(NvCtrlAttributePrivateHandle *h)
if (warn_str) {
nv_warning_msg("libXv setup warning: %s\n", warn_str);
}
- if (xv != NULL) {
- if (xv->overlay) {
- free(xv->overlay);
- }
- if (xv->texture) {
- free(xv->texture);
- }
- if (xv->blitter) {
- free(xv->blitter);
- }
- free(xv);
- }
+
+ free(xv);
return NULL;
} /* NvCtrlInitXvAttributes() */
-
-ReturnStatus NvCtrlXvGetAttribute(NvCtrlAttributePrivateHandle *h,
- int attr, int *val)
-{
- NvCtrlXvAttribute *a = NULL;
- unsigned int port;
-
- /* first, check that we have the necessary adaptor */
-
- if (!checkAdaptor(h, attr)) return NvCtrlAttributeNotAvailable;
-
- /* get the attribute pointer */
-
- a = getXvAttributePtr(h, attr);
- if (!a) return NvCtrlAttributeNotAvailable;
-
- if (! (a->range.permissions & ATTRIBUTE_TYPE_READ))
- return NvCtrlWriteOnlyAttribute;
-
- /* get the port */
-
- port = getXvPort(h, attr);
- if (!port) return NvCtrlAttributeNotAvailable;
-
- /* finally, query the value */
-
- if (__libXv->XvGetPortAttribute(h->dpy, port, a->atom, val) != Success) {
- return NvCtrlError;
- }
-
- return NvCtrlSuccess;
-
-} /* NvCtrlXvGetAttribute() */
-
-
-
-ReturnStatus NvCtrlXvSetAttribute(NvCtrlAttributePrivateHandle *h,
- int attr, int val)
-{
- NvCtrlXvAttribute *a = NULL;
- unsigned int port;
-
- /* first, check that we have the necessary adaptor */
-
- if (!checkAdaptor(h, attr)) return NvCtrlAttributeNotAvailable;
-
- /* get the attribute pointer */
-
- a = getXvAttributePtr(h, attr);
- if (!a) return NvCtrlAttributeNotAvailable;
-
- /* get the port */
-
- port = getXvPort(h, attr);
- if (!port) return NvCtrlAttributeNotAvailable;
-
- /* finally, set the value */
-
- if (__libXv->XvSetPortAttribute(h->dpy, port, a->atom, val) != Success) {
- return NvCtrlError;
- }
-
- XFlush(h->dpy);
-
- return NvCtrlSuccess;
-
-} /* NvCtrlXvSetAttribute() */
-
-
/*
* Get Xv String Attribute values
*/
@@ -457,226 +254,6 @@ NvCtrlXvGetStringAttribute(NvCtrlAttributePrivateHandle *h,
} /* NvCtrlXvGetStringAttribute() */
-ReturnStatus
-NvCtrlXvGetValidAttributeValues(NvCtrlAttributePrivateHandle *h, int attr,
- NVCTRLAttributeValidValuesRec *val)
-{
- NvCtrlXvAttribute *a;
-
- /* first, check that we have the necessary adaptor */
-
- if (!checkAdaptor(h, attr)) return NvCtrlAttributeNotAvailable;
-
- /* get the attribute pointer */
-
- a = getXvAttributePtr(h, attr);
- if (!a) return NvCtrlAttributeNotAvailable;
-
- /* XXX should we force _SET_DEFAULTS to bool? */
-
- /* assign range and return */
-
- *val = a->range;
-
- return NvCtrlSuccess;
-
-} /* NvCtrlXvGetValidAttributeValues() */
-
-
-
-/*
- * getXvAttribute() - loop through the attributes for the given port,
- * looking for the attribute specified by 'name'. If the named
- * attribute is found, get its minimum and maximum values, and (if
- * possible) get its current value. Return a malloced and initialized
- * NvCtrlXvAttribute struct if successful, otherwise return NULL.
- */
-
-static NvCtrlXvAttribute *getXvAttribute(NvCtrlAttributePrivateHandle *h,
- XvPortID port,
- const char *name)
-{
- NvCtrlXvAttribute *attr = NULL;
- XvAttribute *attributes = NULL;
- int i, n;
-
- attributes = __libXv->XvQueryPortAttributes(h->dpy, port, &n);
-
- if (!attributes || !n) goto failed;
-
- for (i = 0; i < n; i++) {
- if (strcmp(attributes[i].name, name) != 0) continue;
-
- attr = malloc(sizeof(NvCtrlXvAttribute));
- attr->range.type = ATTRIBUTE_TYPE_RANGE;
- attr->range.u.range.min = attributes[i].min_value;
- attr->range.u.range.max = attributes[i].max_value;
- attr->atom = XInternAtom(h->dpy, name, True);
- if (attr->atom == None) goto failed;
-
- if (! (attributes[i].flags & XvSettable)) goto failed;
-
- attr->range.permissions = ATTRIBUTE_TYPE_WRITE;
-
- if (attributes[i].flags & XvGettable) {
- attr->range.permissions |= ATTRIBUTE_TYPE_READ;
- }
-
- /* All Xv attributes are controlled with X screen target type */
-
- attr->range.permissions |= ATTRIBUTE_TYPE_X_SCREEN;
-
- break;
- }
-
- if (attributes) XFree(attributes);
-
- return attr;
-
- failed:
- if (attr) free(attr);
- if (attributes) XFree(attributes);
- return NULL;
-
-} /* getXvAttribute() */
-
-
-
-/*
- * checkAdaptor() - check that the handle has data for the adaptor
- * needed for the specified attribute.
- */
-
-static Bool checkAdaptor(NvCtrlAttributePrivateHandle *h,
- unsigned int attribute)
-{
-
- switch(attribute) {
-
- case NV_CTRL_ATTR_XV_OVERLAY_SATURATION:
- case NV_CTRL_ATTR_XV_OVERLAY_CONTRAST:
- case NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS:
- case NV_CTRL_ATTR_XV_OVERLAY_HUE:
- case NV_CTRL_ATTR_XV_OVERLAY_SET_DEFAULTS:
- if (h && h->xv && h->xv->overlay) return True;
- else return False;
-
- case NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK:
- case NV_CTRL_ATTR_XV_TEXTURE_CONTRAST:
- case NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS:
- case NV_CTRL_ATTR_XV_TEXTURE_HUE:
- case NV_CTRL_ATTR_XV_TEXTURE_SATURATION:
- case NV_CTRL_ATTR_XV_TEXTURE_SET_DEFAULTS:
- if (h && h->xv && h->xv->texture) return True;
- else return False;
- case NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK:
- case NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS:
- if (h && h->xv && h->xv->blitter) return True;
- else return False;
-
- default:
- return False;
- }
-} /* checkAdaptor() */
-
-
-
-/*
- * look up the port number for the adaptor for the attribute
- * specified; returns 0 if the attribute/adaptor is not available.
- */
-
-static unsigned int getXvPort(NvCtrlAttributePrivateHandle *h,
- unsigned int attribute)
-{
- if (!checkAdaptor(h, attribute)) return 0;
-
- switch(attribute) {
-
- case NV_CTRL_ATTR_XV_OVERLAY_SATURATION:
- case NV_CTRL_ATTR_XV_OVERLAY_CONTRAST:
- case NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS:
- case NV_CTRL_ATTR_XV_OVERLAY_HUE:
- case NV_CTRL_ATTR_XV_OVERLAY_SET_DEFAULTS:
- return h->xv->overlay->port;
-
- case NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK:
- case NV_CTRL_ATTR_XV_TEXTURE_CONTRAST:
- case NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS:
- case NV_CTRL_ATTR_XV_TEXTURE_HUE:
- case NV_CTRL_ATTR_XV_TEXTURE_SATURATION:
- case NV_CTRL_ATTR_XV_TEXTURE_SET_DEFAULTS:
- return h->xv->texture->port;
-
- case NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK:
- case NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS:
- return h->xv->blitter->port;
-
- default:
- return 0;
- }
-} /* getXvPort() */
-
-
-
-/*
- * getXvAttributePtr() - return the NvCtrlXvAttribute pointer for the
- * specified attribute; or NULL if that attribute is not available.
- */
-
-static NvCtrlXvAttribute *getXvAttributePtr(NvCtrlAttributePrivateHandle *h,
- unsigned int attribute)
-{
- if (!checkAdaptor(h, attribute)) return NULL;
-
- switch (attribute) {
-
- case NV_CTRL_ATTR_XV_OVERLAY_SATURATION:
- return h->xv->overlay->saturation;
-
- case NV_CTRL_ATTR_XV_OVERLAY_CONTRAST:
- return h->xv->overlay->contrast;
-
- case NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS:
- return h->xv->overlay->brightness;
-
- case NV_CTRL_ATTR_XV_OVERLAY_HUE:
- return h->xv->overlay->hue;
-
- case NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK:
- return h->xv->texture->sync_to_vblank;
-
- case NV_CTRL_ATTR_XV_TEXTURE_CONTRAST:
- return h->xv->texture->contrast;
-
- case NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS:
- return h->xv->texture->brightness;
-
- case NV_CTRL_ATTR_XV_TEXTURE_HUE:
- return h->xv->texture->hue;
-
- case NV_CTRL_ATTR_XV_TEXTURE_SATURATION:
- return h->xv->texture->saturation;
-
- case NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK:
- return h->xv->blitter->sync_to_vblank;
-
- case NV_CTRL_ATTR_XV_OVERLAY_SET_DEFAULTS:
- return h->xv->overlay->defaults;
-
- case NV_CTRL_ATTR_XV_TEXTURE_SET_DEFAULTS:
- return h->xv->texture->defaults;
-
- case NV_CTRL_ATTR_XV_BLITTER_SET_DEFAULTS:
- return h->xv->blitter->defaults;
-
- default:
- return NULL;
- }
-} /* getXvAttributePtr() */
-
-
-
/*
* Frees and relinquishes any resource used by the Xv Attributes
*/
@@ -690,16 +267,6 @@ NvCtrlXvAttributesClose (NvCtrlAttributePrivateHandle *h)
close_libxv();
- if (h->xv->overlay) {
- free(h->xv->overlay);
- }
- if (h->xv->texture) {
- free(h->xv->texture);
- }
- if (h->xv->blitter) {
- free(h->xv->blitter);
- }
-
free(h->xv);
h->xv = NULL;
diff --git a/src/parse.c b/src/parse.c
index bb4a296..e758a8a 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -94,7 +94,7 @@ AttributeTableEntry attributeTable[] = {
{ "CursorShadowXOffset", NV_CTRL_CURSOR_SHADOW_X_OFFSET, 0, "Hardware cursor shadow X offset." },
{ "CursorShadowYOffset", NV_CTRL_CURSOR_SHADOW_Y_OFFSET, 0, "Hardware cursor shadow Y offset." },
{ "AssociatedDisplays", NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, N|D, "Display device mask indicating which display devices are \"associated\" with the specified X screen (i.e., are available for displaying the desktop)." },
- { "ProbeDisplays", NV_CTRL_PROBE_DISPLAYS, A, "When this attribute is queried, the X driver re-probes the hardware to detect which display devices are connected to the GPU or DPU driving the specified X screen. Returns a display mask of the currently connected display devices." },
+ { "ProbeDisplays", NV_CTRL_PROBE_DISPLAYS, A|D, "When this attribute is queried, the X driver re-probes the hardware to detect which display devices are connected to the GPU or DPU driving the specified X screen. Returns a display mask of the currently connected display devices." },
{ "InitialPixmapPlacement", NV_CTRL_INITIAL_PIXMAP_PLACEMENT, N, "Controls where X pixmaps are initially created." },
{ "DynamicTwinview", NV_CTRL_DYNAMIC_TWINVIEW, N, "Does the X screen support dynamic TwinView." },
{ "MultiGpuDisplayOwner", NV_CTRL_MULTIGPU_DISPLAY_OWNER, N, "GPU ID of the GPU that has the display device(s) used for showing the X screen." },
@@ -208,6 +208,7 @@ AttributeTableEntry attributeTable[] = {
{ "FrameLockFPGARevision", NV_CTRL_FRAMELOCK_FPGA_REVISION, N|F|G, "Returns the FPGA revision of the Frame Lock device." },
{ "FrameLockSyncRate4", NV_CTRL_FRAMELOCK_SYNC_RATE_4, N|F|G, "Returns the refresh rate that the frame lock board is sending to the GPU in 1/10000 Hz (i.e., to get the refresh rate in Hz, divide the returned value by 10000)." },
{ "FrameLockSyncDelayResolution", NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION, N|F|G, "Returns the number of nanoseconds that one unit of FrameLockSyncDelay corresponds to." },
+ { "FrameLockIncomingHouseSyncRate", NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE, N|F|G, "Returns the rate of the incoming house sync signal to the frame lock board, in mHz (Millihertz) (i.e., to get the house sync rate in Hz, divide the returned value by 1000)." },
/* GVO */
{ "GvoSupported", NV_CTRL_GVO_SUPPORTED, I|N, "Returns whether this X screen supports GVO; if this screen does not support GVO output, then all other GVO attributes are unavailable." },
@@ -313,17 +314,6 @@ AttributeTableEntry attributeTable[] = {
{ "TVSaturation", NV_CTRL_TV_SATURATION, 0, "Adjusts the amount of saturation on the specified display device." },
/* X Video */
- { "XVideoOverlaySaturation", NV_CTRL_ATTR_XV_OVERLAY_SATURATION, V, "Controls the amount of saturation in the X video overlay." },
- { "XVideoOverlayContrast", NV_CTRL_ATTR_XV_OVERLAY_CONTRAST, V, "Controls the amount of contrast in the X video overlay." },
- { "XVideoOverlayBrightness", NV_CTRL_ATTR_XV_OVERLAY_BRIGHTNESS, V, "Controls the amount of brightness in the X video overlay." },
- { "XVideoOverlayHue", NV_CTRL_ATTR_XV_OVERLAY_HUE, V, "Controls the amount of hue in the X video overlay." },
- { "XVideoTextureBrightness", NV_CTRL_ATTR_XV_TEXTURE_BRIGHTNESS, V, "Controls the amount of brightness in the X video texture adaptor." },
- { "XVideoTextureContrast", NV_CTRL_ATTR_XV_TEXTURE_CONTRAST, V, "Controls the amount of contrast in the X video texture adaptor." },
- { "XVideoTextureHue", NV_CTRL_ATTR_XV_TEXTURE_HUE, V, "Controls the amount of hue in the X video texture adaptor." },
- { "XVideoTextureSaturation", NV_CTRL_ATTR_XV_TEXTURE_SATURATION, V, "Controls the amount of saturation in the X video texture adaptor." },
-
- { "XVideoTextureSyncToVBlank", NV_CTRL_ATTR_XV_TEXTURE_SYNC_TO_VBLANK, V, "Enables sync to vertical blanking for X video texture adaptor." },
- { "XVideoBlitterSyncToVBlank", NV_CTRL_ATTR_XV_BLITTER_SYNC_TO_VBLANK, V, "Enables sync to vertical blanking for X video blitter adaptor." },
{ "XVideoSyncToDisplay", NV_CTRL_XV_SYNC_TO_DISPLAY, D|Z, "Controls which display device is synced to by the texture and blitter adaptors when they are set to synchronize to the vertical blanking." },
/* 3D Vision Pro */
@@ -376,7 +366,7 @@ AttributeTableEntry attributeTable[] = {
* about.
*/
-#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_DISPLAY_ENABLED
+#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_FRAMELOCK_INCOMING_HOUSE_SYNC_RATE
#warning "Have you forgotten to add a new integer attribute to attributeTable?"
#endif
@@ -796,23 +786,36 @@ static int nv_parse_display_and_target(char *start,
}
/*
- * everything after the colon should be numeric; assign it to
- * the target_id
+ * are all characters numeric? compute the target_id integer as we scan
+ * the string to check
*/
-
+
+ digits_only = NV_TRUE;
target_id = 0;
- for (s = colon + 1; *s; s++) {
+ for (s = colon +1; *s; s++) {
if (!isdigit(*s)) {
- free(tmp);
- return NV_PARSER_STATUS_TARGET_SPEC_BAD_TARGET_ID;
+ digits_only = NV_FALSE;
+ break;
}
target_id = (target_id * 10) + ctoi(*s);
}
-
+
+ /*
+ * if all characters are numeric, this is the target_id, otherwise,
+ * this is a target type-specific name.
+ */
+
a->target_type = target_type;
- a->target_id = target_id;
-
+
+ if (digits_only) {
+ a->target_id = target_id;
+ a->target_name = NULL;
+ } else {
+ a->target_id = -1;
+ a->target_name = strdup(colon +1);
+ }
+
a->flags |= NV_PARSER_HAS_TARGET;
/* we're finally done with the temp string */
@@ -1278,8 +1281,9 @@ void nv_parsed_attribute_clean(ParsedAttribute *p)
if (p->display) free(p->display);
if (p->name) free(p->name);
-
- memset(p, 0, sizeof(ParsedAttribute));
+ free(p->target_name);
+
+ memset(p, 0, sizeof(*p));
} /* nv_parsed_attribute_clean() */
diff --git a/src/parse.h b/src/parse.h
index 7dfcc1b..b7358b7 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -117,6 +117,7 @@ typedef struct _ParsedAttribute {
char *name;
int target_type;
int target_id;
+ char *target_name;
int attr;
union {
int i;
diff --git a/src/query-assign.c b/src/query-assign.c
index 54bc01a..5e16fac 100644
--- a/src/query-assign.c
+++ b/src/query-assign.c
@@ -87,6 +87,28 @@ int nv_process_assignments_and_queries(Options *op)
/*
+ * query_display_target_names() - retrieves the list of display device names
+ * for the given target.
+ */
+static void query_display_target_names(CtrlHandleTarget *t)
+{
+ NvCtrlGetStringAttribute(t->h, NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME,
+ &(t->protoNames[NV_DPY_PROTO_NAME_TYPE_BASENAME]));
+ NvCtrlGetStringAttribute(t->h, NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID,
+ &(t->protoNames[NV_DPY_PROTO_NAME_TYPE_ID]));
+ NvCtrlGetStringAttribute(t->h, NV_CTRL_STRING_DISPLAY_NAME_DP_GUID,
+ &(t->protoNames[NV_DPY_PROTO_NAME_DP_GUID]));
+ NvCtrlGetStringAttribute(t->h, NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH,
+ &(t->protoNames[NV_DPY_PROTO_NAME_EDID_HASH]));
+ NvCtrlGetStringAttribute(t->h, NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX,
+ &(t->protoNames[NV_DPY_PROTO_NAME_TARGET_INDEX]));
+ NvCtrlGetStringAttribute(t->h, NV_CTRL_STRING_DISPLAY_NAME_RANDR,
+ &(t->protoNames[NV_DPY_PROTO_NAME_RANDR]));
+}
+
+
+
+/*
* nv_alloc_ctrl_handles() - allocate a new CtrlHandles structure,
* connect to the X server identified by display, and initialize an
* NvCtrlAttributeHandle for each possible target (X screens, gpus,
@@ -291,6 +313,10 @@ CtrlHandles *nv_alloc_ctrl_handles(const char *display)
} else {
h->targets[target].t[i].name = tmp;
}
+
+ if (target == DISPLAY_TARGET) {
+ query_display_target_names(&(h->targets[target].t[i]));
+ }
}
/*
@@ -372,26 +398,32 @@ void nv_free_ctrl_handles(CtrlHandles *h)
*/
XCloseDisplay(h->dpy);
h->dpy = NULL;
-
+
for (j = 0; targetTypeTable[j].name; j++) {
-
+
target = targetTypeTable[j].target_index;
-
+
for (i = 0; i < h->targets[target].n; i++) {
-
- NvCtrlAttributeClose(h->targets[target].t[i].h);
-
- if (h->targets[target].t[i].name) {
- free(h->targets[target].t[i].name);
+ CtrlHandleTarget *t = &(h->targets[target].t[i]);
+ int n;
+
+ NvCtrlAttributeClose(t->h);
+ free(t->name);
+ for (n = 0; n < NV_DPY_PROTO_NAME_MAX; n++) {
+ if (t->protoNames[n]) {
+ XFree(t->protoNames[n]);
+ }
}
+
+ memset(t, 0, sizeof(*t));
}
-
+
if (h->targets[target].t) free(h->targets[target].t);
}
}
-
+
free(h);
-
+
} /* nv_free_ctrl_handles() */
@@ -619,8 +651,9 @@ static int validate_value(CtrlHandleTarget *t, ParsedAttribute *a, uint32 d,
a->name, NvCtrlAttributesStrError(status));
return NV_FALSE;
}
-
- if (valid.permissions & ATTRIBUTE_TYPE_DISPLAY) {
+
+ if (target_type != NV_CTRL_TARGET_TYPE_DISPLAY &&
+ valid.permissions & ATTRIBUTE_TYPE_DISPLAY) {
tmp_d_str = display_device_mask_to_display_device_name(d);
sprintf(d_str, ", display device: %s", tmp_d_str);
free(tmp_d_str);
@@ -898,7 +931,8 @@ static void print_queried_value(CtrlHandleTarget *t,
/* append the display device name, if necessary */
- if (v->permissions & ATTRIBUTE_TYPE_DISPLAY) {
+ if ((NvCtrlGetTargetType(t->h) != NV_CTRL_TARGET_TYPE_DISPLAY) &&
+ v->permissions & ATTRIBUTE_TYPE_DISPLAY) {
tmp_d_str = display_device_mask_to_display_device_name(mask);
snprintf(d_str, 64, "; display device: %s", tmp_d_str);
free(tmp_d_str);
@@ -1548,8 +1582,9 @@ static int process_parsed_attribute_internal(CtrlHandleTarget *t,
ReturnStatus status;
char str[32], *tmp_d_str;
int ret;
-
- if (valid.permissions & ATTRIBUTE_TYPE_DISPLAY) {
+
+ if (target_type != NV_CTRL_TARGET_TYPE_DISPLAY &&
+ valid.permissions & ATTRIBUTE_TYPE_DISPLAY) {
tmp_d_str = display_device_mask_to_display_device_name(d);
sprintf(str, ", display device: %s", tmp_d_str);
free(tmp_d_str);
@@ -1748,6 +1783,37 @@ int nv_process_parsed_attribute(ParsedAttribute *a, CtrlHandles *h,
nv_error_msg("Invalid target specified %s.", whence);
goto done;
}
+
+ /*
+ * If the target was named, match it to one of the probed targets
+ * to obtain the target_id
+ */
+
+ if (a->target_name) {
+ Bool found = FALSE;
+ for (i = 0; i < h->targets[target].n; i++) {
+ int j;
+ t = &(h->targets[target].t[i]);
+ for (j = 0; j < NV_DPY_PROTO_NAME_MAX; j++) {
+ char *name = t->protoNames[j];
+ if (!name) continue;
+ if (strcasecmp(name, a->target_name) == 0) {
+ a->target_id = NvCtrlGetTargetId(t->h);
+ found = TRUE;
+ break;
+ }
+ }
+ if (found) break;
+ }
+
+ if (!found) {
+ nv_error_msg("Invalid name '%s' specified for %s "
+ "specified %s.", a->target_name,
+ target_type_name, whence);
+ goto done;
+ }
+ }
+
/* make sure the target_id is in range */
diff --git a/src/query-assign.h b/src/query-assign.h
index 85fba7c..d7209a8 100644
--- a/src/query-assign.h
+++ b/src/query-assign.h
@@ -30,6 +30,15 @@
#include "parse.h"
#include "command-line.h"
+enum {
+ NV_DPY_PROTO_NAME_TYPE_BASENAME = 0,
+ NV_DPY_PROTO_NAME_TYPE_ID,
+ NV_DPY_PROTO_NAME_DP_GUID,
+ NV_DPY_PROTO_NAME_EDID_HASH,
+ NV_DPY_PROTO_NAME_TARGET_INDEX,
+ NV_DPY_PROTO_NAME_RANDR,
+ NV_DPY_PROTO_NAME_MAX,
+};
/*
* The CtrlHandles struct contains an array of target types for an X
@@ -43,7 +52,8 @@ typedef struct {
NvCtrlAttributeHandle *h; /* handle for this target */
uint32 d; /* display device mask for this target */
uint32 c; /* Connected display device mask for target */
- char *name; /* name for this target */
+ char *name; /* Name for this target */
+ char *protoNames[NV_DPY_PROTO_NAME_MAX]; /* List of valid names for this target */
} CtrlHandleTarget;
typedef struct {
diff --git a/src/version.mk b/src/version.mk
index 527bb7c..11c1292 100644
--- a/src/version.mk
+++ b/src/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 302.17
+NVIDIA_VERSION = 304.22
diff --git a/utils.mk b/utils.mk
index 2a7a9cf..b912f98 100644
--- a/utils.mk
+++ b/utils.mk
@@ -65,6 +65,7 @@ WHOAMI ?= whoami
HOSTNAME_CMD ?= hostname
DATE ?= date
GZIP_CMD ?= gzip
+CHMOD ?= chmod
NV_AUTO_DEPEND ?= 1
NV_VERBOSE ?= 0
@@ -156,6 +157,25 @@ ifndef NVIDIA_VERSION
$(error NVIDIA_VERSION undefined)
endif
+
+##############################################################################
+# Several of the functions below take an argument that indicates if
+# the expression is for the target platform (the system the built
+# program is going to run on) or the host platform (the system
+# performing the build). The argument is either "HOST" or "TARGET"
+# and needs to be converted:
+#
+# "HOST" -> "HOST_"
+# "TARGET" -> ""
+#
+# and prepended to "CC" or "CFLAGS"
+##############################################################################
+
+host_target = $(patsubst HOST,HOST_,$(patsubst TARGET,,$(1)))
+host_target_cc = $(call host_target,$(1))CC
+host_target_cflags = $(call host_target,$(1))CFLAGS
+
+
##############################################################################
# to generate the dependency files, use the compiler's "-MM" option to
# generate output of the form "foo.o : foo.c foo.h"; then, use sed to
@@ -168,13 +188,14 @@ endif
# applies to the object files produced in the build.
#
# Arguments:
-# $(1): CC command (CC or HOST_CC)
+# $(1): whether for host or target platform ("HOST" or "TARGET")
# $(2): source filename
# $(3): object filename
##############################################################################
ifeq ($(NV_AUTO_DEPEND),1)
- AUTO_DEP_CMD = && $($(1)) -MM $$(CFLAGS) $$< | $$(SED) \
+ AUTO_DEP_CMD = && $($(call host_target_cc,$(1))) \
+ -MM $$($(call host_target_cflags,$(1))) $$< | $$(SED) \
-e "s,: ,: $$$$\(wildcard ," \
-e "s,\([^\\]\)$$$$,\1)," \
-e "s;^$$(addsuffix .o,$$(notdir $$(basename $(2)))): ;$(3): ;" \
@@ -249,11 +270,12 @@ BUILD_DEPENDENCY_LIST = \
##############################################################################
# functions to define a rule to build an object file; the first
-# argument is either CC or HOST_CC, the second argument is the source
-# file to compile, and the third argument (_WITH_OBJECT_NAME-only) is
-# the object filename to produce. Example usage:
+# argument whether the rule is for the target or host platform ("HOST"
+# or "TARGET"), the second argument is the source file to compile, and
+# the third argument (_WITH_OBJECT_NAME-only) is the object filename
+# to produce. Example usage:
#
-# $(eval $(call DEFINE_OBJECT_RULE,CC,foo.c))
+# $(eval $(call DEFINE_OBJECT_RULE,TARGET,foo.c))
#
# Note this also attempts to include the dependency file for this
# source file.
@@ -266,7 +288,8 @@ BUILD_DEPENDENCY_LIST = \
define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME
$(3): $(2)
@$(MKDIR) $(OUTPUTDIR)
- $$(call quiet_cmd,$(1)) $$(CFLAGS) -c $$< -o $$@ \
+ $$(call quiet_cmd,$(call host_target_cc,$(1))) \
+ $$($(call host_target_cflags,$(1))) -c $$< -o $$@ \
$(call AUTO_DEP_CMD,$(1),$(2),$(3))
-include $$(call BUILD_DEPENDENCY_LIST,$(3))
diff --git a/version.mk b/version.mk
index 527bb7c..11c1292 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 302.17
+NVIDIA_VERSION = 304.22