summaryrefslogtreecommitdiff
path: root/bsd-core
AgeCommit message (Expand)Author
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
2003-03-29Remove dead vma code and remove the unused devstate struct definition.Eric Anholt
2003-03-29Add DRMFILE definitions and supply filp for BSD in theEric Anholt
2003-03-25XFree86 4.3.0 mergeAlan Hourihane
2003-03-11Merge back from FreeBSD-current, adding FreeBSD ID tags to aid futureEric Anholt
2003-03-08Make dma_addr_t an unsigned long not a uint32, don't try to use memrangeEric Anholt
2003-03-06Remove the vbl signal code because it's untested (and has lock issues onEric Anholt
2003-03-05Put cdevsw initialization in line with FreeBSD-current. (From r1.10,r1.11Eric Anholt
2003-03-05Update mmap handling for FreeBSD-current (Based on r1.3 of FreeBSD CVS).Eric Anholt
2003-03-05Remove a paste-o in DRM_SPINUNINIT and add a volatile to the compatibilityEric Anholt
2003-03-04DRM_FREE/2 patch from Philip BrownKeith Whitwell
2003-02-22Fix build on NetBSD.Eric Anholt
2003-02-21Merge from bsd-4-0-0-branch.Eric Anholt
2003-02-02don't inflate relative vblank sequence numbers on repeated calls (e.g. whenMichel Daenzer
2003-01-24Fix build on -current: Provide M_WAITOK define.Eric Anholt
2002-12-06Add vblank signal code for BSD DRM. Untested so far, but working with aEric Anholt
2002-10-30Kernel support for vblank syncing on Rage 128 and Matrox.Eric Anholt
2002-10-29Use bus_alloc_resource/bus_release_resource more properly: save the ridEric Anholt
2002-10-27Catch up to -current.Eric Anholt
2002-10-14Fix reversed test that broke vblank waiting on FreeBSD.Eric Anholt
2002-09-29Remove some noise being spit to the console.Eric Anholt
2002-09-29Make our set_bit and friends match linux better (cleans up some warnings)Eric Anholt
2002-09-29warnings cleanupEric Anholt
2002-09-29Fix some of my silliness in DRM_WAIT_ON (not returning EINTR).Eric Anholt
2002-09-29Move os-dependent stuff out of radeon_irq.cKeith Whitwell
2002-09-29Fix up BSD irq handling.Eric Anholt
>1, "unexpected event: %d\n", event); } static void send_event(int pipe, enum auth_event send_event) { int ret; unsigned char event; event = send_event; ret = write(commfd[pipe], &event, 1); if (ret == -1) err(1, "failed to send event %d", event); } static void client_auth(int drmfd) { struct drm_auth auth; int ret; /* Get a client magic number and pass it to the master for auth. */ ret = ioctl(drmfd, DRM_IOCTL_GET_MAGIC, &auth); if (ret == -1) err(1, "Couldn't get client magic"); send_event(0, CLIENT_MAGIC); ret = write(commfd[0], &auth.magic, sizeof(auth.magic)); if (ret == -1) err(1, "Couldn't write auth data"); } static void server_auth(int drmfd) { struct drm_auth auth; int ret; send_event(1, SERVER_READY); wait_event(1, CLIENT_MAGIC); ret = read(commfd[1], &auth.magic, sizeof(auth.magic)); if (ret == -1) err(1, "Failure to read client magic"); ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth); if (ret == -1) err(1, "Failure to authenticate client magic\n"); } /** Tests that locking is successful in normal conditions */ static void test_lock_unlock(int drmfd) { int ret; ret = drmGetLock(drmfd, lock1, 0); if (ret != 0) err(1, "Locking failed"); ret = drmUnlock(drmfd, lock1); if (ret != 0) err(1, "Unlocking failed"); } /** Tests that unlocking the lock while it's not held works correctly */ static void test_unlock_unlocked(int drmfd) { int ret; ret = drmUnlock(drmfd, lock1); if (ret == 0) err(1, "Unlocking unlocked lock succeeded"); } /** Tests that unlocking a lock held by another context fails appropriately */ static void test_unlock_unowned(int drmfd) { int ret; ret = drmGetLock(drmfd, lock1, 0); assert(ret == 0); ret = drmUnlock(drmfd, lock2); if (ret == 0) errx(1, "Unlocking other context's lock succeeded"); ret = drmUnlock(drmfd, lock1); assert(ret == 0); } /** * Tests that an open/close by the same process doesn't result in the lock * being dropped. */ static void test_open_close_locked(drmfd) { int ret, tempfd; ret = drmGetLock(drmfd, lock1, 0); assert(ret == 0); /* XXX: Need to make sure that this is the same device as drmfd */ tempfd = drm_open_any(); close(tempfd); ret = drmUnlock(drmfd, lock1); if (ret != 0) errx(1, "lock lost during open/close by same pid"); } static void client() { int drmfd, ret; unsigned int time; wait_event(0, SERVER_READY); /* XXX: Should make sure we open the same DRM as the master */ drmfd = drm_open_any(); client_auth(drmfd); /* Wait for the server to grab the lock, then grab it ourselves (to * contest it). Hopefully we hit it within the window of when the * server locks. */ wait_event(0, SERVER_LOCKED); ret = drmGetLock(drmfd, lock2, 0); time = get_millis(); if (ret != 0) err(1, "Failed to get lock on client\n"); drmUnlock(drmfd, lock2); /* Tell the server that our locking completed, and when it did */ send_event(0, CLIENT_LOCKED); ret = write(commfd[0], &time, sizeof(time)); close(drmfd); exit(0); } static void server() { int drmfd, tempfd, ret; unsigned int client_time, unlock_time; drmfd = drm_open_any_master(); test_lock_unlock(drmfd); test_unlock_unlocked(drmfd); test_unlock_unowned(drmfd); test_open_close_locked(drmfd); /* Perform the authentication sequence with the client. */ server_auth(drmfd); /* Now, test that the client attempting to lock while the server * holds the lock works correctly. */ ret = drmGetLock(drmfd, lock1, 0); assert(ret == 0); send_event(1, SERVER_LOCKED); /* Wait a while for the client to do its thing */ sleep(1); ret = drmUnlock(drmfd, lock1); assert(ret == 0); unlock_time = get_millis(); wait_event(1, CLIENT_LOCKED); ret = read(commfd[1], &client_time, sizeof(client_time)); if (ret == -1) err(1, "Failure to read client magic"); if (client_time < unlock_time) errx(1, "Client took lock before server released it"); close(drmfd); } int main(int argc, char **argv) { int ret; ret = pipe(commfd); if (ret == -1) err(1, "Couldn't create pipe"); ret = fork(); if (ret == -1) err(1, "failure to fork client"); if (ret == 0) client(); else server(); return 0; }