summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2010-06-18 17:32:06 -0700
committerAaron Plattner <aplattner@nvidia.com>2010-06-18 17:32:06 -0700
commit655fb95354fdfb7ffe5f44f0341c132165b0c983 (patch)
treee60c626588aed5edb6b7096705b352cde2e8f133
parent7ff0fdc1dfc3d9bb301c9e6f2a1caffb768dbac0 (diff)
256.35256.35
-rw-r--r--samples/nv-control-dpy.c6
-rw-r--r--samples/nv-control-events.c177
-rw-r--r--samples/nv-control-framelock.c2
-rw-r--r--samples/nv-control-gvi.c495
-rw-r--r--samples/nv-control-targets.c39
-rw-r--r--src/gtk+-2.x/ctkecc.c33
-rw-r--r--src/gtk+-2.x/ctkecc.h2
-rw-r--r--src/gtk+-2.x/ctkgauge.c5
-rw-r--r--src/gtk+-2.x/ctkgvo.c3
-rw-r--r--src/gtk+-2.x/ctkthermal.c88
-rw-r--r--src/libXNVCtrl/NVCtrl.h8
-rw-r--r--version.mk2
12 files changed, 637 insertions, 223 deletions
diff --git a/samples/nv-control-dpy.c b/samples/nv-control-dpy.c
index 2c18cca..28fc7e3 100644
--- a/samples/nv-control-dpy.c
+++ b/samples/nv-control-dpy.c
@@ -46,7 +46,8 @@ static char *display_device_name(int mask);
static unsigned int display_device_mask(char *str);
static char *remove_whitespace(char *str);
static int count_bits(unsigned int mask);
-static void parse_mode_string(char *modeString, char **modeName, int *mask);
+static void parse_mode_string(char *modeString, char **modeName,
+ unsigned int *mask);
static char *find_modeline(char *modeString, char *pModeLines,
int ModeLineLen);
@@ -1392,7 +1393,8 @@ static int count_bits(unsigned int mask)
* mask for the per-display device MetaMode string in 'modeString'
*/
-static void parse_mode_string(char *modeString, char **modeName, int *mask)
+static void parse_mode_string(char *modeString, char **modeName,
+ unsigned int *mask)
{
char *colon, *s, tmp;
diff --git a/samples/nv-control-events.c b/samples/nv-control-events.c
index 7412e52..5b627d7 100644
--- a/samples/nv-control-events.c
+++ b/samples/nv-control-events.c
@@ -46,6 +46,7 @@ int main(void)
Bool ret;
int event_base, error_base;
int num_screens, num_gpus, num_framelocks, num_vcs, i;
+ int num_gvis, num_coolers, num_thermal_sensors;
int sources;
XEvent event;
XNVCtrlAttributeChangedEvent *nvevent;
@@ -115,6 +116,39 @@ int main(void)
return 1;
}
+ /* Query number of GVI (Graphics Video Input) devices */
+
+ ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_GVI,
+ &num_gvis);
+ if (ret != True) {
+ fprintf(stderr, "Failed to query the number of Graphics Video "
+ "Input devices on '%s'.\n",
+ XDisplayName(NULL));
+ return 1;
+ }
+
+ /* Query number of Cooler devices */
+
+ ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_COOLER,
+ &num_coolers);
+ if (ret != True) {
+ fprintf(stderr, "Failed to query the number of Cooler devices "
+ "on '%s'.\n",
+ XDisplayName(NULL));
+ return 1;
+ }
+
+ /* Query number of Thermal Sensor devices */
+
+ ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR,
+ &num_thermal_sensors);
+ if (ret != True) {
+ fprintf(stderr, "Failed to query the number of Thermal Sensor "
+ "devices on '%s'.\n",
+ XDisplayName(NULL));
+ return 1;
+ }
+
/*
* register to receive NV-CONTROL events: whenever any NV-CONTROL
* attribute is changed by an NV-CONTROL client, any other client
@@ -182,8 +216,8 @@ int main(void)
i, TARGET_ATTRIBUTE_CHANGED_EVENT,
True);
if (ret != True) {
- printf("- Unable to register to receive NV-CONTROL X Screen "
- "target events for screen %d on '%s'.\n",
+ printf("- Unable to register to receive NV-CONTROL "
+ "target events for X screen %d on '%s'.\n",
i, XDisplayName(NULL));
continue;
}
@@ -201,7 +235,7 @@ int main(void)
i, TARGET_ATTRIBUTE_CHANGED_EVENT,
True);
if (ret != True) {
- printf("- Unable to register to receive NV-CONTROL GPU "
+ printf("- Unable to register to receive NV-CONTROL "
"target events for GPU %d on '%s'.\n",
i, XDisplayName(NULL));
continue;
@@ -220,7 +254,7 @@ int main(void)
i, TARGET_ATTRIBUTE_CHANGED_EVENT,
True);
if (ret != True) {
- printf("- Unable to register to receive NV-CONTROL GPU "
+ printf("- Unable to register to receive NV-CONTROL "
"target events for Frame Lock %d on '%s'.\n",
i, XDisplayName(NULL));
continue;
@@ -239,7 +273,7 @@ int main(void)
i, TARGET_ATTRIBUTE_CHANGED_EVENT,
True);
if (ret != True) {
- printf("- Unable to register to receive NV-CONTROL VCS "
+ printf("- Unable to register to receive NV-CONTROL "
"target events for VCS %d on '%s'.\n",
i, XDisplayName(NULL));
continue;
@@ -250,6 +284,63 @@ int main(void)
sources++;
}
+ /* Register to receive on all GVI targets */
+
+ for (i = 0; i < num_gvis; i++ ) {
+
+ ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_GVI,
+ i, TARGET_ATTRIBUTE_CHANGED_EVENT,
+ True);
+ if (ret != True) {
+ printf("- Unable to register to receive NV-CONTROL "
+ "target events for GVI %d on '%s'.\n",
+ i, XDisplayName(NULL));
+ continue;
+ }
+
+ printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on GVI "
+ "%d.\n", i);
+ sources++;
+ }
+
+ /* Register to receive on all Cooler targets */
+
+ for (i = 0; i < num_coolers; i++ ) {
+
+ ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_COOLER,
+ i, TARGET_ATTRIBUTE_CHANGED_EVENT,
+ True);
+ if (ret != True) {
+ printf("- Unable to register to receive NV-CONTROL "
+ "target events for Cooler %d on '%s'.\n",
+ i, XDisplayName(NULL));
+ continue;
+ }
+
+ printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on Cooler "
+ "%d.\n", i);
+ sources++;
+ }
+
+ /* Register to receive on all Thermal Sensor targets */
+
+ for (i = 0; i < num_thermal_sensors; i++ ) {
+
+ ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR,
+ i, TARGET_ATTRIBUTE_CHANGED_EVENT,
+ True);
+ if (ret != True) {
+ printf("- Unable to register to receive NV-CONTROL "
+ "target events for Thermal Sensor %d on '%s'.\n",
+ i, XDisplayName(NULL));
+ continue;
+ }
+
+ printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on Thermal "
+ "Sensor %d.\n", i);
+ sources++;
+ }
+
/*
* Report the number of sources (things that we have registered to
* listen for NV-CONTROL X Events on.)
@@ -337,10 +428,14 @@ static const char *target2str(int n)
static char unknown[24];
switch (n) {
- case NV_CTRL_TARGET_TYPE_X_SCREEN: return "X Screen"; break;
- case NV_CTRL_TARGET_TYPE_GPU: return "GPU"; break;
- case NV_CTRL_TARGET_TYPE_FRAMELOCK: return "Frame Lock"; break;
- case NV_CTRL_TARGET_TYPE_VCSC: return "VCS"; break;
+ case NV_CTRL_TARGET_TYPE_X_SCREEN: return "X Screen"; break;
+ case NV_CTRL_TARGET_TYPE_GPU: return "GPU"; break;
+ case NV_CTRL_TARGET_TYPE_FRAMELOCK: return "Frame Lock"; break;
+ case NV_CTRL_TARGET_TYPE_VCSC: return "VCS"; break;
+ case NV_CTRL_TARGET_TYPE_GVI: return "GVI"; break;
+ case NV_CTRL_TARGET_TYPE_COOLER: return "Cooler"; break;
+ case NV_CTRL_TARGET_TYPE_THERMAL_SENSOR: return "Thermal Sensor"; break;
+
default:
snprintf(unknown, 24, "Unknown (%d)", n);
return unknown;
@@ -546,8 +641,72 @@ static AttrEntry attr_table[] = {
MAKE_ENTRY(NV_CTRL_DEPTH_30_ALLOWED),
MAKE_ENTRY(NV_CTRL_MODE_SET_EVENT),
MAKE_ENTRY(NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE),
+ MAKE_ENTRY(NV_CTRL_VCSC_HIGH_PERF_MODE),
MAKE_ENTRY(NV_CTRL_DISPLAYPORT_LINK_RATE),
MAKE_ENTRY(NV_CTRL_STEREO_EYES_EXCHANGE),
+ MAKE_ENTRY(NV_CTRL_NO_SCANOUT),
+ MAKE_ENTRY(NV_CTRL_GVO_CSC_CHANGED_EVENT),
+ MAKE_ENTRY(NV_CTRL_FRAMELOCK_SLAVEABLE ),
+ MAKE_ENTRY(NV_CTRL_GVO_SYNC_TO_DISPLAY),
+ MAKE_ENTRY(NV_CTRL_X_SERVER_UNIQUE_ID),
+ MAKE_ENTRY(NV_CTRL_PIXMAP_CACHE),
+ MAKE_ENTRY(NV_CTRL_PIXMAP_CACHE_ROUNDING_SIZE_KB),
+ MAKE_ENTRY(NV_CTRL_IS_GVO_DISPLAY),
+ MAKE_ENTRY(NV_CTRL_PCI_ID),
+ MAKE_ENTRY(NV_CTRL_GVO_FULL_RANGE_COLOR),
+ MAKE_ENTRY(NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE),
+ MAKE_ENTRY(NV_CTRL_GVO_ENABLE_RGB_DATA),
+ MAKE_ENTRY(NV_CTRL_IMAGE_SHARPENING_DEFAULT),
+ MAKE_ENTRY(NV_CTRL_PCI_DOMAIN),
+ MAKE_ENTRY(NV_CTRL_GVI_NUM_JACKS),
+ MAKE_ENTRY(NV_CTRL_GVI_MAX_LINKS_PER_STREAM),
+ MAKE_ENTRY(NV_CTRL_GVI_DETECTED_CHANNEL_BITS_PER_COMPONENT),
+ MAKE_ENTRY(NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT),
+ MAKE_ENTRY(NV_CTRL_GVI_DETECTED_CHANNEL_COMPONENT_SAMPLING),
+ MAKE_ENTRY(NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING),
+ MAKE_ENTRY(NV_CTRL_GVI_REQUESTED_STREAM_CHROMA_EXPAND),
+ MAKE_ENTRY(NV_CTRL_GVI_DETECTED_CHANNEL_COLOR_SPACE),
+ MAKE_ENTRY(NV_CTRL_GVI_DETECTED_CHANNEL_LINK_ID),
+ MAKE_ENTRY(NV_CTRL_GVI_DETECTED_CHANNEL_SMPTE352_IDENTIFIER),
+ MAKE_ENTRY(NV_CTRL_GVI_GLOBAL_IDENTIFIER),
+ MAKE_ENTRY(NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION),
+ MAKE_ENTRY(NV_CTRL_GPU_COOLER_MANUAL_CONTROL),
+ MAKE_ENTRY(NV_CTRL_THERMAL_COOLER_LEVEL),
+ MAKE_ENTRY(NV_CTRL_THERMAL_COOLER_LEVEL_SET_DEFAULT),
+ MAKE_ENTRY(NV_CTRL_THERMAL_COOLER_CONTROL_TYPE),
+ MAKE_ENTRY(NV_CTRL_THERMAL_COOLER_TARGET),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_SUPPORTED),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_STATUS),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_CONFIGURATION_SUPPORTED),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_CONFIGURATION),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_DEFAULT_CONFIGURATION),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_SINGLE_BIT_ERRORS),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_DOUBLE_BIT_ERRORS),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_AGGREGATE_SINGLE_BIT_ERRORS),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_AGGREGATE_DOUBLE_BIT_ERRORS),
+ MAKE_ENTRY(NV_CTRL_GPU_ECC_RESET_ERROR_STATUS),
+ MAKE_ENTRY(NV_CTRL_GPU_POWER_MIZER_MODE),
+ MAKE_ENTRY(NV_CTRL_GVI_SYNC_OUTPUT_FORMAT),
+ MAKE_ENTRY(NV_CTRL_GVI_MAX_CHANNELS_PER_JACK),
+ MAKE_ENTRY(NV_CTRL_GVI_MAX_STREAMS ),
+ MAKE_ENTRY(NV_CTRL_GVI_NUM_CAPTURE_SURFACES),
+ MAKE_ENTRY(NV_CTRL_OVERSCAN_COMPENSATION),
+ MAKE_ENTRY(NV_CTRL_GPU_PCIE_GENERATION),
+ MAKE_ENTRY(NV_CTRL_GVI_BOUND_GPU),
+ MAKE_ENTRY(NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3),
MAKE_ENTRY(NV_CTRL_ACCELERATE_TRAPEZOIDS),
+ MAKE_ENTRY(NV_CTRL_GPU_CORES),
+ MAKE_ENTRY(NV_CTRL_GPU_MEMORY_BUS_WIDTH),
+ MAKE_ENTRY(NV_CTRL_GVI_TEST_MODE),
+ MAKE_ENTRY(NV_CTRL_COLOR_SPACE),
+ MAKE_ENTRY(NV_CTRL_COLOR_RANGE),
+ MAKE_ENTRY(NV_CTRL_GPU_SCALING_DEFAULT_TARGET),
+ MAKE_ENTRY(NV_CTRL_GPU_SCALING_DEFAULT_METHOD),
+ MAKE_ENTRY(NV_CTRL_FLATPANEL_DITHERING_MODE),
+ // MAKE_ENTRY(NV_CTRL_FLATPANEL_DEFAULT_DITHERING),
+ // MAKE_ENTRY(NV_CTRL_FLATPANEL_DEFAULT_DITHERING_MODE),
+ MAKE_ENTRY(NV_CTRL_THERMAL_SENSOR_READING),
+ MAKE_ENTRY(NV_CTRL_THERMAL_SENSOR_PROVIDER),
+ MAKE_ENTRY(NV_CTRL_THERMAL_SENSOR_TARGET),
{ -1, NULL, NULL }
};
diff --git a/samples/nv-control-framelock.c b/samples/nv-control-framelock.c
index d92b6c8..51f21b3 100644
--- a/samples/nv-control-framelock.c
+++ b/samples/nv-control-framelock.c
@@ -307,7 +307,7 @@ static void do_enable(Display *dpy)
gpu, // target_id
0, // display_mask
NV_CTRL_ENABLED_DISPLAYS,
- &mask);
+ (int *)&mask);
if (!ret) {
printf("Failed to query enabled displays!\n");
continue;
diff --git a/samples/nv-control-gvi.c b/samples/nv-control-gvi.c
index 9b093ea..8bc988b 100644
--- a/samples/nv-control-gvi.c
+++ b/samples/nv-control-gvi.c
@@ -46,145 +46,120 @@ char *SyncTypeName(int value)
switch (value) {
case NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_HD:
return "NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_HD";
- break;
case NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_SD:
return "NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_SD";
- break;
case NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_NONE:
return "NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_NONE";
- break;
default:
return "Invalid Value";
- break;
}
}
/*
* Decode provided signal format.
*/
+
+#define ADD_NVCTRL_CASE(FMT) \
+case (FMT): \
+ return #FMT;
+
+
char *VideoFormatName(int value)
{
switch(value) {
- case NV_CTRL_GVO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC:
- return "NV_CTRL_GVO_VIDEO_FORMAT_480I_59_94_SMPTE259_NTSC";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL:
- return "NV_CTRL_GVO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_59_94_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_59_94_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_60_00_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_60_00_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1035I_59_94_SMPTE260:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1035I_59_94_SMPTE260";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1035I_60_00_SMPTE260:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1035I_60_00_SMPTE260";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE295:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE295";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080I_59_94_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080I_59_94_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080I_60_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080I_60_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080P_23_976_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080P_23_976_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080P_24_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080P_24_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080P_25_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080P_25_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080P_29_97_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080P_29_97_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080P_30_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080P_30_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_50_00_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_50_00_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080I_48_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080I_48_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080I_47_96_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080I_47_96_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_30_00_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_30_00_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_29_97_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_29_97_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_25_00_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_25_00_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_24_00_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_24_00_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_720P_23_98_SMPTE296:
- return "NV_CTRL_GVO_VIDEO_FORMAT_720P_23_98_SMPTE296";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_25_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_25_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_29_97_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_29_97_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_30_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_30_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_24_00_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_24_00_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_23_98_SMPTE274:
- return "NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_23_98_SMPTE274";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048P_30_00_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048P_30_00_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048P_29_97_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048P_29_97_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048I_60_00_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048I_60_00_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048I_59_94_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048I_59_94_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048P_25_00_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048P_25_00_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048I_50_00_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048I_50_00_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048P_24_00_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048P_24_00_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048P_23_98_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048P_23_98_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048I_48_00_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048I_48_00_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_2048I_47_96_SMPTE372:
- return "NV_CTRL_GVO_VIDEO_FORMAT_2048I_47_96_SMPTE372";
- break;
- case NV_CTRL_GVO_VIDEO_FORMAT_NONE:
- return "NV_CTRL_GVO_VIDEO_FORMAT_NONE";
- break;
+ 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";
+ }
+}
+
+const char *SamplingName(int value)
+{
+ switch (value) {
+ default:
+ 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);
+ return "Invalid Value";
+ }
+}
+
+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";
- break;
}
}
@@ -202,6 +177,7 @@ static void do_help(void)
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()*/
@@ -276,57 +252,44 @@ static void do_query(Display *dpy, int use_gvi)
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_GVIO_REQUESTED_VIDEO_FORMAT,
- &value);
- if (!ret) {
- printf(" - Failed to query requested video format of "
- "GVI %d.\n", gvi);
- continue;
- }
- printf(" - Requested video format: %d\n", value);
ret = XNVCTRLQueryTargetAttribute(dpy,
NV_CTRL_TARGET_TYPE_GVI,
gvi, // target_id
0, // display_mask
- NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT,
+ NV_CTRL_GVI_GLOBAL_IDENTIFIER,
&value);
if (!ret) {
- printf(" - Failed to query detected video format of "
- "GVI %d.\n", gvi);
+ printf(" - Failed to query global ID of GVI %d.\n", gvi);
continue;
}
- printf(" - Detected video format: %d\n", value);
- */
+ printf(" - Global ID: %d\n", value);
ret = XNVCTRLQueryTargetAttribute(dpy,
NV_CTRL_TARGET_TYPE_GVI,
gvi, // target_id
0, // display_mask
- NV_CTRL_GVI_GLOBAL_IDENTIFIER,
+ NV_CTRL_GVI_NUM_CAPTURE_SURFACES,
&value);
if (!ret) {
- printf(" - Failed to query global ID of GVI %d.\n", gvi);
+ printf(" - Failed to number of capture surfaces of GVI %d.\n", gvi);
continue;
}
- printf(" - Global ID: %d\n", value);
+ printf(" - Number of capture surfaces: %d\n", value);
ret = XNVCTRLQueryTargetAttribute(dpy,
NV_CTRL_TARGET_TYPE_GVI,
gvi, // target_id
0, // display_mask
- NV_CTRL_GVI_NUM_CAPTURE_SURFACES,
+ NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT,
&value);
if (!ret) {
- printf(" - Failed to number of capture surfaces of GVI %d.\n", gvi);
+ printf(" - Failed to query requested video format on "
+ "GVI %d.\n", gvi);
continue;
}
- printf(" - Number of capture surfaces: %d\n", value);
+ printf(" - Requested video format: %d (%s)\n", value,
+ VideoFormatName(value));
ret = XNVCTRLQueryTargetAttribute(dpy,
NV_CTRL_TARGET_TYPE_GVI,
@@ -539,6 +502,67 @@ static void do_query(Display *dpy, int use_gvi)
}
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;
@@ -548,6 +572,182 @@ static void do_query(Display *dpy, int use_gvi)
+unsigned int firstbit (unsigned int mask)
+{
+ return mask ^ ((mask - 1) & mask);
+}
+
+// List the configuration space of the GVI device.
+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 || !pOut) {
+ 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.");
+ 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 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:\n", VideoFormatName(fmt));
+
+ // 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() */
+
+
+
void do_configure(Display *dpy, int use_gvi, char *pIn)
{
Bool ret;
@@ -649,6 +849,9 @@ int main(int argc, char *argv[])
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) {
diff --git a/samples/nv-control-targets.c b/samples/nv-control-targets.c
index bc78462..0f402db 100644
--- a/samples/nv-control-targets.c
+++ b/samples/nv-control-targets.c
@@ -90,6 +90,9 @@ int main(int argc, char *argv[])
int num_gpus, num_screens, num_gsyncs;
int num_vcs;
+ int num_gvis;
+ int num_coolers;
+ int num_thermal_sensors;
int gpu, screen;
int display_devices, mask;
int *pData;
@@ -178,6 +181,42 @@ int main(int argc, char *argv[])
num_vcs);
+ /* Get the number of GVI devices in the system */
+
+ ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_GVI,
+ &num_gvis);
+ if (!ret) {
+ fprintf(stderr, "Failed to query number of GVIs\n");
+ return 1;
+ }
+ printf(" number of Graphics Video Input Devices: %d\n",
+ num_gvis);
+
+
+ /* Get the number of Cooler devices in the system */
+
+ ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_COOLER,
+ &num_coolers);
+ if (!ret) {
+ fprintf(stderr, "Failed to query number of Coolers\n");
+ return 1;
+ }
+ printf(" number of Cooler Devices: %d\n",
+ num_coolers);
+
+
+ /* Get the number of Thermal Sensor devices in the system */
+
+ ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR,
+ &num_thermal_sensors);
+ if (!ret) {
+ fprintf(stderr, "Failed to query number of Thermal Sensors\n");
+ return 1;
+ }
+ printf(" number of Thermal Sensor Devices: %d\n",
+ num_thermal_sensors);
+
+
/* display information about all GPUs */
for (gpu = 0; gpu < num_gpus; gpu++) {
diff --git a/src/gtk+-2.x/ctkecc.c b/src/gtk+-2.x/ctkecc.c
index 1207379..a31b4dd 100644
--- a/src/gtk+-2.x/ctkecc.c
+++ b/src/gtk+-2.x/ctkecc.c
@@ -372,7 +372,8 @@ GtkWidget* ctk_ecc_new(NvCtrlAttributeHandle *handle,
if ( ret != NvCtrlSuccess ) {
aggregate_dbit_error_available = FALSE;
}
-
+ ctk_ecc->dbit_error_available = dbit_error_available;
+ ctk_ecc->aggregate_dbit_error_available = aggregate_dbit_error_available;
/* Query ECC configuration supported */
ret = NvCtrlGetAttribute(handle,
@@ -548,28 +549,32 @@ GtkTextBuffer *ctk_ecc_create_help(GtkTextTagTable *table,
ctk_help_heading(b, &i, "ECC");
ctk_help_para(b, &i, __ecc_status_help);
- ctk_help_heading(b, &i, "Double-bit ECC Errors");
- ctk_help_para(b, &i, __dbit_error_help);
-
- ctk_help_heading(b, &i, "Aggregate Double-bit ECC Errors");
- ctk_help_para(b, &i, __aggregate_dbit_error_help);
-
+ if (ctk_ecc->dbit_error_available) {
+ ctk_help_heading(b, &i, "Double-bit ECC Errors");
+ ctk_help_para(b, &i, __dbit_error_help);
+ }
+ if (ctk_ecc->aggregate_dbit_error_available) {
+ ctk_help_heading(b, &i, "Aggregate Double-bit ECC Errors");
+ ctk_help_para(b, &i, __aggregate_dbit_error_help);
+ }
ctk_help_heading(b, &i, "ECC Configuration");
ctk_help_para(b, &i, __configuration_status_help);
ctk_help_heading(b, &i, "Enable ECC");
ctk_help_para(b, &i, __ecc_status_help);
+ if (ctk_ecc->dbit_error_available) {
+ ctk_help_heading(b, &i, "Clear ECC Errors");
+ ctk_help_para(b, &i, __clear_button_help);
+ }
+ if (ctk_ecc->aggregate_dbit_error_available) {
+ ctk_help_heading(b, &i, "Clear Aggregate ECC Errors");
+ ctk_help_para(b, &i, __clear_aggregate_button_help);
+ }
+
ctk_help_heading(b, &i, "Reset Default Configuration");
ctk_help_para(b, &i, __reset_default_config_button_help);
- ctk_help_heading(b, &i, "Clear Aggregate ECC Errors");
- ctk_help_para(b, &i, __clear_aggregate_button_help);
-
- ctk_help_heading(b, &i, "Clear ECC Errors");
- ctk_help_para(b, &i, __clear_button_help);
-
-
ctk_help_finish(b);
diff --git a/src/gtk+-2.x/ctkecc.h b/src/gtk+-2.x/ctkecc.h
index 1b187bb..b301ea7 100644
--- a/src/gtk+-2.x/ctkecc.h
+++ b/src/gtk+-2.x/ctkecc.h
@@ -69,6 +69,8 @@ struct _CtkEcc
GtkWidget* configuration_status;
gboolean ecc_enabled;
+ gboolean dbit_error_available;
+ gboolean aggregate_dbit_error_available;
};
diff --git a/src/gtk+-2.x/ctkgauge.c b/src/gtk+-2.x/ctkgauge.c
index 12c3b59..045ef58 100644
--- a/src/gtk+-2.x/ctkgauge.c
+++ b/src/gtk+-2.x/ctkgauge.c
@@ -262,10 +262,11 @@ static void draw(CtkGauge *ctk_gauge)
{
GtkWidget *widget;
gint x1, x2, y, width, i, percent, pos;
- gint upper, lower, current;
+ gint upper, lower, range, current;
lower = ctk_gauge->lower;
upper = ctk_gauge->upper;
+ range = upper - lower;
current = ctk_gauge->current;
gdk_gc_set_function(ctk_gauge->gdk_gc, GDK_COPY);
@@ -276,7 +277,7 @@ static void draw(CtkGauge *ctk_gauge)
width = ctk_gauge->width / 5;
y = ctk_gauge->height / 5;
- percent = ((current - lower) * 100) / (upper - lower);
+ percent = (range > 0) ? (((current - lower) * 100) / range) : 0;
pos = (percent >= 95) ? 10 : (percent / 10);
x1 = (ctk_gauge->width / 2) - width - 4;
diff --git a/src/gtk+-2.x/ctkgvo.c b/src/gtk+-2.x/ctkgvo.c
index 8969a7c..614a88c 100644
--- a/src/gtk+-2.x/ctkgvo.c
+++ b/src/gtk+-2.x/ctkgvo.c
@@ -76,7 +76,8 @@ static const char * __clone_mode_video_format_help =
static const char * __clone_mode_data_format_help =
"The Data Format drop-down allows you to select the desired data format that "
-"the SDI will output.";
+"the SDI will output. Note that the new data format "
+"will be applied at modeset time.";
static const char * __clone_mode_x_offset_help =
"The X Offset determines the start location of the left side of SDI output "
diff --git a/src/gtk+-2.x/ctkthermal.c b/src/gtk+-2.x/ctkthermal.c
index e2b3e92..40c2052 100644
--- a/src/gtk+-2.x/ctkthermal.c
+++ b/src/gtk+-2.x/ctkthermal.c
@@ -1080,7 +1080,8 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
gint cooler_level;
gint cooler_control_type;
gchar *name = NULL;
- int *pData;
+ int *pDataCooler = NULL, *pDataSensor = NULL;
+ gint cooler_count = 0, sensor_count = 0;
int len, value;
int major = 0, minor = 0;
Bool can_access_cooler_level;
@@ -1130,13 +1131,29 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
return NULL;
}
}
- /* Retrieve CtrlHandles from ctk_config */
+ /* Query the list of sensors attached to this GPU */
- h = ctk_config->pCtrlHandles;
+ ret = NvCtrlGetBinaryAttribute(handle, 0,
+ NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU,
+ (unsigned char **)(&pDataSensor), &len);
+ if ( ret == NvCtrlSuccess ) {
+ sensor_count = pDataSensor[0];
+ }
+
+ /* Query the list of coolers attached to this GPU */
+ ret = NvCtrlGetBinaryAttribute(handle, 0,
+ NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU,
+ (unsigned char **)(&pDataCooler), &len);
+ if ( ret == NvCtrlSuccess ) {
+ cooler_count = pDataCooler[0];
+ }
+
/* return if sensor and Fan information not available */
- if ((h->targets[THERMAL_SENSOR_TARGET].n == 0) &&
- (h->targets[COOLER_TARGET].n == 0)) {
+ if ((thermal_sensor_target_type_supported && !sensor_count) &&
+ !cooler_count) {
+ XFree(pDataSensor);
+ XFree(pDataCooler);
return NULL;
}
@@ -1149,7 +1166,8 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
ctk_thermal->ctk_config = ctk_config;
ctk_thermal->settings_changed = FALSE;
ctk_thermal->show_fan_control_frame = TRUE;
- ctk_thermal->cooler_count = 0;
+ ctk_thermal->cooler_count = cooler_count;
+ ctk_thermal->sensor_count = sensor_count;
ctk_thermal->thermal_sensor_target_type_supported = thermal_sensor_target_type_supported;
/* set container properties for the CtkThermal widget */
@@ -1180,13 +1198,18 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
__license_accepted = TRUE;
}
+ /* Retrieve CtrlHandles from ctk_config */
+
+ h = ctk_config->pCtrlHandles;
+
/* Thermal Information */
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(object), vbox, FALSE, FALSE, 0);
if (thermal_sensor_target_type_supported) {
- if ( h->targets[THERMAL_SENSOR_TARGET].n == 0 ) {
+
+ if ( ctk_thermal->sensor_count == 0 ) {
goto sensor_end;
}
hbox1 = gtk_hbox_new(FALSE, FRAME_PADDING);
@@ -1197,25 +1220,15 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
hsep = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(hbox1), hsep, TRUE, TRUE, 0);
- /* Query the list of sensors attached to this GPU */
-
- ret = NvCtrlGetBinaryAttribute(handle, 0,
- NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU,
- (unsigned char **)(&pData), &len);
- if ( ret == NvCtrlSuccess ) {
- ctk_thermal->sensor_count = pData[0];
- } else {
- ctk_thermal->sensor_count = 0;
- }
-
if (ctk_thermal->sensor_count > 0) {
ctk_thermal->sensor_info = (SensorInfoPtr)
- malloc(pData[0] * sizeof(SensorInfoRec));
+ malloc(ctk_thermal->sensor_count * sizeof(SensorInfoRec));
}
for (j = 1; j <= ctk_thermal->sensor_count; j++) {
gint reading, target, provider;
- sensor_handle = h->targets[THERMAL_SENSOR_TARGET].t[pData[j]].h;
+ sensor_handle =
+ h->targets[THERMAL_SENSOR_TARGET].t[pDataSensor[j]].h;
if ( !sensor_handle ) {
continue;
@@ -1260,13 +1273,15 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
sensor_range.u.range.max, target, provider);
cur_sensor_idx++;
}
- XFree(pData);
- pData = NULL;
} else {
/* GPU Core Treshold Temperature */
+ vbox1 = gtk_vbox_new(FALSE, 0);
+ hbox1 = gtk_hbox_new(FALSE, 0);
frame = gtk_frame_new("Slowdown Threshold");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox1), vbox1, FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 0);
hbox2 = gtk_hbox_new(FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(hbox2), FRAME_PADDING);
@@ -1294,7 +1309,7 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
/* GPU Core Temperature */
table = gtk_table_new(2, 2, FALSE);
- gtk_box_pack_end(GTK_BOX(vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox1), table, FALSE, FALSE, 0);
hbox2 = gtk_hbox_new(FALSE, 0);
gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 0, 1,
@@ -1344,14 +1359,14 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
/* GPU Core Temperature Gauge */
- ctk_thermal->core_gauge = pack_gauge(hbox, 25, upper,
+ ctk_thermal->core_gauge = pack_gauge(hbox1, 25, upper,
ctk_config, __temp_level_help);
}
sensor_end:
/* Check for if Fans present on GPU */
- if ( h->targets[COOLER_TARGET].n == 0 ) {
+ if ( ctk_thermal->cooler_count == 0 ) {
goto end;
}
@@ -1376,22 +1391,13 @@ sensor_end:
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
ctk_thermal->cooler_table_hbox = hbox;
- /* Query the list of coolers attached to this GPU */
-
- ret = NvCtrlGetBinaryAttribute(handle, 0,
- NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU,
- (unsigned char **)(&pData), &len);
- if ( ret == NvCtrlSuccess ) {
- ctk_thermal->cooler_count = pData[0];
- }
-
/* Create cooler level control sliders/checkbox */
ctk_thermal->cooler_control = (CoolerControlPtr)
- malloc(pData[0] * sizeof(CoolerControlRec));
+ malloc(ctk_thermal->cooler_count * sizeof(CoolerControlRec));
for (j = 1; j <= ctk_thermal->cooler_count; j++) {
- cooler_handle = h->targets[COOLER_TARGET].t[pData[j]].h;
+ cooler_handle = h->targets[COOLER_TARGET].t[pDataCooler[j]].h;
if ( !cooler_handle ) {
continue;
@@ -1474,8 +1480,6 @@ sensor_end:
}
}
- XFree(pData);
-
if ( ctk_thermal->cooler_count && ctk_thermal->show_fan_control_frame ) {
/* Create the enable dialog */
@@ -1577,6 +1581,12 @@ sensor_end:
}
end:
+ XFree(pDataSensor);
+ pDataSensor = NULL;
+
+ XFree(pDataCooler);
+ pDataCooler = NULL;
+
/* sync GUI to current server settings */
sync_gui_to_modify_cooler_level(ctk_thermal);
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index 0b8ea8f..ed94ce7 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -2317,14 +2317,6 @@
#define NV_CTRL_VCSC_HIGH_PERF_MODE_DISABLE 0
#define NV_CTRL_VCSC_HIGH_PERF_MODE_ENABLE 1
-
-/*
- * NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE - the gamma value used by
- * OpenGL when NV_CTRL_OPENGL_AA_LINE_GAMMA is enabled
- */
-
-#define NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE 281 /* RW-X */
-
/*
* NV_CTRL_DISPLAYPORT_LINK_RATE - returns the negotiated lane bandwidth of the
* DisplayPort main link.
diff --git a/version.mk b/version.mk
index d11bb1b..32e7a20 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 256.29
+NVIDIA_VERSION = 256.35