diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2013-04-02 16:56:31 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2013-04-02 16:56:31 -0700 |
commit | 031b1b3c7e9e555420a48e9817abf06d26d5ebf8 (patch) | |
tree | 78a6a611b0d8fd3dade13c5fbd1e2f39080909d2 | |
parent | 3648ff048ce4a95ad2dade378ae6cca38f86601f (diff) |
313.30313.30
-rw-r--r-- | doc/version.mk | 2 | ||||
-rw-r--r-- | samples/version.mk | 2 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig.c | 282 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig.h | 2 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplaylayout.h | 16 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkserver.c | 1 | ||||
-rw-r--r-- | src/libXNVCtrl/NVCtrl.h | 1 | ||||
-rw-r--r-- | src/version.mk | 2 | ||||
-rw-r--r-- | version.mk | 2 |
9 files changed, 230 insertions, 80 deletions
diff --git a/doc/version.mk b/doc/version.mk index 17f7d33..d8ad3ea 100644 --- a/doc/version.mk +++ b/doc/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 313.26 +NVIDIA_VERSION = 313.30 diff --git a/samples/version.mk b/samples/version.mk index 17f7d33..d8ad3ea 100644 --- a/samples/version.mk +++ b/samples/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 313.26 +NVIDIA_VERSION = 313.30 diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index 7d3bb6d..a0c5c01 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -2834,6 +2834,179 @@ static void setup_display_refresh_dropdown(CtkDisplayConfig *ctk_object) +/** allocate_selected_mode() ***************************************** + * + * Allocates, fills and returns a nvSelectedModePtr. + * + */ + +static nvSelectedModePtr +allocate_selected_mode(char *name, + nvModeLinePtr modeline, + Bool isSpecial) +{ + nvSelectedModePtr selected_mode; + + selected_mode = (nvSelectedModePtr)nvalloc(sizeof(nvSelectedMode)); + + selected_mode->label = gtk_menu_item_new_with_label(name); + + selected_mode->modeline = modeline; + selected_mode->isSpecial = isSpecial; + + return selected_mode; +} + + + +/** free_selected_modes() ******************************************** + * + * Recursively frees each item of a list of selected modes. + * + */ + +static void +free_selected_modes(nvSelectedModePtr selected_mode) +{ + if (selected_mode) { + free_selected_modes(selected_mode->next); + free(selected_mode); + } +} + + + +/** append_unique_selected_mode() ************************************ + * + * Appends a selected mode to the given list only if it doesn't already exist. + * Special modes ("Auto", "Off") are not checked. Two selected modes are unique + * if their [hv]display differ. Returns TRUE if the selected mode has been + * added, FALSE otherwise. + * + */ + +static Bool +append_unique_selected_mode(nvSelectedModePtr head, + const nvSelectedModePtr mode) +{ + nvSelectedModePtr iter, prev = NULL; + + nvModeLinePtr ml1 = mode->modeline; + iter = head; + while (iter) + { + nvModeLinePtr ml2 = iter->modeline; + + if (ml1 && ml2 && + !iter->isSpecial && !mode->isSpecial && + (ml1->data.hdisplay == ml2->data.hdisplay) && + (ml1->data.vdisplay == ml2->data.vdisplay)) { + return FALSE; + } + + prev = iter; + iter = iter->next; + } + + if (prev == NULL) { + return FALSE; + } + + prev->next = mode; + + return TRUE; +} + + + +/** matches_current_selected_mode() ********************************** + * + * Checks whether the provided selected mode matches the current mode. + * + * Returns TRUE if the provided selected mode matches the current mode, FALSE + * otherwise. + * + */ + +static Bool matches_current_selected_mode(const nvDisplayPtr display, + const nvSelectedModePtr selected_mode) +{ + nvModeLinePtr ml1, ml2; + + if (!display || !display->cur_mode || !selected_mode) { + return FALSE; + } + + ml1 = display->cur_mode->modeline; + ml2 = selected_mode->modeline; + + if (!ml1 || !ml2) { + return FALSE; + } + + return (!IS_NVIDIA_DEFAULT_MODE(ml1) && + (ml1->data.hdisplay == ml2->data.hdisplay) && + (ml1->data.vdisplay == ml2->data.vdisplay)); +} + + + +/** generate_selected_modes() **************************************** + * + * Generates a list of selected mode. The list is generated by parsing + * modelines. This function makes sure that each item of the list is unique + * and sorted. + * + */ + +static void generate_selected_modes(const nvDisplayPtr display) +{ + nvSelectedModePtr selected_mode = NULL; + nvModeLinePtr modeline; + + /* Add the off item */ + selected_mode = allocate_selected_mode("Off", + NULL /* modeline */, + TRUE /* isSpecial */); + + display->num_selected_modes = 1; + display->selected_modes = selected_mode; + + modeline = display->modelines; + while (modeline) { + gchar *name; + Bool isSpecial; + + if (IS_NVIDIA_DEFAULT_MODE(modeline)) { + name = g_strdup_printf("Auto"); + isSpecial = TRUE; + } else { + name = g_strdup_printf("%dx%d", + modeline->data.hdisplay, + modeline->data.vdisplay); + isSpecial = FALSE; + } + + selected_mode = allocate_selected_mode(name, modeline, isSpecial); + g_free(name); + + if (append_unique_selected_mode(display->selected_modes, + selected_mode)) { + display->num_selected_modes++; + + if (matches_current_selected_mode(display, selected_mode)) { + display->cur_selected_mode = selected_mode; + } + } else { + free(selected_mode); + } + + modeline = modeline->next; + } +} + + + /** setup_display_resolution_dropdown() ****************************** * * Generates the resolution dropdown based on the currently selected @@ -2849,14 +3022,10 @@ static void setup_display_resolution_dropdown(CtkDisplayConfig *ctk_object) nvDisplayPtr display = ctk_display_layout_get_selected_display (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); - nvModeLinePtr modeline; - nvModeLinePtr modelines; - nvModeLinePtr cur_modeline; + nvSelectedModePtr selected_mode; int cur_idx = 0; /* Currently selected modeline (resolution) */ - - /* Get selection information */ if (!display->screen || !display->cur_mode) { gtk_widget_hide(ctk_object->box_display_resolution); @@ -2865,94 +3034,56 @@ static void setup_display_resolution_dropdown(CtkDisplayConfig *ctk_object) gtk_widget_show(ctk_object->box_display_resolution); gtk_widget_set_sensitive(ctk_object->box_display_resolution, TRUE); - - cur_modeline = display->cur_mode->modeline; + /* Generate dropdown content */ + free_selected_modes(display->selected_modes); + + /* Create the selected modes lookup table for the dropdown */ + display->cur_selected_mode = NULL; + generate_selected_modes(display); - /* Create the modeline lookup table for the dropdown */ if (ctk_object->resolution_table) { free(ctk_object->resolution_table); ctk_object->resolution_table_len = 0; } ctk_object->resolution_table = - calloc(display->num_modelines + 1, sizeof(nvModeLinePtr)); + calloc(display->num_selected_modes, sizeof(nvSelectedModePtr)); if (!ctk_object->resolution_table) { goto fail; } + if (display->cur_mode->modeline) { + cur_idx = 1; /* Modeline is set, start off as 'nvidia-auto-select' */ + } else { + cur_idx = 0; /* Modeline not set, start off as 'off'. */ + } + /* Start the menu generation */ menu = gtk_menu_new(); + /* Fill dropdown menu */ + selected_mode = display->selected_modes; + while (selected_mode) { + menu_item = selected_mode->label; - /* Add the off mode */ - menu_item = gtk_menu_item_new_with_label("Off"); - if (display->screen->num_displays <= 1) { - gtk_widget_set_sensitive(menu_item, False); - } - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - gtk_widget_show(menu_item); - ctk_object->resolution_table[ctk_object->resolution_table_len++] = NULL; - - - /* Add the 'nvidia-auto-select' modeline */ - modelines = display->modelines; - if (IS_NVIDIA_DEFAULT_MODE(modelines)) { - menu_item = gtk_menu_item_new_with_label("Auto"); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); gtk_widget_show(menu_item); - ctk_object->resolution_table[ctk_object->resolution_table_len++] = - modelines; - modelines = modelines->next; - } + ctk_object->resolution_table[ctk_object->resolution_table_len] = + selected_mode; - /* Set the selected modeline index */ - if (cur_modeline) { - cur_idx = 1; /* Modeline is set, start off as 'nvidia-auto-select' */ - } else { - cur_idx = 0; /* Modeline not set, start off as 'off'. */ - } - - - /* Generate the resolution menu */ - modeline = modelines; - while (modeline) { - nvModeLinePtr m; - gchar *name; - - /* Find the first resolution that matches the current res W & H */ - m = modelines; - while (m != modeline) { - if (modeline->data.hdisplay == m->data.hdisplay && - modeline->data.vdisplay == m->data.vdisplay) { - break; - } - m = m->next; + if (selected_mode == display->cur_selected_mode) { + cur_idx = ctk_object->resolution_table_len; } - /* Add resolution if it is the first of its kind */ - if (m == modeline) { - - /* Set the current modeline idx if not already set by default */ - if (cur_modeline) { - if (!IS_NVIDIA_DEFAULT_MODE(cur_modeline) && - cur_modeline->data.hdisplay == modeline->data.hdisplay && - cur_modeline->data.vdisplay == modeline->data.vdisplay) { - cur_idx = ctk_object->resolution_table_len; - } - } - - name = g_strdup_printf("%dx%d", modeline->data.hdisplay, - modeline->data.vdisplay); - menu_item = gtk_menu_item_new_with_label(name); - g_free(name); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - gtk_widget_show(menu_item); - ctk_object->resolution_table[ctk_object->resolution_table_len++] = - modeline; + if (selected_mode->isSpecial && + !selected_mode->modeline && + display->screen->num_displays <= 1) { + gtk_widget_set_sensitive(menu_item, FALSE); } - modeline = modeline->next; + + ctk_object->resolution_table_len++; + selected_mode = selected_mode->next; } - /* Setup the menu and select the current mode */ g_signal_handlers_block_by_func @@ -5510,13 +5641,13 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) CtkDisplayConfig *ctk_object = CTK_DISPLAY_CONFIG(user_data); gint idx; gint last_idx; - nvModeLinePtr modeline; + nvSelectedModePtr selected_mode; nvDisplayPtr display; /* Get the modeline and display to set */ idx = gtk_option_menu_get_history(GTK_OPTION_MENU(widget)); - modeline = ctk_object->resolution_table[idx]; + selected_mode = ctk_object->resolution_table[idx]; display = ctk_display_layout_get_selected_display (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); @@ -5536,7 +5667,8 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) */ if (!ctk_object->advanced_mode && (display->screen->num_displays == 1)) { int metamode_idx = - display_find_closest_mode_matching_modeline(display, modeline); + display_find_closest_mode_matching_modeline(display, + selected_mode->modeline); /* Select the new metamode */ if (metamode_idx >= 0) { @@ -5550,7 +5682,7 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) /* Select the new modeline for its resolution */ ctk_display_layout_set_mode_modeline (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), - display->cur_mode, modeline); + display->cur_mode, selected_mode->modeline); /* Update the UI */ diff --git a/src/gtk+-2.x/ctkdisplayconfig.h b/src/gtk+-2.x/ctkdisplayconfig.h index 3371d49..126620e 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.h +++ b/src/gtk+-2.x/ctkdisplayconfig.h @@ -104,7 +104,7 @@ typedef struct _CtkDisplayConfig GtkWidget *box_display_resolution; GtkWidget *mnu_display_resolution; - nvModeLinePtr *resolution_table; + nvSelectedModePtr *resolution_table; int resolution_table_len; GtkWidget *mnu_display_refresh; diff --git a/src/gtk+-2.x/ctkdisplaylayout.h b/src/gtk+-2.x/ctkdisplaylayout.h index 4bb68b3..cbf1a6b 100644 --- a/src/gtk+-2.x/ctkdisplaylayout.h +++ b/src/gtk+-2.x/ctkdisplaylayout.h @@ -166,6 +166,18 @@ typedef struct nvModeLineRec { +typedef struct nvSelectedModeRec { + struct nvSelectedModeRec *next; + + GtkWidget *label; /* Label shown in dropdown menu */ + + nvModeLinePtr modeline; /* Modeline this mode references */ + + Bool isSpecial; /* Whether this mode is "Off" or "Auto" */ +} nvSelectedMode, *nvSelectedModePtr; + + + /* Mode (A particular configuration for a display within an X screen) * * NOTE: When metamodes are duplicated, the modes are memcpy'ed over, so @@ -231,6 +243,10 @@ typedef struct nvDisplayRec { nvModeLinePtr modelines; /* Modelines validated by X */ int num_modelines; + nvSelectedModePtr selected_modes; /* List of modes to show in the dropdown menu */ + int num_selected_modes; + nvSelectedModePtr cur_selected_mode; /* Current mode selected in the dropdown menu */ + nvModePtr modes; /* List of modes this display uses */ int num_modes; nvModePtr cur_mode; /* Current mode display uses */ diff --git a/src/gtk+-2.x/ctkserver.c b/src/gtk+-2.x/ctkserver.c index c60eee9..7a1b5fa 100644 --- a/src/gtk+-2.x/ctkserver.c +++ b/src/gtk+-2.x/ctkserver.c @@ -295,6 +295,7 @@ GtkWidget* ctk_server_new(NvCtrlAttributeHandle *handle, if (tmp == NV_CTRL_ARCHITECTURE_X86) arch = "x86"; else if (tmp == NV_CTRL_ARCHITECTURE_X86_64) arch = "x86_64"; else if (tmp == NV_CTRL_ARCHITECTURE_IA64) arch = "ia64"; + else if (tmp == NV_CTRL_ARCHITECTURE_ARM) arch = "ARM"; } if (!arch) arch = "Unknown"; os = g_strdup_printf("%s-%s", os, arch); diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h index 679cd01..53b49ae 100644 --- a/src/libXNVCtrl/NVCtrl.h +++ b/src/libXNVCtrl/NVCtrl.h @@ -704,6 +704,7 @@ #define NV_CTRL_ARCHITECTURE_X86 0 #define NV_CTRL_ARCHITECTURE_X86_64 1 #define NV_CTRL_ARCHITECTURE_IA64 2 +#define NV_CTRL_ARCHITECTURE_ARM 3 /* diff --git a/src/version.mk b/src/version.mk index 17f7d33..d8ad3ea 100644 --- a/src/version.mk +++ b/src/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 313.26 +NVIDIA_VERSION = 313.30 @@ -1 +1 @@ -NVIDIA_VERSION = 313.26 +NVIDIA_VERSION = 313.30 |