summaryrefslogtreecommitdiff
path: root/linux/gamma_drv.c
AgeCommit message (Expand)Author
2002-07-05merged bsd-3-0-0-branchAlan Hourihane
2002-04-09Merged drmcommand-0-0-1Jens Owen
2002-02-14First pass of mesa-4-0 branch merge into trunk.David Dawes
2001-07-23Fixes that allow the modules to be built into the kernelJeff Hartmann
2001-07-18Add module version name at a lower layer of the code, allows things to beJeff Hartmann
2001-07-16Added version string to the end of the kernel module name. This allowsJeff Hartmann
2001-02-16- Clean up the way customization of the templates is done.Gareth Hughes
2001-02-15- Fix up merge.Gareth Hughes
2001-02-15Merge mga-1-0-0-branch into trunk.Gareth Hughes
2000-11-15Sync with Linux 2.4.0-test11-pre5 Provide backward compatibility testedRik Faith
2000-09-29Audit calls to schedule() Remove tags from files shared with Linux kernelRik Faith
2000-09-24commit xfree86 4.0.1d-pre updateAlan Hourihane
2000-09-10Sync with 2.4.0-test8 kernel.Gareth Hughes
2000-09-06Sync with 2.4.0-test8-pre5 kernel.Gareth Hughes
2000-08-28Add compatibility header file to make Linux 2.4.0 kernel patches cleaner.Rik Faith
2000-08-26Sync with Linux 2.4.0-test7 Add signal blocking support to all driversRik Faith
2000-08-08Sync with Linux 2.4.0-test6-pre8Rik Faith
2000-08-04Sync with Linux 2.4.0-test6-pre2Rik Faith
2000-07-21Changes to make AGP optional for in-kernel buildsRik Faith
2000-07-20More fixups for kernel build: EXPORT_SYMTAB warning removalRik Faith
2000-07-20Fix signature for *_options functionRik Faith
2000-07-20Added support for building as modules or as part of monolithic kernelRik Faith
2000-07-19Bump driver dates and add descriptionsRik Faith
2000-07-19Sync with Linux 2.4.0-test4 kernelRik Faith
2000-06-13Unify code with kernel: Change some spacing in comments Add #includeRik Faith
2000-06-09Fix define of PCI_DEVICE_ID_3DLABS_GAMMA when not available in the kernelAlan Hourihane
2000-06-08Merged glxmisc-3-0-0Brian Paul
2000-06-05Include new updated gamma support.Alan Hourihane
2000-04-04Merged mga branch with trunkJeff Hartmann
2000-03-16Merge with 4.0Jeff Hartmann
2000-02-22Import of XFree86 3.9.18Kevin E Martin
2000-01-06Import of XFree86 3.9.17Rik Faith
1999-12-05First DRI release of 3dfx driver.Daryll Strauss
/span> * Eric Anholt <anholt@FreeBSD.org> */ #include "drmP.h" #include "drm.h" #include "mga_drm.h" #include "mga_drv.h" u32 mga_get_vblank_counter(struct drm_device *dev, int crtc) { const drm_mga_private_t *const dev_priv = (drm_mga_private_t *) dev->dev_private; if (crtc != 0) { return 0; } return atomic_read(&dev_priv->vbl_received); } irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) { struct drm_device *dev = (struct drm_device *) arg; drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; int status; int handled = 0; status = MGA_READ(MGA_STATUS); /* VBLANK interrupt */ if (status & MGA_VLINEPEN) { MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR); atomic_inc(&dev_priv->vbl_received); drm_handle_vblank(dev, 0); handled = 1; } /* SOFTRAP interrupt */ if (status & MGA_SOFTRAPEN) { const u32 prim_start = MGA_READ(MGA_PRIMADDRESS); const u32 prim_end = MGA_READ(MGA_PRIMEND); MGA_WRITE(MGA_ICLEAR, MGA_SOFTRAPICLR); /* In addition to clearing the interrupt-pending bit, we * have to write to MGA_PRIMEND to re-start the DMA operation. */ if ((prim_start & ~0x03) != (prim_end & ~0x03)) { MGA_WRITE(MGA_PRIMEND, prim_end); } atomic_inc(&dev_priv->last_fence_retired); DRM_WAKEUP(&dev_priv->fence_queue); handled = 1; } if (handled) return IRQ_HANDLED; return IRQ_NONE; } int mga_enable_vblank(struct drm_device *dev, int crtc) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; if (crtc != 0) { DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", crtc); return 0; } MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); return 0; } void mga_disable_vblank(struct drm_device *dev, int crtc) { if (crtc != 0) { DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", crtc); } /* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have * a nice hardware counter that tracks the number of refreshes when * the interrupt is disabled, and the kernel doesn't know the refresh * rate to calculate an estimate. */ /* MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); */ } int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; unsigned int cur_fence; int ret = 0; /* Assume that the user has missed the current sequence number * by about a day rather than she wants to wait for years * using fences. */ DRM_WAIT_ON(ret, dev_priv->fence_queue, 3 * DRM_HZ, (((cur_fence = atomic_read(&dev_priv->last_fence_retired)) - *sequence) <= (1 << 23))); *sequence = cur_fence; return ret; } void mga_driver_irq_preinstall(struct drm_device * dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; /* Disable *all* interrupts */ MGA_WRITE(MGA_IEN, 0); /* Clear bits if they're already high */ MGA_WRITE(MGA_ICLEAR, ~0); } int mga_driver_irq_postinstall(struct drm_device * dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; int ret; ret = drm_vblank_init(dev, 1); if (ret) return ret; DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); /* Turn on soft trap interrupt. Vertical blank interrupts are enabled * in mga_enable_vblank. */ MGA_WRITE(MGA_IEN, MGA_SOFTRAPEN); return 0; } void mga_driver_irq_uninstall(struct drm_device * dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; if (!dev_priv) return; /* Disable *all* interrupts */ MGA_WRITE(MGA_IEN, 0); dev->irq_enabled = 0; }