summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2014-06-09 12:32:33 -0700
committerAaron Plattner <aplattner@nvidia.com>2014-06-09 12:32:33 -0700
commit9f5d554890c871d58bd4f505ee03c3370e1f4e90 (patch)
tree6af03009c7deb33666aefb4f0cc36b8fb9021500
parent11027cc3b9039a50d529520d93d768887bf440ae (diff)
340.17340.17
-rw-r--r--doc/version.mk2
-rw-r--r--samples/nv-control-events.c1
-rw-r--r--samples/version.mk2
-rw-r--r--src/Makefile26
-rw-r--r--src/app-profiles.c26
-rw-r--r--src/gtk+-2.x/ctkappprofile.c59
-rw-r--r--src/gtk+-2.x/ctkdisplayconfig.c62
-rw-r--r--src/gtk+-2.x/ctkdisplaylayout.h2
-rw-r--r--src/gtk+-2.x/ctkevent.c2
-rw-r--r--src/gtk+-2.x/ctkevent.h1
-rw-r--r--src/gtk+-2.x/ctkopengl.c114
-rw-r--r--src/gtk+-2.x/ctkopengl.h1
-rw-r--r--src/gtk+-2.x/ctkwindow.c2
-rw-r--r--src/libXNVCtrl/utils.mk15
-rw-r--r--src/libXNVCtrl/version.mk2
-rw-r--r--src/parse.c1
-rw-r--r--src/query-assign.c15
-rw-r--r--src/src.mk9
-rw-r--r--src/version.mk2
-rw-r--r--utils.mk15
-rw-r--r--version.mk2
21 files changed, 290 insertions, 71 deletions
diff --git a/doc/version.mk b/doc/version.mk
index dea0f65..95e697a 100644
--- a/doc/version.mk
+++ b/doc/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 337.25
+NVIDIA_VERSION = 340.17
diff --git a/samples/nv-control-events.c b/samples/nv-control-events.c
index be23e20..34e6310 100644
--- a/samples/nv-control-events.c
+++ b/samples/nv-control-events.c
@@ -742,5 +742,6 @@ static AttrEntry attr_table[] = {
MAKE_ENTRY(NV_CTRL_GPU_POWER_MIZER_DEFAULT_MODE),
MAKE_ENTRY(NV_CTRL_XV_SYNC_TO_DISPLAY_ID),
MAKE_ENTRY(NV_CTRL_PALETTE_UPDATE_EVENT),
+ MAKE_ENTRY(NV_CTRL_GSYNC_ALLOWED),
{ -1, NULL, NULL }
};
diff --git a/samples/version.mk b/samples/version.mk
index dea0f65..95e697a 100644
--- a/samples/version.mk
+++ b/samples/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 337.25
+NVIDIA_VERSION = 340.17
diff --git a/src/Makefile b/src/Makefile
index b4f4d60..7471d7d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -59,6 +59,7 @@ ifndef VDPAU_CFLAGS
endif
endif
+# These will be unused if nvidia-settings links dynamically against jansson
ifndef JANSSON_CFLAGS
JANSSON_CFLAGS = -Wno-cast-qual
JANSSON_CFLAGS += -Wno-strict-prototypes
@@ -112,12 +113,25 @@ LDFLAGS += $(X_LDFLAGS)
# static library libXxf86vm.a. Statically link against libXxf86vm
# when building nvidia-settings within the NVIDIA driver build, but
# dynamically link against libXxf86vm in the public builds.
-ifdef NV_LINK_LIBXXF86VM_STATICALLY
+NV_LINK_LIBXXF86VM_STATICALLY ?= 0
+
+ifneq ($(NV_LINK_LIBXXF86VM_STATICALLY),0)
LIBS += -Wl,-Bstatic -lXxf86vm -Wl,-Bdynamic
else
LIBS += -lXxf86vm
endif
+# nvidia-settings depends on libjansson >= 2.2. If NV_USE_BUNDLED_LIBJANSSON is
+# set to a non-zero value, then nvidia-settings is linked statically against the
+# copy of libjansson bundled in the source tarball; if it is set to 0,
+# nvidia-settings is linked dynamically against the copy of libjansson on the
+# host system. By default, nvidia-settings is linked against the bundled copy.
+NV_USE_BUNDLED_LIBJANSSON ?= 1
+
+ifeq ($(NV_USE_BUNDLED_LIBJANSSON),0)
+ LIBS += -ljansson
+endif
+
# Preferably, we would use pkg-config's "--libs-only-l" and
# "--libs-only-L" options to get separate GTK_LDFLAGS and GTK_LIBS,
# appending them to LDFLAGS and LIBS, respectively. However, the
@@ -157,7 +171,11 @@ CFLAGS += -I $(XCONFIG_PARSER_DIR)/..
CFLAGS += -I libXNVCtrlAttributes
CFLAGS += -I xpm_data
CFLAGS += -I gtk+-2.x
-CFLAGS += -I jansson
+
+ifneq ($(NV_USE_BUNDLED_LIBJANSSON),0)
+ CFLAGS += -I jansson
+endif
+
CFLAGS += -I $(COMMON_UTILS_DIR)
CFLAGS += -I $(VIRTUAL_RESOLUTIONS_DIR)
CFLAGS += -I $(OUTPUTDIR)
@@ -166,7 +184,9 @@ CFLAGS += -DPROGRAM_NAME=\"nvidia-settings\"
$(call BUILD_OBJECT_LIST,$(GTK_SRC)): CFLAGS += $(GTK_CFLAGS)
-$(call BUILD_OBJECT_LIST,$(JANSSON_SRC)): CFLAGS += $(JANSSON_CFLAGS)
+ifneq ($(NV_USE_BUNDLED_LIBJANSSON),0)
+ $(call BUILD_OBJECT_LIST,$(JANSSON_SRC)): CFLAGS += $(JANSSON_CFLAGS)
+endif
##############################################################################
diff --git a/src/app-profiles.c b/src/app-profiles.c
index 88dfebf..a3b1003 100644
--- a/src/app-profiles.c
+++ b/src/app-profiles.c
@@ -40,6 +40,24 @@
#include "app-profiles.h"
#include "msg.h"
+/*
+ * Define a wrapper around json_object_foreach() for compatibility with older
+ * versions of libjansson.
+ */
+#if JANSSON_VERSION_HEX < 0x020200
+# error "nvidia-settings requires jansson version 2.2 or later. Please update"
+# error "your version of jansson, or set NV_USE_BUNDLED_LIBJANSSON=1 to build"
+# error "with the version of jansson included with the nvidia-settings source"
+# error "code."
+#elif JANSSON_VERSION_HEX < 0x020300
+# define NV_JSON_OBJECT_FOREACH(object, key, value) \
+ for(key = json_object_iter_key(json_object_iter(object)); \
+ key && (value = json_object_iter_value(json_object_iter_at(object, key))); \
+ key = json_object_iter_key(json_object_iter_next(object, json_object_iter_at(object, key))))
+#else
+# define NV_JSON_OBJECT_FOREACH(object, key, value) json_object_foreach(object, key, value)
+#endif
+
static char *slurp(FILE *fp)
{
int eof = FALSE;
@@ -787,7 +805,7 @@ static void app_profile_config_load_file(AppProfileConfig *config,
{
const char *key;
json_t *value;
- json_object_foreach(new_json_profiles, key, value) {
+ NV_JSON_OBJECT_FOREACH(new_json_profiles, key, value) {
json_object_set_new(config->profile_locations, key, json_string(filename));
}
}
@@ -1412,7 +1430,7 @@ static char *config_to_cfg_file_syntax(json_t *old_rules, json_t *old_profiles)
}
if (old_profiles) {
- json_object_foreach(old_profiles, profile_name, old_profile) {
+ NV_JSON_OBJECT_FOREACH(old_profiles, profile_name, old_profile) {
new_profile = app_profile_config_profile_output(profile_name, old_profile);
json_array_append_new(profiles_array, new_profile);
}
@@ -1487,7 +1505,7 @@ json_t *nv_app_profile_config_validate(AppProfileConfig *new_config,
add_files_from_config(old_config, all_files, changed_files);
// For each file in the set, determine if it needs to be updated
- json_object_foreach(all_files, filename, unused) {
+ NV_JSON_OBJECT_FOREACH(all_files, filename, unused) {
app_profile_config_get_per_file_config(new_config, filename, &new_file, &new_rules, &new_profiles);
app_profile_config_get_per_file_config(old_config, filename, &old_file, &old_rules, &old_profiles);
@@ -1498,7 +1516,7 @@ json_t *nv_app_profile_config_validate(AppProfileConfig *new_config,
}
// For each file that changed, generate an update record with the new JSON
- json_object_foreach(changed_files, filename, unused) {
+ NV_JSON_OBJECT_FOREACH(changed_files, filename, unused) {
update = json_object();
json_object_set_new(update, "filename", json_string(filename));
diff --git a/src/gtk+-2.x/ctkappprofile.c b/src/gtk+-2.x/ctkappprofile.c
index 8b7d224..60b3e69 100644
--- a/src/gtk+-2.x/ctkappprofile.c
+++ b/src/gtk+-2.x/ctkappprofile.c
@@ -2702,6 +2702,50 @@ static gboolean is_valid_setting_value(json_t *value, char **invalid_type_str)
}
}
+static json_t *decode_setting_value(const gchar *text, json_error_t *perror)
+{
+#if JANSSON_VERSION_HEX >= 0x020300
+ /*
+ * For jansson >= 2.3, we can simply use the JSON_DECODE_ANY
+ * flag to let Jansson handle this value.
+ */
+ return json_loads(text, JSON_DECODE_ANY, perror);
+#else
+ /*
+ * We have to enclose the string in an dummy array so jansson
+ * won't throw a parse error if the value is not an array or
+ * object (not compliant with RFC 4627).
+ */
+ char *wraptext = NULL;
+ json_t *wrapval = NULL;
+ json_t *val = NULL;
+
+ wraptext = nvstrcat("[", text, "]", NULL);
+ if (!wraptext) {
+ goto parse_done;
+ }
+
+ wrapval = json_loads(wraptext, 0, perror);
+ if (!wrapval ||
+ !json_is_array(wrapval) ||
+ json_array_size(wrapval) != 1) {
+ goto parse_done;
+ }
+
+ val = json_array_get(wrapval, 0);
+ if (val) {
+ /* Save a copy, since the wrapper object will be freed */
+ val = json_deep_copy(val);
+ }
+
+parse_done:
+ free(wraptext);
+ json_decref(wrapval);
+
+ return val;
+#endif
+}
+
static void setting_value_edited(GtkCellRendererText *renderer,
gchar *path_s,
gchar *new_text,
@@ -2740,7 +2784,7 @@ static void setting_value_edited(GtkCellRendererText *renderer,
expected_type = get_type_from_string(get_expected_type_string_from_key(ctk_app_profile->key_docs, type_str));
new_text_in_json = nv_app_profile_file_syntax_to_json(new_text);
- value = json_loads(new_text_in_json, JSON_DECODE_ANY, &error);
+ value = decode_setting_value(new_text_in_json, &error);
if (!value) {
edit_profile_dialog_statusbar_message(dialog,
@@ -3604,13 +3648,22 @@ static char *get_default_keys_file(const char *driver_version)
free(file);
return nvstrdup(file_noversion);
} else {
+ char *expected_file_paths;
+ if (file) {
+ expected_file_paths = nvstrcat("either ", file, " or ", file_noversion, NULL);
+ } else {
+ expected_file_paths = nvstrdup(file_noversion);
+ }
+
nv_error_msg("nvidia-settings could not find the registry key file. "
"This file should have been installed along with this "
- "driver at either %s or %s. The application profiles "
+ "driver at %s. The application profiles "
"will continue to work, but values cannot be "
"preopulated or validated, and will not be listed in "
"the help text. Please see the README for possible "
- "values and descriptions.", file, file_noversion);
+ "values and descriptions.", expected_file_paths);
+
+ free(expected_file_paths);
free(file);
return NULL;
}
diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c
index 8b2240f..1ce5b6e 100644
--- a/src/gtk+-2.x/ctkdisplayconfig.c
+++ b/src/gtk+-2.x/ctkdisplayconfig.c
@@ -3041,7 +3041,7 @@ allocate_selected_mode(char *name,
selected_mode = (nvSelectedModePtr)nvalloc(sizeof(nvSelectedMode));
- selected_mode->text = g_strdup(name);
+ selected_mode->label = gtk_menu_item_new_with_label(name);
selected_mode->modeline = modeline;
selected_mode->isSpecial = isSpecial;
@@ -3075,7 +3075,6 @@ free_selected_modes(nvSelectedModePtr selected_mode)
{
if (selected_mode) {
free_selected_modes(selected_mode->next);
- g_free(selected_mode->text);
free(selected_mode);
}
}
@@ -3238,26 +3237,20 @@ static void generate_selected_modes(const nvDisplayPtr display)
nvSelectedModePtr selected_mode = NULL;
nvModeLinePtr modeline;
- display->num_selected_modes = 0;
- display->selected_modes = NULL;
+ /* Add the off item */
+ selected_mode = allocate_selected_mode("Off",
+ NULL /* modeline */,
+ TRUE /* isSpecial */,
+ NULL /* viewPortIn */,
+ NULL /* viewPortOut */);
- /* Add the off item if we have more than one display */
- if (display->screen->num_displays > 1) {
- selected_mode = allocate_selected_mode("Off",
- NULL /* modeline */,
- TRUE /* isSpecial */,
- NULL /* viewPortIn */,
- NULL /* viewPortOut */);
-
- display->num_selected_modes = 1;
- display->selected_modes = selected_mode;
- }
+ display->num_selected_modes = 1;
+ display->selected_modes = selected_mode;
modeline = display->modelines;
while (modeline) {
gchar *name;
Bool isSpecial;
- Bool mode_added;
if (IS_NVIDIA_DEFAULT_MODE(modeline)) {
name = g_strdup_printf("Auto");
@@ -3274,15 +3267,8 @@ static void generate_selected_modes(const nvDisplayPtr display)
NULL /* viewPortOut */);
g_free(name);
- if (!display->selected_modes) {
- display->selected_modes = selected_mode;
- mode_added = TRUE;
- } else {
- mode_added = append_unique_selected_mode(display->selected_modes,
- selected_mode);
- }
-
- if (mode_added) {
+ if (append_unique_selected_mode(display->selected_modes,
+ selected_mode)) {
display->num_selected_modes++;
if (matches_current_selected_mode(display, selected_mode,
@@ -3415,18 +3401,10 @@ static void setup_display_resolution_dropdown(CtkDisplayConfig *ctk_object)
}
- if (display->cur_mode->modeline && display->screen->num_displays > 1) {
- /*
- * Modeline is set and we have more than 1 display, start off as
- * 'nvidia-auto-select'
- */
- cur_idx = 1;
+ if (display->cur_mode->modeline) {
+ cur_idx = 1; /* Modeline is set, start off as 'nvidia-auto-select' */
} else {
- /*
- * Modeline not set, start off as 'off'. If we do not have more than
- * 1 display, 'auto' will be at index 0.
- */
- cur_idx = 0;
+ cur_idx = 0; /* Modeline not set, start off as 'off'. */
}
/* Setup the menu */
@@ -3440,10 +3418,12 @@ static void setup_display_resolution_dropdown(CtkDisplayConfig *ctk_object)
/* Fill dropdown menu */
selected_mode = display->selected_modes;
while (selected_mode) {
+ GtkWidget *menu_item = selected_mode->label;
+ const gchar *label_text = gtk_label_get_text(
+ GTK_LABEL(gtk_bin_get_child(GTK_BIN(selected_mode->label))));
gtk_combo_box_append_text(
- GTK_COMBO_BOX(ctk_object->mnu_display_resolution),
- selected_mode->text);
+ GTK_COMBO_BOX(ctk_object->mnu_display_resolution), label_text);
ctk_object->resolution_table[ctk_object->resolution_table_len] =
selected_mode;
@@ -3452,6 +3432,12 @@ static void setup_display_resolution_dropdown(CtkDisplayConfig *ctk_object)
cur_idx = ctk_object->resolution_table_len;
}
+ if (selected_mode->isSpecial &&
+ !selected_mode->modeline &&
+ display->screen->num_displays <= 1) {
+ gtk_widget_set_sensitive(menu_item, FALSE);
+ }
+
ctk_object->resolution_table_len++;
selected_mode = selected_mode->next;
}
diff --git a/src/gtk+-2.x/ctkdisplaylayout.h b/src/gtk+-2.x/ctkdisplaylayout.h
index f8039d6..34a7b44 100644
--- a/src/gtk+-2.x/ctkdisplaylayout.h
+++ b/src/gtk+-2.x/ctkdisplaylayout.h
@@ -166,7 +166,7 @@ typedef struct nvModeLineRec {
typedef struct nvSelectedModeRec {
struct nvSelectedModeRec *next;
- gchar *text; /* Text shown in dropdown menu */
+ GtkWidget *label; /* Label shown in dropdown menu */
nvModeLinePtr modeline; /* Modeline this mode references */
diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c
index a565239..9e677e8 100644
--- a/src/gtk+-2.x/ctkevent.c
+++ b/src/gtk+-2.x/ctkevent.c
@@ -334,6 +334,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_SIGNAL(NV_CTRL_THERMAL_COOLER_SPEED);
MAKE_SIGNAL(NV_CTRL_PALETTE_UPDATE_EVENT);
MAKE_SIGNAL(NV_CTRL_VIDEO_ENCODER_UTILIZATION);
+ MAKE_SIGNAL(NV_CTRL_GSYNC_ALLOWED);
MAKE_SIGNAL(NV_CTRL_GPU_NVCLOCK_OFFSET);
MAKE_SIGNAL(NV_CTRL_GPU_MEM_TRANSFER_RATE_OFFSET);
#undef MAKE_SIGNAL
@@ -733,6 +734,7 @@ static gboolean ctk_event_dispatch(GSource *source,
event_struct.value = nvctrlevent->value;
event_struct.display_mask = nvctrlevent->display_mask;
event_struct.is_availability_changed = TRUE;
+ event_struct.availability = nvctrlevent->availability;
/*
* XXX Is emitting a signal with g_signal_emit() really
diff --git a/src/gtk+-2.x/ctkevent.h b/src/gtk+-2.x/ctkevent.h
index 61ecdca..2943baa 100644
--- a/src/gtk+-2.x/ctkevent.h
+++ b/src/gtk+-2.x/ctkevent.h
@@ -65,6 +65,7 @@ struct _CtkEventStruct
gint value;
guint display_mask;
gboolean is_availability_changed;
+ gboolean availability;
};
GType ctk_event_get_type (void) G_GNUC_CONST;
diff --git a/src/gtk+-2.x/ctkopengl.c b/src/gtk+-2.x/ctkopengl.c
index d9b37d7..f251737 100644
--- a/src/gtk+-2.x/ctkopengl.c
+++ b/src/gtk+-2.x/ctkopengl.c
@@ -34,6 +34,8 @@ static void post_vblank_sync_button_toggled(CtkOpenGL *, gboolean);
static void post_allow_flipping_button_toggled(CtkOpenGL *, gboolean);
+static void post_allow_gsync_button_toggled(CtkOpenGL *, gboolean);
+
static void post_force_stereo_button_toggled(CtkOpenGL *, gboolean);
static void post_show_sli_visual_indicator_button_toggled(CtkOpenGL *,
@@ -52,6 +54,8 @@ static void post_use_conformant_clamping_button_toggled(CtkOpenGL *, gint);
static void allow_flipping_button_toggled(GtkWidget *, gpointer);
+static void allow_gsync_button_toggled(GtkWidget *, gpointer);
+
static void force_stereo_button_toggled (GtkWidget *, gpointer);
static void xinerama_stereo_button_toggled (GtkWidget *, gpointer);
@@ -164,6 +168,7 @@ static const char *__use_conformant_clamping_help =
#define __STEREO_EYES_EXCHANGE (1 << 10)
#define __SHOW_MULTIGPU_VISUAL_INDICATOR (1 << 11)
#define __CONFORMANT_CLAMPING (1 << 12)
+#define __ALLOW_GSYNC (1 << 13)
@@ -212,6 +217,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
gint sync_to_vblank;
gint flipping_allowed;
+ gint gsync_allowed;
gint force_stereo;
gint xinerama_stereo;
gint stereo_eyes_exchange;
@@ -224,6 +230,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
ReturnStatus ret_sync_to_vblank;
ReturnStatus ret_flipping_allowed;
+ ReturnStatus ret_gsync_allowed;
ReturnStatus ret_force_stereo;
ReturnStatus ret_xinerama_stereo;
ReturnStatus ret_stereo_eyes_exchange;
@@ -242,6 +249,10 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
NvCtrlGetAttribute(handle, NV_CTRL_FLIPPING_ALLOWED,
&flipping_allowed);
+ ret_gsync_allowed =
+ NvCtrlGetAttribute(handle, NV_CTRL_GSYNC_ALLOWED,
+ &gsync_allowed);
+
ret_force_stereo =
NvCtrlGetAttribute(handle, NV_CTRL_FORCE_STEREO, &force_stereo);
@@ -281,6 +292,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
/* There are no OpenGL settings to change (OpenGL disabled?) */
if ((ret_sync_to_vblank != NvCtrlSuccess) &&
(ret_flipping_allowed != NvCtrlSuccess) &&
+ (ret_gsync_allowed != NvCtrlSuccess) &&
(ret_force_stereo != NvCtrlSuccess) &&
(ret_xinerama_stereo != NvCtrlSuccess) &&
(ret_stereo_eyes_exchange != NvCtrlSuccess) &&
@@ -394,7 +406,41 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
ctk_opengl->allow_flipping_button = check_button;
}
-
+
+ /*
+ * allow G-SYNC
+ *
+ * Always create the checkbox, but only show it if the attribute starts out
+ * available.
+ */
+
+ label = gtk_label_new("Allow G-SYNC");
+
+ check_button = gtk_check_button_new();
+ gtk_container_add(GTK_CONTAINER(check_button), label);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button),
+ gsync_allowed);
+
+ gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(check_button), "toggled",
+ G_CALLBACK(allow_gsync_button_toggled),
+ (gpointer) ctk_opengl);
+
+ g_signal_connect(G_OBJECT(ctk_event),
+ CTK_EVENT_NAME(NV_CTRL_GSYNC_ALLOWED),
+ G_CALLBACK(value_changed), (gpointer) ctk_opengl);
+
+ ctk_config_set_tooltip(ctk_config, check_button,
+ "Enabling this option allows OpenGL to flip "
+ "using G-SYNC when possible. This option is "
+ "applied immediately.");
+
+ ctk_opengl->active_attributes |= __ALLOW_GSYNC;
+
+ ctk_opengl->allow_gsync_button = check_button;
+
if (ret_force_stereo == NvCtrlSuccess) {
label = gtk_label_new("Force Stereo Flipping");
@@ -675,6 +721,14 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
gtk_widget_show_all(GTK_WIDGET(object));
+ /*
+ * If GSYNC is not currently available, start out with the GSYNC button
+ * hidden.
+ */
+ if (ret_gsync_allowed != NvCtrlSuccess) {
+ gtk_widget_hide(GTK_WIDGET(ctk_opengl->allow_gsync_button));
+ }
+
return GTK_WIDGET(object);
}
@@ -697,6 +751,14 @@ static void post_allow_flipping_button_toggled(CtkOpenGL *ctk_opengl,
enabled ? "allowed" : "not allowed");
}
+static void post_allow_gsync_button_toggled(CtkOpenGL *ctk_opengl,
+ gboolean enabled)
+{
+ ctk_config_statusbar_message(ctk_opengl->ctk_config,
+ "G-SYNC %s.",
+ enabled ? "allowed" : "not allowed");
+}
+
static void post_force_stereo_button_toggled(CtkOpenGL *ctk_opengl,
gboolean enabled)
{
@@ -790,6 +852,20 @@ static void allow_flipping_button_toggled(GtkWidget *widget,
}
+static void allow_gsync_button_toggled(GtkWidget *widget,
+ gpointer user_data)
+{
+ CtkOpenGL *ctk_opengl;
+ gboolean enabled;
+
+ ctk_opengl = CTK_OPENGL(user_data);
+
+ enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+ NvCtrlSetAttribute(ctk_opengl->handle, NV_CTRL_GSYNC_ALLOWED, enabled);
+ post_allow_gsync_button_toggled(ctk_opengl, enabled);
+}
+
static void force_stereo_button_toggled(GtkWidget *widget,
gpointer user_data)
{
@@ -915,6 +991,7 @@ static void value_changed(GtkObject *object, gpointer arg1, gpointer user_data)
CtkEventStruct *event_struct;
CtkOpenGL *ctk_opengl;
gboolean enabled;
+ gboolean check_available = FALSE;
GtkToggleButton *button;
GCallback func;
@@ -932,6 +1009,12 @@ static void value_changed(GtkObject *object, gpointer arg1, gpointer user_data)
func = G_CALLBACK(allow_flipping_button_toggled);
post_allow_flipping_button_toggled(ctk_opengl, event_struct->value);
break;
+ case NV_CTRL_GSYNC_ALLOWED:
+ button = GTK_TOGGLE_BUTTON(ctk_opengl->allow_gsync_button);
+ func = G_CALLBACK(allow_gsync_button_toggled);
+ post_allow_gsync_button_toggled(ctk_opengl, event_struct->value);
+ check_available = TRUE;
+ break;
case NV_CTRL_FORCE_STEREO:
button = GTK_TOGGLE_BUTTON(ctk_opengl->force_stereo_button);
func = G_CALLBACK(force_stereo_button_toggled);
@@ -987,7 +1070,15 @@ static void value_changed(GtkObject *object, gpointer arg1, gpointer user_data)
gtk_toggle_button_set_active(button, event_struct->value);
g_signal_handlers_unblock_by_func(button, func, ctk_opengl);
}
-
+
+ if (check_available && event_struct->is_availability_changed) {
+ if (event_struct->availability) {
+ gtk_widget_show(GTK_WIDGET(button));
+ } else {
+ gtk_widget_hide(GTK_WIDGET(button));
+ }
+ }
+
} /* value_changed() */
@@ -1226,6 +1317,25 @@ GtkTextBuffer *ctk_opengl_create_help(GtkTextTagTable *table,
"after the option is set.");
}
+ if (ctk_opengl->active_attributes & __ALLOW_GSYNC) {
+ ctk_help_heading(b, &i, "Allow G-SYNC");
+ ctk_help_para(b, &i, "Enabling this option allows OpenGL to use G-SYNC "
+ "when available. G-SYNC is a technology that allows a "
+ "monitor to delay updating the screen until the GPU is "
+ "ready to display a new frame. Without G-SYNC, the GPU "
+ "waits for the display to be ready to accept a new frame "
+ "instead.");
+
+ ctk_help_para(b, &i, "Note that this option is applied immediately, "
+ "unlike most other OpenGL options which are only "
+ "applied to OpenGL applications that are started "
+ "after the option is set.");
+
+ ctk_help_para(b, &i, "This option can be overridden on a "
+ "per-application basis using the GLGSYNCAllowed "
+ "application profile key.");
+ }
+
if (ctk_opengl->active_attributes & __FORCE_STEREO) {
ctk_help_heading(b, &i, "Force Stereo Flipping");
ctk_help_para(b, &i, "%s", __force_stereo_help);
diff --git a/src/gtk+-2.x/ctkopengl.h b/src/gtk+-2.x/ctkopengl.h
index be88c94..c8907d8 100644
--- a/src/gtk+-2.x/ctkopengl.h
+++ b/src/gtk+-2.x/ctkopengl.h
@@ -55,6 +55,7 @@ struct _CtkOpenGL
GtkWidget *sync_to_vblank_button;
GtkWidget *allow_flipping_button;
+ GtkWidget *allow_gsync_button;
GtkWidget *use_conformant_clamping_button;
GtkWidget *force_stereo_button;
GtkWidget *xinerama_stereo_button;
diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c
index 5286655..03a37f6 100644
--- a/src/gtk+-2.x/ctkwindow.c
+++ b/src/gtk+-2.x/ctkwindow.c
@@ -1022,6 +1022,8 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf,
if (ret != NvCtrlSuccess) {
driver_version = NULL;
}
+ } else {
+ driver_version = NULL;
}
widget = ctk_app_profile_new(ctk_config, driver_version);
diff --git a/src/libXNVCtrl/utils.mk b/src/libXNVCtrl/utils.mk
index a725f14..cc989d0 100644
--- a/src/libXNVCtrl/utils.mk
+++ b/src/libXNVCtrl/utils.mk
@@ -230,7 +230,7 @@ NV_MODULE_LOGGING_NAME ?=
ifeq ($(NV_VERBOSE),0)
quiet_cmd = @$(PRINTF) \
- " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ]) $(quiet_$(1))\n" \
+ " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \
"$(NV_MODULE_LOGGING_NAME)" && $($(1))
else
quiet_cmd = $($(1))
@@ -343,11 +343,12 @@ define DEFINE_STAMP_C_RULE
$$(call BUILD_OBJECT_LIST,$$(STAMP_C)),$(1)) \
$$(VERSION_MK)
@ $$(RM) $$@
- @ $$(PRINTF) "const char NV_ID[] = \"nvidia id: " >> $$@
- @ $$(PRINTF) "$(2): " >> $$@
- @ $$(PRINTF) "version $$(NVIDIA_VERSION) " >> $$@
- @ $$(PRINTF) "($$(shell $$(WHOAMI))@$$(shell $$(HOSTNAME_CMD))) " >> $$@
- @ $$(PRINTF) "$$(shell $(DATE))\";\n" >> $$@
- @ $$(PRINTF) "const char *pNV_ID = NV_ID + 11;\n" >> $$@
+ @ $$(PRINTF) "%s" "const char NV_ID[] = \"nvidia id: " >> $$@
+ @ $$(PRINTF) "%s" "$(2): " >> $$@
+ @ $$(PRINTF) "%s" "version $$(NVIDIA_VERSION) " >> $$@
+ @ $$(PRINTF) "%s" "($$(shell $$(WHOAMI))" >> $$@
+ @ $$(PRINTF) "%s" "@$$(shell $$(HOSTNAME_CMD))) " >> $$@
+ @ $$(PRINTF) "%s\n" "$$(shell $(DATE))\";" >> $$@
+ @ $$(PRINTF) "%s\n" "const char *pNV_ID = NV_ID + 11;" >> $$@
endef
diff --git a/src/libXNVCtrl/version.mk b/src/libXNVCtrl/version.mk
index dea0f65..95e697a 100644
--- a/src/libXNVCtrl/version.mk
+++ b/src/libXNVCtrl/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 337.25
+NVIDIA_VERSION = 340.17
diff --git a/src/parse.c b/src/parse.c
index 3163eed..5dec1f5 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -128,6 +128,7 @@ const AttributeTableEntry attributeTable[] = {
{ "SliMosaicModeAvailable", NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE, INT_ATTR, {0,0,0,0,1,0}, { .int_flags = {0,0,0,0,0,0,0} }, "Returns whether or not SLI Mosaic Mode is supported." },
{ "SLIMode", NV_CTRL_STRING_SLI_MODE, STR_ATTR, {0,0,0,0,1,0}, {}, "Returns a string describing the current SLI mode, if any." },
{ "MultiGpuMode", NV_CTRL_STRING_MULTIGPU_MODE, STR_ATTR, {0,0,0,0,1,0}, {}, "Returns a string describing the current MultiGPU mode, if any." },
+ { "AllowGSYNC", NV_CTRL_GSYNC_ALLOWED, INT_ATTR, {0,0,0,0,0,0}, { .int_flags = {0,0,0,0,0,0,0} }, "Enables or disables the use of G-SYNC when available." },
/* GPU */
{ "BusType", NV_CTRL_BUS_TYPE, INT_ATTR, {0,0,0,0,1,0}, { .int_flags = {0,0,0,0,0,0,0} }, "Returns the type of bus connecting the specified device to the computer. If the target is an X screen, then it uses the GPU driving the X screen as the device." },
diff --git a/src/query-assign.c b/src/query-assign.c
index a6401c2..0a0a57c 100644
--- a/src/query-assign.c
+++ b/src/query-assign.c
@@ -2799,6 +2799,21 @@ static int query_all_targets(const char *display_name, const int target_index,
nvfree(extra_str);
}
+ /* Print the valid protocal names for the target */
+ if (t->protoNames[0]) {
+ int idx;
+
+ nv_msg(" ", "Has the following name%s:",
+ t->protoNames[1] ? "s" : "");
+ for (idx = 0; idx < NV_PROTO_NAME_MAX; idx++) {
+ if (t->protoNames[idx]) {
+ nv_msg(" ", "%s", t->protoNames[idx]);
+ }
+ }
+
+ nv_msg(NULL, "");
+ }
+
/* Print connectivity information */
if (nv_get_verbosity() >= NV_VERBOSITY_ALL) {
switch (target_index) {
diff --git a/src/src.mk b/src/src.mk
index ccf5a54..625da2c 100644
--- a/src/src.mk
+++ b/src/src.mk
@@ -282,7 +282,14 @@ JANSSON_SRC += jansson/strconv.c
JANSSON_SRC += jansson/utf.c
JANSSON_SRC += jansson/value.c
-NVIDIA_SETTINGS_SRC += $(JANSSON_SRC)
+NV_USE_BUNDLED_LIBJANSSON ?= 1
+
+ifneq ($(NV_USE_BUNDLED_LIBJANSSON),0)
+ NVIDIA_SETTINGS_SRC += $(JANSSON_SRC)
+else
+ # Continue to distribute jansson source files, but don't build them
+ NVIDIA_SETTINGS_EXTRA_DIST += $(JANSSON_SRC)
+endif
JANSSON_EXTRA_DIST += jansson/hashtable.h
JANSSON_EXTRA_DIST += jansson/jansson_config.h
diff --git a/src/version.mk b/src/version.mk
index dea0f65..95e697a 100644
--- a/src/version.mk
+++ b/src/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 337.25
+NVIDIA_VERSION = 340.17
diff --git a/utils.mk b/utils.mk
index a725f14..cc989d0 100644
--- a/utils.mk
+++ b/utils.mk
@@ -230,7 +230,7 @@ NV_MODULE_LOGGING_NAME ?=
ifeq ($(NV_VERBOSE),0)
quiet_cmd = @$(PRINTF) \
- " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ]) $(quiet_$(1))\n" \
+ " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \
"$(NV_MODULE_LOGGING_NAME)" && $($(1))
else
quiet_cmd = $($(1))
@@ -343,11 +343,12 @@ define DEFINE_STAMP_C_RULE
$$(call BUILD_OBJECT_LIST,$$(STAMP_C)),$(1)) \
$$(VERSION_MK)
@ $$(RM) $$@
- @ $$(PRINTF) "const char NV_ID[] = \"nvidia id: " >> $$@
- @ $$(PRINTF) "$(2): " >> $$@
- @ $$(PRINTF) "version $$(NVIDIA_VERSION) " >> $$@
- @ $$(PRINTF) "($$(shell $$(WHOAMI))@$$(shell $$(HOSTNAME_CMD))) " >> $$@
- @ $$(PRINTF) "$$(shell $(DATE))\";\n" >> $$@
- @ $$(PRINTF) "const char *pNV_ID = NV_ID + 11;\n" >> $$@
+ @ $$(PRINTF) "%s" "const char NV_ID[] = \"nvidia id: " >> $$@
+ @ $$(PRINTF) "%s" "$(2): " >> $$@
+ @ $$(PRINTF) "%s" "version $$(NVIDIA_VERSION) " >> $$@
+ @ $$(PRINTF) "%s" "($$(shell $$(WHOAMI))" >> $$@
+ @ $$(PRINTF) "%s" "@$$(shell $$(HOSTNAME_CMD))) " >> $$@
+ @ $$(PRINTF) "%s\n" "$$(shell $(DATE))\";" >> $$@
+ @ $$(PRINTF) "%s\n" "const char *pNV_ID = NV_ID + 11;" >> $$@
endef
diff --git a/version.mk b/version.mk
index dea0f65..95e697a 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 337.25
+NVIDIA_VERSION = 340.17