summaryrefslogtreecommitdiff
path: root/bsd-core
AgeCommit message (Expand)Author
2003-10-20Clean up BSD MTRR handling. The NetBSD code is untested, but it's my bestEric Anholt
2003-10-19- SMPng lock the DRM. This is only partial -- there are a few code pathsEric Anholt
2003-10-19Clean up extra zeroing of dev->dma, and use calloc to take advantage ofEric Anholt
2003-10-17- Move IRQ functions from drm_dma.h to new drm_irq.h and disentangle themEric Anholt
2003-10-17- Converted Linux drivers to initialize DRM instances based on PCI IDs, notEric Anholt
2003-10-03Some code cleanups done while working on locking. Reduces always-trueEric Anholt
2003-10-03Stylistic preparation for SMPng locking work: DRM_LOCK/DRM_UNLOCK have sideEric Anholt
2003-10-02Add an MIT-style copyright, assigned to myself, to these files. I thinkEric Anholt
2003-10-02Axe more old gamma DMA infrastructure.Eric Anholt
2003-10-02Mostly whitespace cleanups and style(9) fixes focused on "if(" -> "if ("Eric Anholt
2003-10-02Wrap sys/endian.h usage with __FreeBSD_version >= 480000.Eric Anholt
2003-10-02Allow the DRM to attach to a "drmsub" device. This will be provided by theEric Anholt
2003-10-02MTRR issue with SMP and -stable seems to be resolved. Re-enable MTRRs onEric Anholt
2003-09-09Use spldrm/splx around tsleep() in DRM_WAIT_ONKeith Whitwell
2003-09-07Fix for older -stable.Eric Anholt
2003-08-29These files were missed in the SiS DRM commit.Eric Anholt
2003-08-29Port the SiS DRM to FreeBSD. This includes the ability for the DRM toEric Anholt
2003-08-29Add DRM(calloc), which is convenient, used by the new sis code, and takesEric Anholt
2003-08-29Update radeon PCI IDs.Eric Anholt
2003-08-29This PCI header has been living in dev/pci/ for a while now.Eric Anholt
2003-08-19Fix the debug build.Eric Anholt
2003-08-19- Remove $FreeBSD$ tags as they weren't too useful and merges are now beingEric Anholt
2003-08-12Merge from FreeBSD r1.11: We have memset in the kernel, no need to defineEric Anholt
2003-07-29IRQ code cleanup suggested by Linus TorvaldsMichel Daenzer
2003-07-26Fix FreeBSD build after IRQ changes.Eric Anholt
2003-07-25Compile fixes for recent 2.5/2.6 Linux kernels. I hope this doesn't breakMichel Daenzer
2003-05-16Support AGP bridges where the AGP aperture can't be accessed directly byMichel Daenzer
2003-04-28Fix a typo: On takedown the mtrr operation is MEMRANGE_SET_REMOVE, notEric Anholt
2003-04-27Use real endian conversion functions.Eric Anholt
2003-04-26Fix formatting of hw.dri sysctl.Eric Anholt
2003-04-26Remove the map argument from DRM_*MEMORYBARRIER. Not all of the uses ofEric Anholt
2003-04-26MFL: Don't install irq handler unless the driver has been initialized.Eric Anholt
2003-04-26Add PCI DMA memory functions and make addbufs_pci and associated code useEric Anholt
2003-04-26Missed files in the last commit: Remove memory debugging sysctl unlessEric Anholt
2003-04-26Move the memory functions with debugging info to drm_memory_debug.h, andEric Anholt
2003-04-26Remove #if 0'ed code.Eric Anholt
2003-04-26Replace the C atomic_cmpset_int compatibility function for -stable with theEric Anholt
2003-04-26Disable MTRRs on FreeBSD-stable. Without this, it hangs on boot in the MTRREric Anholt
2003-04-25Merge from FreeBSD-current.Eric Anholt
2003-04-25Clean up the DRM_COPY_TO_USER()ing of DRM(infobufs), making it moreEric Anholt
2003-04-24Clean up the style of the linux-compat code and use ioctl() directly ratherEric Anholt
2003-04-24Remove more gamma DMA infrastructure. Most of this code was copied straightEric Anholt
2003-04-24Remove more gamma DMA code. This isn't all of it, but it's a major portion.Eric Anholt
2003-04-24Move some common code from addbufs_<type> to addbufs. Make buf_alloc beEric Anholt
2003-04-24Remove the ioctl_count variable from the device. A reference is held to theEric Anholt
2003-04-24Remove a bunch of dead code and fix spelling of a couple of comments.Eric Anholt
2003-04-24Move one definition to drm_drv.h and remove the rest of drm_init.h whichEric Anholt
2003-04-24Remove DRM_DMA_HISTOGRAM and associated code.Eric Anholt
2003-04-24Make DRM(read) and DRM(poll) stubs and remove DRM(write) andEric Anholt
2003-04-01Whitespace and remove a dead commented line.Eric Anholt
%s\n", version->desc ? version->desc : "?"); drmFreeVersion(version); } else { printf(" No version information available\n"); } } static void getbusid(int fd) { const char *busid = drmGetBusid(fd); printf(" Busid: %s\n", *busid ? busid : "(not set)"); drmFreeBusid(busid); } static void getvm(int fd) { int i; const char *typename; char flagname[33]; drmHandle offset; drmSize size; drmMapType type; drmMapFlags flags; drmHandle handle; int mtrr; printf(" VM map information:\n"); printf(" flags: (R)estricted (r)ead/(w)rite (l)ocked (k)ernel (W)rite-combine (L)ock:\n"); printf(" slot offset size type flags address mtrr\n"); for (i = 0; !drmGetMap(fd, i, &offset, &size, &type, &flags, &handle, &mtrr); i++) { switch (type) { case DRM_FRAME_BUFFER: typename = "FB"; break; case DRM_REGISTERS: typename = "REG"; break; case DRM_SHM: typename = "SHM"; break; case DRM_AGP: typename = "AGP"; break; case DRM_SCATTER_GATHER: typename = "SG"; break; default: typename = "???"; break; } flagname[0] = (flags & DRM_RESTRICTED) ? 'R' : ' '; flagname[1] = (flags & DRM_READ_ONLY) ? 'r' : 'w'; flagname[2] = (flags & DRM_LOCKED) ? 'l' : ' '; flagname[3] = (flags & DRM_KERNEL) ? 'k' : ' '; flagname[4] = (flags & DRM_WRITE_COMBINING) ? 'W' : ' '; flagname[5] = (flags & DRM_CONTAINS_LOCK) ? 'L' : ' '; flagname[6] = '\0'; printf(" %4d 0x%08lx 0x%08lx %3.3s %6.6s 0x%08lx ", i, offset, (unsigned long)size, typename, flagname, handle); if (mtrr < 0) printf("none\n"); else printf("%4d\n", mtrr); } } static void getclients(int fd) { int i; int auth; int pid; int uid; unsigned long magic; unsigned long iocs; char buf[64]; char cmd[40]; int procfd; printf(" DRI client information:\n"); printf(" a pid uid magic ioctls prog\n"); for (i = 0; !drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs); i++) { sprintf(buf, "/proc/%d/cmdline", pid); memset(cmd, sizeof(cmd), 0); if ((procfd = open(buf, O_RDONLY, 0)) >= 0) { read(procfd, cmd, sizeof(cmd)-1); close(procfd); } if (*cmd) { char *pt; for (pt = cmd; *pt; pt++) if (!isprint(*pt)) *pt = ' '; printf(" %c %5d %5d %10lu %10lu %s\n", auth ? 'y' : 'n', pid, uid, magic, iocs, cmd); } else { printf(" %c %5d %5d %10lu %10lu\n", auth ? 'y' : 'n', pid, uid, magic, iocs); } } } static void printhuman(unsigned long value, const char *name, int mult) { const char *p; double f; /* Print width 5 number in width 6 space */ if (value < 100000) { printf(" %5lu", value); return; } p = name; f = (double)value / (double)mult; if (f < 10.0) { printf(" %4.2f%c", f, *p); return; } p++; f = (double)value / (double)mult; if (f < 10.0) { printf(" %4.2f%c", f, *p); return; } p++; f = (double)value / (double)mult; if (f < 10.0) { printf(" %4.2f%c", f, *p); return; } } static void getstats(int fd, int i) { drmStatsT prev, curr; int j; double rate; printf(" System statistics:\n"); if (drmGetStats(fd, &prev)) return; if (!i) { for (j = 0; j < prev.count; j++) { printf(" "); printf(prev.data[j].long_format, prev.data[j].long_name); if (prev.data[j].isvalue) printf(" 0x%08lx\n", prev.data[j].value); else printf(" %10lu\n", prev.data[j].value); } return; } printf(" "); for (j = 0; j < prev.count; j++) if (!prev.data[j].verbose) { printf(" "); printf(prev.data[j].rate_format, prev.data[j].rate_name); } printf("\n"); for (;;) { sleep(i); if (drmGetStats(fd, &curr)) return; printf(" "); for (j = 0; j < curr.count; j++) { if (curr.data[j].verbose) continue; if (curr.data[j].isvalue) { printf(" %08lx", curr.data[j].value); } else { rate = (curr.data[j].value - prev.data[j].value) / (double)i; printhuman(rate, curr.data[j].mult_names, curr.data[j].mult); } } printf("\n"); memcpy(&prev, &curr, sizeof(prev)); } } int main(int argc, char **argv) { int c; int mask = 0; int minor = 0; int interval = 0; int fd; char buf[64]; int i; while ((c = getopt(argc, argv, "avmcsbM:i:")) != EOF) switch (c) { case 'a': mask = ~0; break; case 'v': mask |= DRM_VERSION; break; case 'm': mask |= DRM_MEMORY; break; case 'c': mask |= DRM_CLIENTS; break; case 's': mask |= DRM_STATS; break; case 'b': mask |= DRM_BUSID; break; case 'i': interval = strtol(optarg, NULL, 0); break; case 'M': minor = strtol(optarg, NULL, 0); break; default: fprintf( stderr, "Usage: dristat [options]\n" ); return 1; } for (i = 0; i < 16; i++) if (!minor || i == minor) { sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i); fd = drmOpenMinor(i, 1); if (fd >= 0) { printf("%s\n", buf); if (mask & DRM_BUSID) getbusid(fd); if (mask & DRM_VERSION) getversion(fd); if (mask & DRM_MEMORY) getvm(fd); if (mask & DRM_CLIENTS) getclients(fd); if (mask & DRM_STATS) getstats(fd, interval); close(fd); } } return 0; }