summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2009-01-08 18:50:33 -0800
committerAaron Plattner <aplattner@nvidia.com>2009-01-08 18:50:33 -0800
commit8775a7ac7c2cdc2ee752d9933c247a190f45e5bb (patch)
treef3941cf189dc808dcd971879a09c4f1ae4feae7e
parent733e2e324f8e48ac5bc2f77e0fe9305ca29312de (diff)
-rw-r--r--samples/nv-control-events.c1
-rw-r--r--src/XF86Config-parser/Generate.c19
-rw-r--r--src/gtk+-2.x/ctkevent.c1
-rw-r--r--src/gtk+-2.x/ctkopengl.c106
-rw-r--r--src/gtk+-2.x/ctkopengl.h1
-rw-r--r--src/libXNVCtrl/NVCtrl.h3
-rw-r--r--src/parse.c2
7 files changed, 110 insertions, 23 deletions
diff --git a/samples/nv-control-events.c b/samples/nv-control-events.c
index cfcc3e1..15a9f7a 100644
--- a/samples/nv-control-events.c
+++ b/samples/nv-control-events.c
@@ -360,6 +360,7 @@ static const char *attr2str(int n)
case NV_CTRL_FRAMELOCK_TEST_SIGNAL: return "frame lock test signal"; break;
case NV_CTRL_FRAMELOCK_ETHERNET_DETECTED: return "frame lock ethernet detected"; break;
case NV_CTRL_FRAMELOCK_VIDEO_MODE: return "frame lock video mode"; break;
+ case NV_CTRL_FORCE_GENERIC_CPU: return "force generic cpu"; break;
case NV_CTRL_OPENGL_AA_LINE_GAMMA: return "opengl aa line gamma"; break;
case NV_CTRL_FLIPPING_ALLOWED: return "flipping allowed"; break;
case NV_CTRL_TEXTURE_CLAMPING: return "texture clamping"; break;
diff --git a/src/XF86Config-parser/Generate.c b/src/XF86Config-parser/Generate.c
index 0b6c9bd..22ce212 100644
--- a/src/XF86Config-parser/Generate.c
+++ b/src/XF86Config-parser/Generate.c
@@ -48,7 +48,6 @@
static int is_file(const char *filename);
-static void add_files(GenerateOptions *gop, XConfigPtr config);
static void add_font_path(GenerateOptions *gop, XConfigPtr config);
static void add_modules(GenerateOptions *gop, XConfigPtr config);
@@ -72,7 +71,7 @@ XConfigPtr xconfigGenerate(GenerateOptions *gop)
/* add files, fonts, and modules */
- add_files(gop, config);
+ config->files = xconfigAlloc(sizeof(XConfigFilesRec));
add_font_path(gop, config);
add_modules(gop, config);
@@ -255,22 +254,6 @@ static char *find_libdir(GenerateOptions *gop)
/*
- * add_files() -
- */
-
-static void add_files(GenerateOptions *gop, XConfigPtr config)
-{
- char *libdir = find_libdir(gop);
-
- config->files = xconfigAlloc(sizeof(XConfigFilesRec));
- config->files->rgbpath = xconfigStrcat(libdir, "/X11/rgb", NULL);
-
- free(libdir);
-
-} /* add_files() */
-
-
-/*
* add_font_path() - scan through the __font_paths[] array,
* temporarily chop off the ":unscaled" appendage, and check for the
* file "fonts.dir" in the directory. If fonts.dir exists, append the
diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c
index 10ecf7d..facdb72 100644
--- a/src/gtk+-2.x/ctkevent.c
+++ b/src/gtk+-2.x/ctkevent.c
@@ -157,6 +157,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_SIGNAL(NV_CTRL_FRAMELOCK_ETHERNET_DETECTED);
MAKE_SIGNAL(NV_CTRL_FRAMELOCK_VIDEO_MODE);
MAKE_SIGNAL(NV_CTRL_FRAMELOCK_SYNC_RATE);
+ MAKE_SIGNAL(NV_CTRL_FORCE_GENERIC_CPU);
MAKE_SIGNAL(NV_CTRL_OPENGL_AA_LINE_GAMMA);
MAKE_SIGNAL(NV_CTRL_FLIPPING_ALLOWED);
MAKE_SIGNAL(NV_CTRL_FORCE_STEREO);
diff --git a/src/gtk+-2.x/ctkopengl.c b/src/gtk+-2.x/ctkopengl.c
index 4efccb7..6253407 100644
--- a/src/gtk+-2.x/ctkopengl.c
+++ b/src/gtk+-2.x/ctkopengl.c
@@ -44,6 +44,8 @@ static void post_show_sli_hud_button_toggled(CtkOpenGL *, gboolean);
static void post_xinerama_stereo_button_toggled(CtkOpenGL *, gboolean);
+static void post_force_generic_cpu_toggled(CtkOpenGL *, gboolean);
+
static void post_aa_line_gamma_toggled(CtkOpenGL *, gboolean);
static void allow_flipping_button_toggled(GtkWidget *, gpointer);
@@ -52,6 +54,8 @@ static void force_stereo_button_toggled (GtkWidget *, gpointer);
static void xinerama_stereo_button_toggled (GtkWidget *, gpointer);
+static void force_generic_cpu_toggled (GtkWidget *, gpointer);
+
static void aa_line_gamma_toggled (GtkWidget *, gpointer);
static void show_sli_hud_button_toggled (GtkWidget *, gpointer);
@@ -78,6 +82,16 @@ static const char *__sync_to_vblank_help =
"applied to OpenGL applications that are started after "
"this option is set.";
+static const char *__force_generic_cpu_help =
+"Enable this option to disable use of CPU "
+"specific features such as MMX, SSE, or 3DNOW!. "
+"Use of this option may result in performance "
+"loss, but may be useful in conjunction with "
+"software such as the Valgrind memory "
+"debugger. This option is applied to "
+"OpenGL applications that are started after "
+"this option is set.";
+
static const char *__image_settings_slider_help =
"The Image Settings slider controls the image quality setting.";
@@ -158,6 +172,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
NVCTRLAttributeValidValuesRec image_settings_valid;
gint image_settings_value;
gint aa_line_gamma;
+ gint force_generic_cpu;
gint show_sli_hud;
ReturnStatus ret_sync_to_vblank;
@@ -166,6 +181,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
ReturnStatus ret_xinerama_stereo;
ReturnStatus ret_image_settings;
ReturnStatus ret_aa_line_gama;
+ ReturnStatus ret_force_generic_cpu;
ReturnStatus ret_show_sli_hud;
/* Query OpenGL settings */
@@ -197,6 +213,11 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
ret_aa_line_gama = NvCtrlGetAttribute(handle, NV_CTRL_OPENGL_AA_LINE_GAMMA,
&aa_line_gamma);
+
+ ret_force_generic_cpu = NvCtrlGetAttribute(handle,
+ NV_CTRL_FORCE_GENERIC_CPU,
+ &force_generic_cpu);
+
ret_show_sli_hud = NvCtrlGetAttribute(handle, NV_CTRL_SHOW_SLI_HUD,
&show_sli_hud);
@@ -207,6 +228,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
(ret_xinerama_stereo != NvCtrlSuccess) &&
(ret_image_settings != NvCtrlSuccess) &&
(ret_aa_line_gama != NvCtrlSuccess) &&
+ (ret_force_generic_cpu != NvCtrlSuccess) &&
(ret_show_sli_hud != NvCtrlSuccess)) {
return NULL;
}
@@ -460,7 +482,39 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle,
ctk_opengl->aa_line_gamma_button = check_button;
}
-
+
+ /*
+ * Force Generic CPU
+ */
+
+ if (ret_force_generic_cpu == NvCtrlSuccess) {
+ label = gtk_label_new("Disable use of enhanced CPU instruction sets");
+
+ check_button = gtk_check_button_new();
+ gtk_container_add(GTK_CONTAINER(check_button), label);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button),
+ force_generic_cpu ==
+ NV_CTRL_FORCE_GENERIC_CPU_ENABLE);
+
+ gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(check_button), "toggled",
+ G_CALLBACK(force_generic_cpu_toggled),
+ (gpointer) ctk_opengl);
+
+ g_signal_connect(G_OBJECT(ctk_event),
+ CTK_EVENT_NAME(NV_CTRL_FORCE_GENERIC_CPU),
+ G_CALLBACK(value_changed), (gpointer) ctk_opengl);
+
+ ctk_config_set_tooltip(ctk_config, check_button,
+ __force_generic_cpu_help);
+
+ ctk_opengl->active_attributes |= __FORCE_GENERIC_CPU;
+
+ ctk_opengl->force_generic_cpu_button = check_button;
+ }
+
if (ret_show_sli_hud == NvCtrlSuccess) {
label = gtk_label_new("Enable SLI Heads-Up-Display");
@@ -537,6 +591,20 @@ static void post_xinerama_stereo_button_toggled(CtkOpenGL *ctk_opengl,
enabled ? "allowed" : "not allowed");
}
+static void post_force_generic_cpu_toggled(CtkOpenGL *ctk_opengl,
+ gboolean enabled)
+{
+ /*
+ * XXX the logic is awkward, but correct: when
+ * NV_CTRL_FORCE_GENERIC_CPU is enabled, use of enhanced CPU
+ * instructions is disabled, and vice versa.
+ */
+
+ ctk_config_statusbar_message(ctk_opengl->ctk_config,
+ "OpenGL use of enhanced CPU instructions %s.",
+ enabled ? "disabled" : "enabled");
+}
+
static void post_aa_line_gamma_toggled(CtkOpenGL *ctk_opengl,
gboolean enabled)
{
@@ -622,6 +690,31 @@ static void xinerama_stereo_button_toggled(GtkWidget *widget,
post_xinerama_stereo_button_toggled(ctk_opengl, enabled);
}
+static void force_generic_cpu_toggled(
+ GtkWidget *widget,
+ gpointer user_data
+)
+{
+ CtkOpenGL *ctk_opengl;
+ gboolean enabled;
+ ReturnStatus ret;
+
+ ctk_opengl = CTK_OPENGL(user_data);
+
+ enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+ ret = NvCtrlSetAttribute(ctk_opengl->handle,
+ NV_CTRL_FORCE_GENERIC_CPU, enabled);
+
+ if (ret != NvCtrlSuccess) return;
+ post_force_generic_cpu_toggled(ctk_opengl, enabled);
+ /*
+ * XXX the logic is awkward, but correct: when
+ * NV_CTRL_FORCE_GENERIC_CPU is enabled, use of enhanced CPU
+ * instructions is disabled, and vice versa.
+ */
+}
+
static void aa_line_gamma_toggled(
GtkWidget *widget,
gpointer user_data
@@ -685,6 +778,11 @@ static void value_changed(GtkObject *object, gpointer arg1, gpointer user_data)
func = G_CALLBACK(aa_line_gamma_toggled);
post_aa_line_gamma_toggled(ctk_opengl, event_struct->value);
break;
+ case NV_CTRL_FORCE_GENERIC_CPU:
+ button = GTK_TOGGLE_BUTTON(ctk_opengl->force_generic_cpu_button);
+ func = G_CALLBACK(force_generic_cpu_toggled);
+ post_force_generic_cpu_toggled(ctk_opengl, event_struct->value);
+ break;
case NV_CTRL_SHOW_SLI_HUD:
button = GTK_TOGGLE_BUTTON(ctk_opengl->show_sli_hud_button);
func = G_CALLBACK(show_sli_hud_button_toggled);
@@ -880,6 +978,12 @@ GtkTextBuffer *ctk_opengl_create_help(GtkTextTagTable *table,
"this option is set.");
}
+ if (ctk_opengl->active_attributes & __FORCE_GENERIC_CPU) {
+ ctk_help_heading(b, &i, "Disable use of enhanced CPU "
+ "instruction sets");
+ ctk_help_para(b, &i, __force_generic_cpu_help);
+ }
+
if (ctk_opengl->active_attributes & __SHOW_SLI_HUD) {
ctk_help_heading(b, &i, "SLI Heads-Up-Display");
ctk_help_para(b, &i, "This option draws information about the current "
diff --git a/src/gtk+-2.x/ctkopengl.h b/src/gtk+-2.x/ctkopengl.h
index ff37a0c..9b99476 100644
--- a/src/gtk+-2.x/ctkopengl.h
+++ b/src/gtk+-2.x/ctkopengl.h
@@ -64,6 +64,7 @@ struct _CtkOpenGL
GtkWidget *xinerama_stereo_button;
GtkWidget *image_settings_scale;
GtkWidget *aa_line_gamma_button;
+ GtkWidget *force_generic_cpu_button;
GtkWidget *show_sli_hud_button;
unsigned int active_attributes;
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index d231372..04f7ab5 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -586,9 +586,6 @@
* conjunction with software such as the Valgrind memory debugger.
* This setting is only applied to OpenGL clients that are started
* after this setting is applied.
- *
- * USAGE NOTE: This attribute is deprecated. CPU compatibility is now
- * checked each time during initialization.
*/
#define NV_CTRL_FORCE_GENERIC_CPU 37 /* RW-X */
diff --git a/src/parse.c b/src/parse.c
index 5bc6f9a..f55dc63 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -97,7 +97,7 @@ AttributeTableEntry attributeTable[] = {
{ "AssociatedDisplays", NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, N|D },
{ "ProbeDisplays", NV_CTRL_PROBE_DISPLAYS, A },
{ "Depth30Allowed", NV_CTRL_DEPTH_30_ALLOWED, N },
- { "ForceGenericCpu", NV_CTRL_FORCE_GENERIC_CPU, N },
+ { "ForceGenericCpu", NV_CTRL_FORCE_GENERIC_CPU, 0 },
{ "GammaCorrectedAALines", NV_CTRL_OPENGL_AA_LINE_GAMMA, 0 },
{ "ShowSLIHUD", NV_CTRL_SHOW_SLI_HUD, 0 },
{ "CursorShadow", NV_CTRL_CURSOR_SHADOW, 0 },