diff options
author | Liam Middlebrook <lmiddlebrook@nvidia.com> | 2018-11-08 09:39:12 -0800 |
---|---|---|
committer | Liam Middlebrook <lmiddlebrook@nvidia.com> | 2018-11-08 09:39:12 -0800 |
commit | e0e985ffaefd791a8bdb7aa8d4d23cd00c51b3e2 (patch) | |
tree | a92d85a100e9fc8c6b2f3edaa59141fef994f76d | |
parent | 8042553a7f085370e47b339baa4bda331a8a0bcf (diff) |
415.13415.13
28 files changed, 1118 insertions, 267 deletions
diff --git a/doc/nvidia-settings.1.m4 b/doc/nvidia-settings.1.m4 index b8c35c9..61e0dc5 100644 --- a/doc/nvidia-settings.1.m4 +++ b/doc/nvidia-settings.1.m4 @@ -501,7 +501,7 @@ is released as GPL. The most recent official version of the source code is available here: .sp .ti +5 -.__URL__ ftp://download.nvidia.com/XFree86/nvidia-settings/ +.__URL__ https://download.nvidia.com/XFree86/nvidia-settings/ .sp Note that .B nvidia\-settings diff --git a/doc/nvidia-settings.desktop b/doc/nvidia-settings.desktop index a879422..c79f88f 100644 --- a/doc/nvidia-settings.desktop +++ b/doc/nvidia-settings.desktop @@ -28,3 +28,7 @@ Comment[pt_BR]=Definir &configurações de gerenciamento de usuário... Comment[zh_CN]=配置 NVIDIA X 服务器设置 Comment[zh_HK]=配置 NVIDIA X 伺服器設定 Comment[zh_TW]=配置 NVIDIA X 伺服器設定 + +# Translation by Marcin Mikołajczak +Name[pl]=Ustawienia serwera X NVIDIA +Comment[pl]=Narzędzie konfiguracyjne dla ustawień serwera X NVIDIA diff --git a/doc/version.mk b/doc/version.mk index 0032b02..da40957 100644 --- a/doc/version.mk +++ b/doc/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 410.73 +NVIDIA_VERSION = 415.13 diff --git a/samples/version.mk b/samples/version.mk index 0032b02..da40957 100644 --- a/samples/version.mk +++ b/samples/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 410.73 +NVIDIA_VERSION = 415.13 diff --git a/src/XF86Config-parser/Device.c b/src/XF86Config-parser/Device.c index b730228..c759e64 100644 --- a/src/XF86Config-parser/Device.c +++ b/src/XF86Config-parser/Device.c @@ -514,3 +514,26 @@ void xconfigFormatPciBusString(char *str, int len, } str[len - 1] = '\0'; } + + +/* + * xconfigAddInactiveDevice() - add a device to the inactive section of + * the xconfig layout. + */ +void xconfigAddInactiveDevice(XConfigPtr config, XConfigLayoutPtr layout, + int device_n) +{ + XConfigDevicePtr device; + XConfigInactivePtr inac; + + device = add_device(config, -1, -1, -1, NULL, device_n, + "modesetting", "Unknown"); + + inac = xconfigAlloc(sizeof (XConfigInactiveRec)); + inac->next = NULL; + inac->device = device; + inac->device_name = xconfigStrdup(device->identifier); + xconfigAddListItem((GenericListPtr *)(&layout->inactives), + (GenericListPtr) inac); +} /* xconfigAddInactiveDevice() */ + diff --git a/src/XF86Config-parser/Flags.c b/src/XF86Config-parser/Flags.c index 5d8d324..cfbff5e 100644 --- a/src/XF86Config-parser/Flags.c +++ b/src/XF86Config-parser/Flags.c @@ -107,11 +107,13 @@ xconfigParseFlagsSection (void) */ case DEFAULTLAYOUT: strvalue = TRUE; + /* fall through */ case BLANKTIME: case STANDBYTIME: case SUSPENDTIME: case OFFTIME: hasvalue = TRUE; + /* fall through */ case NOTRAPSIGNALS: case DONTZAP: case DONTZOOM: diff --git a/src/XF86Config-parser/Generate.c b/src/XF86Config-parser/Generate.c index b3b84c7..1f8ffca 100644 --- a/src/XF86Config-parser/Generate.c +++ b/src/XF86Config-parser/Generate.c @@ -46,9 +46,6 @@ static int is_file(const char *filename); static void add_font_path(GenerateOptions *gop, XConfigPtr config); static void add_modules(GenerateOptions *gop, XConfigPtr config); -static XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain, - int slot, char *boardname, int count); - static void add_layout(GenerateOptions *gop, XConfigPtr config); static void add_inputref(XConfigPtr config, XConfigLayoutPtr layout, @@ -95,14 +92,17 @@ XConfigPtr xconfigGenerate(GenerateOptions *gop) XConfigScreenPtr xconfigGenerateAddScreen(XConfigPtr config, int bus, int domain, int slot, - char *boardname, int count) + char *boardname, int count, + const char *driver, + const char *vendor) { XConfigScreenPtr screen, s; XConfigDevicePtr device; XConfigMonitorPtr monitor; monitor = xconfigAddMonitor(config, count); - device = add_device(config, bus, domain, slot, boardname, count); + device = add_device(config, bus, domain, slot, boardname, count, + driver, vendor); screen = xconfigAlloc(sizeof(XConfigScreenRec)); @@ -458,8 +458,9 @@ XConfigMonitorPtr xconfigAddMonitor(XConfigPtr config, int count) * add_device() */ -static XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain, - int slot, char *boardname, int count) +XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain, + int slot, char *boardname, int count, + const char *driver, const char *vendor) { XConfigDevicePtr device, d; @@ -467,8 +468,9 @@ static XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain, device->identifier = xconfigAlloc(32); snprintf(device->identifier, 32, DEVICE_IDENTIFIER, count); - device->driver = xconfigStrdup("nvidia"); - device->vendor = xconfigStrdup("NVIDIA Corporation"); + device->index_id = count; + device->driver = xconfigStrdup(driver); + device->vendor = xconfigStrdup(vendor); if (bus != -1 && domain != -1 && slot != -1) { device->busid = xconfigAlloc(32); @@ -527,7 +529,8 @@ static void add_layout(GenerateOptions *gop, XConfigPtr config) /* assume 1 X screen */ - screen = xconfigGenerateAddScreen(config, -1, -1, -1, NULL, 0); + screen = xconfigGenerateAddScreen(config, -1, -1, -1, NULL, 0, + "nvidia", "NVIDIA Corporation"); /* create layout */ @@ -1240,11 +1243,7 @@ int xconfigAddKeyboard(GenerateOptions *gop, XConfigPtr config) #if defined(NV_SUNOS) || defined(NV_BSD) input->driver = xconfigStrdup("keyboard"); #else - if (gop->xserver == X_IS_XORG) { - input->driver = xconfigStrdup("kbd"); - } else { - input->driver = xconfigStrdup("keyboard"); - } + input->driver = xconfigStrdup("kbd"); #endif } @@ -1316,7 +1315,6 @@ static char *xconfigGetDefaultProjectRoot(void) */ static int get_xserver_information(const char *versionString, - int *isXorg, int *autoloadsGLX, int *supportsExtensionSection, int *xineramaPlusCompositeWorks, @@ -1331,17 +1329,10 @@ static int get_xserver_information(const char *versionString, /* check if this is an XFree86 X server */ if (strstr(versionString, "XFree86 Version")) { - *isXorg = FALSE; - *autoloadsGLX = FALSE; - *supportsExtensionSection = FALSE; - *xineramaPlusCompositeWorks = FALSE; - return TRUE; + xconfigErrorMsg(WarnMsg, "XFree86 is not supported."); + return FALSE; } - /* this must be an X.Org X server */ - - *isXorg = TRUE; - /* attempt to parse the major.minor version out of the string */ found = FALSE; @@ -1439,8 +1430,6 @@ static int get_xserver_information(const char *versionString, void xconfigGetXServerInUse(GenerateOptions *gop) { FILE *stream = NULL; - int xserver = -1; - int isXorg; int len, found; char *cmd, *ptr, *ret; @@ -1474,19 +1463,12 @@ void xconfigGetXServerInUse(GenerateOptions *gop) */ found = get_xserver_information(buf, - &isXorg, &gop->autoloads_glx, &gop->supports_extension_section, &gop->xinerama_plus_composite_works, &gop->compositeExtensionName); - if (found) { - if (isXorg) { - xserver = X_IS_XORG; - } else { - xserver = X_IS_XF86; - } - } else { + if (!found) { xconfigErrorMsg(WarnMsg, "Unable to parse X.Org version string."); } } @@ -1494,20 +1476,6 @@ void xconfigGetXServerInUse(GenerateOptions *gop) pclose(stream); free(cmd); - if (xserver == -1) { - char *xorgpath; - - xorgpath = xconfigStrcat(gop->x_project_root, "/bin/Xorg", NULL); - if (access(xorgpath, F_OK)==0) { - xserver = X_IS_XORG; - } else { - xserver = X_IS_XF86; - } - free(xorgpath); - } - - gop->xserver=xserver; - } /* xconfigGetXServerInUse() */ @@ -1524,7 +1492,6 @@ void xconfigGenerateLoadDefaultOptions(GenerateOptions *gop) gop->x_project_root = xconfigGetDefaultProjectRoot(); /* XXX What to default the following to? - gop->xserver gop->keyboard gop->mouse gop->keyboard_driver diff --git a/src/XF86Config-parser/Layout.c b/src/XF86Config-parser/Layout.c index 9f7c7ca..1565556 100644 --- a/src/XF86Config-parser/Layout.c +++ b/src/XF86Config-parser/Layout.c @@ -474,7 +474,6 @@ xconfigValidateLayout (XConfigPtr p) adj = adj->next; } - /* I not believe the "inactives" list is used for anything */ iptr = layout->inactives; while (iptr) diff --git a/src/XF86Config-parser/xf86Parser.h b/src/XF86Config-parser/xf86Parser.h index 131876e..2c8163b 100644 --- a/src/XF86Config-parser/xf86Parser.h +++ b/src/XF86Config-parser/xf86Parser.h @@ -336,6 +336,7 @@ typedef struct __xconfigconfdevicerec { int chiprev; int irq; int screen; + size_t index_id; XConfigOptionPtr options; char *comment; } XConfigDeviceRec, *XConfigDevicePtr; @@ -612,11 +613,7 @@ typedef struct { * config, and when sanitizing an existing config */ -#define X_IS_XF86 0 -#define X_IS_XORG 1 - typedef struct { - int xserver; char *x_project_root; char *keyboard; char *mouse; @@ -754,7 +751,16 @@ XConfigPtr xconfigGenerate(GenerateOptions *gop); XConfigScreenPtr xconfigGenerateAddScreen(XConfigPtr config, int bus, int domain, int slot, - char *boardname, int count); + char *boardname, int count, + const char *driver, + const char *vendor); + +XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain, + int slot, char *boardname, int count, + const char *driver, const char *vendor); + +void xconfigAddInactiveDevice(XConfigPtr config, XConfigLayoutPtr layout, + int device_n); void xconfigGenerateAssignScreenAdjacencies(XConfigLayoutPtr layout); diff --git a/src/gtk+-2.x/ctkappprofile.c b/src/gtk+-2.x/ctkappprofile.c index 53d5183..b070f02 100644 --- a/src/gtk+-2.x/ctkappprofile.c +++ b/src/gtk+-2.x/ctkappprofile.c @@ -257,7 +257,7 @@ static void app_profile_finalize(GObject *object) static void tool_button_set_label_and_stock_icon(GtkToolButton *button, const gchar *label_text, const gchar *icon_id) { GtkWidget *icon; - icon = gtk_image_new_from_stock(icon_id, GTK_ICON_SIZE_SMALL_TOOLBAR); + icon = ctk_image_new_from_str(icon_id, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_tool_button_set_icon_widget(button, icon); gtk_tool_button_set_label(button, label_text); gtk_widget_show_all(GTK_WIDGET(button)); @@ -270,7 +270,7 @@ static void button_set_label_and_stock_icon(GtkButton *button, const gchar *labe GtkWidget *label; GtkWidget *button_child; hbox = gtk_hbox_new(FALSE, 0); - icon = gtk_image_new_from_stock(icon_id, GTK_ICON_SIZE_SMALL_TOOLBAR); + icon = ctk_image_new_from_str(icon_id, GTK_ICON_SIZE_SMALL_TOOLBAR); label = gtk_label_new(label_text); gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); @@ -394,7 +394,8 @@ static void populate_toolbar(GtkToolbar *toolbar, while (num_items--) { if (item->icon_id) { - icon = gtk_image_new_from_stock(item->icon_id, GTK_ICON_SIZE_SMALL_TOOLBAR); + icon = ctk_image_new_from_str(item->icon_id, + GTK_ICON_SIZE_SMALL_TOOLBAR); } else { icon = NULL; } @@ -1121,7 +1122,7 @@ static void edit_rule_dialog_load_values(EditRuleDialog *dialog) // add/edit button tool_button_set_label_and_stock_icon( GTK_TOOL_BUTTON(dialog->add_edit_rule_button), "Update Rule", - dialog->new_rule ? GTK_STOCK_ADD : GTK_STOCK_PREFERENCES); + dialog->new_rule ? CTK_STOCK_ADD : CTK_STOCK_PREFERENCES); // source file combo_box_entry = GTK_COMBO_BOX(dialog->source_file_combo); @@ -1439,7 +1440,7 @@ static void config_create_source_file_entry(CtkConfig *ctk_config, browse_button = gtk_button_new(); button_set_label_and_stock_icon(GTK_BUTTON(browse_button), - "Browse...", GTK_STOCK_OPEN); + "Browse...", CTK_STOCK_OPEN); g_string_printf(help_string, "Clicking this button opens a file selection dialog box which allows you to choose an " "appropriate configuration file for the %s.", name); @@ -1934,7 +1935,7 @@ static ToolbarItemTemplate *get_edit_rule_dialog_toolbar_items(EditRuleDialog *d { .text = UPDATE_RULE_LABEL, .help_text = "The Update Rule button allows you to save changes made to the rule definition.", - .icon_id = GTK_STOCK_SAVE, + .icon_id = CTK_STOCK_SAVE, .callback = G_CALLBACK(edit_rule_dialog_save_changes), .user_data = dialog, .flags = 0, @@ -1942,7 +1943,7 @@ static ToolbarItemTemplate *get_edit_rule_dialog_toolbar_items(EditRuleDialog *d { .text = "Cancel", .help_text = "The Cancel button allows you to discard any changes made to the rule definition.", - .icon_id = GTK_STOCK_CANCEL, + .icon_id = CTK_STOCK_CANCEL, .callback = G_CALLBACK(edit_rule_dialog_cancel), .user_data = dialog, .flags = 0, @@ -2555,7 +2556,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, { .text = "Add Setting", .help_text = "The Add Setting button allows you to create a new setting in the profile.", - .icon_id = GTK_STOCK_ADD, + .icon_id = CTK_STOCK_ADD, .callback = G_CALLBACK(edit_profile_dialog_add_setting), .user_data = dialog, .flags = 0, @@ -2565,7 +2566,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .help_text = "The Delete Setting button allows you to delete a highlighted setting from the profile.", .extended_help_text = "A setting can also be deleted from the profile by highlighting it in the list " "and hitting the Delete key.", - .icon_id = GTK_STOCK_REMOVE, + .icon_id = CTK_STOCK_REMOVE, .callback = G_CALLBACK(edit_profile_dialog_delete_setting), .user_data = dialog, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -2575,7 +2576,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .help_text = "The Edit Setting button allows you to edit a highlighted setting in the profile.", .extended_help_text = "This will activate an entry box in the setting's key column. To modify the setting's " "value, hit the Tab key or Right Arrow key, or double-click on the value.", - .icon_id = GTK_STOCK_PREFERENCES, + .icon_id = CTK_STOCK_PREFERENCES, .callback = G_CALLBACK(edit_profile_dialog_edit_setting), .user_data = dialog, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -2590,7 +2591,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, { .text = UPDATE_PROFILE_LABEL, .help_text = "The Update Profile button allows you to save changes made to the profile definition.", - .icon_id = GTK_STOCK_SAVE, + .icon_id = CTK_STOCK_SAVE, .callback = G_CALLBACK(edit_profile_dialog_save_changes), .user_data = dialog, .flags = 0, @@ -2598,7 +2599,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, { .text = "Cancel", .help_text = "The Cancel button allows you to discard any changes made to the profile definition.", - .icon_id = GTK_STOCK_CANCEL, + .icon_id = CTK_STOCK_CANCEL, .callback = G_CALLBACK(edit_profile_dialog_cancel), .user_data = dialog, .flags = 0, @@ -3159,7 +3160,7 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) "to applications which match a given pattern.", .extended_help_text = "See the \"Add/Edit Rule Dialog Box\" help section for more " "information on adding new rules.", - .icon_id = GTK_STOCK_ADD, + .icon_id = CTK_STOCK_ADD, .callback = (GCallback)add_rule_callback, .user_data = ctk_app_profile, .flags = 0, @@ -3167,7 +3168,7 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) { .text = "Delete Rule", .help_text = "The Delete Rule button allows you to remove a highlighted rule from the list.", - .icon_id = GTK_STOCK_REMOVE, + .icon_id = CTK_STOCK_REMOVE, .callback = (GCallback)delete_rule_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -3182,7 +3183,7 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) "on their position along the configuration file search path. Hence, nvidia-settings " "may move the rule to a different source file if it is necessary for the rule to achieve " "a particular priority.", - .icon_id = GTK_STOCK_GO_UP, + .icon_id = CTK_STOCK_GO_UP, .callback = (GCallback)increase_rule_priority_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -3192,7 +3193,7 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) .help_text = "This decreases the priority of the highlighted rule in the list. If multiple rules " "with a conflicting driver setting match the same application, the application will " "take on the setting value of the highest-priority rule (lowest number) in the list.", - .icon_id = GTK_STOCK_GO_DOWN, + .icon_id = CTK_STOCK_GO_DOWN, .callback = (GCallback)decrease_rule_priority_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -3202,9 +3203,7 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) .help_text = "The Edit Rule button allows you to edit a highlighted rule in the list.", .extended_help_text = "See the \"Add/Edit Rule Dialog Box\" help section for more " "information on editing rules.", - // Would be nice to use GTK_STOCK_EDIT here, but unfortunately only - // available from 2.6 onwards... - .icon_id = GTK_STOCK_PREFERENCES, + .icon_id = CTK_STOCK_PREFERENCES, .callback = (GCallback)edit_rule_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -3404,7 +3403,7 @@ static void edit_profile_dialog_load_values(EditProfileDialog *dialog) tool_button_set_label_and_stock_icon( GTK_TOOL_BUTTON(dialog->add_edit_profile_button), "Update Profile", - dialog->new_profile ? GTK_STOCK_ADD : GTK_STOCK_PREFERENCES); + dialog->new_profile ? CTK_STOCK_ADD : CTK_STOCK_PREFERENCES); // profile name gtk_entry_set_text(GTK_ENTRY(dialog->name_entry), dialog->name->str); @@ -3550,7 +3549,7 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) "to applications which match a given pattern.", .extended_help_text = "See the \"Add/Edit Profile Dialog Box\" help section for more " "information on adding new profiles.", - .icon_id = GTK_STOCK_ADD, + .icon_id = CTK_STOCK_ADD, .callback = (GCallback)add_profile_callback, .user_data = ctk_app_profile, .flags = 0 @@ -3558,7 +3557,7 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) { .text = "Delete Profile", .help_text = "The Delete Profile button allows you to remove a highlighted profile from the list.", - .icon_id = GTK_STOCK_REMOVE, + .icon_id = CTK_STOCK_REMOVE, .callback = (GCallback)delete_profile_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -3568,9 +3567,7 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) .help_text = "The Edit Profile button allows you to edit a highlighted profile in the list.", .extended_help_text = "See the \"Add/Edit Profile Dialog Box\" help section for more " "information on editing profiles.", - // Would be nice to use GTK_STOCK_EDIT here, but unfortunately only - // available from 2.6 onwards... - .icon_id = GTK_STOCK_PREFERENCES, + .icon_id = CTK_STOCK_PREFERENCES, .callback = (GCallback)edit_profile_callback, .user_data = ctk_app_profile, .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED @@ -3828,7 +3825,7 @@ static ToolbarItemTemplate *get_save_reload_toolbar_items(CtkAppProfile *ctk_app .extended_help_text = "This button displays a dialog box which allows you to preview the changes " "that will be made to the JSON configuration files, and toggle whether nvidia-settings " "should make backup copies of the original files before overwriting existing files.", - .icon_id = GTK_STOCK_SAVE, + .icon_id = CTK_STOCK_SAVE, .callback = (GCallback)save_changes_callback, .user_data = ctk_app_profile, .flags = 0, @@ -3839,7 +3836,7 @@ static ToolbarItemTemplate *get_save_reload_toolbar_items(CtkAppProfile *ctk_app "disk, reverting any unsaved changes.", .extended_help_text = "If nvidia-settings detects unsaved changes in the configuration, this button will " "display a dialog box to warn you before attempting to reload.", - .icon_id = GTK_STOCK_REFRESH, + .icon_id = CTK_STOCK_REFRESH, .callback = (GCallback)reload_callback, .user_data = ctk_app_profile, .flags = 0, @@ -3950,7 +3947,7 @@ static ToolbarItemTemplate *get_save_app_profile_changes_toolbar_items(SaveAppPr { .text = "Save Changes", .help_text = "Save the changes to disk.", - .icon_id = GTK_STOCK_SAVE, + .icon_id = CTK_STOCK_SAVE, .callback = G_CALLBACK(save_app_profile_changes_dialog_save_changes), .user_data = dialog, .flags = 0, @@ -3958,7 +3955,7 @@ static ToolbarItemTemplate *get_save_app_profile_changes_toolbar_items(SaveAppPr { .text = "Cancel", .help_text = "Cancel the save operation.", - .icon_id = GTK_STOCK_CANCEL, + .icon_id = CTK_STOCK_CANCEL, .callback = G_CALLBACK(save_app_profile_changes_dialog_cancel), .user_data = dialog, .flags = 0, diff --git a/src/gtk+-2.x/ctkcolorcorrection.c b/src/gtk+-2.x/ctkcolorcorrection.c index d94b310..44dc213 100644 --- a/src/gtk+-2.x/ctkcolorcorrection.c +++ b/src/gtk+-2.x/ctkcolorcorrection.c @@ -531,8 +531,8 @@ GtkWidget* ctk_color_correction_new(CtrlTarget *ctrl_target, "values may be incorrect."); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, - GTK_ICON_SIZE_BUTTON); + image = ctk_image_new_from_str(CTK_STOCK_DIALOG_WARNING, + GTK_ICON_SIZE_BUTTON); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); diff --git a/src/gtk+-2.x/ctkcurve.c b/src/gtk+-2.x/ctkcurve.c index cac3828..2c68605 100644 --- a/src/gtk+-2.x/ctkcurve.c +++ b/src/gtk+-2.x/ctkcurve.c @@ -159,7 +159,6 @@ static gboolean ctk_curve_expose_event( ) #endif { - gint width, height; CtkCurve *ctk_curve; GtkAllocation allocation; @@ -167,9 +166,6 @@ static gboolean ctk_curve_expose_event( ctk_widget_get_allocation(widget, &allocation); - width = allocation.width - 2 * gtk_widget_get_style(widget)->xthickness; - height = allocation.height - 2 * gtk_widget_get_style(widget)->ythickness; - #ifdef CTK_GTK3 gtk_render_frame(gtk_widget_get_style_context(widget), cr, 0, 0, allocation.width, allocation.height); @@ -178,17 +174,22 @@ static gboolean ctk_curve_expose_event( cairo_set_source_surface(cr, ctk_curve->c_surface, 0, 0); cairo_paint(cr); #else - gtk_paint_shadow(widget->style, widget->window, - GTK_STATE_NORMAL, GTK_SHADOW_IN, - &event->area, widget, "ctk_curve", 0, 0, - allocation.width, allocation.height); + { + gint width = allocation.width - 2 * gtk_widget_get_style(widget)->xthickness; + gint height = allocation.height - 2 * gtk_widget_get_style(widget)->ythickness; - gdk_gc_set_function(ctk_curve->gdk_gc, GDK_COPY); + gtk_paint_shadow(widget->style, widget->window, + GTK_STATE_NORMAL, GTK_SHADOW_IN, + &event->area, widget, "ctk_curve", 0, 0, + allocation.width, allocation.height); - gdk_draw_drawable(widget->window, ctk_curve->gdk_gc, ctk_curve->gdk_pixmap, - 0, 0, widget->style->xthickness, - widget->style->ythickness, - width, height); + gdk_gc_set_function(ctk_curve->gdk_gc, GDK_COPY); + + gdk_draw_drawable(widget->window, ctk_curve->gdk_gc, ctk_curve->gdk_pixmap, + 0, 0, widget->style->xthickness, + widget->style->ythickness, + width, height); + } #endif return FALSE; } diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index 571574b..87a4983 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -964,8 +964,8 @@ static GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) hbox, TRUE, TRUE, 5); /* Pack the information icon */ - image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, - GTK_ICON_SIZE_DIALOG); + image = ctk_image_new_from_str(CTK_STOCK_DIALOG_INFO, + GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(image), 0.0f, 0.0f); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 5); @@ -1066,8 +1066,8 @@ static GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) hbox, TRUE, TRUE, 5); /* Pack the information icon */ - image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, - GTK_ICON_SIZE_DIALOG); + image = ctk_image_new_from_str(CTK_STOCK_DIALOG_INFO, + GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(image), 0.0f, 0.0f); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 5); @@ -9164,10 +9164,8 @@ static Bool add_layout_to_xconfig(nvLayoutPtr layout, XConfigPtr config) static int generateXConfig(CtkDisplayConfig *ctk_object, XConfigPtr *pConfig) { nvLayoutPtr layout = ctk_object->layout; - CtrlTarget *ctrl_target; XConfigPtr config = NULL; GenerateOptions go; - char *server_vendor; int ret; @@ -9178,16 +9176,6 @@ static int generateXConfig(CtkDisplayConfig *ctk_object, XConfigPtr *pConfig) xconfigGenerateLoadDefaultOptions(&go); xconfigGetXServerInUse(&go); - /* Query actual server X.Org/XFree86 */ - ctrl_target = NvCtrlGetDefaultTarget(layout->system); - server_vendor = NvCtrlGetServerVendor(ctrl_target); - if (server_vendor && g_strrstr(server_vendor, "X.Org")) { - go.xserver = X_IS_XORG; - } else { - go.xserver = X_IS_XF86; - } - - /* Generate the basic layout */ config = xconfigGenerate(&go); diff --git a/src/gtk+-2.x/ctkframelock.c b/src/gtk+-2.x/ctkframelock.c index 1679cb4..6f51e23 100644 --- a/src/gtk+-2.x/ctkframelock.c +++ b/src/gtk+-2.x/ctkframelock.c @@ -448,7 +448,7 @@ static GtkWidget *create_error_msg_dialog(CtkFramelock *ctk_framelock) gtk_container_add(GTK_CONTAINER( ctk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox); - pixbuf = gtk_widget_render_icon(dialog, GTK_STOCK_DIALOG_ERROR, + pixbuf = ctk_widget_render_icon(dialog, CTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG, NULL); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); @@ -488,8 +488,8 @@ static GtkWidget *create_sync_state_button(CtkFramelock *ctk_framelock) /* create the enable syncing icon */ - pixbuf = gtk_widget_render_icon(button, - GTK_STOCK_EXECUTE, + pixbuf = ctk_widget_render_icon(button, + CTK_STOCK_EXECUTE, GTK_ICON_SIZE_BUTTON, "enable frame lock"); if (pixbuf) image = gtk_image_new_from_pixbuf(pixbuf); @@ -517,8 +517,8 @@ static GtkWidget *create_sync_state_button(CtkFramelock *ctk_framelock) /* create the disable syncing icon */ - pixbuf = gtk_widget_render_icon(button, - GTK_STOCK_STOP, + pixbuf = ctk_widget_render_icon(button, + CTK_STOCK_STOP, GTK_ICON_SIZE_BUTTON, "disable frame lock"); if (pixbuf) image = gtk_image_new_from_pixbuf(pixbuf); @@ -600,7 +600,7 @@ static GtkWidget *create_add_devices_dialog(CtkFramelock *ctk_framelock) gtk_container_add(GTK_CONTAINER(ctk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox); - pixbuf = gtk_widget_render_icon(dialog, GTK_STOCK_DIALOG_QUESTION, + pixbuf = ctk_widget_render_icon(dialog, CTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG, NULL); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); @@ -687,7 +687,7 @@ static GtkWidget *create_remove_devices_dialog(CtkFramelock *ctk_framelock) gtk_container_add(GTK_CONTAINER(ctk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox); - pixbuf = gtk_widget_render_icon(dialog, GTK_STOCK_DIALOG_QUESTION, + pixbuf = ctk_widget_render_icon(dialog, CTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG, NULL); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); @@ -1686,8 +1686,8 @@ static void expander_button_clicked(GtkWidget *widget, gpointer user_data) gtk_container_remove(GTK_CONTAINER(entry->expander_button), entry->expander_button_image); entry->expander_button_image = - gtk_image_new_from_stock(GTK_STOCK_ADD, - GTK_ICON_SIZE_SMALL_TOOLBAR); + ctk_image_new_from_str(CTK_STOCK_ADD, + GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_set_size_request(entry->expander_button, 20, 20); gtk_container_add(GTK_CONTAINER(entry->expander_button), @@ -1700,8 +1700,8 @@ static void expander_button_clicked(GtkWidget *widget, gpointer user_data) gtk_container_remove(GTK_CONTAINER(entry->expander_button), entry->expander_button_image); entry->expander_button_image = - gtk_image_new_from_stock(GTK_STOCK_REMOVE, - GTK_ICON_SIZE_SMALL_TOOLBAR); + ctk_image_new_from_str(CTK_STOCK_REMOVE, + GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_set_size_request(entry->expander_button, 20, 20); gtk_container_add(GTK_CONTAINER(entry->expander_button), @@ -1733,8 +1733,8 @@ static void list_entry_add_expander_button(nvListEntryPtr entry) entry->expander_vbox = gtk_vbox_new(FALSE, 0); entry->expander_button = gtk_button_new(); entry->expander_button_image = - gtk_image_new_from_stock(GTK_STOCK_REMOVE, - GTK_ICON_SIZE_SMALL_TOOLBAR); + ctk_image_new_from_str(CTK_STOCK_REMOVE, + GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_set_size_request(entry->expander_button, 20, 20); entry->expanded = True; @@ -2713,13 +2713,13 @@ static void list_entry_expand_collapse(nvListEntryPtr entry, gboolean expand) if (expand) { /* Expand */ entry->expander_button_image = - gtk_image_new_from_stock(GTK_STOCK_REMOVE, - GTK_ICON_SIZE_SMALL_TOOLBAR); + ctk_image_new_from_str(CTK_STOCK_REMOVE, + GTK_ICON_SIZE_SMALL_TOOLBAR); } else { /* Collapse */ entry->expander_button_image = - gtk_image_new_from_stock(GTK_STOCK_ADD, - GTK_ICON_SIZE_SMALL_TOOLBAR); + ctk_image_new_from_str(CTK_STOCK_ADD, + GTK_ICON_SIZE_SMALL_TOOLBAR); } gtk_widget_set_size_request(entry->expander_button, 20, 20); diff --git a/src/gtk+-2.x/ctkgauge.c b/src/gtk+-2.x/ctkgauge.c index 488056a..369f6f9 100644 --- a/src/gtk+-2.x/ctkgauge.c +++ b/src/gtk+-2.x/ctkgauge.c @@ -160,7 +160,6 @@ static gboolean ctk_gauge_expose_event( ) #endif { - gint width, height; CtkGauge *ctk_gauge; GtkAllocation allocation; @@ -168,9 +167,6 @@ static gboolean ctk_gauge_expose_event( ctk_widget_get_allocation(widget, &allocation); - width = allocation.width - 2 * gtk_widget_get_style(widget)->xthickness; - height = allocation.height - 2 * gtk_widget_get_style(widget)->ythickness; - #ifdef CTK_GTK3 gtk_render_frame(gtk_widget_get_style_context(widget), cr, 0, 0, allocation.width, allocation.height); @@ -180,17 +176,22 @@ static gboolean ctk_gauge_expose_event( cairo_set_source_surface(cr, ctk_gauge->c_surface, 0, 0); cairo_paint(cr); #else - gtk_paint_shadow(widget->style, widget->window, - GTK_STATE_NORMAL, GTK_SHADOW_IN, - &event->area, widget, "ctk_gauge", 0, 0, - widget->allocation.width, widget->allocation.height); + { + gint width = allocation.width - 2 * gtk_widget_get_style(widget)->xthickness; + gint height = allocation.height - 2 * gtk_widget_get_style(widget)->ythickness; + + gtk_paint_shadow(widget->style, widget->window, + GTK_STATE_NORMAL, GTK_SHADOW_IN, + &event->area, widget, "ctk_gauge", 0, 0, + widget->allocation.width, widget->allocation.height); - gdk_gc_set_function(ctk_gauge->gdk_gc, GDK_COPY); + gdk_gc_set_function(ctk_gauge->gdk_gc, GDK_COPY); - gdk_draw_drawable(widget->window, ctk_gauge->gdk_gc, ctk_gauge->gdk_pixmap, - 0, 0, widget->style->xthickness, - widget->style->ythickness, - width, height); + gdk_draw_drawable(widget->window, ctk_gauge->gdk_gc, ctk_gauge->gdk_pixmap, + 0, 0, widget->style->xthickness, + widget->style->ythickness, + width, height); + } #endif return FALSE; } @@ -358,7 +359,6 @@ static GdkColor *get_foreground_color(CtkGauge *ctk_gauge, gint i) static void draw(CtkGauge *ctk_gauge) { - GtkWidget *widget; gint x1, x2, y, width, i, percent, pos; gint upper, lower, range, current; @@ -367,8 +367,6 @@ static void draw(CtkGauge *ctk_gauge) range = upper - lower; current = ctk_gauge->current; - widget = GTK_WIDGET(ctk_gauge); - #ifdef CTK_GTK3 /* Fill Curve surface with black background */ cairo_set_operator(ctk_gauge->c_context, CAIRO_OPERATOR_SOURCE); @@ -378,10 +376,14 @@ static void draw(CtkGauge *ctk_gauge) ctk_gauge->width, ctk_gauge->height); cairo_fill(ctk_gauge->c_context); #else - gdk_gc_set_function(ctk_gauge->gdk_gc, GDK_COPY); + { + GtkWidget *widget = GTK_WIDGET(ctk_gauge);; - gdk_draw_rectangle(ctk_gauge->gdk_pixmap, widget->style->black_gc, - TRUE, 0, 0, ctk_gauge->width, ctk_gauge->height); + gdk_gc_set_function(ctk_gauge->gdk_gc, GDK_COPY); + + gdk_draw_rectangle(ctk_gauge->gdk_pixmap, widget->style->black_gc, + TRUE, 0, 0, ctk_gauge->width, ctk_gauge->height); + } #endif width = ctk_gauge->width / 5; diff --git a/src/gtk+-2.x/ctkglx.c b/src/gtk+-2.x/ctkglx.c index 7f1e4de..05c5612 100644 --- a/src/gtk+-2.x/ctkglx.c +++ b/src/gtk+-2.x/ctkglx.c @@ -1056,7 +1056,7 @@ void ctk_glx_probe_info(GtkWidget *widget) vbox = ctk_glx->glxinfo_vpane; - gtk_widget_set_size_request(notebook, -1, 50); + gtk_widget_set_size_request(notebook, -1, 250); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); /* Add (Shared) GLX information to widget */ @@ -1085,7 +1085,7 @@ void ctk_glx_probe_info(GtkWidget *widget) } gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(scroll_win), vbox2); + ctk_scrolled_window_add(GTK_SCROLLED_WINDOW(scroll_win), vbox2); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scroll_win, notebook_label); @@ -1115,7 +1115,7 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(scroll_win), vbox2); + ctk_scrolled_window_add(GTK_SCROLLED_WINDOW(scroll_win), vbox2); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scroll_win, notebook_label); @@ -1143,7 +1143,7 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(scroll_win), vbox2); + ctk_scrolled_window_add(GTK_SCROLLED_WINDOW(scroll_win), vbox2); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scroll_win, notebook_label); @@ -1174,7 +1174,7 @@ void ctk_glx_probe_info(GtkWidget *widget) gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(scroll_win), vbox2); + ctk_scrolled_window_add(GTK_SCROLLED_WINDOW(scroll_win), vbox2); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scroll_win, notebook_label); @@ -1210,7 +1210,7 @@ void ctk_glx_probe_info(GtkWidget *widget) } gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(scroll_win), vbox2); + ctk_scrolled_window_add(GTK_SCROLLED_WINDOW(scroll_win), vbox2); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scroll_win, notebook_label); } diff --git a/src/gtk+-2.x/ctkgvo-csc.c b/src/gtk+-2.x/ctkgvo-csc.c index 1faf68b..73b3e27 100644 --- a/src/gtk+-2.x/ctkgvo-csc.c +++ b/src/gtk+-2.x/ctkgvo-csc.c @@ -26,6 +26,7 @@ #include "ctkconfig.h" #include "ctkhelp.h" #include "ctkdropdownmenu.h" +#include "ctkutils.h" #include "ctkgvo-csc.h" @@ -1155,8 +1156,8 @@ static GtkWidget *build_opengl_only_msg(void) /* create the information icon */ - pixbuf = gtk_widget_render_icon(label, - GTK_STOCK_DIALOG_INFO, + pixbuf = ctk_widget_render_icon(label, + CTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, "CSC information message"); diff --git a/src/gtk+-2.x/ctkutils.c b/src/gtk+-2.x/ctkutils.c index 65ee75a..cd21ffe 100644 --- a/src/gtk+-2.x/ctkutils.c +++ b/src/gtk+-2.x/ctkutils.c @@ -215,6 +215,15 @@ GtkWidget *ctk_scrolled_window_get_vscrollbar(GtkScrolledWindow *sw) #endif } +void ctk_scrolled_window_add(GtkScrolledWindow *sw, GtkWidget *child) +{ +#ifdef CTK_GTK3 + gtk_container_add(GTK_CONTAINER(sw), child); +#else + gtk_scrolled_window_add_with_viewport(sw, child); +#endif +} + GtkWidget *ctk_statusbar_get_message_area(GtkStatusbar *statusbar) { #ifdef CTK_GTK3 @@ -270,6 +279,37 @@ void ctk_combo_box_text_append_text(GtkWidget *widget, const gchar *text) #endif } +GtkWidget *ctk_image_new_from_str(const gchar *str, GtkIconSize size) +{ + if (!str) { + return NULL; + } + +#ifdef CTK_GTK3 + /* added in 2.6 */ + return gtk_image_new_from_icon_name(str, size); +#else + /* deprecated in 3.10 */ + return gtk_image_new_from_stock(str, size); +#endif +} + +GdkPixbuf *ctk_widget_render_icon(GtkWidget *widget, const gchar *stock_id, + GtkIconSize size, const gchar *detail) +{ + if (!stock_id) { + return NULL; + } + +#ifdef CTK_GTK3 + /* added in 3.0 and deprecated in 3.10 */ + return gtk_widget_render_icon_pixbuf(widget, stock_id, size); +#else + /* deprecated in 3.0 */ + return gtk_widget_render_icon(widget, stock_id, size, detail); +#endif +} + void ctk_cell_renderer_set_alignment(GtkCellRenderer *renderer, gfloat x, gfloat y) { diff --git a/src/gtk+-2.x/ctkutils.h b/src/gtk+-2.x/ctkutils.h index a4d8fb9..92fa64b 100644 --- a/src/gtk+-2.x/ctkutils.h +++ b/src/gtk+-2.x/ctkutils.h @@ -33,6 +33,56 @@ G_BEGIN_DECLS # define G_VALUE_INIT { 0, { { 0 } } } #endif +#ifdef CTK_GTK3 +#define CTK_STOCK_ADD "list-add" +#define CTK_STOCK_APPLY "_Apply" /* No icon recommended */ +#define CTK_STOCK_CANCEL "_Cancel" /* No icon recommended */ +#define CTK_STOCK_CLOSE "window-close" +#define CTK_STOCK_DIALOG_ERROR "dialog-error" +#define CTK_STOCK_DIALOG_INFO "dialog-information" +#define CTK_STOCK_DIALOG_QUESTION "dialog-question" +#define CTK_STOCK_DIALOG_WARNING "dialog-warning" +#define CTK_STOCK_EDIT NULL /* Nothing recommended */ +#define CTK_STOCK_EXECUTE "system-run" +#define CTK_STOCK_GO_DOWN "go-down" +#define CTK_STOCK_GO_UP "go-up" +#define CTK_STOCK_HELP "help-browser" +#define CTK_STOCK_NO NULL /* Nothing recommended */ +#define CTK_STOCK_OK "_OK" /* No icon recommended */ +#define CTK_STOCK_OPEN "document-open" +#define CTK_STOCK_PREFERENCES "preferences-system" +#define CTK_STOCK_QUIT "application-exit" +#define CTK_STOCK_REFRESH "view-refresh" +#define CTK_STOCK_REMOVE "list-remove" +#define CTK_STOCK_SAVE "document-save" +#define CTK_STOCK_STOP "process-stop" +#define CTK_STOCK_YES NULL /* Nothing recommended */ +#else +#define CTK_STOCK_ADD GTK_STOCK_ADD +#define CTK_STOCK_APPLY GTK_STOCK_APPLY +#define CTK_STOCK_CANCEL GTK_STOCK_CANCEL +#define CTK_STOCK_CLOSE GTK_STOCK_CLOSE +#define CTK_STOCK_DIALOG_ERROR GTK_STOCK_DIALOG_ERROR +#define CTK_STOCK_DIALOG_INFO GTK_STOCK_DIALOG_INFO +#define CTK_STOCK_DIALOG_QUESTION GTK_STOCK_DIALOG_QUESTION +#define CTK_STOCK_DIALOG_WARNING GTK_STOCK_DIALOG_WARNING +#define CTK_STOCK_EDIT GTK_STOCK_EDIT +#define CTK_STOCK_EXECUTE GTK_STOCK_EXECUTE +#define CTK_STOCK_GO_DOWN GTK_STOCK_GO_DOWN +#define CTK_STOCK_GO_UP GTK_STOCK_GO_UP +#define CTK_STOCK_HELP GTK_STOCK_HELP +#define CTK_STOCK_NO GTK_STOCK_NO +#define CTK_STOCK_OK GTK_STOCK_OK +#define CTK_STOCK_OPEN GTK_STOCK_OPEN +#define CTK_STOCK_PREFERENCES GTK_STOCK_PREFERENCES +#define CTK_STOCK_QUIT GTK_STOCK_QUIT +#define CTK_STOCK_REFRESH GTK_STOCK_REFRESH +#define CTK_STOCK_REMOVE GTK_STOCK_REMOVE +#define CTK_STOCK_SAVE GTK_STOCK_SAVE +#define CTK_STOCK_STOP GTK_STOCK_STOP +#define CTK_STOCK_YES GTK_STOCK_YES +#endif + /* * GTK 2/3 util functions */ @@ -56,6 +106,7 @@ void ctk_adjustment_set_upper(GtkAdjustment *a, gdouble x); void ctk_adjustment_set_lower(GtkAdjustment *a, gdouble x); GtkWidget *ctk_scrolled_window_get_vscrollbar(GtkScrolledWindow *sw); +void ctk_scrolled_window_add(GtkScrolledWindow *sw, GtkWidget *child); GtkWidget *ctk_statusbar_get_message_area(GtkStatusbar *statusbar); void ctk_cell_renderer_set_alignment(GtkCellRenderer *widget, gfloat x, gfloat y); @@ -72,6 +123,10 @@ void ctk_combo_box_text_append_text(GtkWidget *widget, const gchar *text); void ctk_g_object_ref_sink(gpointer obj); +GtkWidget *ctk_image_new_from_str(const gchar *str, GtkIconSize size); +GdkPixbuf *ctk_widget_render_icon(GtkWidget *widget, const gchar *stock_id, + GtkIconSize size, const gchar *detail); + /* end of GTK 2/3 util functions */ gchar *get_pcie_generation_string(CtrlTarget *ctrl_target); diff --git a/src/gtk+-2.x/ctkvcs.c b/src/gtk+-2.x/ctkvcs.c index c929675..b0b0ca9 100644 --- a/src/gtk+-2.x/ctkvcs.c +++ b/src/gtk+-2.x/ctkvcs.c @@ -246,8 +246,8 @@ static GtkWidget * create_error_dialog(CtkVcs *ctk_object) hbox, TRUE, TRUE, 5); /* Pack the information icon */ - image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, - GTK_ICON_SIZE_DIALOG); + image = ctk_image_new_from_str(CTK_STOCK_DIALOG_INFO, + GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(image), 0.0f, 0.0f); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 5); diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c index d7fdaa7..c7cc65e 100644 --- a/src/gtk+-2.x/ctkwindow.c +++ b/src/gtk+-2.x/ctkwindow.c @@ -1314,7 +1314,7 @@ static GtkWidget *create_quit_dialog(CtkWindow *ctk_window) gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); gtk_container_add(GTK_CONTAINER(ctk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox); - pixbuf = gtk_widget_render_icon(dialog, GTK_STOCK_DIALOG_QUESTION, + pixbuf = ctk_widget_render_icon(dialog, CTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG, NULL); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h index 3f3e3c6..09e27b8 100644 --- a/src/libXNVCtrl/NVCtrl.h +++ b/src/libXNVCtrl/NVCtrl.h @@ -682,7 +682,7 @@ /* * NV_CTRL_FLIPPING_ALLOWED - when TRUE, OpenGL will swap by flipping - * when possible; when FALSE, OpenGL will alway swap by blitting. + * when possible; when FALSE, OpenGL will always swap by blitting. */ #define NV_CTRL_FLIPPING_ALLOWED 40 /* RW-X */ @@ -4728,7 +4728,7 @@ /* * NV_CTRL_BINARY_DATA_GPU_FLAGS - Returns a list of flags for the * given GPU. A flag can, for instance, be a capability which enables - * of disables some features according to the GPU state. + * or disables some features according to the GPU state. * * The format of the returned data is: * diff --git a/src/libXNVCtrl/version.mk b/src/libXNVCtrl/version.mk index 0032b02..da40957 100644 --- a/src/libXNVCtrl/version.mk +++ b/src/libXNVCtrl/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 410.73 +NVIDIA_VERSION = 415.13 diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributes.c b/src/libXNVCtrlAttributes/NvCtrlAttributes.c index c3bf158..a60b85b 100644 --- a/src/libXNVCtrlAttributes/NvCtrlAttributes.c +++ b/src/libXNVCtrlAttributes/NvCtrlAttributes.c @@ -623,8 +623,8 @@ ReturnStatus NvCtrlQueryTargetCount(const CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -785,8 +785,8 @@ ReturnStatus NvCtrlGetDisplayAttribute64(const CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -848,8 +848,8 @@ ReturnStatus NvCtrlSetDisplayAttribute(CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -924,8 +924,8 @@ NvCtrlGetValidDisplayAttributeValues(const CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -999,8 +999,8 @@ NvCtrlGetValidStringDisplayAttributeValues(const CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -1084,8 +1084,8 @@ ReturnStatus NvCtrlGetStringDisplayAttribute(const CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -1166,8 +1166,8 @@ ReturnStatus NvCtrlSetStringDisplayAttribute(CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -1210,8 +1210,8 @@ ReturnStatus NvCtrlGetBinaryAttribute(const CtrlTarget *ctrl_target, (ret != NvCtrlNotSupported)) { return ret; } - /* Fall through */ } + /* Fall through */ case DISPLAY_TARGET: case X_SCREEN_TARGET: case FRAMELOCK_TARGET: @@ -1,5 +1,5 @@ /* - * Copyright 1993-2016 NVIDIA Corporation. All rights reserved. + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. * * NOTICE TO USER: * @@ -95,13 +95,16 @@ extern "C" { /** * NVML API versioning support */ -#define NVML_API_VERSION 8 -#define NVML_API_VERSION_STR "8" +#define NVML_API_VERSION 10 +#define NVML_API_VERSION_STR "10" #define nvmlInit nvmlInit_v2 -#define nvmlDeviceGetPciInfo nvmlDeviceGetPciInfo_v2 +#define nvmlDeviceGetPciInfo nvmlDeviceGetPciInfo_v3 #define nvmlDeviceGetCount nvmlDeviceGetCount_v2 #define nvmlDeviceGetHandleByIndex nvmlDeviceGetHandleByIndex_v2 #define nvmlDeviceGetHandleByPciBusId nvmlDeviceGetHandleByPciBusId_v2 +#define nvmlDeviceGetNvLinkRemotePciInfo nvmlDeviceGetNvLinkRemotePciInfo_v2 +#define nvmlDeviceRemoveGpu nvmlDeviceRemoveGpu_v2 +#define nvmlDeviceGetGridLicensableFeatures nvmlDeviceGetGridLicensableFeatures_v2 /***************************************************************************************************/ /** @defgroup nvmlDeviceStructs Device Structs @@ -122,30 +125,48 @@ typedef struct nvmlDevice_st* nvmlDevice_t; /** * Buffer size guaranteed to be large enough for pci bus id */ -#define NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE 16 +#define NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE 32 + +/** + * Buffer size guaranteed to be large enough for pci bus id for ::busIdLegacy + */ +#define NVML_DEVICE_PCI_BUS_ID_BUFFER_V2_SIZE 16 /** * PCI information about a GPU device. */ -typedef struct nvmlPciInfo_st +typedef struct nvmlPciInfo_st { - char busId[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; //!< The tuple domain:bus:device.function PCI identifier (& NULL terminator) - unsigned int domain; //!< The PCI domain on which the device's bus resides, 0 to 0xffff + char busIdLegacy[NVML_DEVICE_PCI_BUS_ID_BUFFER_V2_SIZE]; //!< The legacy tuple domain:bus:device.function PCI identifier (& NULL terminator) + unsigned int domain; //!< The PCI domain on which the device's bus resides, 0 to 0xffffffff unsigned int bus; //!< The bus on which the device resides, 0 to 0xff unsigned int device; //!< The device's id on the bus, 0 to 31 unsigned int pciDeviceId; //!< The combined 16-bit device id and 16-bit vendor id - + // Added in NVML 2.285 API unsigned int pciSubSystemId; //!< The 32-bit Sub System Device ID - - // NVIDIA reserved for internal use only - unsigned int reserved0; - unsigned int reserved1; - unsigned int reserved2; - unsigned int reserved3; + + char busId[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; //!< The tuple domain:bus:device.function PCI identifier (& NULL terminator) } nvmlPciInfo_t; /** + * PCI format string for ::busIdLegacy + */ +#define NVML_DEVICE_PCI_BUS_ID_LEGACY_FMT "%04X:%02X:%02X.0" + +/** + * PCI format string for ::busId + */ +#define NVML_DEVICE_PCI_BUS_ID_FMT "%08X:%02X:%02X.0" + +/** + * Utility macro for filling the pci bus id format from a nvmlPciInfo_t + */ +#define NVML_DEVICE_PCI_BUS_ID_FMT_ARGS(pciInfo) (pciInfo)->domain, \ + (pciInfo)->bus, \ + (pciInfo)->device + +/** * Detailed ECC error counts for a device. * * @deprecated Different GPU families can have different memory error counters @@ -295,12 +316,15 @@ typedef enum nvmlGpuLevel_enum NVML_TOPOLOGY_SINGLE = 10, // all devices that only need traverse a single PCIe switch NVML_TOPOLOGY_MULTIPLE = 20, // all devices that need not traverse a host bridge NVML_TOPOLOGY_HOSTBRIDGE = 30, // all devices that are connected to the same host bridge - NVML_TOPOLOGY_CPU = 40, // all devices that are connected to the same CPU but possibly multiple host bridges + NVML_TOPOLOGY_NODE = 40, // all devices that are connected to the same NUMA node but possibly multiple host bridges NVML_TOPOLOGY_SYSTEM = 50, // all devices in the system // there is purposefully no COUNT here because of the need for spacing above } nvmlGpuTopologyLevel_t; +/* Compatibility for CPU->NODE renaming */ +#define NVML_TOPOLOGY_CPU NVML_TOPOLOGY_NODE + /* P2P Capability Index Status*/ typedef enum nvmlGpuP2PStatus_enum { @@ -476,6 +500,7 @@ typedef enum nvmlBrandType_enum NVML_BRAND_NVS = 3, NVML_BRAND_GRID = 4, NVML_BRAND_GEFORCE = 5, + NVML_BRAND_TITAN = 6, // Keep this last NVML_BRAND_COUNT @@ -488,7 +513,9 @@ typedef enum nvmlTemperatureThresholds_enum { NVML_TEMPERATURE_THRESHOLD_SHUTDOWN = 0, // Temperature at which the GPU will shut down // for HW protection - NVML_TEMPERATURE_THRESHOLD_SLOWDOWN = 1, // Temperature at which the GPU will begin slowdown + NVML_TEMPERATURE_THRESHOLD_SLOWDOWN = 1, // Temperature at which the GPU will begin HW slowdown + NVML_TEMPERATURE_THRESHOLD_MEM_MAX = 2, // Memory Temperature at which the GPU will begin SW slowdown + NVML_TEMPERATURE_THRESHOLD_GPU_MAX = 3, // GPU Temperature at which the GPU can be throttled below base clock // Keep this last NVML_TEMPERATURE_THRESHOLD_COUNT } nvmlTemperatureThresholds_t; @@ -599,7 +626,7 @@ typedef enum nvmlClockType_enum NVML_CLOCK_VIDEO = 3, //!< Video encoder/decoder clock domain // Keep this last - NVML_CLOCK_COUNT //<! Count of clock types + NVML_CLOCK_COUNT //!< Count of clock types } nvmlClockType_t; /** @@ -614,7 +641,7 @@ typedef enum nvmlClockId_enum NVML_CLOCK_ID_CUSTOMER_BOOST_MAX = 3, //!< OEM-defined maximum clock rate //Keep this last - NVML_CLOCK_ID_COUNT //<! Count of Clock Ids. + NVML_CLOCK_ID_COUNT //!< Count of Clock Ids. } nvmlClockId_t; /** @@ -715,20 +742,19 @@ typedef enum nvmlReturn_enum } nvmlReturn_t; /** - * Memory locations - * * See \ref nvmlDeviceGetMemoryErrorCounter */ typedef enum nvmlMemoryLocation_enum { - NVML_MEMORY_LOCATION_L1_CACHE = 0, //!< GPU L1 Cache - NVML_MEMORY_LOCATION_L2_CACHE = 1, //!< GPU L2 Cache - NVML_MEMORY_LOCATION_DEVICE_MEMORY = 2, //!< GPU Device Memory - NVML_MEMORY_LOCATION_REGISTER_FILE = 3, //!< GPU Register File - NVML_MEMORY_LOCATION_TEXTURE_MEMORY = 4, //!< GPU Texture Memory - NVML_MEMORY_LOCATION_TEXTURE_SHM = 5, //!< Shared memory - NVML_MEMORY_LOCATION_CBU = 6, //!< CBU - + NVML_MEMORY_LOCATION_L1_CACHE = 0, //!< GPU L1 Cache + NVML_MEMORY_LOCATION_L2_CACHE = 1, //!< GPU L2 Cache + NVML_MEMORY_LOCATION_DRAM = 2, //!< Turing+ DRAM + NVML_MEMORY_LOCATION_DEVICE_MEMORY = 2, //!< GPU Device Memory + NVML_MEMORY_LOCATION_REGISTER_FILE = 3, //!< GPU Register File + NVML_MEMORY_LOCATION_TEXTURE_MEMORY = 4, //!< GPU Texture Memory + NVML_MEMORY_LOCATION_TEXTURE_SHM = 5, //!< Shared memory + NVML_MEMORY_LOCATION_CBU = 6, //!< CBU + NVML_MEMORY_LOCATION_SRAM = 7, //!< Turing+ SRAM // Keep this last NVML_MEMORY_LOCATION_COUNT //!< This counts the number of memory locations the driver knows about } nvmlMemoryLocation_t; @@ -881,19 +907,39 @@ typedef enum nvmlGpuVirtualizationMode { #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_TOTAL 73 //!< NVLink Bandwidth Counter Total for Counter Set 1, All Lanes /* NVML Perf Policy Counters */ -#define NVML_FI_DEV_PERF_POLICY_POWER 74 //!< Perf Policy Counter for Power Policy +#define NVML_FI_DEV_PERF_POLICY_POWER 74 //!< Perf Policy Counter for Power Policy #define NVML_FI_DEV_PERF_POLICY_THERMAL 75 //!< Perf Policy Counter for Thermal Policy #define NVML_FI_DEV_PERF_POLICY_SYNC_BOOST 76 //!< Perf Policy Counter for Sync boost Policy #define NVML_FI_DEV_PERF_POLICY_BOARD_LIMIT 77 //!< Perf Policy Counter for Board Limit #define NVML_FI_DEV_PERF_POLICY_LOW_UTILIZATION 78 //!< Perf Policy Counter for Low GPU Utilization Policy #define NVML_FI_DEV_PERF_POLICY_RELIABILITY 79 //!< Perf Policy Counter for Reliability Policy -#define NVML_FI_DEV_PERF_POLICY_TOTAL_APP_CLOCKS 80 //!< Perf Policy Counter for Total App Clock Policy -#define NVML_FI_DEV_PERF_POLICY_TOTAL_BASE_CLOCKS 81 //!< Perf Policy Counter for Total Base Clocks Policy +#define NVML_FI_DEV_PERF_POLICY_TOTAL_APP_CLOCKS 80 //!< Perf Policy Counter for Total App Clock Policy +#define NVML_FI_DEV_PERF_POLICY_TOTAL_BASE_CLOCKS 81 //!< Perf Policy Counter for Total Base Clocks Policy /* Memory temperatures */ #define NVML_FI_DEV_MEMORY_TEMP 82 //!< Memory temperature for the device -#define NVML_FI_MAX 83 //!< One greater than the largest field ID defined above +/* Energy Counter */ +#define NVML_FI_DEV_TOTAL_ENERGY_CONSUMPTION 83 //!< Total energy consumption for the GPU in mJ since the driver was last reloaded + +/* NVLink Speed */ +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_L0 84 //!< NVLink Speed in MBps for Link 0 +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_L1 85 //!< NVLink Speed in MBps for Link 1 +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_L2 86 //!< NVLink Speed in MBps for Link 2 +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_L3 87 //!< NVLink Speed in MBps for Link 3 +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_L4 88 //!< NVLink Speed in MBps for Link 4 +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_L5 89 //!< NVLink Speed in MBps for Link 5 +#define NVML_FI_DEV_NVLINK_SPEED_MBPS_COMMON 90 //!< Common NVLink Speed in MBps for active links + +#define NVML_FI_DEV_NVLINK_LINK_COUNT 91 //!< Number of NVLinks present on the device + +#define NVML_FI_DEV_RETIRED_PENDING_SBE 92 //!< If any pages are pending retirement due to SBE. 1=yes. 0=no. +#define NVML_FI_DEV_RETIRED_PENDING_DBE 93 //!< If any pages are pending retirement due to DBE. 1=yes. 0=no. + +#define NVML_FI_DEV_PCIE_REPLAY_COUNTER 94 //!< PCIe replay counter +#define NVML_FI_DEV_PCIE_REPLAY_ROLLOVER_COUNTER 95 //!< PCIe replay rollover counter + +#define NVML_FI_MAX 96 //!< One greater than the largest field ID defined above /** * Information for a Field Value Sample @@ -1102,7 +1148,7 @@ typedef struct nvmlEventData_st * @see nvmlDeviceSetApplicationsClocks * @see nvmlDeviceGetApplicationsClock */ -#define nvmlClocksThrottleReasonApplicationsClocksSetting 0x0000000000000002LL +#define nvmlClocksThrottleReasonApplicationsClocksSetting 0x0000000000000002LL /** * @deprecated Renamed to \ref nvmlClocksThrottleReasonApplicationsClocksSetting @@ -1144,6 +1190,43 @@ typedef struct nvmlEventData_st */ #define nvmlClocksThrottleReasonSyncBoost 0x0000000000000010LL +/** SW Thermal Slowdown + * + * This is an indicator of one or more of the following: + * - Current GPU temperature above the GPU Max Operating Temperature + * - Current memory temperature above the Memory Max Operating Temperature + * + */ +#define nvmlClocksThrottleReasonSwThermalSlowdown 0x0000000000000020LL + +/** HW Thermal Slowdown (reducing the core clocks by a factor of 2 or more) is engaged + * + * This is an indicator of: + * - temperature being too high + * + * @see nvmlDeviceGetTemperature + * @see nvmlDeviceGetTemperatureThreshold + * @see nvmlDeviceGetPowerUsage + */ +#define nvmlClocksThrottleReasonHwThermalSlowdown 0x0000000000000040LL + +/** HW Power Brake Slowdown (reducing the core clocks by a factor of 2 or more) is engaged + * + * This is an indicator of: + * - External Power Brake Assertion being triggered (e.g. by the system power supply) + * + * @see nvmlDeviceGetTemperature + * @see nvmlDeviceGetTemperatureThreshold + * @see nvmlDeviceGetPowerUsage + */ +#define nvmlClocksThrottleReasonHwPowerBrakeSlowdown 0x0000000000000080LL + +/** GPU clocks are limited by current setting of Display clocks + * + * @see bug 1997531 + */ +#define nvmlClocksThrottleReasonDisplayClockSetting 0x0000000000000100LL + /** Bit mask representing no clocks throttling * * Clocks are as high as possible. @@ -1159,6 +1242,10 @@ typedef struct nvmlEventData_st | nvmlClocksThrottleReasonSwPowerCap \ | nvmlClocksThrottleReasonHwSlowdown \ | nvmlClocksThrottleReasonSyncBoost \ + | nvmlClocksThrottleReasonSwThermalSlowdown \ + | nvmlClocksThrottleReasonHwThermalSlowdown \ + | nvmlClocksThrottleReasonHwPowerBrakeSlowdown \ + | nvmlClocksThrottleReasonDisplayClockSetting \ ) /** @} */ @@ -1217,13 +1304,14 @@ typedef struct nvmlAccountingStats_st { #define NVML_VGPU_NAME_BUFFER_SIZE 64 -#define NVML_MAX_VGPU_TYPES_PER_PGPU 18 - -#define NVML_MAX_VGPU_INSTANCES_PER_PGPU 24 - #define NVML_GRID_LICENSE_FEATURE_MAX_COUNT 3 -#define NVML_GRID_LICENSE_INFO_MAX_LENGTH 128 +/*! + * Macros for pGPU's virtualization capabilities bitfield. + */ +#define NVML_VGPU_PGPU_VIRTUALIZATION_CAP_MIGRATION 0:0 +#define NVML_VGPU_PGPU_VIRTUALIZATION_CAP_MIGRATION_NO 0x0 +#define NVML_VGPU_PGPU_VIRTUALIZATION_CAP_MIGRATION_YES 0x1 /** @} */ @@ -1241,17 +1329,21 @@ typedef enum nvmlVgpuVmIdType { NVML_VGPU_VM_ID_UUID = 1, //!< VM ID represents UUID } nvmlVgpuVmIdType_t; -// vGPU GUEST info state. +/** + * vGPU GUEST info state. + */ typedef enum nvmlVgpuGuestInfoState_enum { - NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = 0, //<! Guest-dependent fields uninitialized - NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = 1, //<! Guest-dependent fields initialized + NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = 0, //!< Guest-dependent fields uninitialized + NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = 1, //!< Guest-dependent fields initialized } nvmlVgpuGuestInfoState_t; -// GRID license feature code +/** + * GRID license feature code + */ typedef enum { - NVML_GRID_LICENSE_FEATURE_CODE_VGPU = 1, // Virtual GPU - NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION = 2 // Virtual Workstation + NVML_GRID_LICENSE_FEATURE_CODE_VGPU = 1, //!< Virtual GPU + NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION = 2 //!< Virtual Workstation } nvmlGridLicenseFeatureCode_t; /** @} */ @@ -1308,20 +1400,24 @@ typedef struct nvmlProcessUtilizationSample_st } nvmlProcessUtilizationSample_t; /** - * Structure to store GRID licensable features + * Structure containing GRID licensable feature information */ typedef struct nvmlGridLicensableFeature_st { - nvmlGridLicenseFeatureCode_t featureCode; //<! Licensed feature code - unsigned int featureState; //<! Non-zero if feature is currently licensed, otherwise zero - char licenseInfo[NVML_GRID_LICENSE_INFO_MAX_LENGTH]; + nvmlGridLicenseFeatureCode_t featureCode; //!< Licensed feature code + unsigned int featureState; //!< Non-zero if feature is currently licensed, otherwise zero + char licenseInfo[NVML_GRID_LICENSE_BUFFER_SIZE]; + char productName[NVML_GRID_LICENSE_BUFFER_SIZE]; } nvmlGridLicensableFeature_t; +/** + * Structure to store GRID licensable features + */ typedef struct nvmlGridLicensableFeatures_st { - int isGridLicenseSupported; //<! Non-zero if GRID Software Licensing is supported on the system, otherwise zero - unsigned int licensableFeaturesCount; //<! Entries returned in \a gridLicensableFeatures array - nvmlGridLicensableFeature_t gridLicensableFeatures[NVML_GRID_LICENSE_FEATURE_MAX_COUNT]; + int isGridLicenseSupported; //!< Non-zero if GRID Software Licensing is supported on the system, otherwise zero + unsigned int licensableFeaturesCount; //!< Entries returned in \a gridLicensableFeatures array + nvmlGridLicensableFeature_t gridLicensableFeatures[NVML_GRID_LICENSE_FEATURE_MAX_COUNT]; //!< Array of GRID licensable features. } nvmlGridLicensableFeatures_t; /** @} */ @@ -1332,17 +1428,17 @@ typedef struct nvmlGridLicensableFeatures_st */ /***************************************************************************************************/ -/* +/** * Represents type of encoder for capacity can be queried */ typedef enum nvmlEncoderQueryType_enum { - NVML_ENCODER_QUERY_H264 = 0, - NVML_ENCODER_QUERY_HEVC = 1, + NVML_ENCODER_QUERY_H264 = 0, //!< H264 encoder + NVML_ENCODER_QUERY_HEVC = 1, //!< HEVC encoder }nvmlEncoderType_t; -/* - * Struct to hold encoder session data +/** + * Structure to hold encoder session data */ typedef struct nvmlEncoderSessionInfo_st { @@ -1353,12 +1449,93 @@ typedef struct nvmlEncoderSessionInfo_st unsigned int hResolution; //!< Current encode horizontal resolution unsigned int vResolution; //!< Current encode vertical resolution unsigned int averageFps; //!< Moving average encode frames per second - unsigned int averageLatency; //!< Moving average encode latency in microseconds + unsigned int averageLatency; //!< Moving average encode latency in microseconds }nvmlEncoderSessionInfo_t; /** @} */ /***************************************************************************************************/ +/** @defgroup nvmlFBCStructs Frame Buffer Capture Structures +* @{ +*/ +/***************************************************************************************************/ + +/** + * Represents frame buffer capture session type + */ +typedef enum nvmlFBCSessionType_enum +{ + NVML_FBC_SESSION_TYPE_UNKNOWN = 0, //!< Unknwon + NVML_FBC_SESSION_TYPE_TOSYS, //!< ToSys + NVML_FBC_SESSION_TYPE_CUDA, //!< Cuda + NVML_FBC_SESSION_TYPE_VID, //!< Vid + NVML_FBC_SESSION_TYPE_HWENC, //!< HEnc +} nvmlFBCSessionType_t; + +/** + * Structure to hold frame buffer capture sessions stats + */ +typedef struct nvmlFBCStats_st +{ + unsigned int sessionsCount; //!< Total no of sessions + unsigned int averageFPS; //!< Moving average new frames captured per second + unsigned int averageLatency; //!< Moving average new frame capture latency in microseconds +} nvmlFBCStats_t; + +#define NVML_NVFBC_SESSION_FLAG_DIFFMAP_ENABLED 0x00000001 //!< Bit specifying differential map state. +#define NVML_NVFBC_SESSION_FLAG_CLASSIFICATIONMAP_ENABLED 0x00000002 //!< Bit specifying classification map state. +#define NVML_NVFBC_SESSION_FLAG_CAPTURE_WITH_WAIT_NO_WAIT 0x00000004 //!< Bit specifying if capture was requested as non-blocking call. +#define NVML_NVFBC_SESSION_FLAG_CAPTURE_WITH_WAIT_INFINITE 0x00000008 //!< Bit specifying if capture was requested as blocking call. +#define NVML_NVFBC_SESSION_FLAG_CAPTURE_WITH_WAIT_TIMEOUT 0x00000010 //!< Bit specifying if capture was requested as blocking call with timeout period. + +/** + * Structure to hold FBC session data + */ +typedef struct nvmlFBCSessionInfo_st +{ + unsigned int sessionId; //!< Unique session ID + unsigned int pid; //!< Owning process ID + nvmlVgpuInstance_t vgpuInstance; //!< Owning vGPU instance ID (only valid on vGPU hosts, otherwise zero) + unsigned int displayOrdinal; //!< Display identifier + nvmlFBCSessionType_t sessionType; //!< Type of frame buffer capture session + unsigned int sessionFlags; //!< Session flags (one or more of NVML_NVFBC_SESSION_FLAG_XXX). + unsigned int hMaxResolution; //!< Max horizontal resolution supported by the capture session + unsigned int vMaxResolution; //!< Max vertical resolution supported by the capture session + unsigned int hResolution; //!< Horizontal resolution requested by caller in capture call + unsigned int vResolution; //!< Vertical resolution requested by caller in capture call + unsigned int averageFPS; //!< Moving average new frames captured per second + unsigned int averageLatency; //!< Moving average new frame capture latency in microseconds +} nvmlFBCSessionInfo_t; + +/** @} */ + +/***************************************************************************************************/ +/** @defgroup nvmlDrainDefs definitions related to the drain state + * @{ + */ +/***************************************************************************************************/ + +/** + * Is the GPU device to be removed from the kernel by nvmlDeviceRemoveGpu() + */ +typedef enum nvmlDetachGpuState_enum +{ + NVML_DETACH_GPU_KEEP = 0, + NVML_DETACH_GPU_REMOVE, +} nvmlDetachGpuState_t; + +/** + * Parent bridge PCIe link state requested by nvmlDeviceRemoveGpu() + */ +typedef enum nvmlPcieLinkState_enum +{ + NVML_PCIE_LINK_KEEP = 0, + NVML_PCIE_LINK_SHUT_DOWN, +} nvmlPcieLinkState_t; + +/** @} */ + +/***************************************************************************************************/ /** @defgroup nvmlInitializationAndCleanup Initialization and Cleanup * This chapter describes the methods that handle NVML initialization and cleanup. * It is the user's responsibility to call \ref nvmlInit() before calling any other methods, and @@ -1367,9 +1544,14 @@ typedef struct nvmlEncoderSessionInfo_st */ /***************************************************************************************************/ +#define NVML_INIT_FLAG_NO_GPUS 1 //!< Don't fail nvmlInit() when no GPUs are found +#define NVML_INIT_FLAG_NO_ATTACH 2 //!< Don't attach GPUs + /** * Initialize NVML, but don't initialize any GPUs yet. * + * \note nvmlInit_v3 introduces a "flags" argument, that allows passing boolean values + * modifying the behaviour of nvmlInit(). * \note In NVML 5.319 new nvmlInit_v2 has replaced nvmlInit"_v1" (default in NVML 4.304 and older) that * did initialize all GPU devices in the system. * @@ -1395,6 +1577,23 @@ typedef struct nvmlEncoderSessionInfo_st nvmlReturn_t DECLDIR nvmlInit(void); /** + * nvmlInitWithFlags is a variant of nvmlInit(), that allows passing a set of boolean values + * modifying the behaviour of nvmlInit(). + * Other than the "flags" parameter it is completely similar to \ref nvmlInit. + * + * For all products. + * + * @param flags behaviour modifier flags + * + * @return + * - \ref NVML_SUCCESS if NVML has been properly initialized + * - \ref NVML_ERROR_DRIVER_NOT_LOADED if NVIDIA driver is not running + * - \ref NVML_ERROR_NO_PERMISSION if NVML does not have permission to talk to the driver + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlInitWithFlags(unsigned int flags); + +/** * Shut down NVML by releasing all GPU resources previously allocated with \ref nvmlInit(). * * For all products. @@ -1532,8 +1731,8 @@ nvmlReturn_t DECLDIR nvmlSystemGetNVMLVersion(char *version, unsigned int length * * For all products. * - * The returned CUDA driver version is the same as the CUDA API - * cuDriverGetVersion() would return on the system. + * The CUDA driver version returned will be retreived from the currently installed version of CUDA. + * If the cuda library is not found, this function will return a known supported version number. * * @param cudaDriverVersion Reference in which to return the version identifier * @@ -1544,6 +1743,29 @@ nvmlReturn_t DECLDIR nvmlSystemGetNVMLVersion(char *version, unsigned int length nvmlReturn_t DECLDIR nvmlSystemGetCudaDriverVersion(int *cudaDriverVersion); /** + * Retrieves the version of the CUDA driver from the shared library. + * + * For all products. + * + * The returned CUDA driver version by calling cuDriverGetVersion() + * + * @param cudaDriverVersion Reference in which to return the version identifier + * + * @return + * - \ref NVML_SUCCESS if \a cudaDriverVersion has been set + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a cudaDriverVersion is NULL + * - \ref NVML_ERROR_LIBRARY_NOT_FOUND if \a libcuda.so.1 or libcuda.dll is not found + * - \ref NVML_ERROR_FUNCTION_NOT_FOUND if \a cuDriverGetVersion() is not found in the shared library + */ +nvmlReturn_t DECLDIR nvmlSystemGetCudaDriverVersion_v2(int *cudaDriverVersion); + +/** + * Macros for converting the CUDA driver version number to Major and Minor version numbers. + */ +#define NVML_CUDA_DRIVER_VERSION_MAJOR(v) ((v)/1000) +#define NVML_CUDA_DRIVER_VERSION_MINOR(v) (((v)%1000)/10) + +/** * Gets name of the process with provided process id * * For all products. @@ -2138,7 +2360,7 @@ nvmlReturn_t DECLDIR nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigne * @param device1 The first device * @param device2 The second device * @param p2pIndex p2p Capability Index being looked for between \a device1 and \a device2 - * @param p2pStatus Reference in which to return the status of the \a p2pIndex + * @param p2pStatus Reference in which to return the status of the \a p2pIndex * between \a device1 and \a device2 * @return * - \ref NVML_SUCCESS if \a p2pStatus has been populated @@ -2510,9 +2732,9 @@ nvmlReturn_t DECLDIR nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUt * @param value Reference in which to return the counter's value * * @return - * - \ref NVML_SUCCESS if \a value and \a rollover have been set + * - \ref NVML_SUCCESS if \a value has been set * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a value or \a rollover are NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a value is NULL * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error @@ -3437,7 +3659,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtil nvmlReturn_t DECLDIR nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int *utilization, unsigned int *samplingPeriodUs); /** - * Retrieves the current capacity of the device's encoder, in macroblocks per second. + * Retrieves the current capacity of the device's encoder, as a percentage of maximum encoder capacity with valid values in the range 0-100. * * For Maxwell &tm; or newer fully supported devices. * @@ -3525,6 +3747,54 @@ nvmlReturn_t DECLDIR nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned nvmlReturn_t DECLDIR nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int *utilization, unsigned int *samplingPeriodUs); /** +* Retrieves the active frame buffer capture sessions statistics for a given device. +* +* For Maxwell &tm; or newer fully supported devices. +* +* @param device The identifier of the target device +* @param fbcStats Reference to nvmlFBCStats_t structure contianing NvFBC stats +* +* @return +* - \ref NVML_SUCCESS if \a fbcStats is fetched +* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized +* - \ref NVML_ERROR_INVALID_ARGUMENT if \a fbcStats is NULL +* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible +* - \ref NVML_ERROR_UNKNOWN on any unexpected error +*/ +nvmlReturn_t DECLDIR nvmlDeviceGetFBCStats(nvmlDevice_t device, nvmlFBCStats_t *fbcStats); + +/** +* Retrieves information about active frame buffer capture sessions on a target device. +* +* An array of active FBC sessions is returned in the caller-supplied buffer pointed at by \a sessionInfo. The +* array element count is passed in \a sessionCount, and \a sessionCount is used to return the number of sessions +* written to the buffer. +* +* If the supplied buffer is not large enough to accomodate the active session array, the function returns +* NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlFBCSessionInfo_t array required in \a sessionCount. +* To query the number of active FBC sessions, call this function with *sessionCount = 0. The code will return +* NVML_SUCCESS with number of active FBC sessions updated in *sessionCount. +* +* For Maxwell &tm; or newer fully supported devices. +* +* @note hResolution, vResolution, averageFPS and averageLatency data for a FBC session returned in \a sessionInfo may +* be zero if there are no new frames captured since the session started. +* +* @param device The identifier of the target device +* @param sessionCount Reference to caller supplied array size, and returns the number of sessions. +* @param sessionInfo Reference in which to return the session information +* +* @return +* - \ref NVML_SUCCESS if \a sessionInfo is fetched +* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized +* - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a sessionCount is too small, array element count is returned in \a sessionCount +* - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount is NULL. +* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible +* - \ref NVML_ERROR_UNKNOWN on any unexpected error +*/ +nvmlReturn_t DECLDIR nvmlDeviceGetFBCSessions(nvmlDevice_t device, unsigned int *sessionCount, nvmlFBCSessionInfo_t *sessionInfo); + +/** * Retrieves the current and pending driver model for the device. * * For Fermi &tm; or newer fully supported devices. @@ -3959,6 +4229,38 @@ nvmlReturn_t DECLDIR nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageReti unsigned int *pageCount, unsigned long long *addresses); /** + * Returns the list of retired pages by source, including pages that are pending retirement + * The address information provided from this API is the hardware address of the page that was retired. Note + * that this does not match the virtual address used in CUDA, but will match the address information in XID 63 + * + * \note nvmlDeviceGetRetiredPages_v2 adds an additional timestamps paramter to return the time of each page's + * retirement. + * + * For Kepler &tm; or newer fully supported devices. + * + * @param device The identifier of the target device + * @param cause Filter page addresses by cause of retirement + * @param pageCount Reference in which to provide the \a addresses buffer size, and + * to return the number of retired pages that match \a cause + * Set to 0 to query the size without allocating an \a addresses buffer + * @param addresses Buffer to write the page addresses into + * @param timestamps Buffer to write the timestamps of page retirement, additional for _v2 + * + * @return + * - \ref NVML_SUCCESS if \a pageCount was populated and \a addresses was filled + * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a pageCount indicates the buffer is not large enough to store all the + * matching page addresses. \a pageCount is set to the needed size. + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a pageCount is NULL, \a cause is invalid, or + * \a addresses is NULL + * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetRetiredPages_v2(nvmlDevice_t device, nvmlPageRetirementCause_t cause, + unsigned int *pageCount, unsigned long long *addresses, unsigned long long *timestamps); + +/** * Check if any pages are pending retirement and need a reboot to fully retire. * * For Kepler &tm; or newer fully supported devices. @@ -4196,10 +4498,64 @@ nvmlReturn_t DECLDIR nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccC nvmlReturn_t DECLDIR nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags); /** + * Set clocks that device will lock to. + * + * Sets the clocks that the device will be running at to the value in the range of minGpuClockMHz to maxGpuClockMHz. + * Setting this will supercede application clock values and take effect regardless if a cuda app is running. + * See /ref nvmlDeviceSetApplicationsClocks + * + * Can be used as a setting to request constant performance. + * + * Requires root/admin permissions. + * + * After system reboot or driver reload applications clocks go back to their default value. + * See \ref nvmlDeviceResetGpuLockedClocks. + * + * For newer than Pascal &tm; fully supported devices. + * + * @param device The identifier of the target device + * @param minGpuClockMHz Requested minimum gpu clock in MHz + * @param maxGpuClockMHz Requested maximum gpu clock in MHz + * + * @return + * - \ref NVML_SUCCESS if new settings were successfully set + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a minGpuClockMHz and \a maxGpuClockMHz + * is not a valid clock combination + * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation + * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceSetGpuLockedClocks(nvmlDevice_t device, unsigned int minGpuClockMHz, unsigned int maxGpuClockMHz); + +/** + * Resets the gpu clock to the default value + * + * This is the gpu clock that will be used after system reboot or driver reload. + * Default values are idle clocks, but the current values can be changed using \ref nvmlDeviceSetApplicationsClocks. + * + * @see nvmlDeviceSetGpuLockedClocks + * + * For newer than Pascal &tm; fully supported devices. + * + * @param device The identifier of the target device + * + * @return + * - \ref NVML_SUCCESS if new settings were successfully set + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid + * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceResetGpuLockedClocks(nvmlDevice_t device); + +/** * Set clocks that applications will lock to. * * Sets the clocks that compute and graphics applications will be running at. - * e.g. CUDA driver requests these clocks during context creation which means this property + * e.g. CUDA driver requests these clocks during context creation which means this property * defines clocks at which CUDA applications will be running unless some overspec event * occurs (e.g. over power, over thermal or external HW brake). * @@ -4212,9 +4568,9 @@ nvmlReturn_t DECLDIR nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverMod * above the clock value being set. * * For Kepler &tm; or newer non-GeForce fully supported devices and Maxwell or newer GeForce devices. - * Requires root/admin permissions. + * Requires root/admin permissions. * - * See \ref nvmlDeviceGetSupportedMemoryClocks and \ref nvmlDeviceGetSupportedGraphicsClocks + * See \ref nvmlDeviceGetSupportedMemoryClocks and \ref nvmlDeviceGetSupportedGraphicsClocks * for details on how to list available clocks combinations. * * After system reboot or driver reload applications clocks go back to their default value. @@ -4223,13 +4579,13 @@ nvmlReturn_t DECLDIR nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverMod * @param device The identifier of the target device * @param memClockMHz Requested memory clock in MHz * @param graphicsClockMHz Requested graphics clock in MHz - * - * @return + * + * @return * - \ref NVML_SUCCESS if new settings were successfully set * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memClockMHz and \a graphicsClockMHz + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memClockMHz and \a graphicsClockMHz * is not a valid clock combination - * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation + * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible * - \ref NVML_ERROR_UNKNOWN on any unexpected error @@ -4826,6 +5182,9 @@ nvmlReturn_t DECLDIR nvmlDeviceQueryDrainState (nvmlPciInfo_t *pciInfo, nvmlEnab * Some Kepler devices supported. * * @param pciInfo The PCI address of the GPU to be removed + * @param gpuState Whether the GPU is to be removed, from the OS + * see \ref nvmlDetachGpuState_t + * @param linkState Requested upstream PCIe link state, see \ref nvmlPcieLinkState_t * * @return * - \ref NVML_SUCCESS if counters were successfully reset @@ -4834,7 +5193,7 @@ nvmlReturn_t DECLDIR nvmlDeviceQueryDrainState (nvmlPciInfo_t *pciInfo, nvmlEnab * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature * - \ref NVML_ERROR_IN_USE if the device is still in use and cannot be removed */ -nvmlReturn_t DECLDIR nvmlDeviceRemoveGpu (nvmlPciInfo_t *pciInfo); +nvmlReturn_t DECLDIR nvmlDeviceRemoveGpu (nvmlPciInfo_t *pciInfo, nvmlDetachGpuState_t gpuState, nvmlPcieLinkState_t linkState); /** * Request the OS and the NVIDIA kernel driver to rediscover a portion of the PCI subsystem looking for GPUs that @@ -5155,7 +5514,7 @@ nvmlReturn_t DECLDIR nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char *v * - \ref NVML_SUCCESS successful completion * - \ref NVML_ERROR_NOT_SUPPORTED if frame rate limiter is turned off for the vGPU type * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a frameRateLimit is NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a frameRateLimit is NULL * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int *frameRateLimit); @@ -5179,6 +5538,21 @@ nvmlReturn_t DECLDIR nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, nvmlReturn_t DECLDIR nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int *vgpuInstanceCount); /** + * Retrieve the maximum number of vGPU instances supported per VM for given vGPU type + * + * For Kepler &tm; or newer fully supported devices. + * + * @param vgpuTypeId Handle to vGPU type + * @param vgpuInstanceCountPerVm Pointer to get the max number of vGPU instances supported per VM for given \a vgpuTypeId + * @return + * - \ref NVML_SUCCESS successful completion + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a vgpuInstanceCountPerVm is NULL + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlVgpuTypeGetMaxInstancesPerVm(nvmlVgpuTypeId_t vgpuTypeId, unsigned int *vgpuInstanceCountPerVm); + +/** * Retrieve the active vGPU instances on a device. * * An array of active vGPU instances is returned in the caller-supplied buffer pointed at by \a vgpuInstances. The @@ -5225,7 +5599,8 @@ nvmlReturn_t DECLDIR nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int * @return * - \ref NVML_SUCCESS successful completion * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a vmId or \a vmIdType are NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vmId or \a vmIdType is NULL, or \a vgpuInstance is 0 + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ @@ -5247,7 +5622,8 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, ch * @return * - \ref NVML_SUCCESS successful completion * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a uuid is NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a uuid is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ @@ -5273,7 +5649,8 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, ch * @return * - \ref NVML_SUCCESS if \a version has been set * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0 + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ @@ -5292,7 +5669,8 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuI * @return * - \ref NVML_SUCCESS successful completion * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a fbUsage is NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a fbUsage is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long *fbUsage); @@ -5310,7 +5688,8 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, * @return * - \ref NVML_SUCCESS if \a licensed has been set * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a licensed is NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a licensed is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int *licensed); @@ -5328,7 +5707,8 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuIns * @return * - \ref NVML_SUCCESS if \a vgpuTypeId has been set * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a vgpuTypeId is NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a vgpuTypeId is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t *vgpuTypeId); @@ -5347,13 +5727,14 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nv * - \ref NVML_SUCCESS if \a frameRateLimit has been set * - \ref NVML_ERROR_NOT_SUPPORTED if frame rate limiter is turned off for the vGPU type * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a frameRateLimit is NULL + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a frameRateLimit is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int *frameRateLimit); /** - * Retrieve the encoder Capacity of a vGPU instance, in macroblocks per second. + * Retrieve the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100. * * For Maxwell &tm; or newer fully supported devices. * @@ -5363,13 +5744,14 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuIn * @return * - \ref NVML_SUCCESS if \a encoderCapacity has been retrived * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a encoderQueryType is invalid + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a encoderQueryType is invalid + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int *encoderCapacity); /** - * Set the encoder Capacity of a vGPU instance, in macroblocks per second. + * Set the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100. * * For Maxwell &tm; or newer fully supported devices. * @@ -5379,7 +5761,8 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuI * @return * - \ref NVML_SUCCESS if \a encoderCapacity has been set * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a encoderCapacity is out of range of 0-100. + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity); @@ -5509,7 +5892,8 @@ nvmlReturn_t DECLDIR nvmlDeviceGetGridLicensableFeatures(nvmlDevice_t device, nv * - \ref NVML_SUCCESS if \a sessionCount, \a averageFps and \a averageLatency is fetched * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount , or \a averageFps or \a averageLatency is NULL - * or \a vgpuInstance is invalid. + * or \a vgpuInstance is 0. + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int *sessionCount, @@ -5519,7 +5903,7 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInst * Retrieves information about all active encoder sessions on a vGPU Instance. * * An array of active encoder sessions is returned in the caller-supplied buffer pointed at by \a sessionInfo. The - * array elememt count is passed in \a sessionCount, and \a sessionCount is used to return the number of sessions + * array element count is passed in \a sessionCount, and \a sessionCount is used to return the number of sessions * written to the buffer. * * If the supplied buffer is not large enough to accomodate the active session array, the function returns @@ -5540,12 +5924,61 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInst * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a sessionCount is too small, array element count is returned in \a sessionCount - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount is NULL or \a vgpuInstance is invalid.. + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount is NULL, or \a vgpuInstance is 0. + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system * - \ref NVML_ERROR_UNKNOWN on any unexpected error */ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int *sessionCount, nvmlEncoderSessionInfo_t *sessionInfo); /** +* Retrieves the active frame buffer capture sessions statistics of a vGPU Instance +* +* For Maxwell &tm; or newer fully supported devices. +* +* @param vgpuInstance Identifier of the target vGPU instance +* @param fbcStats Reference to nvmlFBCStats_t structure contianing NvFBC stats +* +* @return +* - \ref NVML_SUCCESS if \a fbcStats is fetched +* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized +* - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a fbcStats is NULL +* - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system +* - \ref NVML_ERROR_UNKNOWN on any unexpected error +*/ +nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance, nvmlFBCStats_t *fbcStats); + +/** +* Retrieves information about active frame buffer capture sessions on a vGPU Instance. +* +* An array of active FBC sessions is returned in the caller-supplied buffer pointed at by \a sessionInfo. The +* array element count is passed in \a sessionCount, and \a sessionCount is used to return the number of sessions +* written to the buffer. +* +* If the supplied buffer is not large enough to accomodate the active session array, the function returns +* NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlFBCSessionInfo_t array required in \a sessionCount. +* To query the number of active FBC sessions, call this function with *sessionCount = 0. The code will return +* NVML_SUCCESS with number of active FBC sessions updated in *sessionCount. +* +* For Maxwell &tm; or newer fully supported devices. +* +* @note hResolution, vResolution, averageFPS and averageLatency data for a FBC session returned in \a sessionInfo may +* be zero if there are no new frames captured since the session started. +* +* @param vgpuInstance Identifier of the target vGPU instance +* @param sessionCount Reference to caller supplied array size, and returns the number of sessions. +* @param sessionInfo Reference in which to return the session information +* +* @return +* - \ref NVML_SUCCESS if \a sessionInfo is fetched +* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized +* - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a sessionCount is NULL. +* - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system +* - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a sessionCount is too small, array element count is returned in \a sessionCount +* - \ref NVML_ERROR_UNKNOWN on any unexpected error +*/ +nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFBCSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int *sessionCount, nvmlFBCSessionInfo_t *sessionInfo); + +/** * Retrieves the current utilization and process ID * * For Maxwell &tm; or newer fully supported devices. @@ -5585,12 +6018,345 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuI nvmlReturn_t DECLDIR nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t *utilization, unsigned int *processSamplesCount, unsigned long long lastSeenTimeStamp); +/** + * Queries the state of per process accounting mode on vGPU. + * + * For Maxwell &tm; or newer fully supported devices. + * + * @param vgpuInstance The identifier of the target vGPU VM + * @param mode Reference in which to return the current accounting mode + * + * @return + * - \ref NVML_SUCCESS if the mode has been successfully retrieved + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a mode is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system + * - \ref NVML_ERROR_NOT_SUPPORTED if the vGPU doesn't support this feature + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlVgpuInstanceGetAccountingMode(nvmlVgpuInstance_t vgpuInstance, nvmlEnableState_t *mode); + +/** + * Queries list of processes running on vGPU that can be queried for accounting stats. The list of processes + * returned can be in running or terminated state. + * + * For Maxwell &tm; or newer fully supported devices. + * + * To just query the maximum number of processes that can be queried, call this function with *count = 0 and + * pids=NULL. The return code will be NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if list is empty. + * + * For more details see \ref nvmlVgpuInstanceGetAccountingStats. + * + * @note In case of PID collision some processes might not be accessible before the circular buffer is full. + * + * @param vgpuInstance The identifier of the target vGPU VM + * @param count Reference in which to provide the \a pids array size, and + * to return the number of elements ready to be queried + * @param pids Reference in which to return list of process ids + * + * @return + * - \ref NVML_SUCCESS if pids were successfully retrieved + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a count is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system + * - \ref NVML_ERROR_NOT_SUPPORTED if the vGPU doesn't support this feature or accounting mode is disabled + * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a count is too small (\a count is set to expected value) + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + * + * @see nvmlVgpuInstanceGetAccountingPids + */ +nvmlReturn_t DECLDIR nvmlVgpuInstanceGetAccountingPids(nvmlVgpuInstance_t vgpuInstance, unsigned int *count, unsigned int *pids); + +/** + * Queries process's accounting stats. + * + * For Maxwell &tm; or newer fully supported devices. + * + * Accounting stats capture GPU utilization and other statistics across the lifetime of a process, and + * can be queried during life time of the process or after its termination. + * The time field in \ref nvmlAccountingStats_t is reported as 0 during the lifetime of the process and + * updated to actual running time after its termination. + * Accounting stats are kept in a circular buffer, newly created processes overwrite information about old + * processes. + * + * See \ref nvmlAccountingStats_t for description of each returned metric. + * List of processes that can be queried can be retrieved from \ref nvmlVgpuInstanceGetAccountingPids. + * + * @note Accounting Mode needs to be on. See \ref nvmlVgpuInstanceGetAccountingMode. + * @note Only compute and graphics applications stats can be queried. Monitoring applications stats can't be + * queried since they don't contribute to GPU utilization. + * @note In case of pid collision stats of only the latest process (that terminated last) will be reported + * + * @param vgpuInstance The identifier of the target vGPU VM + * @param pid Process Id of the target process to query stats for + * @param stats Reference in which to return the process's accounting stats + * + * @return + * - \ref NVML_SUCCESS if stats have been successfully retrieved + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is 0, or \a stats is NULL + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system + * or \a stats is not found + * - \ref NVML_ERROR_NOT_SUPPORTED if the vGPU doesn't support this feature or accounting mode is disabled + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlVgpuInstanceGetAccountingStats(nvmlVgpuInstance_t vgpuInstance, unsigned int pid, nvmlAccountingStats_t *stats); + +/** @} */ + +/***************************************************************************************************/ +/** @defgroup nvml vGPU Migration + * This chapter describes NVML operations that are associated with vGPU Migration. + * @{ + */ +/***************************************************************************************************/ + +/** + * Structure representing a range of vGPU version + */ +typedef struct nvmlVgpuVersion_st +{ + unsigned int minVersion; //!< Minimum vGPU version. + unsigned int maxVersion; //!< Maximum vGPU version. +} nvmlVgpuVersion_t; + +/** + * vGPU metadata structure. + */ +typedef struct nvmlVgpuMetadata_st +{ + unsigned int version; //!< Current version of the structure + unsigned int revision; //!< Current revision of the structure + nvmlVgpuGuestInfoState_t guestInfoState; //!< Current state of Guest-dependent fields + char guestDriverVersion[NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE]; //!< Version of driver installed in guest + char hostDriverVersion[NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE]; //!< Version of driver installed in host + unsigned int reserved[7]; //!< Reserved for internal use + unsigned int guestVgpuVersion; //!< vGPU version of guest driver + unsigned int opaqueDataSize; //!< Size of opaque data field in bytes + char opaqueData[4]; //!< Opaque data +} nvmlVgpuMetadata_t; + +/** + * Physical GPU metadata structure + */ +typedef struct nvmlVgpuPgpuMetadata_st +{ + unsigned int version; //!< Current version of the structure + unsigned int revision; //!< Current revision of the structure + char hostDriverVersion[NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE]; //!< Host driver version + unsigned int pgpuVirtualizationCaps; //!< Pgpu virtualizaion capabilities bitfileld + unsigned int reserved[5]; //!< Reserved for internal use + nvmlVgpuVersion_t hostSupportedVgpuRange; //!< vGPU version range supported by host driver + unsigned int opaqueDataSize; //!< Size of opaque data field in bytes + char opaqueData[4]; //!< Opaque data +} nvmlVgpuPgpuMetadata_t; + +/** + * vGPU VM compatibility codes + */ +typedef enum nvmlVgpuVmCompatibility_enum +{ + NVML_VGPU_VM_COMPATIBILITY_NONE = 0x0, //!< vGPU is not runnable + NVML_VGPU_VM_COMPATIBILITY_COLD = 0x1, //!< vGPU is runnable from a cold / powered-off state (ACPI S5) + NVML_VGPU_VM_COMPATIBILITY_HIBERNATE = 0x2, //!< vGPU is runnable from a hibernated state (ACPI S4) + NVML_VGPU_VM_COMPATIBILITY_SLEEP = 0x4, //!< vGPU is runnable from a sleeped state (ACPI S3) + NVML_VGPU_VM_COMPATIBILITY_LIVE = 0x8, //!< vGPU is runnable from a live/paused (ACPI S0) +} nvmlVgpuVmCompatibility_t; + +/** + * vGPU-pGPU compatibility limit codes + */ +typedef enum nvmlVgpuPgpuCompatibilityLimitCode_enum +{ + NVML_VGPU_COMPATIBILITY_LIMIT_NONE = 0x0, //!< Compatibility is not limited. + NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER = 0x1, //!< ompatibility is limited by host driver version. + NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER = 0x2, //!< Compatibility is limited by guest driver version. + NVML_VGPU_COMPATIBILITY_LIMIT_GPU = 0x4, //!< Compatibility is limited by GPU hardware. + NVML_VGPU_COMPATIBILITY_LIMIT_OTHER = 0x80000000, //!< Compatibility is limited by an undefined factor. +} nvmlVgpuPgpuCompatibilityLimitCode_t; + +/** + * vGPU-pGPU compatibility structure + */ +typedef struct nvmlVgpuPgpuCompatibility_st +{ + nvmlVgpuVmCompatibility_t vgpuVmCompatibility; //!< Compatibility of vGPU VM. See \ref nvmlVgpuVmCompatibility_t + nvmlVgpuPgpuCompatibilityLimitCode_t compatibilityLimitCode; //!< Limiting factor for vGPU-pGPU compatibility. See \ref nvmlVgpuPgpuCompatibilityLimitCode_t +} nvmlVgpuPgpuCompatibility_t; + +/** + * Returns vGPU metadata structure for a running vGPU. The structure contains information about the vGPU and its associated VM + * such as the currently installed NVIDIA guest driver version, together with host driver version and an opaque data section + * containing internal state. + * + * nvmlVgpuInstanceGetMetadata() may be called at any time for a vGPU instance. Some fields in the returned structure are + * dependent on information obtained from the guest VM, which may not yet have reached a state where that information + * is available. The current state of these dependent fields is reflected in the info structure's \ref guestInfoState field. + * + * The VMM may choose to read and save the vGPU's VM info as persistent metadata associated with the VM, and provide + * it to GRID Virtual GPU Manager when creating a vGPU for subsequent instances of the VM. + * + * The caller passes in a buffer via \a vgpuMetadata, with the size of the buffer in \a bufferSize. If the vGPU Metadata structure + * is too large to fit in the supplied buffer, the function returns NVML_ERROR_INSUFFICIENT_SIZE with the size needed + * in \a bufferSize. + * + * @param vgpuInstance vGPU instance handle + * @param vgpuMetadata Pointer to caller-supplied buffer into which vGPU metadata is written + * @param bufferSize Size of vgpuMetadata buffer + * + * @return + * - \ref NVML_SUCCESS vGPU metadata structure was successfully returned + * - \ref NVML_ERROR_INSUFFICIENT_SIZE vgpuMetadata buffer is too small, required size is returned in \a bufferSize + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a bufferSize is NULL or \a vgpuInstance is 0; if \a vgpuMetadata is NULL and the value of \a bufferSize is not 0. + * - \ref NVML_ERROR_NOT_FOUND if \a vgpuInstance does not match a valid active vGPU instance on the system + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlVgpuInstanceGetMetadata(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuMetadata_t *vgpuMetadata, unsigned int *bufferSize); + +/** + * Returns a vGPU metadata structure for the physical GPU indicated by \a device. The structure contains information about + * the GPU and the currently installed NVIDIA host driver version that's controlling it, together with an opaque data section + * containing internal state. + * + * The caller passes in a buffer via \a pgpuMetadata, with the size of the buffer in \a bufferSize. If the \a pgpuMetadata + * structure is too large to fit in the supplied buffer, the function returns NVML_ERROR_INSUFFICIENT_SIZE with the size needed + * in \a bufferSize. + * + * @param device The identifier of the target device + * @param pgpuMetadata Pointer to caller-supplied buffer into which \a pgpuMetadata is written + * @param bufferSize Pointer to size of \a pgpuMetadata buffer + * + * @return + * - \ref NVML_SUCCESS GPU metadata structure was successfully returned + * - \ref NVML_ERROR_INSUFFICIENT_SIZE pgpuMetadata buffer is too small, required size is returned in \a bufferSize + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a bufferSize is NULL or \a device is invalid; if \a pgpuMetadata is NULL and the value of \a bufferSize is not 0. + * - \ref NVML_ERROR_NOT_SUPPORTED vGPU is not supported by the system + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetVgpuMetadata(nvmlDevice_t device, nvmlVgpuPgpuMetadata_t *pgpuMetadata, unsigned int *bufferSize); + +/** + * Takes a vGPU instance metadata structure read from \ref nvmlVgpuInstanceGetMetadata(), and a vGPU metadata structure for a + * physical GPU read from \ref nvmlDeviceGetVgpuMetadata(), and returns compatibility information of the vGPU instance and the + * physical GPU. + * + * The caller passes in a buffer via \a compatibilityInfo, into which a compatibility information structure is written. The + * structure defines the states in which the vGPU / VM may be booted on the physical GPU. If the vGPU / VM compatibility + * with the physical GPU is limited, a limit code indicates the factor limiting compability. + * (see \ref nvmlVgpuPgpuCompatibilityLimitCode_t for details). + * + * Note: vGPU compatibility does not take into account dynamic capacity conditions that may limit a system's ability to + * boot a given vGPU or associated VM. + * + * @param vgpuMetadata Pointer to caller-supplied vGPU metadata structure + * @param pgpuMetadata Pointer to caller-supplied GPU metadata structure + * @param compatibilityInfo Pointer to caller-supplied buffer to hold compatibility info + * + * @return + * - \ref NVML_SUCCESS vGPU metadata structure was successfully returned + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuMetadata or \a pgpuMetadata or \a bufferSize are NULL + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlGetVgpuCompatibility(nvmlVgpuMetadata_t *vgpuMetadata, nvmlVgpuPgpuMetadata_t *pgpuMetadata, nvmlVgpuPgpuCompatibility_t *compatibilityInfo); + +/** + * Returns the following two version range structures \ref nvmlVgpuVersion_t : + * 1. \a supported : structure representing the range of vGPU versions supported by the host; + * 2. \a current : structure representing the range of supported versions enforced by the caller via \ref nvmlSetVgpuVersion(). + * + * The caller pass in the pointer to the structures, into which the compatible ranges are written. + * + * @note: 1. The guest driver will fail to load if the version is below the range returned in the \a current structure. + * 2. If the guest driver is above the range, it will be downgraded to the current structure maximum version. + * + * @param supported Pointer to caller-supplied structure into which the supported vGPU version range is returned + * @param current Pointer to caller-supplied structure into which the caller enforced supported vGPU version range is returned. + * + * @return + * - \ref NVML_SUCCESS vGPU version range structure was successfully returned + * - \ref NVML_ERROR_NOT_SUPPORTED API not supported + * - \ref NVML_ERROR_UNKNOWN Error while getting the data + */ +nvmlReturn_t DECLDIR nvmlGetVgpuVersion(nvmlVgpuVersion_t *supported, nvmlVgpuVersion_t *current); + +/** + * Takes a vGPU version range structure \ref nvmlVgpuVersion_t and set the vGPU compatible version range to the one provided as input. + * The caller should call the \ref nvmlGetVgpuVersion() to get the range of supported version by the host driver. + * + * @note: 1. The guest driver will fail to load if the version is below the range set via \a vgpuVersion structure. + * 2. If the guest driver is above the range, it will be downgraded to the \a vgpuVersion structure maximum version. + * 3. This will result error if there are VMs already active on the host or the supported range being set is outside the range supported by host driver. + * + * @param vgpuVersion Pointer to caller-supplied vGPU supported version range. + * + * @return + * - \ref NVML_SUCCESS vGPU metadata structure was successfully returned + * - \ref NVML_ERROR_NOT_SUPPORTED API not supported + * - \ref NVML_ERROR_IN_USE Range not set as VM is running on the host + * - \ref NVML_ERROR_INVALID_ARGUMENT Range being set is outside the range supported by host driver + */ +nvmlReturn_t DECLDIR nvmlSetVgpuVersion(nvmlVgpuVersion_t *vgpuVersion); + +/** @} */ + +/***************************************************************************************************/ +/** @defgroup nvmlGpuBlacklistQueries GPU Blacklist Queries + * This chapter describes NVML operations that are associated with blacklisted GPUs. + * @{ + */ +/***************************************************************************************************/ + +/** + * Blacklist GPU device information + **/ +typedef struct nvmlBlacklistDeviceInfo_st +{ + nvmlPciInfo_t pciInfo; //!< The PCI information for the blacklisted GPU + char uuid[NVML_DEVICE_UUID_BUFFER_SIZE]; //!< The ASCII string UUID for the blacklisted GPU +} nvmlBlacklistDeviceInfo_t; + + /** + * Retrieves the number of blacklisted GPU devices in the system. + * + * For all products. + * + * @param deviceCount Reference in which to return the number of blacklisted devices + * + * @return + * - \ref NVML_SUCCESS if \a deviceCount has been set + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a deviceCount is NULL + */ +nvmlReturn_t DECLDIR nvmlGetBlacklistDeviceCount(unsigned int *deviceCount); + +/** + * Acquire the device information for a blacklisted device, based on its index. + * + * For all products. + * + * Valid indices are derived from the \a deviceCount returned by + * \ref nvmlGetBlacklistDeviceCount(). For example, if \a deviceCount is 2 the valid indices + * are 0 and 1, corresponding to GPU 0 and GPU 1. + * + * @param index The index of the target GPU, >= 0 and < \a deviceCount + * @param info Reference in which to return the device information + * + * @return + * - \ref NVML_SUCCESS if \a device has been set + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a index is invalid or \a info is NULL + * + * @see nvmlGetBlacklistDeviceCount + */ +nvmlReturn_t DECLDIR nvmlGetBlacklistDeviceInfoByIndex(unsigned int index, nvmlBlacklistDeviceInfo_t *info); + /** @} */ /** * NVML API versioning support */ #if defined(__NVML_API_VERSION_INTERNAL) +#undef nvmlDeviceGetGridLicensableFeatures +#undef nvmlDeviceRemoveGpu +#undef nvmlDeviceGetNvLinkRemotePciInfo #undef nvmlDeviceGetPciInfo #undef nvmlDeviceGetCount #undef nvmlDeviceGetHandleByIndex diff --git a/src/version.h b/src/version.h index 7a7d88e..3e3ef01 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define NVIDIA_VERSION "410.73" +#define NVIDIA_VERSION "415.13" diff --git a/src/version.mk b/src/version.mk index 0032b02..da40957 100644 --- a/src/version.mk +++ b/src/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 410.73 +NVIDIA_VERSION = 415.13 @@ -1 +1 @@ -NVIDIA_VERSION = 410.73 +NVIDIA_VERSION = 415.13 |