summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2010-07-29 14:54:38 -0700
committerAaron Plattner <aplattner@nvidia.com>2010-07-29 14:54:38 -0700
commit4cca3a62dc6330a9048f77c40460fc24ed0281c0 (patch)
treeed78fd2603cf734cda42d8e2075519e0fcdb3b98
parent44183b9e70a2a0602f3fd5e97c72d033250a93e9 (diff)
256.38.02256.38.02
-rw-r--r--XF86Config-parser/Device.c19
-rw-r--r--XF86Config-parser/Generate.c18
-rw-r--r--XF86Config-parser/xf86Parser.h5
-rw-r--r--make_usable.c32
-rw-r--r--multiple_screens.c10
-rw-r--r--nvidia-xconfig.c50
-rw-r--r--nvidia-xconfig.h5
-rw-r--r--option_table.h24
-rw-r--r--options.c1
-rw-r--r--query_gpu_info.c14
-rw-r--r--version.mk2
11 files changed, 133 insertions, 47 deletions
diff --git a/XF86Config-parser/Device.c b/XF86Config-parser/Device.c
index a374fa4..10a9c17 100644
--- a/XF86Config-parser/Device.c
+++ b/XF86Config-parser/Device.c
@@ -434,8 +434,8 @@ int xconfigParsePciBusString(const char *busID,
{
/*
* The format is assumed to be "bus[@domain]:device[:func]", where domain,
- * bus, device and func are decimal integers. domain and func may be
- * omitted and assumed to be zero, although doing this isn't encouraged.
+ * bus, device and func are decimal integers. func may be omitted and
+ * assumed to be zero.
*/
char *p, *s, *d;
@@ -499,3 +499,18 @@ int xconfigParsePciBusString(const char *busID,
return TRUE;
}
+
+/*
+ * xconfigFormatPciBusString : The function checks for the availability
+ * of PCI domain & accordingly formats the busid string.
+ */
+void xconfigFormatPciBusString(char *str, int len,
+ int domain, int bus, int device)
+{
+ if (domain) {
+ snprintf(str, len, "PCI:%d@%d:%d:0", bus, domain, device);
+ } else {
+ snprintf(str, len, "PCI:%d:%d:0", bus, device);
+ }
+ str[len - 1] = '\0';
+}
diff --git a/XF86Config-parser/Generate.c b/XF86Config-parser/Generate.c
index 89f4361..5137d6f 100644
--- a/XF86Config-parser/Generate.c
+++ b/XF86Config-parser/Generate.c
@@ -51,8 +51,8 @@ static int is_file(const char *filename);
static void add_font_path(GenerateOptions *gop, XConfigPtr config);
static void add_modules(GenerateOptions *gop, XConfigPtr config);
-static XConfigDevicePtr
-add_device(XConfigPtr config, int bus, int slot, char *boardname, int count);
+static XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain,
+ int slot, char *boardname, int count);
static void add_layout(GenerateOptions *gop, XConfigPtr config);
@@ -99,7 +99,7 @@ XConfigPtr xconfigGenerate(GenerateOptions *gop)
*/
XConfigScreenPtr xconfigGenerateAddScreen(XConfigPtr config,
- int bus, int slot,
+ int bus, int domain, int slot,
char *boardname, int count)
{
XConfigScreenPtr screen, s;
@@ -107,7 +107,7 @@ XConfigScreenPtr xconfigGenerateAddScreen(XConfigPtr config,
XConfigMonitorPtr monitor;
monitor = xconfigAddMonitor(config, count);
- device = add_device(config, bus, slot, boardname, count);
+ device = add_device(config, bus, domain, slot, boardname, count);
screen = xconfigAlloc(sizeof(XConfigScreenRec));
@@ -463,8 +463,8 @@ XConfigMonitorPtr xconfigAddMonitor(XConfigPtr config, int count)
* add_device()
*/
-static XConfigDevicePtr
-add_device(XConfigPtr config, int bus, int slot, char *boardname, int count)
+static XConfigDevicePtr add_device(XConfigPtr config, int bus, int domain,
+ int slot, char *boardname, int count)
{
XConfigDevicePtr device, d;
@@ -475,9 +475,9 @@ add_device(XConfigPtr config, int bus, int slot, char *boardname, int count)
device->driver = xconfigStrdup("nvidia");
device->vendor = xconfigStrdup("NVIDIA Corporation");
- if (bus != -1 && slot != -1) {
+ if (bus != -1 && domain != -1 && slot != -1) {
device->busid = xconfigAlloc(32);
- snprintf(device->busid, 32, "PCI:%d:%d:0", bus, slot);
+ xconfigFormatPciBusString(device->busid, 32, domain, bus, slot);
}
if (boardname) device->board = xconfigStrdup(boardname);
@@ -532,7 +532,7 @@ static void add_layout(GenerateOptions *gop, XConfigPtr config)
/* assume 1 X screen */
- screen = xconfigGenerateAddScreen(config, -1, -1, NULL, 0);
+ screen = xconfigGenerateAddScreen(config, -1, -1, -1, NULL, 0);
/* create layout */
diff --git a/XF86Config-parser/xf86Parser.h b/XF86Config-parser/xf86Parser.h
index f207e31..bbbbf9b 100644
--- a/XF86Config-parser/xf86Parser.h
+++ b/XF86Config-parser/xf86Parser.h
@@ -710,6 +710,8 @@ XConfigOptionPtr xconfigParseOption(XConfigOptionPtr head);
void xconfigPrintOptionList(FILE *fp, XConfigOptionPtr list, int tabs);
int xconfigParsePciBusString(const char *busID,
int *bus, int *device, int *func);
+void xconfigFormatPciBusString(char *str, int len,
+ int domain, int bus, int device);
void xconfigAddDisplay(XConfigDisplayPtr *pHead, const int depth);
@@ -718,7 +720,8 @@ void xconfigRemoveMode(XConfigModePtr *pHead, const char *name);
XConfigPtr xconfigGenerate(GenerateOptions *gop);
-XConfigScreenPtr xconfigGenerateAddScreen(XConfigPtr config, int bus, int slot,
+XConfigScreenPtr xconfigGenerateAddScreen(XConfigPtr config,
+ int bus, int domain, int slot,
char *boardname, int count);
void xconfigGenerateAssignScreenAdjacencies(XConfigLayoutPtr layout);
diff --git a/make_usable.c b/make_usable.c
index 417524d..4d334c4 100644
--- a/make_usable.c
+++ b/make_usable.c
@@ -275,7 +275,27 @@ static int update_device(Options *op, XConfigPtr config, XConfigDevicePtr device
device->comment = comment;
device->screen = screen;
device->board = board;
- device->busid = busid;
+
+ /*
+ * Considering three conditions, in order, while populating busid field
+ * 1. If we want to write busid with option --busid
+ * 2. If we want to preserve existing bus id
+ * 3. If there are multiple screens
+ */
+
+ if (op->busid) {
+ device->busid = op->busid;
+ } else if (GET_BOOL_OPTION(op->boolean_options,
+ PRESERVE_BUSID_BOOL_OPTION)) {
+ if (GET_BOOL_OPTION(op->boolean_option_values,
+ PRESERVE_BUSID_BOOL_OPTION)) {
+ device->busid = busid;
+ } else {
+ device->busid = NULL;
+ }
+ } else if (config->screens->next) {
+ device->busid = busid;
+ }
device->chipid = -1;
device->chiprev = -1;
@@ -287,16 +307,6 @@ static int update_device(Options *op, XConfigPtr config, XConfigDevicePtr device
device->driver = "nvidia";
}
- /*
- * XXX do we really want to preserve the BusID line? Let's only
- * preserve the BusID if there are multiple screens in this
- * config; not a very good heuristic
- */
-
- if (!config->screens->next) {
- device->busid = NULL;
- }
-
return TRUE;
} /* update_device() */
diff --git a/multiple_screens.c b/multiple_screens.c
index 780fe10..b751bb8 100644
--- a/multiple_screens.c
+++ b/multiple_screens.c
@@ -442,10 +442,11 @@ static int enable_separate_x_screens(Options *op, XConfigPtr config,
}
screenlist[i]->device->busid = nvalloc(32);
- snprintf(screenlist[i]->device->busid, 32,
- "PCI:%d:%d:0",
- pDevices->devices[i].dev.bus,
- pDevices->devices[i].dev.slot);
+ xconfigFormatPciBusString(screenlist[i]->device->busid, 32,
+ pDevices->devices[i].dev.domain,
+ pDevices->devices[i].dev.bus,
+ pDevices->devices[i].dev.slot);
+
screenlist[i]->device->board = nvstrdup(pDevices->devices[i].name);
}
@@ -850,6 +851,7 @@ static int enable_all_gpus(Options *op, XConfigPtr config,
for (i = 0; i < pDevices->nDevices; i++) {
xconfigGenerateAddScreen(config,
pDevices->devices[i].dev.bus,
+ pDevices->devices[i].dev.domain,
pDevices->devices[i].dev.slot,
pDevices->devices[i].name, i);
}
diff --git a/nvidia-xconfig.c b/nvidia-xconfig.c
index 30f9b2a..73665a5 100644
--- a/nvidia-xconfig.c
+++ b/nvidia-xconfig.c
@@ -251,6 +251,8 @@ static void parse_commandline(Options *op, int argc, char *argv[])
case LAYOUT_OPTION: op->layout = strval; break;
case SCREEN_OPTION: op->screen = strval; break;
+ case DEVICE_OPTION: op->device = strval; break;
+ case BUSID_OPTION: op->busid = strval; break;
case X_PREFIX_OPTION: op->gop.x_project_root = strval; break;
@@ -1088,8 +1090,8 @@ static XConfigPtr find_system_xconfig(Options *op)
static int update_xconfig(Options *op, XConfigPtr config)
{
XConfigLayoutPtr layout;
- XConfigScreenPtr screen;
XConfigAdjacencyPtr adj;
+ int updated;
/* get the layout to update */
@@ -1106,22 +1108,44 @@ static int update_xconfig(Options *op, XConfigPtr config)
/*
* update the device and option for all screens, or the screen
- * that was requested
+ * or device that was requested.
*/
-
- if (op->screen) {
- screen = xconfigFindScreen(op->screen, config->screens);
- if (!screen) {
- fmterr("Unable to find screen '%s'", op->screen);
- return FALSE;
+ updated = FALSE;
+
+ for (adj = layout->adjacencies; adj; adj = adj->next) {
+
+ if (!adj->screen) {
+ continue;
}
- update_screen(op, config, screen);
- } else {
- for (adj = layout->adjacencies; adj; adj = adj->next) {
- update_screen(op, config, adj->screen);
+
+ /* if screen option set: skip adj if not the requested screen */
+
+ if ((op->screen) &&
+ (xconfigNameCompare(op->screen, adj->screen->identifier) != 0)) {
+ continue;
}
+
+ /* if device option set: skip adj if not the requested device */
+
+ if ((op->device) &&
+ (xconfigNameCompare(op->device, adj->screen->device_name) != 0)) {
+ continue;
+ }
+
+ update_screen(op, config, adj->screen);
+ updated = TRUE;
}
-
+
+ if (op->screen && !updated) {
+ fmterr("Unable to find screen '%s'", op->screen);
+ return FALSE;
+ }
+
+ if (op->device && !updated) {
+ fmterr("Unable to find device '%s'", op->device);
+ return FALSE;
+ }
+
update_extensions(op, config);
update_modules(config);
diff --git a/nvidia-xconfig.h b/nvidia-xconfig.h
index b926353..a71ce60 100644
--- a/nvidia-xconfig.h
+++ b/nvidia-xconfig.h
@@ -90,8 +90,9 @@ typedef struct {
#define ENABLE_ACPI_HOTKEYS_BOOL_OPTION 38
#define MODE_DEBUG_BOOL_OPTION 39
#define THERMAL_CONFIGURATION_CHECK_BOOL_OPTION 40
+#define PRESERVE_BUSID_BOOL_OPTION 41
-#define XCONFIG_BOOL_OPTION_COUNT (THERMAL_CONFIGURATION_CHECK_BOOL_OPTION + 1)
+#define XCONFIG_BOOL_OPTION_COUNT (PRESERVE_BUSID_BOOL_OPTION + 1)
/* # of 32-bit variables needed to hold all the boolean options (bits) */
#define XCONFIG_BOOL_OPTION_SLOTS \
@@ -149,6 +150,8 @@ typedef struct __options {
char *output_xconfig;
char *layout;
char *screen;
+ char *device;
+ char *busid;
char *multigpu;
char *sli;
char *rotate;
diff --git a/option_table.h b/option_table.h
index 61c8fa0..86543fb 100644
--- a/option_table.h
+++ b/option_table.h
@@ -48,6 +48,8 @@
#define CONNECTED_MONITOR_OPTION 37
#define REGISTRY_DWORDS_OPTION 38
#define META_MODES_OPTION 39
+#define BUSID_OPTION 42
+#define DEVICE_OPTION 43
/*
* To add a boolean option to nvidia-xconfig:
@@ -148,6 +150,21 @@ static const NVGetoptOption __options[] = {
NVGETOPT_IS_BOOLEAN, NULL,
"Disable or enable the \"NoBandWidthTest\" X configuration option." },
+ { "busid", BUSID_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
+ "This option writes the specified BusID to the device section of the "
+ "X configuration file. If there are multiple device sections, then it "
+ "adds the BusID field to each of them. To add the BusID to only a "
+ "specific device or screen section, use the '--device' or '--screen' "
+ "options." },
+
+ { "preserve-busid", XCONFIG_BOOL_VAL(PRESERVE_BUSID_BOOL_OPTION),
+ NVGETOPT_IS_BOOLEAN, NULL,
+ "By default, nvidia-xconfig preserves the existing BusID in the X "
+ "configuration file only if there are multiple X screens configured "
+ "for the X server. Use '--preserve-busid' or '--no-preserve-busid' to "
+ "force the BusID to be preserved or not preserved, overriding the "
+ "default behavior." },
+
{ "cool-bits", COOL_BITS_OPTION,
NVGETOPT_INTEGER_ARGUMENT | NVGETOPT_ALLOW_DISABLE, NULL,
"Enable or disable the \"Coolbits\" X configuration option. Setting this "
@@ -200,6 +217,13 @@ static const NVGetoptOption __options[] = {
"Set the default depth to [DEPTH]; valid values for [DEPTH] are "
"8, 15, 16, 24, and 30." },
+ { "device", DEVICE_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
+ "The nvidia-xconfig utility operates on one or more devices in "
+ "the X configuration file. If this option is specified, the "
+ "device named [DEVICE] in the X configuration file will be "
+ "used. If this option is not specified, all the devices within "
+ "the X configuration file will be used." },
+
{ "disable-glx-root-clipping",
XCONFIG_BOOL_VAL(DISABLE_GLX_ROOT_CLIPPING_BOOL_OPTION),
NVGETOPT_IS_BOOLEAN, NULL, "Disable or enable clipping OpenGL rendering "
diff --git a/options.c b/options.c
index cf2c55a..5c5365e 100644
--- a/options.c
+++ b/options.c
@@ -550,6 +550,7 @@ void update_options(Options *op, XConfigScreenPtr screen)
if (i == SEPARATE_X_SCREENS_BOOL_OPTION) continue;
if (i == XINERAMA_BOOL_OPTION) continue;
if (i == COMPOSITE_BOOL_OPTION) continue;
+ if (i == PRESERVE_BUSID_BOOL_OPTION) continue;
o = get_option(i);
diff --git a/query_gpu_info.c b/query_gpu_info.c
index b187bd0..5ba1f44 100644
--- a/query_gpu_info.c
+++ b/query_gpu_info.c
@@ -26,13 +26,14 @@
*/
#include "nvidia-xconfig.h"
+#include <string.h>
static char *display_device_mask_to_display_device_name(unsigned int mask);
#define TAB " "
#define BIGTAB " "
-
+#define BUS_ID_STRING_LENGTH 32
/*
@@ -45,7 +46,7 @@ int query_gpu_info(Options *op)
DevicesPtr pDevices;
DisplayDevicePtr pDisplayDevice;
int i, j;
- char *name;
+ char *name, busid[BUS_ID_STRING_LENGTH];
/* query the GPU information */
@@ -66,9 +67,12 @@ int query_gpu_info(Options *op)
fmtout("GPU #%d:", i);
fmtoutp(TAB, "Name : %s", pDevices->devices[i].name);
- fmtoutp(TAB, "PCI BusID : PCI:%d:%d:0",
- pDevices->devices[i].dev.bus,
- pDevices->devices[i].dev.slot);
+ memset(busid, 0, BUS_ID_STRING_LENGTH);
+ xconfigFormatPciBusString(busid, BUS_ID_STRING_LENGTH,
+ pDevices->devices[i].dev.domain,
+ pDevices->devices[i].dev.bus,
+ pDevices->devices[i].dev.slot);
+ fmtoutp(TAB, "PCI BusID : %s", busid);
fmtout("");
fmtoutp(TAB, "Number of Display Devices: %d",
diff --git a/version.mk b/version.mk
index 32e7a20..9378557 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 256.35
+NVIDIA_VERSION = 256.38.02