summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2009-05-28 09:57:06 -0700
committerAaron Plattner <aplattner@nvidia.com>2009-05-28 09:57:06 -0700
commit37c32510db16c92d802991f0137ded02b8cc8058 (patch)
tree8a40a4b4bda1c73ee5829b269ba90fa3a096fcf7
parenta69f45fc3dc7847ca600bfb1873ec2995fce13a6 (diff)
185.18.14185.18.14
-rw-r--r--src/XF86Config-parser/Generate.c167
-rw-r--r--src/XF86Config-parser/xf86Parser.h1
-rw-r--r--src/config-file.c6
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-crt.c2
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-dfp.c2
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-tv.c2
-rw-r--r--src/gtk+-2.x/ctkevent.c3
-rw-r--r--src/gtk+-2.x/ctkframelock.c21
-rw-r--r--src/gtk+-2.x/ctkhelp.c11
-rw-r--r--src/gtk+-2.x/ctkhelp.h3
-rw-r--r--src/gtk+-2.x/ctkslimm.c159
-rw-r--r--src/gtk+-2.x/ctkslimm.h3
-rw-r--r--src/libXNVCtrl/NVCtrl.h28
-rw-r--r--src/parse.c11
-rw-r--r--src/parse.h3
15 files changed, 340 insertions, 82 deletions
diff --git a/src/XF86Config-parser/Generate.c b/src/XF86Config-parser/Generate.c
index 04bc2fb..b2e414a 100644
--- a/src/XF86Config-parser/Generate.c
+++ b/src/XF86Config-parser/Generate.c
@@ -375,6 +375,15 @@ static void add_modules(GenerateOptions *gop, XConfigPtr config)
{
XConfigLoadPtr l = NULL;
+ /*
+ * if the X server will automatically autoload GLX, then don't
+ * bother adding a modules section; it is difficult for
+ * nvidia-xconfig to know if modules like "type1" are present,
+ * anyway.
+ */
+
+ if (gop->autoloads_glx) return;
+
config->modules = xconfigAlloc(sizeof(XConfigModuleRec));
xconfigAddNewLoadDirective(&l, xconfigStrdup("dbe"),
@@ -1329,6 +1338,104 @@ static char *xconfigGetDefaultProjectRoot(void)
+
+/*
+ * get_xserver_information() - parse the versionString (from `X
+ * -version`) and assign relevant information that we infer from the X
+ * server version.
+ *
+ * Note: this implementation should be shared with nvidia-installer
+ */
+
+static int get_xserver_information(const char *versionString,
+ int *isXorg,
+ int *isModular,
+ int *autoloadsGLX,
+ int *supportsExtensionSection)
+{
+#define XSERVER_VERSION_FORMAT_1 "X Window System Version"
+#define XSERVER_VERSION_FORMAT_2 "X.Org X Server"
+
+ int major, minor, found;
+ const char *ptr;
+
+ /* check if this is an XFree86 X server */
+
+ if (strstr(versionString, "XFree86 Version")) {
+ *isXorg = FALSE;
+ *isModular = FALSE;
+ *autoloadsGLX = FALSE;
+ *supportsExtensionSection = FALSE;
+ return TRUE;
+ }
+
+ /* this must be an X.Org X server */
+
+ *isXorg = TRUE;
+
+ /* attempt to parse the major.minor version out of the string */
+
+ found = FALSE;
+
+ if (((ptr = strstr(versionString, XSERVER_VERSION_FORMAT_1)) != NULL) &&
+ (sscanf(ptr, XSERVER_VERSION_FORMAT_1 " %d.%d", &major, &minor) == 2)) {
+ found = TRUE;
+ }
+
+ if (!found &&
+ ((ptr = strstr(versionString, XSERVER_VERSION_FORMAT_2)) != NULL) &&
+ (sscanf(ptr, XSERVER_VERSION_FORMAT_2 " %d.%d", &major, &minor) == 2)) {
+ found = TRUE;
+ }
+
+ /* if we can't parse the version, give up */
+
+ if (!found) return FALSE;
+
+ /*
+ * isModular: X.Org X11R6.x X servers are monolithic, all others
+ * are modular
+ */
+
+ if (major == 6) {
+ *isModular = FALSE;
+ } else {
+ *isModular = TRUE;
+ }
+
+ /*
+ * supportsExtensionSection: support for the "Extension" xorg.conf
+ * section was added between X.Org 6.7 and 6.8. To account for
+ * the X server version wrap, it is easier to check for X servers
+ * that do not support the Extension section: 6.x (x < 8) X
+ * servers.
+ */
+
+ if ((major == 6) && (minor < 8)) {
+ *supportsExtensionSection = FALSE;
+ } else {
+ *supportsExtensionSection = TRUE;
+ }
+
+ /*
+ * support for autoloading GLX was added in X.Org 1.5. To account
+ * for the X server version wrap, it is easier to check for X
+ * servers that do not support GLX autoloading: 6.x, 7.x, or < 1.5
+ * X servers.
+ */
+
+ if ((major == 6) || (major == 7) || ((major == 1) && (minor < 5))) {
+ *autoloadsGLX = FALSE;
+ } else {
+ *autoloadsGLX = TRUE;
+ }
+
+ return TRUE;
+
+} /* get_xserver_information() */
+
+
+
/*
* xconfigGetXServerInUse() - try to determine which X server is in use
* (XFree86, Xorg); also determine if the X server supports the
@@ -1341,33 +1448,29 @@ static char *xconfigGetDefaultProjectRoot(void)
#define NV_LINE_LEN 1024
#define EXTRA_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/bin/X11"
-#define VERSION_FORMAT "X Protocol Version %d, Revision %d, Release %d.%d"
+#if defined(NV_SUNOS)
+#define XSERVER_BIN_NAME "Xorg"
+#else
+#define XSERVER_BIN_NAME "X"
+#endif
+
void xconfigGetXServerInUse(GenerateOptions *gop)
{
-#if defined(NV_SUNOS)
-
- /*
- * Solaris x86/x64 always uses X.Org 6.8 or higher, atleast as far
- * as the NVIDIA X driver is concerned
- */
-
- gop->xserver = X_IS_XORG;
- gop->supports_extension_section = TRUE;
-
-#else
-
FILE *stream = NULL;
int xserver = -1;
- int dummy, len, release_major, release_minor;
+ int isXorg;
+ int dummy, len, found;
char *cmd, *ptr, *ret;
gop->supports_extension_section = FALSE;
-
+ gop->autoloads_glx = FALSE;
+
/* run `X -version` with a PATH that hopefully includes the X binary */
cmd = xconfigStrcat("PATH=", gop->x_project_root, ":",
- EXTRA_PATH, ":$PATH X -version 2>&1", NULL);
+ EXTRA_PATH, ":$PATH ", XSERVER_BIN_NAME,
+ " -version 2>&1", NULL);
if ((stream = popen(cmd, "r"))) {
char buf[NV_LINE_LEN];
@@ -1382,23 +1485,26 @@ void xconfigGetXServerInUse(GenerateOptions *gop)
ptr = strchr(ptr, '\0');
} while ((ret != NULL) && (len > 1));
- /* Check if this is an XFree86 release */
+ /*
+ * process the `X -version` output to infer relevant
+ * information from this X server
+ */
- if (strstr(buf, "XFree86 Version") != NULL) {
- xserver = X_IS_XF86;
- gop->supports_extension_section = FALSE;
- } else {
- xserver = X_IS_XORG;
- if ((ptr = strstr(buf, "X Protocol Version")) != NULL &&
- sscanf(ptr, VERSION_FORMAT, &dummy, &dummy,
- &release_major, &release_minor) == 4) {
+ found = get_xserver_information(buf,
+ &isXorg,
+ &dummy, /* isModular */
+ &gop->autoloads_glx,
+ &gop->supports_extension_section);
- if ((release_major > 6) ||
- ((release_major == 6) && (release_minor >= 8))) {
- gop->supports_extension_section = TRUE;
- }
+ if (found) {
+ if (isXorg) {
+ xserver = X_IS_XORG;
+ } else {
+ xserver = X_IS_XF86;
}
- }
+ } else {
+ xconfigErrorMsg(WarnMsg, "Unable to parse X.Org version string.");
+ }
}
/* Close the popen()'ed stream. */
pclose(stream);
@@ -1417,7 +1523,6 @@ void xconfigGetXServerInUse(GenerateOptions *gop)
}
gop->xserver=xserver;
-#endif
} /* xconfigGetXServerInUse() */
diff --git a/src/XF86Config-parser/xf86Parser.h b/src/XF86Config-parser/xf86Parser.h
index f8a5f0f..2e1e7b4 100644
--- a/src/XF86Config-parser/xf86Parser.h
+++ b/src/XF86Config-parser/xf86Parser.h
@@ -593,6 +593,7 @@ typedef struct {
char *keyboard_driver;
int supports_extension_section;
+ int autoloads_glx;
} GenerateOptions;
diff --git a/src/config-file.c b/src/config-file.c
index 11e5664..e63e672 100644
--- a/src/config-file.c
+++ b/src/config-file.c
@@ -214,7 +214,8 @@ int nv_write_config_file(const char *filename, CtrlHandles *h,
NVCTRLAttributeValidValuesRec valid;
uint32 mask;
CtrlHandleTarget *t;
- char *tmp_d_str, *tmp, *prefix, scratch[4];
+ char *tmp_d_str, *prefix, scratch[4];
+ const char *tmp;
char *locale = "C";
stream = fopen(filename, "w");
@@ -386,7 +387,8 @@ int nv_write_config_file(const char *filename, CtrlHandles *h,
continue;
}
- tmp = nv_get_attribute_name(p->attr);
+ tmp = nv_get_attribute_name(p->attr, NV_PARSER_TYPE_STRING_ATTRIBUTE,
+ p->flags);
if (!tmp) {
nv_error_msg("Failure to save unknown attribute %d.", p->attr);
p = p->next;
diff --git a/src/gtk+-2.x/ctkdisplaydevice-crt.c b/src/gtk+-2.x/ctkdisplaydevice-crt.c
index 991875b..fffa40d 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-crt.c
+++ b/src/gtk+-2.x/ctkdisplaydevice-crt.c
@@ -266,6 +266,8 @@ GtkTextBuffer *ctk_display_device_crt_create_help(GtkTextTagTable *table,
add_acquire_edid_help(b, &i);
}
+ ctk_help_reset_hardware_defaults(b, &i, ctk_display_device_crt->name);
+
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkdisplaydevice-dfp.c b/src/gtk+-2.x/ctkdisplaydevice-dfp.c
index ec7f598..ba20523 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-dfp.c
+++ b/src/gtk+-2.x/ctkdisplaydevice-dfp.c
@@ -885,6 +885,8 @@ GtkTextBuffer *ctk_display_device_dfp_create_help(GtkTextTagTable *table,
add_acquire_edid_help(b, &i);
}
+ ctk_help_reset_hardware_defaults(b, &i, ctk_display_device_dfp->name);
+
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkdisplaydevice-tv.c b/src/gtk+-2.x/ctkdisplaydevice-tv.c
index 12773e6..954e980 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-tv.c
+++ b/src/gtk+-2.x/ctkdisplaydevice-tv.c
@@ -737,6 +737,8 @@ GtkTextBuffer *ctk_display_device_tv_create_help(GtkTextTagTable *table,
add_acquire_edid_help(b, &i);
}
+ ctk_help_reset_hardware_defaults(b, &i, ctk_display_device_tv->name);
+
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c
index b406b88..3c12a30 100644
--- a/src/gtk+-2.x/ctkevent.c
+++ b/src/gtk+-2.x/ctkevent.c
@@ -270,6 +270,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_SIGNAL(NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE);
MAKE_SIGNAL(NV_CTRL_GVO_ENABLE_RGB_DATA);
MAKE_SIGNAL(NV_CTRL_IMAGE_SHARPENING_DEFAULT);
+ MAKE_SIGNAL(NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION);
#undef MAKE_SIGNAL
@@ -280,7 +281,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
* knows about.
*/
-#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_IMAGE_SHARPENING_DEFAULT
+#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION
#warning "There are attributes that do not emit signals!"
#endif
diff --git a/src/gtk+-2.x/ctkframelock.c b/src/gtk+-2.x/ctkframelock.c
index 27db08a..6083946 100644
--- a/src/gtk+-2.x/ctkframelock.c
+++ b/src/gtk+-2.x/ctkframelock.c
@@ -215,6 +215,8 @@ struct _nvFrameLockDataRec {
gpointer handle; /* NV-CONTROL Frame Lock Target */
int server_id;
+ int sync_delay_resolution;
+
/* Signal Handler IDs */
gulong signal_ids[NUM_FRAMELOCK_SIGNALS];
@@ -3457,7 +3459,8 @@ void list_entry_update_framelock_status(CtkFramelock *ctk_framelock,
/* Sync Delay (Skew) */
gtk_widget_set_sensitive(data->delay_label, framelock_enabled);
gtk_widget_set_sensitive(data->delay_text, framelock_enabled);
- fvalue = ((gfloat) delay) * NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR;
+ fvalue = ((gfloat) delay) *
+ ((gfloat) data->sync_delay_resolution) / 1000.0;
snprintf(str, 32, "%.2f uS", fvalue); // 10.2f
gtk_label_set_text(GTK_LABEL(data->delay_text), str);
@@ -5244,7 +5247,19 @@ static unsigned int add_framelock_devices(CtkFramelock *ctk_framelock,
framelock_id,
NV_CTRL_ATTRIBUTES_NV_CONTROL_SUBSYSTEM);
- /* Get the framelock revision information */
+ /* Gather framelock device information */
+ ret = NvCtrlGetAttribute(framelock_data->handle,
+ NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION,
+ &val);
+ if (ret == NvCtrlSuccess) {
+ framelock_data->sync_delay_resolution = val;
+ } else {
+ /* Fall back to the GSync II's resolution when
+ * working with an older X server
+ */
+ framelock_data->sync_delay_resolution = 7810;
+ }
+
ret = NvCtrlGetAttribute(framelock_data->handle,
NV_CTRL_FRAMELOCK_FPGA_REVISION,
&val);
@@ -5492,7 +5507,7 @@ static gint add_devices(CtkFramelock *ctk_framelock,
static void add_entry_to_parsed_attributes(nvListEntryPtr entry,
ParsedAttribute *head)
{
- ParsedAttribute a;
+ ParsedAttribute a = { 0 };
char *display_name = NULL;
int target_type = 0;
int target_id = 0;
diff --git a/src/gtk+-2.x/ctkhelp.c b/src/gtk+-2.x/ctkhelp.c
index f2da306..8ab9a7c 100644
--- a/src/gtk+-2.x/ctkhelp.c
+++ b/src/gtk+-2.x/ctkhelp.c
@@ -406,3 +406,14 @@ void ctk_help_finish(GtkTextBuffer *buffer)
gtk_text_buffer_apply_tag_by_name
(buffer, CTK_HELP_SINGLE_SPACE_TAG, &start, &end);
}
+
+void ctk_help_reset_hardware_defaults(GtkTextBuffer *b, GtkTextIter *i,
+ char *name)
+{
+ ctk_help_heading(b, i, "Reset Hardware Defaults");
+ ctk_help_para(b, i, "The Reset Hardware Defaults button restores "
+ "the %s settings to their default "
+ "values.", name);
+
+}
+
diff --git a/src/gtk+-2.x/ctkhelp.h b/src/gtk+-2.x/ctkhelp.h
index 090adc8..ea4934b 100644
--- a/src/gtk+-2.x/ctkhelp.h
+++ b/src/gtk+-2.x/ctkhelp.h
@@ -78,6 +78,9 @@ void ctk_help_heading (GtkTextBuffer *, GtkTextIter *, const gchar *, ...);
void ctk_help_term (GtkTextBuffer *, GtkTextIter *, const gchar *, ...);
void ctk_help_finish (GtkTextBuffer *);
+void ctk_help_reset_hardware_defaults(GtkTextBuffer *, GtkTextIter *, char *);
+
+
#define CTK_HELP_TITLE_TAG "title"
#define CTK_HELP_HEADING_TAG "heading"
#define CTK_HELP_HEADING_NOT_EDITABLE_TAG "not_editable"
diff --git a/src/gtk+-2.x/ctkslimm.c b/src/gtk+-2.x/ctkslimm.c
index 4f3f331..eae821c 100644
--- a/src/gtk+-2.x/ctkslimm.c
+++ b/src/gtk+-2.x/ctkslimm.c
@@ -275,13 +275,95 @@ static XConfigPtr xconfig_generate(XConfigPtr xconfCur,
+static Bool compute_screen_size(CtkSLIMM *ctk_object, gint *width,
+ gint *height)
+{
+ gint config_idx;
+ GridConfig *grid_config;
+ gint x_displays,y_displays;
+ gint h_overlap, v_overlap;
+
+
+ if (!ctk_object->cur_modeline) {
+ return FALSE;
+ }
+
+ config_idx = gtk_option_menu_get_history(GTK_OPTION_MENU(ctk_object->mnu_display_config));
+
+ /* Get grid configuration values from index */
+ grid_config = get_ith_valid_grid_config(config_idx);
+ if (grid_config) {
+ x_displays = grid_config->columns;
+ y_displays = grid_config->rows;
+ } else {
+ x_displays = y_displays = 0;
+ }
+
+ gtk_widget_set_sensitive(ctk_object->spbtn_hedge_overlap,
+ x_displays > 1 ? True : False);
+ gtk_widget_set_sensitive(ctk_object->spbtn_vedge_overlap,
+ y_displays > 1 ? True : False);
+
+ h_overlap = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ctk_object->spbtn_hedge_overlap));
+ v_overlap = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ctk_object->spbtn_vedge_overlap));
+
+ /* Total X Screen Size Calculation */
+ *width = x_displays * ctk_object->cur_modeline->data.hdisplay -
+ (x_displays - 1) * h_overlap;
+ *height = y_displays * ctk_object->cur_modeline->data.vdisplay -
+ (y_displays - 1) * v_overlap;
+
+ return TRUE;
+}
+
+
+
static void save_xconfig_button_clicked(GtkWidget *widget, gpointer user_data)
{
CtkSLIMM *ctk_object = CTK_SLIMM(user_data);
+ gint width, height;
+ Bool error = FALSE;
+ gchar *err_msg = NULL;
- /* Run the dialog */
- run_save_xconfig_dialog(ctk_object->save_xconfig_dlg);
+ /* Make sure the screen size is acceptable */
+ if (!compute_screen_size(ctk_object, &width, &height)) {
+ error = TRUE;
+ err_msg = g_strdup("Unknown screen size!");
+
+ } else if ((width > ctk_object->max_screen_width) ||
+ (height > ctk_object->max_screen_height)) {
+ error = TRUE;
+ err_msg = g_strdup_printf("The configured X screen size of %dx%d is \n"
+ "too large. The maximum supported size is\n"
+ "%dx%d.",
+ width, height,
+ ctk_object->max_screen_width,
+ ctk_object->max_screen_height);
+ }
+
+ if (error) {
+ GtkWidget *dlg;
+ GtkWidget *parent;
+
+ parent = ctk_get_parent_window(GTK_WIDGET(ctk_object));
+
+ dlg = gtk_message_dialog_new
+ (GTK_WINDOW(parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ err_msg);
+
+ gtk_dialog_run(GTK_DIALOG(dlg));
+ gtk_widget_destroy(dlg);
+ g_free(err_msg);
+ return;
+ }
+
+
+ /* Run the save dialog */
+ run_save_xconfig_dialog(ctk_object->save_xconfig_dlg);
}
@@ -393,48 +475,21 @@ static void slimm_checkbox_toggled(GtkWidget *widget, gpointer user_data)
static void setup_total_size_label(CtkSLIMM *ctk_object)
{
- gint idx;
- gint x_displays,y_displays;
- gint h_overlap, v_overlap;
+ gint width, height;
gchar *xscreen_size;
- gint x_total, y_total;
- GridConfig *grid_config;
-
- if (!ctk_object->cur_modeline) {
- return;
- }
- idx = gtk_option_menu_get_history(GTK_OPTION_MENU(ctk_object->mnu_display_config));
- /* Get grid configuration values from index */
- grid_config = get_ith_valid_grid_config(idx);
- if (grid_config) {
- x_displays = grid_config->columns;
- y_displays = grid_config->rows;
- } else {
- x_displays = y_displays = 0;
+ if (!compute_screen_size(ctk_object, &width, &height)) {
+ return;
}
-
- gtk_widget_set_sensitive(ctk_object->spbtn_hedge_overlap,
- x_displays > 1 ? True : False);
- gtk_widget_set_sensitive(ctk_object->spbtn_vedge_overlap,
- y_displays > 1 ? True : False);
-
- h_overlap = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ctk_object->spbtn_hedge_overlap));
- v_overlap = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ctk_object->spbtn_vedge_overlap));
-
- /* Total X Screen Size Calculation */
- x_total = x_displays * ctk_object->cur_modeline->data.hdisplay -
- (x_displays - 1) * h_overlap;
- y_total = y_displays * ctk_object->cur_modeline->data.vdisplay -
- (y_displays - 1) * v_overlap;
- xscreen_size = g_strdup_printf("%d x %d", x_total, y_total);
+ xscreen_size = g_strdup_printf("%d x %d", width, height);
gtk_label_set_text(GTK_LABEL(ctk_object->lbl_total_size), xscreen_size);
g_free(xscreen_size);
-
}
+
+
/** setup_display_refresh_dropdown() *********************************
*
* Generates the refresh rate dropdown based on the currently selected
@@ -1222,6 +1277,21 @@ GtkWidget* ctk_slimm_new(NvCtrlAttributeHandle *handle,
return NULL;
}
+ /* Query the maximum screen sizes */
+ ret = NvCtrlGetAttribute(ctk_object->handle,
+ NV_CTRL_MAX_SCREEN_WIDTH,
+ &ctk_slimm->max_screen_width);
+ if (ret != NvCtrlSuccess) {
+ return NULL;
+ }
+
+ ret = NvCtrlGetAttribute(ctk_object->handle,
+ NV_CTRL_MAX_SCREEN_HEIGHT,
+ &ctk_slimm->max_screen_height);
+ if (ret != NvCtrlSuccess) {
+ return NULL;
+ }
+
/*
* Create the display configuration widgets
*
@@ -1545,6 +1615,25 @@ GtkWidget* ctk_slimm_new(NvCtrlAttributeHandle *handle,
gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 9, 10, GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL, 0.5, 0.5);
+ hbox = gtk_hbox_new(FALSE, 0);
+ label = gtk_label_new("Maximum Size");
+ hseparator = gtk_hseparator_new();
+ gtk_widget_show(hseparator);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 5);
+ gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 10, 11, GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL, 0.5, 0.5);
+
+ tmp = g_strdup_printf("%dx%d", ctk_slimm->max_screen_width,
+ ctk_slimm->max_screen_height);
+ label = gtk_label_new(tmp);
+ g_free(tmp);
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10);
+ gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 11, 12, GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL, 0.5, 0.5);
+
+
label = gtk_label_new("Save to X Configuration File");
hbox = gtk_hbox_new(FALSE, 0);
button = gtk_button_new();
diff --git a/src/gtk+-2.x/ctkslimm.h b/src/gtk+-2.x/ctkslimm.h
index 19cda5a..4bb674a 100644
--- a/src/gtk+-2.x/ctkslimm.h
+++ b/src/gtk+-2.x/ctkslimm.h
@@ -82,6 +82,9 @@ struct _CtkSLIMM
nvModeLinePtr modelines;
nvModeLinePtr cur_modeline;
gint num_modelines;
+
+ int max_screen_width;
+ int max_screen_height;
};
struct _CtkSLIMMClass
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index 1c9526f..32798e6 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -404,17 +404,27 @@
/*
* NV_CTRL_FRAMELOCK_SYNC_DELAY - delay between the frame lock pulse
- * and the GPU sync. This is an 11 bit value which is multipled by
- * 7.81 to determine the sync delay in microseconds.
+ * and the GPU sync. This value must be multiplied by
+ * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION to determine the sync delay in
+ * nanoseconds.
*
* This attribute may be queried through XNVCTRLQueryTargetAttribute()
* using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN
* target.
+ *
+ * USAGE NODE: NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX and
+ * NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR are deprecated.
+ * The Sync Delay _MAX and _FACTOR are different for different
+ * GSync products and so, to be correct, the valid values for
+ * NV_CTRL_FRAMELOCK_SYNC_DELAY must be queried to get the range
+ * of acceptable sync delay values, and
+ * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION must be queried to
+ * obtain the correct factor.
*/
#define NV_CTRL_FRAMELOCK_SYNC_DELAY 24 /* RW-F */
-#define NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX 2047
-#define NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR 7.81
+#define NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX 2047 // deprecated
+#define NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR 7.81 // deprecated
/*
@@ -2317,7 +2327,7 @@
* NV_CTRL_GVO_ENABLE_RGB_DATA - Allows clients to specify when
* the GVO board should process colors as RGB when the output data
* format is one of the NV_CTRL_GVO_DATA_FORMAT_???_PASSTRHU modes.
- */
+ */
#define NV_CTRL_GVO_ENABLE_RGB_DATA 304 /* RW- */
#define NV_CTRL_GVO_ENABLE_RGB_DATA_DISABLE 0
@@ -2330,7 +2340,13 @@
#define NV_CTRL_IMAGE_SHARPENING_DEFAULT 305 /* R-- */
-#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_IMAGE_SHARPENING_DEFAULT
+/*
+ * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION - Returns the number of nanoseconds
+ * that one unit of NV_CTRL_FRAMELOCK_SYNC_DELAY corresponds to.
+ */
+#define NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION 318 /* R-- */
+
+#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION
/**************************************************************************/
diff --git a/src/parse.c b/src/parse.c
index 1fb3cb6..612a467 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -179,6 +179,7 @@ AttributeTableEntry attributeTable[] = {
{ "FrameLockSlaveable", NV_CTRL_FRAMELOCK_SLAVEABLE, N|F|G|D, "Returns whether the display device(s) can be set as slave(s) of the frame lock group." },
{ "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." },
/* 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." },
@@ -289,7 +290,7 @@ AttributeTableEntry attributeTable[] = {
* about.
*/
-#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_IMAGE_SHARPENING_DEFAULT
+#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION
#warning "Have you forgotten to add a new integer attribute to attributeTable?"
#endif
@@ -1095,12 +1096,16 @@ void nv_parsed_attribute_clean(ParsedAttribute *p)
* corresponds to the attribute constant.
*/
-char *nv_get_attribute_name(const int attr)
+const char *nv_get_attribute_name(const int attr, const int flagsMask,
+ const int flags)
{
int i;
for (i = 0; attributeTable[i].name; i++) {
- if (attributeTable[i].attr == attr) return attributeTable[i].name;
+ if (attributeTable[i].attr == attr &&
+ (attributeTable[i].flags & flagsMask) == (flags & flagsMask)) {
+ return attributeTable[i].name;
+ }
}
return NULL;
diff --git a/src/parse.h b/src/parse.h
index 0b99541..8a5830c 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -297,7 +297,8 @@ void nv_parsed_attribute_add(ParsedAttribute *head, ParsedAttribute *a);
void nv_parsed_attribute_free(ParsedAttribute *p);
void nv_parsed_attribute_clean(ParsedAttribute *p);
-char *nv_get_attribute_name(const int attr);
+const char *nv_get_attribute_name(const int attr, const int flagsMask,
+ const int flags);
char *nv_standardize_screen_name(const char *display_name, int screen);