summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-07-25 21:55:21 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-07-28 14:49:06 +0100
commitab28526ea43728fb675448515e1519a970fb5f56 (patch)
tree86b904308564d234a80ff02b70654978b5b39c82
parent6fd37e644d9c662776aff14cd51a27b7e52472de (diff)
intel: Only print the unique chipset names
When printing out the list of supported chipsets, remove the (many times) repeated names as they are very confusing and obscure the product name you may be searching for. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel_module.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/src/intel_module.c b/src/intel_module.c
index 065a54eb..005e4185 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -309,15 +309,65 @@ intel_detect_chipset(ScrnInfoPtr scrn,
*
* Returns the string name for the driver based on the chipset.
*
*/
static void intel_identify(int flags)
{
- xf86PrintChipsets(INTEL_NAME,
- "Driver for Intel Integrated Graphics Chipsets",
- intel_chipsets);
+ const SymTabRec *chipset;
+ const char *stack[64], **unique;
+ int i, j, size, len;
+
+ unique = stack;
+ size = sizeof(stack)/sizeof(stack[0]);
+ i = 0;
+
+ xf86Msg(X_INFO, INTEL_NAME ": Driver for Intel(R) Integrated Graphics Chipsets:\n\t");
+ len = 8;
+
+ for (chipset = intel_chipsets; chipset->name; chipset++) {
+ for (j = i; --j >= 0;)
+ if (strcmp(unique[j], chipset->name) == 0)
+ break;
+ if (j < 0) {
+ int name_len = strlen(chipset->name);
+ if (i != 0) {
+ xf86ErrorF(",");
+ len++;
+ if (len + 2 + name_len < 78) {
+ xf86ErrorF(" ");
+ len++;
+ } else {
+ xf86ErrorF("\n\t");
+ len = 8;
+ }
+ }
+ xf86ErrorF("%s", chipset->name);
+ len += name_len;
+
+ if (i == size) {
+ const char **new_unique;
+
+ if (unique == stack)
+ new_unique = malloc(2*sizeof(*unique)*size);
+ else
+ new_unique = realloc(unique, 2*sizeof(*unique)*size);
+ if (new_unique != NULL) {
+ if (unique == stack)
+ memcpy(new_unique, stack,
+ sizeof(stack));
+ unique = new_unique;
+ size *= 2;
+ }
+ }
+ if (i < size)
+ unique[i++] = chipset->name;
+ }
+ }
+ xf86ErrorF("\n");
+ if (unique != stack)
+ free(unique);
}
static Bool intel_driver_func(ScrnInfoPtr pScrn,
xorgDriverFuncOp op,
pointer ptr)
{