summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2003-07-09file drm_mem.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-09file drm_dma.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-09file drm_fops.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-09file drm_lock.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-09file drm_stub.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-09file drm_vm.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-08Removed unused __HAVE_KERNEL_CTX_SWITCH, whatever that was.Keith Whitwell
2003-07-04Don't need to include linux/wrapper.h - we only use Set/ClearPageReservedLeif Delgass
2003-07-01file drm_agp.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-01file drm_bufs.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-01file drm_mem.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-01file drm_pci.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-07-01file drm_sg.c was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-23file savage_dma.c was initially added on branch savage-1_0_0-branch.Alan Hourihane
2003-06-23file savage_state.c was initially added on branch savage-1_0_0-branch.Alan Hourihane
2003-06-21file drm_pci_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-21file drm_stub_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-21file drm_memory_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-21file drm_vm_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-21file drm_dma_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-21file drm_lock_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-19file drm_bufs_tmp.h was initially added on branch newdrm-0-0-1-branch.Jose Fonseca
2003-06-19Revert the janitorial - that works is now on the new branchJose Fonseca
2003-06-18file i830_compat.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830.h was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830_dma.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830_drm.h was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830_drv.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830_drv.h was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830_irq.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-18file i830_mem.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-06-16Possibly fix stanford checker complaints about sareaKeith Whitwell
2003-06-14Move the linux AGP includes into drm_agp.h and only define the AGP dataJose Fonseca
2003-06-10Texture rectangle support for r100Keith Whitwell
2003-06-09Revert bogus last commitKeith Whitwell
2003-06-09Don't activate blend fallbacks unless blending is enabledKeith Whitwell
2003-06-07Verify 'drm_agp' is not NULL for all its wrappers - this causes no overheadJose Fonseca
2003-06-07Check that the AGPGART "drm_agp" symbol pointer is valid beforeJose Fonseca
2003-06-07fix pitch compile errorDave Airlie
2003-06-05add page flipping support to the DRM, up version number to 1.3.0...Dave Airlie
2003-06-03Added the Doxygen configuration file. Minor documentation fixes.Jose Fonseca
2003-06-03Split declarations/definitions in drm_scatter.h into drm_sg.h/drm_sg_tmp.hJose Fonseca
2003-06-03file i830_mem.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-05-30file i830_compat.c was initially added on branch i865-agp-0-1-branch.Keith Whitwell
2003-05-28Restore change to _DRM_VBLANK_SIGNAL from rev. 1.41, which was revertedLeif Delgass
2003-05-28Restore DRM_*MEMORYBARRIER change reverted with documentation mergeLeif Delgass
2003-05-27Merged DRM documentation.Jose Fonseca
2003-05-26Add support to r128 for MESA_ycbcr_texture (Ian Romanick, Leif Delgass)Leif Delgass
2003-05-20DRM part of Radeon DRI suspend/resume support (Charl Botha).David Dawes
2003-05-20Support for building DRM module on OpenBSD (Wilbern Cobb, Matthieu Herrb).David Dawes
triction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include "drmP.h" #include <linux/interrupt.h> /* For task queue support */ /** * Get interrupt from bus id. * * \param inode device inode. * \param filp file pointer. * \param cmd command. * \param arg user argument, pointing to a drm_irq_busid structure. * \return zero on success or a negative number on failure. * * Finds the PCI device with the specified bus id and gets its IRQ number. * This IOCTL is deprecated, and will now return EINVAL for any busid not equal * to that of the device that this DRM instance attached to. */ int drm_irq_by_busid(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; drm_irq_busid_t __user *argp = (void __user *)arg; drm_irq_busid_t p; if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return -EINVAL; if (copy_from_user(&p, argp, sizeof(p))) return -EFAULT; if ((p.busnum >> 8) != dev->pci_domain || (p.busnum & 0xff) != dev->pci_bus || p.devnum != dev->pci_slot || p.funcnum != dev->pci_func) return -EINVAL; p.irq = dev->irq; DRM_DEBUG("%d:%d:%d => IRQ %d\n", p.busnum, p.devnum, p.funcnum, p.irq); if (copy_to_user(argp, &p, sizeof(p))) return -EFAULT; return 0; } /** * Install IRQ handler. * * \param dev DRM device. * * Initializes the IRQ related data, and setups drm_device::vbl_queue. Installs the handler, calling the driver * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions * before and after the installation. */ static int drm_irq_install(drm_device_t * dev) { int ret; unsigned long sh_flags = 0; if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return -EINVAL; if (dev->irq == 0) return -EINVAL; down(&dev->struct_sem); /* Driver must have been initialized */ if (!dev->dev_private) { up(&dev->struct_sem); return -EINVAL; } if (dev->irq_enabled) { up(&dev->struct_sem); return -EBUSY; } dev->irq_enabled = 1; up(&dev->struct_sem); DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) { init_waitqueue_head(&dev->vbl_queue); spin_lock_init(&dev->vbl_lock); INIT_LIST_HEAD(&dev->vbl_sigs.head); dev->vbl_pending = 0; } /* Before installing handler */ dev->driver->irq_preinstall(dev); /* Install handler */ if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) sh_flags = SA_SHIRQ; ret = request_irq(dev->irq, dev->driver->irq_handler, sh_flags, dev->devname, dev); if (ret < 0) { down(&dev->struct_sem); dev->irq_enabled = 0; up(&dev->struct_sem); return ret; } /* After installing handler */ dev->driver->irq_postinstall(dev); return 0; } /** * Uninstall the IRQ handler. * * \param dev DRM device. * * Calls the driver's \c drm_driver_irq_uninstall() function, and stops the irq. */ int drm_irq_uninstall(drm_device_t * dev) { int irq_enabled; if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return -EINVAL; down(&dev->struct_sem); irq_enabled = dev->irq_enabled; dev->irq_enabled = 0; up(&dev->struct_sem); if (!irq_enabled) return -EINVAL; DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); dev->driver->irq_uninstall(dev); free_irq(dev->irq, dev); return 0; } EXPORT_SYMBOL(drm_irq_uninstall); /** * IRQ control ioctl. * * \param inode device inode. * \param filp file pointer. * \param cmd command. * \param arg user argument, pointing to a drm_control structure. * \return zero on success or a negative number on failure. * * Calls irq_install() or irq_uninstall() according to \p arg. */ int drm_control(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; drm_control_t ctl; /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ if (copy_from_user(&ctl, (drm_control_t __user *) arg, sizeof(ctl))) return -EFAULT; switch (ctl.func) { case DRM_INST_HANDLER: if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return 0; if (dev->if_version < DRM_IF_VERSION(1, 2) && ctl.irq != dev->irq) return -EINVAL; return drm_irq_install(dev); case DRM_UNINST_HANDLER: if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) return 0; return drm_irq_uninstall(dev); default: return -EINVAL; } } /** * Wait for VBLANK. * * \param inode device inode. * \param filp file pointer.rm. * \param cmd command. * \param data user argument, pointing to a drm_wait_vblank structure. * \return zero on success or a negative number on failure. * * Verifies the IRQ is installed * * If a signal is requested checks if this task has already scheduled the same signal * for the same vblank sequence number - nothing to be done in * that case. If the number of tasks waiting for the interrupt exceeds 100 the * function fails. Otherwise adds a new entry to drm_device::vbl_sigs for this * task. * * If a signal is not requested, then calls vblank_wait(). */ int drm_wait_vblank(DRM_IOCTL_ARGS) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; drm_wait_vblank_t __user *argp = (void __user *)data; drm_wait_vblank_t vblwait; struct timeval now; int ret = 0; unsigned int flags; if (!drm_core_check_feature(dev, DRIVER_IRQ_VBL)) return -EINVAL; if ((!dev->irq) || (!dev->irq_enabled)) return -EINVAL; DRM_COPY_FROM_USER_IOCTL(vblwait, argp, sizeof(vblwait)); switch (vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK) { case _DRM_VBLANK_RELATIVE: vblwait.request.sequence += atomic_read(&dev->vbl_received); vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; case _DRM_VBLANK_ABSOLUTE: break; default: return -EINVAL; } flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; if (flags & _DRM_VBLANK_SIGNAL) { unsigned long irqflags; drm_vbl_sig_t *vbl_sig; vblwait.reply.sequence = atomic_read(&dev->vbl_received); spin_lock_irqsave(&dev->vbl_lock, irqflags); /* Check if this task has already scheduled the same signal * for the same vblank sequence number; nothing to be done in * that case */ list_for_each_entry(vbl_sig, &dev->vbl_sigs.head, head) { if (vbl_sig->sequence == vblwait.request.sequence && vbl_sig->info.si_signo == vblwait.request.signal && vbl_sig->task == current) { spin_unlock_irqrestore(&dev->vbl_lock, irqflags); goto done; } } if (dev->vbl_pending >= 100) { spin_unlock_irqrestore(&dev->vbl_lock, irqflags); return -EBUSY; } dev->vbl_pending++; spin_unlock_irqrestore(&dev->vbl_lock, irqflags); if (! (vbl_sig = drm_alloc(sizeof(drm_vbl_sig_t), DRM_MEM_DRIVER))) { return -ENOMEM; } memset((void *)vbl_sig, 0, sizeof(*vbl_sig)); vbl_sig->sequence = vblwait.request.sequence; vbl_sig->info.si_signo = vblwait.request.signal; vbl_sig->task = current; spin_lock_irqsave(&dev->vbl_lock, irqflags); list_add_tail((struct list_head *)vbl_sig, &dev->vbl_sigs.head); spin_unlock_irqrestore(&dev->vbl_lock, irqflags); } else { if (dev->driver->vblank_wait) ret = dev->driver->vblank_wait(dev, &vblwait.request.sequence); do_gettimeofday(&now);