summaryrefslogtreecommitdiff
path: root/linux-core/drm_irq.c
AgeCommit message (Expand)Author
2007-08-06nouveau: Various internal and external API changesBen Skeggs
2007-07-20Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.Eric Anholt
2007-07-20Replace filp in ioctl arguments with drm_file *file_priv.Eric Anholt
2007-07-16drm: remove drmP.h internal typedefsDave Airlie
2007-07-16drm: detypedef drm.h and fixup all problemsDave Airlie
2007-05-26drm: cleanup use of Linux list handling macrosDave Airlie
2007-03-23drm: remove second spinlock init for tasklet lockDave Airlie
2007-03-11replace instance of SA_SHIRQ with IRQF_SHAREDMaarten Maathuis
2007-02-13Bugzilla Bug #9457Thomas Hellstrom
2006-10-18Merging drm-ttm-0-2-branchThomas Hellstrom
2006-10-02Fix type of second argument to spin_lock_irqsave().Michel Dänzer
2006-10-02Fix type of second argument to spin_lock_irqsave().Michel Dänzer
2006-10-02Make locked tasklet handling more robust.Michel Dänzer
2006-09-29Core vsync: Don't clobber target sequence number when scheduling signal.Michel Dänzer
2006-09-29Core vsync: Add flag DRM_VBLANK_NEXTONMISS.Michel Dänzer
2006-09-29Drop tasklet locked driver callback when uninstalling IRQ.Michel Dänzer
2006-09-29Add support for interrupt triggered driver callback with lock held to DRM core.Michel Dänzer
2006-09-29Add support for secondary vertical blank interrupt to DRM core.Michel Dänzer
2006-09-28Core vsync: Don't clobber target sequence number when scheduling signal.Michel Dänzer
2006-09-28Core vsync: Add flag DRM_VBLANK_NEXTONMISS.Michel Dänzer
2006-09-28Drop tasklet locked driver callback when uninstalling IRQ.Michel Dänzer
2006-09-28Add support for interrupt triggered driver callback with lock held to DRM core.Michel Dänzer
2006-09-28Add support for secondary vertical blank interrupt to DRM core.Michel Dänzer
2006-08-28drm: lots of small cleanups and whitespace issues fixed upDave Airlie
2006-08-28remove local copies of pci domain/bus/slot/numDave Airlie
2006-07-24switch drm to use Linux mutexes instead of semaphore.Dave Airlie
2005-07-11IRQ must be assigned and enabled or this will hangJon Smirl
2005-06-04misc cleanup patch from Adrian BunkDave Airlie
2005-03-28Via updates:Thomas Hellstrom
2004-10-18Update Doxygen configuration & comments.Jose Fonseca
2004-10-12Breakout heads into their own data structures.Jon Smirl
2004-10-10Rename fn_tbl to driver. Core driver now uses pci_driver name whichJon Smirl
2004-10-09remove unused dma remnants that were gamma only - these could cause an oopsDave Airlie
2004-09-30Lindent of core build. Drivers checked for no binary diffs. A few filesJon Smirl
2004-09-27First check in for DRM that splits core from personality modulesJon Smirl
2004-09-08Update doxygen configuration file. Minor documentation updates/fixes.Jose Fonseca
2004-09-05merge back bunch of whitespace and misc changes from kernelDave Airlie
2004-08-30implement drm_core_check_feature and use it .. looks lots nicerDave Airlie
2004-08-30drm-memory patch, cleans up alloc/free and makes calloc look more libc likeDave Airlie
2004-08-29fixup issue caused by fntbl-2 mergeDave Airlie
2004-08-27__NO_VERSION__ hasn't been needed since 2.3 days ditch it...Dave Airlie
2004-08-24Merged drmfntbl-0-0-2Dave Airlie
2004-07-25sync up with current 2.6 kernel bk tree - mostly __user annotationsDave Airlie
2004-07-20first set of __user annotations from kernel (Al Viro)Dave Airlie
2004-04-10remove unused codeDave Airlie
2003-11-05Changes to DRM(irq_install)...... wrap dev->dma usage with __HAVE_DMA inAlan Hourihane
2003-11-05- Tie the DRM to a specific device: setunique no longer succeeds when givenEric Anholt
2003-10-17- Move IRQ functions from drm_dma.h to new drm_irq.h and disentangle themEric Anholt
pected_event) errx(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; wait_event(0, SERVER_READY); /* 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"); close(drmfd); } static void client() { int drmfd, ret; unsigned int time; /* 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)); 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"); } 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; }