diff options
-rw-r--r-- | doc/version.mk | 2 | ||||
-rw-r--r-- | samples/Makefile | 1 | ||||
-rw-r--r-- | samples/README | 5 | ||||
-rw-r--r-- | samples/nv-control-gvi.c | 873 | ||||
-rw-r--r-- | samples/nv-control-warpblend.h | 4 | ||||
-rw-r--r-- | samples/src.mk | 3 | ||||
-rw-r--r-- | samples/version.mk | 2 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkappprofile.c | 18 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkconfig.h | 7 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig-utils.c | 7 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig-utils.h | 2 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig.c | 24 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplaydevice.c | 10 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkslimm.c | 22 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkvdpau.c | 12 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkwindow.c | 61 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkwindow.h | 5 | ||||
-rw-r--r-- | src/libXNVCtrl/version.mk | 2 | ||||
-rw-r--r-- | src/libXNVCtrlAttributes/NvCtrlAttributesNvml.c | 2 | ||||
-rw-r--r-- | src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h | 2 | ||||
-rw-r--r-- | src/nvml.h | 805 | ||||
-rw-r--r-- | src/version.h | 2 | ||||
-rw-r--r-- | src/version.mk | 2 | ||||
-rw-r--r-- | version.mk | 2 |
24 files changed, 591 insertions, 1284 deletions
diff --git a/doc/version.mk b/doc/version.mk index a566622..93af950 100644 --- a/doc/version.mk +++ b/doc/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 435.21 +NVIDIA_VERSION = 440.26 diff --git a/samples/Makefile b/samples/Makefile index 3da3580..e9c52fc 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -60,7 +60,6 @@ SAMPLE_SOURCES += nv-control-events.c SAMPLE_SOURCES += nv-control-dpy.c SAMPLE_SOURCES += nv-control-targets.c SAMPLE_SOURCES += nv-control-framelock.c -SAMPLE_SOURCES += nv-control-gvi.c SAMPLE_SOURCES += nv-control-3dvisionpro.c SAMPLE_SOURCES += nv-control-warpblend.c diff --git a/samples/README b/samples/README index 4709166..67bfb47 100644 --- a/samples/README +++ b/samples/README @@ -33,8 +33,3 @@ Sample applications: nv-control-framelock: Demonstrates how to query frame lock related attributes. Also demonstrates how to enable/ disable frame lock. - - nv-control-gvi: Demonstrates how to interact with the Graphics-to- - Video-In (GVI) capabilities of a GVI target via - NV-CONTROL. - diff --git a/samples/nv-control-gvi.c b/samples/nv-control-gvi.c deleted file mode 100644 index 7b12b3c..0000000 --- a/samples/nv-control-gvi.c +++ /dev/null @@ -1,873 +0,0 @@ -/* - * Copyright (c) 2006-2007 NVIDIA, Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -/* - * nv-control-gvi.c - NV-CONTROL client that demonstrates how to - * interact with the GVI capabilities on an X Server. - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <X11/Xlib.h> - -#include "NVCtrl.h" -#include "NVCtrlLib.h" - - -/* Used to stringify NV_CTRL_XXX #defines */ - -#define ADD_NVCTRL_CASE(FMT) \ -case (FMT): \ - return #FMT; - - -/* - * Decode provided signal format. - */ - -static char *VideoFormatName(int value) -{ - switch(value) { - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_NONE); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_59_94_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_60_00_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1035I_59_94_SMPTE260); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1035I_60_00_SMPTE260); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_50_00_SMPTE295); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_50_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_59_94_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_60_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_23_976_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_24_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_25_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_29_97_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_30_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_50_00_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_48_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_47_96_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_30_00_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_29_97_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_25_00_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_24_00_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_720P_23_98_SMPTE296); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_25_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_29_97_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_30_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_24_00_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080PSF_23_98_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_30_00_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_29_97_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_60_00_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_59_94_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_25_00_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_50_00_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_24_00_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_23_98_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_48_00_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_47_96_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_50_00_3G_LEVEL_A_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_59_94_3G_LEVEL_A_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_60_00_3G_LEVEL_A_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_60_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_60_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_60_00_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_50_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_50_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_50_00_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_30_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_30_00_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_25_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_25_00_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_24_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_24_00_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_48_00_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_48_00_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_59_94_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_59_94_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_59_94_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_29_97_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_29_97_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080P_23_98_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048P_23_98_3G_LEVEL_B_SMPTE372); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_1080I_47_96_3G_LEVEL_B_SMPTE274); - ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_2048I_47_96_3G_LEVEL_B_SMPTE372); - default: - return "Invalid Value"; - } -} - -static const char *SamplingName(int value) -{ - switch (value) { - ADD_NVCTRL_CASE(NV_CTRL_GVI_COMPONENT_SAMPLING_UNKNOWN); - ADD_NVCTRL_CASE(NV_CTRL_GVI_COMPONENT_SAMPLING_4444); - ADD_NVCTRL_CASE(NV_CTRL_GVI_COMPONENT_SAMPLING_4224); - ADD_NVCTRL_CASE(NV_CTRL_GVI_COMPONENT_SAMPLING_444); - ADD_NVCTRL_CASE(NV_CTRL_GVI_COMPONENT_SAMPLING_422); - ADD_NVCTRL_CASE(NV_CTRL_GVI_COMPONENT_SAMPLING_420); - default: - return "Invalid Value"; - } -} - -static const char *BPCName(int value) -{ - switch (value) { - ADD_NVCTRL_CASE(NV_CTRL_GVI_BITS_PER_COMPONENT_UNKNOWN); - ADD_NVCTRL_CASE(NV_CTRL_GVI_BITS_PER_COMPONENT_8); - ADD_NVCTRL_CASE(NV_CTRL_GVI_BITS_PER_COMPONENT_10); - ADD_NVCTRL_CASE(NV_CTRL_GVI_BITS_PER_COMPONENT_12); - default: - return "Invalid Value"; - } -} - - - -/* - * do_help() - * - * Prints some help on how to use this app. - * - */ -static void do_help(void) -{ - printf("usage:\n"); - printf("-q: query system GVI information.\n"); - printf("-c <TOPOLOGY>: configure default GVI system topology.\n"); - printf("-g #: Operate on specific GVI device.\n"); - printf("-l: List GVI configuration space.\n"); - printf("\n"); - -} /* do_help()*/ - - - -/* - * do_query() - * - * Prints information for all GVI devices found on - * the given X server. - * - */ -static void do_query(Display *dpy, int use_gvi) -{ - Bool ret; - int num_gvi; - int gvi; - int last_gvi; - - int value; - int num_jacks; - int jack; - int max_channels_per_jack; - int channel; - - char *pOut; - - - /* Query the number of GVI devices on the server */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_GVI, - &num_gvi); - if (!ret) { - printf("Failed to query number of GVI devices!\n"); - return; - } - printf("Found %d GVI device(s) on server.\n", num_gvi); - if ( !num_gvi ) { - return; - } - - if (use_gvi >= 0 && use_gvi < num_gvi) { - /* Only display information about 1 GVI device/ */ - printf("Querying GVI device %d...\n", use_gvi); - gvi = use_gvi; - last_gvi = use_gvi; - } else { - /* Display all GVI devices */ - printf("Querying all GVI devices...\n"); - gvi = 0; - last_gvi = num_gvi-1; - } - - /* Display information about the GVI(s) */ - - for (; gvi <= last_gvi; gvi++) { - - printf("\n"); - printf("- GVI Board %d :\n", gvi); - - ret = XNVCTRLQueryTargetStringAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_STRING_GVIO_FIRMWARE_VERSION, - &pOut); - if (!ret) { - printf(" - Failed to query firmware version of GVI %d.\n", gvi); - continue; - } - printf(" - Firmware Version: %s\n", pOut); - XFree(pOut); - pOut = NULL; - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVI_GLOBAL_IDENTIFIER, - &value); - if (!ret) { - printf(" - Failed to query global ID of GVI %d.\n", gvi); - continue; - } - printf(" - Global ID: %d\n", value); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVI_NUM_CAPTURE_SURFACES, - &value); - if (!ret) { - printf(" - Failed to number of capture surfaces of GVI %d.\n", gvi); - continue; - } - printf(" - Number of capture surfaces: %d\n", value); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, - &value); - if (!ret) { - printf(" - Failed to query requested video format on " - "GVI %d.\n", gvi); - continue; - } - printf(" - Requested video format: %d (%s)\n", value, - VideoFormatName(value)); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVI_MAX_STREAMS, - &value); - if (!ret) { - printf(" - Failed to query max number of streams on " - "GVI %d.\n", gvi); - continue; - } - printf(" - Max number of configurable streams: %d\n", value); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVI_MAX_LINKS_PER_STREAM, - &value); - if (!ret) { - printf(" - Failed to query max number of links per stream on " - "GVI %d.\n", gvi); - continue; - } - printf(" - Max number of links per stream: %d\n", value); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVI_NUM_JACKS, - &num_jacks); - if (!ret) { - printf(" - Failed to query number of input jacks on GVI " - "%d.\n", gvi); - continue; - } - printf(" - Number of input jacks on device: %d\n", num_jacks); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_GVI_MAX_CHANNELS_PER_JACK, - &max_channels_per_jack); - if (!ret) { - printf(" - Failed to query maximum number of channels per " - "jack on GVI %d.\n", gvi); - continue; - } - printf(" - Maximum number of channels per jack on device: %d\n", - max_channels_per_jack); - - /* Display per-jack/channel information */ - - for (jack = 0; jack < num_jacks; jack++) { - printf(" - Jack %d\n", jack); - - for (channel = 0; channel < max_channels_per_jack; channel++) { - unsigned int link_definition = ((channel & 0xFFFF)<<16); - - printf(" - Channel %d\n", channel); - - link_definition |= (jack & 0xFFFF); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - link_definition, // display_mask - NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT, - &value); - if (!ret) { - printf(" - Failed to query detected video format " - "on jack %d, channel %d of GVI %d.\n", - jack, channel, gvi); - continue; - } - printf(" - Detected Video Format: %d (%s)\n", value, - VideoFormatName(value) - ); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - link_definition, // display_mask - NV_CTRL_GVI_DETECTED_CHANNEL_SMPTE352_IDENTIFIER, - &value); - if (!ret) { - printf(" - Failed to query detected SMPTE352 " - "Identifier on jack %d, channel %d of GVI %d.\n", - jack, channel, gvi); - continue; - } - printf(" - Detected SMPTE352 Identifier: 0x%08x\n", - value); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - link_definition, // display_mask - NV_CTRL_GVI_DETECTED_CHANNEL_BITS_PER_COMPONENT, - &value); - if (!ret) { - printf(" - Failed to query detected bits per " - "component on jack %d, channel %d of GVI %d.\n", - jack, channel, gvi); - continue; - } - printf(" - Detected bits per component: "); - switch (value) { - case NV_CTRL_GVI_BITS_PER_COMPONENT_8: printf("8"); break; - case NV_CTRL_GVI_BITS_PER_COMPONENT_10: printf("10"); break; - case NV_CTRL_GVI_BITS_PER_COMPONENT_12: printf("12"); break; - case NV_CTRL_GVI_BITS_PER_COMPONENT_UNKNOWN: /* Fall Through */ - default: - printf("Unknown"); - break; - } - printf("\n"); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - link_definition, // display_mask - NV_CTRL_GVI_DETECTED_CHANNEL_COMPONENT_SAMPLING, - &value); - if (!ret) { - printf(" - Failed to query detected component " - "sampling on jack %d, channel %d of GVI %d.\n", - jack, channel, gvi); - continue; - } - printf(" - Detected component sampling: "); - switch (value) { - case NV_CTRL_GVI_COMPONENT_SAMPLING_4444: printf("4:4:4:4"); break; - case NV_CTRL_GVI_COMPONENT_SAMPLING_4224: printf("4:2:2:4"); break; - case NV_CTRL_GVI_COMPONENT_SAMPLING_444: printf("4:4:4"); break; - case NV_CTRL_GVI_COMPONENT_SAMPLING_422: printf("4:2:2"); break; - case NV_CTRL_GVI_COMPONENT_SAMPLING_420: printf("4:2:0"); break; - case NV_CTRL_GVI_COMPONENT_SAMPLING_UNKNOWN: /* Fall Through */ - default: - printf("Unknown"); - break; - } - printf("\n"); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - link_definition, // display_mask - NV_CTRL_GVI_DETECTED_CHANNEL_COLOR_SPACE, - &value); - if (!ret) { - printf(" - Failed to query detected color space on " - "jack %d, channel %d of GVI %d.\n", - jack, channel, gvi); - continue; - } - printf(" - Detected color space: "); - switch (value) { - case NV_CTRL_GVI_COLOR_SPACE_GBR: printf("GBR"); break; - case NV_CTRL_GVI_COLOR_SPACE_GBRA: printf("GBRA"); break; - case NV_CTRL_GVI_COLOR_SPACE_GBRD: printf("GBRD"); break; - case NV_CTRL_GVI_COLOR_SPACE_YCBCR: printf("YCbCr"); break; - case NV_CTRL_GVI_COLOR_SPACE_YCBCRA: printf("YCbCrA"); break; - case NV_CTRL_GVI_COLOR_SPACE_YCBCRD: printf("YCbCrD"); break; - case NV_CTRL_GVI_COLOR_SPACE_UNKNOWN: /* Fall Through */ - default: - printf("Unknown"); - break; - } - printf("\n"); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - link_definition, // display_mask - NV_CTRL_GVI_DETECTED_CHANNEL_LINK_ID, - &value); - if (!ret) { - printf(" - Failed to query detected link ID on " - "jack %d, channel %d of GVI %d.\n", - jack, channel, gvi); - continue; - } - printf(" - Detected Link ID: Link %d", value); - if (value == NV_CTRL_GVI_LINK_ID_UNKNOWN) { - printf(" (Unknown)"); - } else if (value < 26) { - printf(" (Link%c)", (int)('A')+value); - } - printf("\n"); - - } /* Done querying per-channel information */ - } /* Done querying per-jack information */ - - - /* Query stream (link to jack+channel) topology */ - ret = XNVCTRLStringOperation(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS, - NULL, // pIn - &pOut); - if (!ret) { - printf(" - Failed to query stream topology configuration of " - "GVI %d.\n", gvi); - continue; - } - printf(" - Topology:\n"); - printf("\n %s\n\n", pOut ? pOut : "No streams are configured."); - - - /* Query per-stream settings */ - if (pOut) { - char *str = pOut; - int i = 0; - - while ( (str = strstr(str, "stream=")) ) - { - printf(" - Stream %d\n", i); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - i, // display_mask (stream #) - NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT, - &value); - if (!ret) { - printf(" - Failed to query requested stream bits per component " - "for stream %d of GVI %d.\n", - i, gvi); - continue; - } - printf(" - Requested bits per component: %d (%s)\n", value, - BPCName(value)); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - i, // display_mask (stream #) - NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING, - &value); - if (!ret) { - printf(" - Failed to query requested stream component sampling " - "for stream %d of GVI %d.\n", - i, gvi); - continue; - } - printf(" - Requested component sampling: %d (%s)\n", value, - SamplingName(value)); - - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - i, // display_mask (stream #) - NV_CTRL_GVI_REQUESTED_STREAM_CHROMA_EXPAND, - &value); - if (!ret) { - printf(" - Failed to query requested stream chroma expand " - "for stream %d of GVI %d.\n", - i, gvi); - continue; - } - printf(" - Requested chroma expand: %s\n", - value ? "Enabled" : "Disabled"); - - i++; - str++; - } - XFree(pOut); - pOut = NULL; - } - - } /* Done Querying information about GVI devices */ - -} /* do_query() */ - - - -static unsigned int firstbit (unsigned int mask) -{ - return mask ^ ((mask - 1) & mask); -} - -// List the configuration space of the GVI device. -static void do_listconfig(Display *dpy, int gvi) -{ - NVCTRLAttributeValidValuesRec values; - - unsigned int fmts[3]; - int i; - char *pOut = NULL; - Bool ret; - - // Assume GVI device has been configured already. - if (gvi < 0) { - gvi = 0; - } - - printf("Querying Valid Configuring Space of GVI device %d:\n\n", gvi); - - /* Query stream (link to jack+channel) topology */ - ret = XNVCTRLStringOperation(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, // target_id - 0, // display_mask - NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS, - NULL, // pIn - &pOut); - if (!ret) { - printf(" - Failed to query stream topology configuration of " - "GVI %d.\n", gvi); - return; - } - printf("- Current Topology:\n\n"); - printf(" %s\n\n", pOut ? pOut : "No streams are configured."); - if (pOut) { - XFree(pOut); - pOut = NULL; - } - - ret = XNVCTRLQueryValidTargetAttributeValues(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // display_mask - NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, - &values); - if (!ret) { - printf("- Failed to query valid video format values(1) of " - "GVI %d.\n", gvi); - return; - } - fmts[0] = values.u.bits.ints; - - ret = XNVCTRLQueryValidTargetAttributeValues(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // display_mask - NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2, - &values); - if (!ret) { - printf("- Failed to query valid video format values(2) of " - "GVI %d.\n", gvi); - return; - } - fmts[1] = values.u.bits.ints; - - ret = XNVCTRLQueryValidTargetAttributeValues(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // display_mask - NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3, - &values); - if (!ret) { - printf("- Failed to query valid video format values(3) of " - "GVI %d.\n", gvi); - return; - } - fmts[2] = values.u.bits.ints; - - - - printf("- Valid Formats (NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT): %08x\n", fmts[0]); - printf("- Valid Formats (NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2): %08x\n", fmts[1]); - printf("- Valid Formats (NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3): %08x\n", fmts[2]); - - printf("\n"); - for (i = 0; i < 3; i++) { - unsigned int fmt_list = fmts[i]; - unsigned int fmt_bit; - unsigned int fmt; - unsigned int fmt_flags; - - unsigned int bpcs; - unsigned int bpc_bit; - unsigned int bpc; - - unsigned int samplings; - unsigned int smp_bit; - unsigned int sampling; - - - while (fmt_list) { - fmt_bit = firstbit(fmt_list); - fmt_list &= (~fmt_bit); - fmt = ffs(fmt_bit) - 1 + (32*i); - - printf("\n%s", VideoFormatName(fmt)); - ret = XNVCTRLQueryTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - fmt, // display_mask - NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS, - (int *)&fmt_flags); - if (!ret) { - printf(" - Failed to query flag bits for video format for " - "GVI %d.\n", gvi); - } else if (fmt_flags == NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_NONE) { - printf(" (No flags set): \n"); - } else { - printf(" (Flags:"); - printf("%c", (fmt_flags & NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_INTERLACED) ? 'I' : '_'); - printf("%c", (fmt_flags & NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_PROGRESSIVE) ? 'P' : '_'); - printf("%c", (fmt_flags & NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_PSF) ? 'F' : '_'); - printf("%c", (fmt_flags & NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_LEVEL_A) ? 'A' : '_'); - printf("%c", (fmt_flags & NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_LEVEL_B) ? 'B' : '_'); - printf("%c", (fmt_flags & NV_CTRL_GVIO_VIDEO_FORMAT_FLAGS_3G_1080P_NO_12BPC) ? 'N' : '_'); - printf("):\n"); - } - - - // Set the video format - XNVCTRLSetTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // display_mask - NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, - fmt); - - // Get all bits per component (on first jack/channel) - ret = XNVCTRLQueryValidTargetAttributeValues(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // jack 0, channel 0 - NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT, - &values); - if (!ret) { - printf(" - Failed to query valid bits per component " - "of GVI %d.\n", gvi); - continue; - } - - bpcs = values.u.bits.ints; - while (bpcs) { - bpc_bit = firstbit(bpcs); - bpcs &= (~bpc_bit); - bpc = ffs(bpc_bit) -1; - - printf(" %s:\n", BPCName(bpc)); - - // Set the bits per component - XNVCTRLSetTargetAttribute(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // jack 0, channel 0 - NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT, - bpc); - - - // Get all component samplings (on first jack/channel) - ret = XNVCTRLQueryValidTargetAttributeValues(dpy, - NV_CTRL_TARGET_TYPE_GVI, - gvi, - 0, // display_mask - NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING, - &values); - if (!ret) { - printf(" - Failed to query valid component sampling " - "values of GVI %d.\n", gvi); - continue; - } - - samplings = values.u.bits.ints; - while (samplings) { - smp_bit = firstbit(samplings); - samplings &= (~smp_bit); - sampling = ffs(smp_bit) -1; - - printf(" %s\n", SamplingName(sampling)); - - } // All component samplings - } // Add BPC - } // All formats - } // All format lists - -} /* do_listconfig() */ - - - -static void do_configure(Display *dpy, int use_gvi, char *pIn) -{ - Bool ret; - char *pOut = NULL; - - - if (use_gvi < 0) { - use_gvi = 0; - } - - printf("Configuring GVI device %d:\n\n", use_gvi); - printf("Setting "); - if (!pIn) { - pIn = "stream=0, link0=jack0.0; " - "stream=1, link0=jack1.0; " - "stream=2, link0=jack2.0; " - "stream=3, link0=jack3.0"; - printf("default"); - } else { - printf("custom"); - } - printf(" configuration:\n\n"); - printf(" \"%s\"\n\n", pIn); - - ret = XNVCTRLStringOperation(dpy, - NV_CTRL_TARGET_TYPE_GVI, - use_gvi, // target_id - 0, // display_mask - NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS, - pIn, - &pOut); - if (!ret) { - printf(" - Failed to configure stream topology of GVI %d.\n", - use_gvi); - return; - } - printf("Topology:\n\n"); - printf(" %s\n\n", pOut ? pOut : "No streams are configured."); - if (pOut) { - XFree(pOut); - pOut = NULL; - } -} - - - -int main(int argc, char *argv[]) -{ - Display *dpy; - Bool ret; - int major, minor; - int use_gvi = -1; - int i; - char *topology_str = NULL; - - /* - * Open a display connection, and make sure the NV-CONTROL X - * extension is present on the screen we want to use. - */ - - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Cannot open display '%s'.\n", XDisplayName(NULL)); - return 1; - } - - /* Query the NV-CONTROL version */ - - ret = XNVCTRLQueryVersion(dpy, &major, &minor); - if (ret != True) { - printf("The NV-CONTROL X extension does not exist on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Print some information */ - - printf("Using NV-CONTROL extension %d.%d on %s\n\n", - major, minor, XDisplayName(NULL)); - - /* See if user wants a specific GVI device */ - - for (i = 0; i < argc; i++) { - if ((strcmp(argv[i], "-g") == 0) && ((i+1) < argc)) { - use_gvi = strtol(argv[i+1], NULL, 10); - } - if ((strcmp(argv[i], "-c") == 0) && ((i+1) < argc)) { - topology_str = argv[i+1]; - } - } - - /* Do what the user wants */ - - ret = 0; - for (i = 0; i < argc; i++) { - if (strcmp(argv[i], "-q") == 0) { - do_query(dpy, use_gvi); - ret = 1; - break; - } else if (strcmp(argv[i], "-c") == 0) { - do_configure(dpy, use_gvi, topology_str); - ret = 1; - break; - } else if (strcmp(argv[i], "-l") == 0) { - do_listconfig(dpy, use_gvi); - ret = 1; - } - } - if (!ret) { - do_help(); - } - - return 0; -} diff --git a/samples/nv-control-warpblend.h b/samples/nv-control-warpblend.h index e403db8..d8243ad 100644 --- a/samples/nv-control-warpblend.h +++ b/samples/nv-control-warpblend.h @@ -392,7 +392,7 @@ SetPixmapDataToAttribute( const char* attributeName) { Bool ret = False; - char tempName[256]; + char tempName[32]; char newAttributes[256]; // Disable the attribute on that DPY @@ -463,7 +463,7 @@ XNVCTRLSetScanoutWarping( GC pGC = NULL; char *paddedBuffer = NULL; int error = 1; - char tempName[256]; + char tempName[32]; char newAttributes[256]; // Disable warping on that DPY diff --git a/samples/src.mk b/samples/src.mk index 35743e8..6c7ef0b 100644 --- a/samples/src.mk +++ b/samples/src.mk @@ -10,7 +10,6 @@ SAMPLES_EXTRA_DIST += nv-control-3dvisionpro.c SAMPLES_EXTRA_DIST += nv-control-dpy.c SAMPLES_EXTRA_DIST += nv-control-info.c SAMPLES_EXTRA_DIST += nv-control-events.c -SAMPLES_EXTRA_DIST += nv-control-gvi.c SAMPLES_EXTRA_DIST += nv-control-targets.c SAMPLES_EXTRA_DIST += nv-control-framelock.c SAMPLES_EXTRA_DIST += nv-control-warpblend.c @@ -18,4 +17,4 @@ SAMPLES_EXTRA_DIST += nv-control-warpblend.h SAMPLES_EXTRA_DIST += nv-control-screen.h SAMPLES_EXTRA_DIST += src.mk -SAMPLES_DIST_FILES := $(SAMPLES_SRC) $(SAMPLES_EXTRA_DIST)
\ No newline at end of file +SAMPLES_DIST_FILES := $(SAMPLES_SRC) $(SAMPLES_EXTRA_DIST) diff --git a/samples/version.mk b/samples/version.mk index a566622..93af950 100644 --- a/samples/version.mk +++ b/samples/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 435.21 +NVIDIA_VERSION = 440.26 diff --git a/src/gtk+-2.x/ctkappprofile.c b/src/gtk+-2.x/ctkappprofile.c index b6253d7..ed45acf 100644 --- a/src/gtk+-2.x/ctkappprofile.c +++ b/src/gtk+-2.x/ctkappprofile.c @@ -1913,6 +1913,9 @@ static void edit_rule_dialog_save_changes(GtkWidget *widget, gpointer user_data) ctk_config_statusbar_message(ctk_app_profile->ctk_config, "Rule updated. %s", STATUSBAR_UPDATE_WARNING); + + ctk_app_profile->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_APP_PROFILES; } static void edit_rule_dialog_cancel(GtkWidget *widget, gpointer user_data) @@ -2528,6 +2531,9 @@ static void edit_profile_dialog_save_changes(GtkWidget *widget, gpointer user_da // Close the window, and re-sensitize the caller gtk_widget_set_sensitive(profile_dialog->caller, TRUE); gtk_widget_hide(profile_dialog->top_window); + + ctk_app_profile->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_APP_PROFILES; } static void edit_profile_dialog_cancel(GtkWidget *widget, gpointer user_data) @@ -3740,6 +3746,9 @@ static void app_profile_load_global_settings(CtkAppProfile *ctk_app_profile, GTK_TOGGLE_BUTTON(ctk_app_profile->enable_check_button), nv_app_profile_config_get_enabled(config)); ctk_app_profile->ctk_config->status_bar.enabled = TRUE; + + ctk_app_profile->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_WRITE_APP_PROFILES; } static void app_profile_reload(CtkAppProfile *ctk_app_profile) @@ -3802,6 +3811,9 @@ static void reload_callback(GtkWidget *widget, gpointer user_data) app_profile_reload(ctk_app_profile); ctk_config_statusbar_message(ctk_app_profile->ctk_config, "Application profile configuration reloaded from disk."); + + ctk_app_profile->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_WRITE_APP_PROFILES; } g_string_free(fatal_errors, TRUE); @@ -3919,6 +3931,9 @@ static void save_app_profile_changes_dialog_save_changes(GtkWidget *widget, gpoi ctk_config_statusbar_message(ctk_app_profile->ctk_config, "Application profile configuration saved to disk."); + + ctk_app_profile->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_WRITE_APP_PROFILES; } json_decref(dialog->updates); @@ -4404,6 +4419,9 @@ static void enabled_check_button_toggled(GtkToggleButton *toggle_button, gtk_toggle_button_get_active(toggle_button) ? "enabled" : "disabled", STATUSBAR_UPDATE_WARNING); + + ctk_app_profile->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_APP_PROFILES; } GtkWidget* ctk_app_profile_new(CtrlTarget *ctrl_target, diff --git a/src/gtk+-2.x/ctkconfig.h b/src/gtk+-2.x/ctkconfig.h index fb1a148..2fc6977 100644 --- a/src/gtk+-2.x/ctkconfig.h +++ b/src/gtk+-2.x/ctkconfig.h @@ -34,6 +34,12 @@ #include "config-file.h" +#define CTK_CONFIG_PENDING_APPLY_DISPLAY_CONFIG (1 << 0) +#define CTK_CONFIG_PENDING_WRITE_DISPLAY_CONFIG (1 << 1) +#define CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG (1 << 2) +#define CTK_CONFIG_PENDING_WRITE_APP_PROFILES (1 << 3) +#define CTK_CONFIG_PENDING_LAST_VALUE (1 << 4) + G_BEGIN_DECLS #define CTK_TYPE_CONFIG (ctk_config_get_type()) @@ -93,6 +99,7 @@ struct _CtkConfig gboolean timer_list_visible; CtrlSystem *pCtrlSystem; GList *help_data; + guint pending_config; }; struct _CtkConfigClass diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c index 47be13a..aef4909 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.c +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c @@ -4682,13 +4682,14 @@ static void xconfig_file_clicked(GtkWidget *widget, gpointer user_data) * **/ -void run_save_xconfig_dialog(SaveXConfDlg *dlg) +int run_save_xconfig_dialog(SaveXConfDlg *dlg) { void *buf; GtkTextIter buf_start, buf_end; gchar *filename = NULL; const gchar *tmp_filename; struct stat st; + int ret = 0; gint result; @@ -4754,7 +4755,7 @@ void run_save_xconfig_dialog(SaveXConfDlg *dlg) /* Save the X config file */ nv_info_msg("", "Writing X config file '%s'", filename); - save_xconfig_file(dlg, filename, (char *)buf, 0644); + ret = save_xconfig_file(dlg, filename, (char *)buf, 0644); g_free(buf); break; @@ -4766,6 +4767,8 @@ void run_save_xconfig_dialog(SaveXConfDlg *dlg) g_free(filename); + return ret; + } /* run_save_xconfig_dialog() */ diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.h b/src/gtk+-2.x/ctkdisplayconfig-utils.h index 1bc4f31..69e6217 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.h +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.h @@ -163,7 +163,7 @@ SaveXConfDlg *create_save_xconfig_dialog(GtkWidget *parent, generate_xconfig_callback xconf_gen_func, gpointer callback_data); -void run_save_xconfig_dialog(SaveXConfDlg *dlg); +int run_save_xconfig_dialog(SaveXConfDlg *dlg); G_END_DECLS diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index 620ac2f..4145e8e 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -601,6 +601,21 @@ static void consolidate_xinerama(CtkDisplayConfig *ctk_object, static void update_btn_apply(CtkDisplayConfig *ctk_object, Bool sensitive) { + /* + * Both the apply and write quit warnings are sent whenever anything changes + * in the display configuration so that the apply button is enabled. The + * apply warning is cleared when the config is applied and the button reset + * here. The save warning is cleared when the config is successfully saved. + */ + if (sensitive) { + ctk_object->ctk_config->pending_config |= + CTK_CONFIG_PENDING_APPLY_DISPLAY_CONFIG; + ctk_object->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_DISPLAY_CONFIG; + } else { + ctk_object->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_APPLY_DISPLAY_CONFIG; + } gtk_widget_set_sensitive(ctk_object->btn_apply, sensitive); } /* update_btn_apply() */ @@ -6718,7 +6733,7 @@ static void post_display_underscan_value_changed(CtkDisplayConfig *ctk_object, TRUE /* update_panning_size */); /* Enable the apply button */ - gtk_widget_set_sensitive(ctk_object->btn_apply, TRUE); + update_btn_apply(ctk_object, TRUE); } @@ -9503,7 +9518,12 @@ static void save_clicked(GtkWidget *widget, gpointer user_data) } /* Run the save dialog */ - run_save_xconfig_dialog(ctk_object->save_xconfig_dlg); + if (run_save_xconfig_dialog(ctk_object->save_xconfig_dlg)) { + + /* Config file written */ + ctk_object->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_WRITE_DISPLAY_CONFIG; + } } /* save_clicked() */ diff --git a/src/gtk+-2.x/ctkdisplaydevice.c b/src/gtk+-2.x/ctkdisplaydevice.c index 1d14402..86ee2fa 100644 --- a/src/gtk+-2.x/ctkdisplaydevice.c +++ b/src/gtk+-2.x/ctkdisplaydevice.c @@ -736,7 +736,7 @@ static gboolean update_link_info(InfoEntry *entry) ReturnStatus ret; gint val; const char *link; - char tmp[32]; + char tmp[64]; ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_FLATPANEL_LINK, &val); if (ret != NvCtrlSuccess) { @@ -759,11 +759,13 @@ static gboolean update_link_info(InfoEntry *entry) } if (val > 0) { - snprintf(tmp, 32, "%d lane%s @ %.2f Gbps", lanes, lanes == 1 ? "" : "s", + snprintf(tmp, sizeof(tmp), + "%d lane%s @ %.2f Gbps", lanes, lanes == 1 ? "" : "s", val * 0.27); } else { - snprintf(tmp, 32, "%d lane%s @ unknown bandwidth", lanes, - lanes == 1 ? "" : "s"); + snprintf(tmp, sizeof(tmp), + "%d lane%s @ unknown bandwidth", + lanes, lanes == 1 ? "" : "s"); } link = tmp; } diff --git a/src/gtk+-2.x/ctkslimm.c b/src/gtk+-2.x/ctkslimm.c index 843d6dc..1f8a767 100644 --- a/src/gtk+-2.x/ctkslimm.c +++ b/src/gtk+-2.x/ctkslimm.c @@ -327,7 +327,12 @@ static void save_xconfig_button_clicked(GtkWidget *widget, gpointer user_data) /* Run the save dialog */ - run_save_xconfig_dialog(ctk_object->save_xconfig_dlg); + if (run_save_xconfig_dialog(ctk_object->save_xconfig_dlg)) { + + /* Config file written */ + ctk_object->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG; + } } @@ -337,6 +342,9 @@ static void txt_overlap_activated(GtkWidget *widget, gpointer user_data) CtkSLIMM *ctk_object = CTK_SLIMM(user_data); /* Update total size label */ setup_total_size_label(ctk_object); + + ctk_object->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG; } static void display_config_changed(GtkWidget *widget, gpointer user_data) @@ -361,6 +369,9 @@ static void display_refresh_changed(GtkWidget *widget, gpointer user_data) /* Select the new modeline as current modeline */ ctk_object->cur_modeline = ctk_object->refresh_table[idx]; + + ctk_object->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG; } @@ -400,6 +411,9 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) /* Regenerate the refresh menu */ setup_display_refresh_dropdown(ctk_object); + + ctk_object->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG; } @@ -430,6 +444,9 @@ static void slimm_checkbox_toggled(GtkWidget *widget, gpointer user_data) gtk_widget_set_sensitive(ctk_object->spbtn_vedge_overlap, False); gtk_widget_set_sensitive(ctk_object->box_total_size, False); } + + ctk_object->ctk_config->pending_config |= + CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG; } @@ -1721,6 +1738,9 @@ GtkWidget* ctk_slimm_new(CtrlTarget *ctrl_target, (gpointer) ctk_slimm); } + ctk_object->ctk_config->pending_config &= + ~CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG; + free(sli_mode); gtk_widget_show_all(GTK_WIDGET(object)); diff --git a/src/gtk+-2.x/ctkvdpau.c b/src/gtk+-2.x/ctkvdpau.c index 64f2d28..2f120f0 100644 --- a/src/gtk+-2.x/ctkvdpau.c +++ b/src/gtk+-2.x/ctkvdpau.c @@ -190,6 +190,12 @@ static int queryBaseInfo(CtkVDPAU *ctk_vdpau, VdpDevice device, {"HEVC", VDP_DECODER_PROFILE_HEVC_MAIN_STILL, 0x80}, {"HEVC", VDP_DECODER_PROFILE_HEVC_MAIN_12, 0x80}, {"HEVC", VDP_DECODER_PROFILE_HEVC_MAIN_444, 0x80}, +#ifdef VDP_DECODER_PROFILE_VP9_PROFILE_0 + {"VP9", VDP_DECODER_PROFILE_VP9_PROFILE_0, 0x100}, + {"VP9", VDP_DECODER_PROFILE_VP9_PROFILE_1, 0x100}, + {"VP9", VDP_DECODER_PROFILE_VP9_PROFILE_2, 0x100}, + {"VP9", VDP_DECODER_PROFILE_VP9_PROFILE_3, 0x100}, +#endif }; const size_t decoder_list_count = sizeof(decoder_list)/sizeof(Desc); @@ -520,6 +526,12 @@ static int queryDecoderCaps(CtkVDPAU *ctk_vdpau, VdpDevice device, {"HEVC Main Still Picture", VDP_DECODER_PROFILE_HEVC_MAIN_STILL, 0}, {"HEVC Main 12", VDP_DECODER_PROFILE_HEVC_MAIN_12, 0}, {"HEVC Main 4:4:4", VDP_DECODER_PROFILE_HEVC_MAIN_444, 0}, +#ifdef VDP_DECODER_PROFILE_VP9_PROFILE_0 + {"VP9 PROFILE 0", VDP_DECODER_PROFILE_VP9_PROFILE_0, 0}, + {"VP9 PROFILE 1", VDP_DECODER_PROFILE_VP9_PROFILE_1, 0}, + {"VP9 PROFILE 2", VDP_DECODER_PROFILE_VP9_PROFILE_2, 0}, + {"VP9 PROFILE 3", VDP_DECODER_PROFILE_VP9_PROFILE_3, 0}, +#endif }; const size_t decoder_profile_count = sizeof(decoder_profiles)/sizeof(Desc); diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c index c7cc65e..5bde243 100644 --- a/src/gtk+-2.x/ctkwindow.c +++ b/src/gtk+-2.x/ctkwindow.c @@ -235,6 +235,66 @@ static void confirm_quit_and_save(CtkWindow *ctk_window) if (ctk_config->conf->booleans & CONFIG_PROPERTIES_SHOW_QUIT_DIALOG) { /* ask for confirmation */ + + const char *beg = "You have pending changes on following page(s):\n\n"; + const char *end = "Do you really want to quit?"; + const char *prefix; + char *pages, *tmp; + + pages = strdup(""); + if (ctk_config->pending_config) { + + if (ctk_config->pending_config & + CTK_CONFIG_PENDING_APPLY_DISPLAY_CONFIG) { + prefix = (strlen(pages) == 0) ? "" : ",\n"; + tmp = nvstrcat(pages, prefix, + "X Server Display Configuration - Apply", NULL); + free(pages); + pages = tmp; + } + if (ctk_config->pending_config & + CTK_CONFIG_PENDING_WRITE_DISPLAY_CONFIG) { + prefix = (strlen(pages) == 0) ? "" : ",\n"; + tmp = nvstrcat(pages, prefix, + "X Server Display Configuration - " + "Save to X Configuration File", NULL); + free(pages); + pages = tmp; + } + if (ctk_config->pending_config & + CTK_CONFIG_PENDING_WRITE_MOSAIC_CONFIG) { + prefix = (strlen(pages) == 0) ? "" : ",\n"; + tmp = nvstrcat(pages, prefix, + "SLI Mosaic Mode Settings - " + "Save to X Configuration File", NULL); + free(pages); + pages = tmp; + } + if (ctk_config->pending_config & + CTK_CONFIG_PENDING_WRITE_APP_PROFILES) { + prefix = (strlen(pages) == 0) ? "" : ",\n"; + tmp = nvstrcat(pages, prefix, + "Application Profiles - Save Changes", NULL); + free(pages); + pages = tmp; + } + + if (pages[0] != '\0') { + tmp = nvstrcat(beg, pages, "\n\n", end, NULL); + gtk_label_set_text( + GTK_LABEL(ctk_window->quit_dialog_pending_label), + tmp); + } else { + gtk_label_set_text( + GTK_LABEL(ctk_window->quit_dialog_pending_label), + "You have pending changes.\n\n" + "Do you really want to quit?"); + } + } else { + gtk_label_set_text(GTK_LABEL(ctk_window->quit_dialog_pending_label), + end); + } + gtk_widget_show_all(ctk_window->quit_dialog); } else { /* doesn't return */ @@ -1324,6 +1384,7 @@ static GtkWidget *create_quit_dialog(CtkWindow *ctk_window) gtk_box_pack_start(GTK_BOX(hbox), alignment, FALSE, FALSE, 2); label = gtk_label_new("Do you really want to quit?"); + ctk_window->quit_dialog_pending_label = label; alignment = gtk_alignment_new(0.0, 0.0, 0, 0); gtk_container_add(GTK_CONTAINER(alignment), label); gtk_box_pack_start(GTK_BOX(hbox), alignment, FALSE, FALSE, 0); diff --git a/src/gtk+-2.x/ctkwindow.h b/src/gtk+-2.x/ctkwindow.h index caf93ab..919f47b 100644 --- a/src/gtk+-2.x/ctkwindow.h +++ b/src/gtk+-2.x/ctkwindow.h @@ -68,8 +68,9 @@ struct _CtkWindow CtkConfig *ctk_config; GtkWidget *ctk_help; - + GtkWidget *quit_dialog; + GtkWidget *quit_dialog_pending_label; ParsedAttribute *attribute_list; @@ -78,7 +79,7 @@ struct _CtkWindow GtkTextTagTable *help_tag_table; GtkTextBuffer *help_text_buffer; - + GtkWidget *display_config_widget; }; diff --git a/src/libXNVCtrl/version.mk b/src/libXNVCtrl/version.mk index a566622..93af950 100644 --- a/src/libXNVCtrl/version.mk +++ b/src/libXNVCtrl/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 435.21 +NVIDIA_VERSION = 440.26 diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesNvml.c b/src/libXNVCtrlAttributes/NvCtrlAttributesNvml.c index 569cff6..35c0f1e 100644 --- a/src/libXNVCtrlAttributes/NvCtrlAttributesNvml.c +++ b/src/libXNVCtrlAttributes/NvCtrlAttributesNvml.c @@ -206,7 +206,7 @@ static Bool LoadNvml(NvCtrlNvmlAttributes *nvml) #define GET_SYMBOL_OPTIONAL(_proc, _name) \ nvml->lib._proc = dlsym(nvml->lib.handle, _name); - GET_SYMBOL_OPTIONAL(deviceGetGridLicensableFeatures, "nvmlDeviceGetGridLicensableFeatures_v2"); + GET_SYMBOL_OPTIONAL(deviceGetGridLicensableFeatures, "nvmlDeviceGetGridLicensableFeatures_v3"); #undef GET_SYMBOL_OPTIONAL ret = nvml->lib.init(); diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h b/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h index 2d1f097..37edb29 100644 --- a/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h +++ b/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h @@ -178,7 +178,7 @@ struct __NvCtrlNvmlAttributes { typeof(nvmlDeviceGetMaxPcieLinkGeneration) (*deviceGetMaxPcieLinkGeneration); typeof(nvmlDeviceGetMaxPcieLinkWidth) (*deviceGetMaxPcieLinkWidth); typeof(nvmlDeviceGetVirtualizationMode) (*deviceGetVirtualizationMode); - typeof(nvmlDeviceGetGridLicensableFeatures_v2) (*deviceGetGridLicensableFeatures); + typeof(nvmlDeviceGetGridLicensableFeatures_v3) (*deviceGetGridLicensableFeatures); } lib; @@ -1,5 +1,5 @@ /* - * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. * * NOTICE TO USER: * @@ -104,7 +104,7 @@ extern "C" { #define nvmlDeviceGetHandleByPciBusId nvmlDeviceGetHandleByPciBusId_v2 #define nvmlDeviceGetNvLinkRemotePciInfo nvmlDeviceGetNvLinkRemotePciInfo_v2 #define nvmlDeviceRemoveGpu nvmlDeviceRemoveGpu_v2 -#define nvmlDeviceGetGridLicensableFeatures nvmlDeviceGetGridLicensableFeatures_v2 +#define nvmlDeviceGetGridLicensableFeatures nvmlDeviceGetGridLicensableFeatures_v3 /***************************************************************************************************/ /** @defgroup nvmlDeviceStructs Device Structs @@ -788,7 +788,11 @@ typedef enum nvmlRestrictedAPI_enum /** @} */ /***************************************************************************************************/ -/** @defgroup nvmlGridEnums GRID Enums +/** @addtogroup gridVirtual + * @{ + */ +/***************************************************************************************************/ +/** @defgroup nvmlGridEnums GRID Virtualization Enums * @{ */ /***************************************************************************************************/ @@ -804,6 +808,147 @@ typedef enum nvmlGpuVirtualizationMode { NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA = 4, //!< Device is associated with VGX hypervisor in vSGA mode } nvmlGpuVirtualizationMode_t; +/** + * Host vGPU modes + */ +typedef enum nvmlHostVgpuMode_enum +{ + NVML_HOST_VGPU_MODE_NON_SRIOV = 0, //!< Non SR-IOV mode + NVML_HOST_VGPU_MODE_SRIOV = 1 //!< SR-IOV mode +} nvmlHostVgpuMode_t; + +/*! + * Types of VM identifiers + */ +typedef enum nvmlVgpuVmIdType { + NVML_VGPU_VM_ID_DOMAIN_ID = 0, //!< VM ID represents DOMAIN ID + NVML_VGPU_VM_ID_UUID = 1, //!< VM ID represents UUID +} nvmlVgpuVmIdType_t; + +/** + * 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 +} nvmlVgpuGuestInfoState_t; + +/** + * GRID license feature code + */ +typedef enum { + NVML_GRID_LICENSE_FEATURE_CODE_VGPU = 1, //!< Virtual GPU + NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION = 2 //!< Virtual Workstation +} nvmlGridLicenseFeatureCode_t; + +/** @} */ + +/***************************************************************************************************/ +/** @defgroup nvmlVgpuConstants GRID Virtualization Constants + * @{ + */ +/***************************************************************************************************/ + +/** + * Buffer size guaranteed to be large enough for \ref nvmlVgpuTypeGetLicense + */ +#define NVML_GRID_LICENSE_BUFFER_SIZE 128 + +#define NVML_VGPU_NAME_BUFFER_SIZE 64 + +#define NVML_GRID_LICENSE_FEATURE_MAX_COUNT 3 + +/*! + * Macros for vGPU instance's virtualization capabilities bitfield. + */ +#define NVML_VGPU_VIRTUALIZATION_CAP_MIGRATION 0:0 +#define NVML_VGPU_VIRTUALIZATION_CAP_MIGRATION_NO 0x0 +#define NVML_VGPU_VIRTUALIZATION_CAP_MIGRATION_YES 0x1 + +/*! + * 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 + +/** @} */ + +/***************************************************************************************************/ +/** @defgroup nvmlVgpuStructs GRID Virtualization Structs + * @{ + */ +/***************************************************************************************************/ + +typedef unsigned int nvmlVgpuTypeId_t; + +typedef unsigned int nvmlVgpuInstance_t; + +/** + * Structure to store Utilization Value and vgpuInstance + */ +typedef struct nvmlVgpuInstanceUtilizationSample_st +{ + nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance + unsigned long long timeStamp; //!< CPU Timestamp in microseconds + nvmlValue_t smUtil; //!< SM (3D/Compute) Util Value + nvmlValue_t memUtil; //!< Frame Buffer Memory Util Value + nvmlValue_t encUtil; //!< Encoder Util Value + nvmlValue_t decUtil; //!< Decoder Util Value +} nvmlVgpuInstanceUtilizationSample_t; + +/** + * Structure to store Utilization Value, vgpuInstance and subprocess information + */ +typedef struct nvmlVgpuProcessUtilizationSample_st +{ + nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance + unsigned int pid; //!< PID of process running within the vGPU VM + char processName[NVML_VGPU_NAME_BUFFER_SIZE]; //!< Name of process running within the vGPU VM + unsigned long long timeStamp; //!< CPU Timestamp in microseconds + unsigned int smUtil; //!< SM (3D/Compute) Util Value + unsigned int memUtil; //!< Frame Buffer Memory Util Value + unsigned int encUtil; //!< Encoder Util Value + unsigned int decUtil; //!< Decoder Util Value +} nvmlVgpuProcessUtilizationSample_t; + +/** + * Structure to store utilization value and process Id + */ +typedef struct nvmlProcessUtilizationSample_st +{ + unsigned int pid; //!< PID of process + unsigned long long timeStamp; //!< CPU Timestamp in microseconds + unsigned int smUtil; //!< SM (3D/Compute) Util Value + unsigned int memUtil; //!< Frame Buffer Memory Util Value + unsigned int encUtil; //!< Encoder Util Value + unsigned int decUtil; //!< Decoder Util Value +} nvmlProcessUtilizationSample_t; + +/** + * 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_BUFFER_SIZE]; + char productName[NVML_GRID_LICENSE_BUFFER_SIZE]; + unsigned int featureEnabled; //!< Non-zero if feature is enabled, otherwise zero +} 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]; //!< Array of GRID licensable features. +} nvmlGridLicensableFeatures_t; + +/** @} */ /** @} */ /***************************************************************************************************/ @@ -1293,135 +1438,6 @@ typedef struct nvmlAccountingStats_st { /** @} */ /***************************************************************************************************/ -/** @defgroup nvmlVgpuConstants Vgpu Constants - * @{ - */ -/***************************************************************************************************/ - -/** - * Buffer size guaranteed to be large enough for \ref nvmlVgpuTypeGetLicense - */ -#define NVML_GRID_LICENSE_BUFFER_SIZE 128 - -#define NVML_VGPU_NAME_BUFFER_SIZE 64 - -#define NVML_GRID_LICENSE_FEATURE_MAX_COUNT 3 - -/*! - * 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 - -/** @} */ - -/***************************************************************************************************/ -/** @defgroup nvmlVgpuEnum Vgpu Enum - * @{ - */ -/***************************************************************************************************/ - -/*! - * Types of VM identifiers - */ -typedef enum nvmlVgpuVmIdType { - NVML_VGPU_VM_ID_DOMAIN_ID = 0, //!< VM ID represents DOMAIN ID - NVML_VGPU_VM_ID_UUID = 1, //!< VM ID represents UUID -} nvmlVgpuVmIdType_t; - -/** - * 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 -} nvmlVgpuGuestInfoState_t; - -/** - * GRID license feature code - */ -typedef enum { - NVML_GRID_LICENSE_FEATURE_CODE_VGPU = 1, //!< Virtual GPU - NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION = 2 //!< Virtual Workstation -} nvmlGridLicenseFeatureCode_t; - -/** @} */ - -/***************************************************************************************************/ -/** @defgroup nvmlVgpuStructs Vgpu Structs - * @{ - */ -/***************************************************************************************************/ - -typedef unsigned int nvmlVgpuTypeId_t; - -typedef unsigned int nvmlVgpuInstance_t; - -/** - * Structure to store Utilization Value and vgpuInstance - */ -typedef struct nvmlVgpuInstanceUtilizationSample_st -{ - nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance - unsigned long long timeStamp; //!< CPU Timestamp in microseconds - nvmlValue_t smUtil; //!< SM (3D/Compute) Util Value - nvmlValue_t memUtil; //!< Frame Buffer Memory Util Value - nvmlValue_t encUtil; //!< Encoder Util Value - nvmlValue_t decUtil; //!< Decoder Util Value -} nvmlVgpuInstanceUtilizationSample_t; - -/** - * Structure to store Utilization Value, vgpuInstance and subprocess information - */ -typedef struct nvmlVgpuProcessUtilizationSample_st -{ - nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance - unsigned int pid; //!< PID of process running within the vGPU VM - char processName[NVML_VGPU_NAME_BUFFER_SIZE]; //!< Name of process running within the vGPU VM - unsigned long long timeStamp; //!< CPU Timestamp in microseconds - unsigned int smUtil; //!< SM (3D/Compute) Util Value - unsigned int memUtil; //!< Frame Buffer Memory Util Value - unsigned int encUtil; //!< Encoder Util Value - unsigned int decUtil; //!< Decoder Util Value -} nvmlVgpuProcessUtilizationSample_t; - -/** - * Structure to store utilization value and process Id - */ -typedef struct nvmlProcessUtilizationSample_st -{ - unsigned int pid; //!< PID of process - unsigned long long timeStamp; //!< CPU Timestamp in microseconds - unsigned int smUtil; //!< SM (3D/Compute) Util Value - unsigned int memUtil; //!< Frame Buffer Memory Util Value - unsigned int encUtil; //!< Encoder Util Value - unsigned int decUtil; //!< Decoder Util Value -} nvmlProcessUtilizationSample_t; - -/** - * 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_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]; //!< Array of GRID licensable features. -} nvmlGridLicensableFeatures_t; - -/** @} */ /***************************************************************************************************/ /** @defgroup nvmlEncoderStructs Encoder Structs @@ -5288,8 +5304,15 @@ nvmlReturn_t DECLDIR nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCou /** @} */ /***************************************************************************************************/ -/** @defgroup nvmlGridQueries Grid Queries - * This chapter describes NVML operations that are associated with NVIDIA GRID products. +/** @defgroup gridVirtual GRID Virtualization Enums, Constants and Structs + * @{ + */ +/** @} */ +/***************************************************************************************************/ + +/***************************************************************************************************/ +/** @defgroup nvmlGridQueries GRID Virtualization APIs + * This chapter describes operations that are associated with NVIDIA GRID products. * @{ */ /***************************************************************************************************/ @@ -5311,14 +5334,23 @@ nvmlReturn_t DECLDIR nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCou */ nvmlReturn_t DECLDIR nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t *pVirtualMode); -/** @} */ - -/***************************************************************************************************/ -/** @defgroup nvmlGridCommands Grid Commands - * This chapter describes NVML operations that are associated with NVIDIA GRID products. - * @{ +/** + * Queries if SR-IOV host operation is supported on a vGPU supported device. + * + * Checks whether SR-IOV host capability is supported by the device and the + * driver, and indicates device is in SR-IOV mode if both of these conditions + * are true. + * + * @param device The identifier of the target device + * @param pHostVgpuMode Reference in which to return the current vGPU mode + * + * @return + * - \ref NVML_SUCCESS if device's vGPU mode has been successfully retrieved + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device handle is 0 or \a pVgpuMode is NULL + * - \ref NVML_ERROR_NOT_SUPPORTED if \a device doesn't support this feature. + * - \ref NVML_ERROR_UNKNOWN if any unexpected error occurred */ -/***************************************************************************************************/ +nvmlReturn_t DECLDIR nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpuMode_t *pHostVgpuMode); /** * This method is used to set the virtualization mode corresponding to the GPU. @@ -5338,13 +5370,69 @@ nvmlReturn_t DECLDIR nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGp */ nvmlReturn_t DECLDIR nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode); +/** + * Retrieve the GRID licensable features. + * + * Identifies whether the system supports GRID Software Licensing. If it does, return the list of licensable feature(s) + * and their current license status. + * + * @param device Identifier of the target device + * @param pGridLicensableFeatures Pointer to structure in which GRID licensable features are returned + * + * @return + * - \ref NVML_SUCCESS if licensable features are successfully retrieved + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a pGridLicensableFeatures is NULL + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetGridLicensableFeatures(nvmlDevice_t device, nvmlGridLicensableFeatures_t *pGridLicensableFeatures); + +/** + * Retrieves the current utilization and process ID + * + * For Maxwell &tm; or newer fully supported devices. + * + * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running. + * Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer pointed at + * by \a utilization. One utilization sample structure is returned per process running, that had some non-zero utilization + * during the last sample period. It includes the CPU timestamp at which the samples were recorded. Individual utilization values + * are returned as "unsigned int" values. + * + * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with + * \a utilization set to NULL. The caller should allocate a buffer of size + * processSamplesCount * sizeof(nvmlProcessUtilizationSample_t). Invoke the function again with the allocated buffer passed + * in \a utilization, and \a processSamplesCount set to the number of entries the buffer is sized for. + * + * On successful return, the function updates \a processSamplesCount with the number of process utilization sample + * structures that were actually written. This may differ from a previously read value as instances are created or + * destroyed. + * + * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 + * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp + * to a timeStamp retrieved from a previous query to read utilization since the previous query. + * + * @param device The identifier of the target device + * @param utilization Pointer to caller-supplied buffer in which guest process utilization samples are returned + * @param processSamplesCount Pointer to caller-supplied array size, and returns number of processes running + * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp. + + * @return + * - \ref NVML_SUCCESS if \a utilization has been populated + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a utilization is NULL, or \a samplingPeriodUs 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 + */ +nvmlReturn_t DECLDIR nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t *utilization, + unsigned int *processSamplesCount, unsigned long long lastSeenTimeStamp); + /** @} */ /***************************************************************************************************/ -/** @defgroup nvmlVgpu vGPU Management +/** @defgroup nvmlVgpu GRID vGPU Management * @{ * - * Set of APIs supporting GRID vGPU + * This chapter describes APIs supporting NVIDIA GRID vGPU */ /***************************************************************************************************/ @@ -5815,117 +5903,6 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuI nvmlReturn_t DECLDIR nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity); /** - * Retrieves current utilization for vGPUs on a physical GPU (device). - * - * For Kepler &tm; or newer fully supported devices. - * - * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for vGPU instances running - * on a device. Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer - * pointed at by \a utilizationSamples. One utilization sample structure is returned per vGPU instance, and includes the - * CPU timestamp at which the samples were recorded. Individual utilization values are returned as "unsigned int" values - * in nvmlValue_t unions. The function sets the caller-supplied \a sampleValType to NVML_VALUE_TYPE_UNSIGNED_INT to - * indicate the returned value type. - * - * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with - * \a utilizationSamples set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance - * count in \a vgpuInstanceSamplesCount, or NVML_SUCCESS if the current vGPU instance count is zero. The caller should allocate - * a buffer of size vgpuInstanceSamplesCount * sizeof(nvmlVgpuInstanceUtilizationSample_t). Invoke the function again with - * the allocated buffer passed in \a utilizationSamples, and \a vgpuInstanceSamplesCount set to the number of entries the - * buffer is sized for. - * - * On successful return, the function updates \a vgpuInstanceSampleCount with the number of vGPU utilization sample - * structures that were actually written. This may differ from a previously read value as vGPU instances are created or - * destroyed. - * - * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 - * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp - * to a timeStamp retrieved from a previous query to read utilization since the previous query. - * - * @param device The identifier for the target device - * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp. - * @param sampleValType Pointer to caller-supplied buffer to hold the type of returned sample values - * @param vgpuInstanceSamplesCount Pointer to caller-supplied array size, and returns number of vGPU instances - * @param utilizationSamples Pointer to caller-supplied buffer in which vGPU utilization samples are returned - - * @return - * - \ref NVML_SUCCESS if utilization samples are successfully retrieved - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuInstanceSamplesCount or \a sampleValType is - * NULL, or a sample count of 0 is passed with a non-NULL \a utilizationSamples - * - \ref NVML_ERROR_INSUFFICIENT_SIZE if supplied \a vgpuInstanceSamplesCount is too small to return samples for all - * vGPU instances currently executing on the device - * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found - * - \ref NVML_ERROR_UNKNOWN on any unexpected error - */ -nvmlReturn_t DECLDIR nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, - nvmlValueType_t *sampleValType, unsigned int *vgpuInstanceSamplesCount, - nvmlVgpuInstanceUtilizationSample_t *utilizationSamples); - -/** - * Retrieves current utilization for processes running on vGPUs on a physical GPU (device). - * - * For Maxwell &tm; or newer fully supported devices. - * - * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running on - * vGPU instances active on a device. Utilization values are returned as an array of utilization sample structures in the - * caller-supplied buffer pointed at by \a utilizationSamples. One utilization sample structure is returned per process running - * on vGPU instances, that had some non-zero utilization during the last sample period. It includes the CPU timestamp at which - * the samples were recorded. Individual utilization values are returned as "unsigned int" values. - * - * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with - * \a utilizationSamples set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance - * count in \a vgpuProcessSamplesCount. The caller should allocate a buffer of size - * vgpuProcessSamplesCount * sizeof(nvmlVgpuProcessUtilizationSample_t). Invoke the function again with - * the allocated buffer passed in \a utilizationSamples, and \a vgpuProcessSamplesCount set to the number of entries the - * buffer is sized for. - * - * On successful return, the function updates \a vgpuSubProcessSampleCount with the number of vGPU sub process utilization sample - * structures that were actually written. This may differ from a previously read value depending on the number of processes that are active - * in any given sample period. - * - * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 - * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp - * to a timeStamp retrieved from a previous query to read utilization since the previous query. - * - * @param device The identifier for the target device - * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp. - * @param vgpuProcessSamplesCount Pointer to caller-supplied array size, and returns number of processes running on vGPU instances - * @param utilizationSamples Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned - - * @return - * - \ref NVML_SUCCESS if utilization samples are successfully retrieved - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuProcessSamplesCount or a sample count of 0 is - * passed with a non-NULL \a utilizationSamples - * - \ref NVML_ERROR_INSUFFICIENT_SIZE if supplied \a vgpuProcessSamplesCount is too small to return samples for all - * vGPU instances currently executing on the device - * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device - * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible - * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found - * - \ref NVML_ERROR_UNKNOWN on any unexpected error - */ -nvmlReturn_t DECLDIR nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, - unsigned int *vgpuProcessSamplesCount, - nvmlVgpuProcessUtilizationSample_t *utilizationSamples); -/** - * Retrieve the GRID licensable features. - * - * Identifies whether the system supports GRID Software Licensing. If it does, return the list of licensable feature(s) - * and their current license status. - * - * @param device Identifier of the target device - * @param pGridLicensableFeatures Pointer to structure in which GRID licensable features are returned - * - * @return - * - \ref NVML_SUCCESS if licensable features are successfully retrieved - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a pGridLicensableFeatures is NULL - * - \ref NVML_ERROR_UNKNOWN on any unexpected error - */ -nvmlReturn_t DECLDIR nvmlDeviceGetGridLicensableFeatures(nvmlDevice_t device, nvmlGridLicensableFeatures_t *pGridLicensableFeatures); - -/** * Retrieves the current encoder statistics of a vGPU Instance * * For Maxwell &tm; or newer fully supported devices. @@ -6025,135 +6002,11 @@ nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFBCStats(nvmlVgpuInstance_t vgpuInstance */ 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. - * - * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running. - * Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer pointed at - * by \a utilization. One utilization sample structure is returned per process running, that had some non-zero utilization - * during the last sample period. It includes the CPU timestamp at which the samples were recorded. Individual utilization values - * are returned as "unsigned int" values. - * - * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with - * \a utilization set to NULL. The caller should allocate a buffer of size - * processSamplesCount * sizeof(nvmlProcessUtilizationSample_t). Invoke the function again with the allocated buffer passed - * in \a utilization, and \a processSamplesCount set to the number of entries the buffer is sized for. - * - * On successful return, the function updates \a processSamplesCount with the number of process utilization sample - * structures that were actually written. This may differ from a previously read value as instances are created or - * destroyed. - * - * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 - * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp - * to a timeStamp retrieved from a previous query to read utilization since the previous query. - * - * @param device The identifier of the target device - * @param utilization Pointer to caller-supplied buffer in which guest process utilization samples are returned - * @param processSamplesCount Pointer to caller-supplied array size, and returns number of processes running - * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp. - - * @return - * - \ref NVML_SUCCESS if \a utilization has been populated - * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized - * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a utilization is NULL, or \a samplingPeriodUs 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 - */ -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 instance - * @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 instance - * @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 instance - * @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. +/** @defgroup nvml GRID Virtualization Migration + * This chapter describes operations that are associated with vGPU Migration. * @{ */ /***************************************************************************************************/ @@ -6177,7 +6030,8 @@ typedef struct nvmlVgpuMetadata_st 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 reserved[6]; //!< Reserved for internal use + unsigned int vgpuVirtualizationCaps; //!< vGPU virtualizaion capabilities bitfileld unsigned int guestVgpuVersion; //!< vGPU version of guest driver unsigned int opaqueDataSize; //!< Size of opaque data field in bytes char opaqueData[4]; //!< Opaque data @@ -6388,6 +6242,195 @@ nvmlReturn_t DECLDIR nvmlSetVgpuVersion(nvmlVgpuVersion_t *vgpuVersion); /** @} */ /***************************************************************************************************/ +/** @defgroup nvmlUtil GRID Virtualization Utilization and Accounting + * This chapter describes operations that are associated with vGPU Utilization and Accounting. + * @{ + */ +/***************************************************************************************************/ + +/** + * Retrieves current utilization for vGPUs on a physical GPU (device). + * + * For Kepler &tm; or newer fully supported devices. + * + * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for vGPU instances running + * on a device. Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer + * pointed at by \a utilizationSamples. One utilization sample structure is returned per vGPU instance, and includes the + * CPU timestamp at which the samples were recorded. Individual utilization values are returned as "unsigned int" values + * in nvmlValue_t unions. The function sets the caller-supplied \a sampleValType to NVML_VALUE_TYPE_UNSIGNED_INT to + * indicate the returned value type. + * + * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with + * \a utilizationSamples set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance + * count in \a vgpuInstanceSamplesCount, or NVML_SUCCESS if the current vGPU instance count is zero. The caller should allocate + * a buffer of size vgpuInstanceSamplesCount * sizeof(nvmlVgpuInstanceUtilizationSample_t). Invoke the function again with + * the allocated buffer passed in \a utilizationSamples, and \a vgpuInstanceSamplesCount set to the number of entries the + * buffer is sized for. + * + * On successful return, the function updates \a vgpuInstanceSampleCount with the number of vGPU utilization sample + * structures that were actually written. This may differ from a previously read value as vGPU instances are created or + * destroyed. + * + * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 + * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp + * to a timeStamp retrieved from a previous query to read utilization since the previous query. + * + * @param device The identifier for the target device + * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp. + * @param sampleValType Pointer to caller-supplied buffer to hold the type of returned sample values + * @param vgpuInstanceSamplesCount Pointer to caller-supplied array size, and returns number of vGPU instances + * @param utilizationSamples Pointer to caller-supplied buffer in which vGPU utilization samples are returned + + * @return + * - \ref NVML_SUCCESS if utilization samples are successfully retrieved + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuInstanceSamplesCount or \a sampleValType is + * NULL, or a sample count of 0 is passed with a non-NULL \a utilizationSamples + * - \ref NVML_ERROR_INSUFFICIENT_SIZE if supplied \a vgpuInstanceSamplesCount is too small to return samples for all + * vGPU instances currently executing on the device + * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, + nvmlValueType_t *sampleValType, unsigned int *vgpuInstanceSamplesCount, + nvmlVgpuInstanceUtilizationSample_t *utilizationSamples); + +/** + * Retrieves current utilization for processes running on vGPUs on a physical GPU (device). + * + * For Maxwell &tm; or newer fully supported devices. + * + * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running on + * vGPU instances active on a device. Utilization values are returned as an array of utilization sample structures in the + * caller-supplied buffer pointed at by \a utilizationSamples. One utilization sample structure is returned per process running + * on vGPU instances, that had some non-zero utilization during the last sample period. It includes the CPU timestamp at which + * the samples were recorded. Individual utilization values are returned as "unsigned int" values. + * + * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with + * \a utilizationSamples set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance + * count in \a vgpuProcessSamplesCount. The caller should allocate a buffer of size + * vgpuProcessSamplesCount * sizeof(nvmlVgpuProcessUtilizationSample_t). Invoke the function again with + * the allocated buffer passed in \a utilizationSamples, and \a vgpuProcessSamplesCount set to the number of entries the + * buffer is sized for. + * + * On successful return, the function updates \a vgpuSubProcessSampleCount with the number of vGPU sub process utilization sample + * structures that were actually written. This may differ from a previously read value depending on the number of processes that are active + * in any given sample period. + * + * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 + * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp + * to a timeStamp retrieved from a previous query to read utilization since the previous query. + * + * @param device The identifier for the target device + * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp. + * @param vgpuProcessSamplesCount Pointer to caller-supplied array size, and returns number of processes running on vGPU instances + * @param utilizationSamples Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned + + * @return + * - \ref NVML_SUCCESS if utilization samples are successfully retrieved + * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized + * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuProcessSamplesCount or a sample count of 0 is + * passed with a non-NULL \a utilizationSamples + * - \ref NVML_ERROR_INSUFFICIENT_SIZE if supplied \a vgpuProcessSamplesCount is too small to return samples for all + * vGPU instances currently executing on the device + * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device + * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible + * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found + * - \ref NVML_ERROR_UNKNOWN on any unexpected error + */ +nvmlReturn_t DECLDIR nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp, + unsigned int *vgpuProcessSamplesCount, + nvmlVgpuProcessUtilizationSample_t *utilizationSamples); + +/** + * 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 nvmlGpuBlacklistQueries GPU Blacklist Queries * This chapter describes NVML operations that are associated with blacklisted GPUs. * @{ diff --git a/src/version.h b/src/version.h index d902256..20657fb 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define NVIDIA_VERSION "435.21" +#define NVIDIA_VERSION "440.26" diff --git a/src/version.mk b/src/version.mk index a566622..93af950 100644 --- a/src/version.mk +++ b/src/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 435.21 +NVIDIA_VERSION = 440.26 @@ -1 +1 @@ -NVIDIA_VERSION = 435.21 +NVIDIA_VERSION = 440.26 |