2005-11-28 16:10:41 -07:00
|
|
|
|
/* radeon_irq.c -- IRQ handling for radeon -*- linux-c -*- */
|
|
|
|
|
/*
|
2002-09-23 11:26:43 -06:00
|
|
|
|
* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
|
2004-09-30 15:12:10 -06:00
|
|
|
|
*
|
2002-09-23 11:26:43 -06:00
|
|
|
|
* The Weather Channel (TM) funded Tungsten Graphics to develop the
|
|
|
|
|
* initial release of the Radeon 8500 driver under the XFree86 license.
|
|
|
|
|
* This notice must be preserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, 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
|
|
|
|
|
* PRECISION INSIGHT 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.
|
|
|
|
|
*
|
|
|
|
|
* Authors:
|
|
|
|
|
* Keith Whitwell <keith@tungstengraphics.com>
|
2004-09-27 13:51:38 -06:00
|
|
|
|
* Michel D<EFBFBD>zer <michel@daenzer.net>
|
2002-09-23 11:26:43 -06:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "drmP.h"
|
|
|
|
|
#include "drm.h"
|
|
|
|
|
#include "radeon_drm.h"
|
|
|
|
|
#include "radeon_drv.h"
|
|
|
|
|
|
2007-06-12 11:44:21 -06:00
|
|
|
|
static void radeon_irq_set_state(drm_device_t *dev, u32 mask, int state)
|
|
|
|
|
{
|
|
|
|
|
drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
|
|
|
|
|
|
|
|
|
|
if (state)
|
|
|
|
|
dev_priv->irq_enable_reg |= mask;
|
|
|
|
|
else
|
|
|
|
|
dev_priv->irq_enable_reg &= ~mask;
|
|
|
|
|
|
|
|
|
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-11 03:02:10 -07:00
|
|
|
|
static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv,
|
|
|
|
|
u32 mask)
|
2005-06-06 05:35:43 -06:00
|
|
|
|
{
|
|
|
|
|
u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & mask;
|
|
|
|
|
if (irqs)
|
|
|
|
|
RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs);
|
|
|
|
|
return irqs;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-23 11:26:43 -06:00
|
|
|
|
/* Interrupts - Used for device synchronization and flushing in the
|
|
|
|
|
* following circumstances:
|
|
|
|
|
*
|
|
|
|
|
* - Exclusive FB access with hw idle:
|
|
|
|
|
* - Wait for GUI Idle (?) interrupt, then do normal flush.
|
|
|
|
|
*
|
|
|
|
|
* - Frame throttling, NV_fence:
|
|
|
|
|
* - Drop marker irq's into command stream ahead of time.
|
|
|
|
|
* - Wait on irq's with lock *not held*
|
|
|
|
|
* - Check each for termination condition
|
|
|
|
|
*
|
|
|
|
|
* - Internally in cp_getbuffer, etc:
|
|
|
|
|
* - as above, but wait with lock held???
|
|
|
|
|
*
|
|
|
|
|
* NOTE: These functions are misleadingly named -- the irq's aren't
|
|
|
|
|
* tied to dma at all, this is just a hangover from dri prehistory.
|
|
|
|
|
*/
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
|
2002-09-23 11:26:43 -06:00
|
|
|
|
{
|
|
|
|
|
drm_device_t *dev = (drm_device_t *) arg;
|
2004-09-30 15:12:10 -06:00
|
|
|
|
drm_radeon_private_t *dev_priv =
|
|
|
|
|
(drm_radeon_private_t *) dev->dev_private;
|
|
|
|
|
u32 stat;
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2003-02-04 08:56:37 -07:00
|
|
|
|
/* Only consider the bits we're interested in - others could be used
|
|
|
|
|
* outside the DRM
|
|
|
|
|
*/
|
2007-06-03 00:28:21 -06:00
|
|
|
|
stat = radeon_acknowledge_irqs(dev_priv, dev_priv->irq_enable_reg);
|
2002-09-29 15:19:01 -06:00
|
|
|
|
if (!stat)
|
2003-07-29 04:11:48 -06:00
|
|
|
|
return IRQ_NONE;
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2002-09-25 11:18:19 -06:00
|
|
|
|
/* SW interrupt */
|
|
|
|
|
if (stat & RADEON_SW_INT_TEST) {
|
2004-09-30 15:12:10 -06:00
|
|
|
|
DRM_WAKEUP(&dev_priv->swi_queue);
|
2002-09-25 11:18:19 -06:00
|
|
|
|
}
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2002-09-25 11:18:19 -06:00
|
|
|
|
/* VBLANK interrupt */
|
2007-06-03 00:28:21 -06:00
|
|
|
|
if (stat & (RADEON_CRTC_VBLANK_STAT|RADEON_CRTC2_VBLANK_STAT)) {
|
|
|
|
|
int vblank_crtc = dev_priv->vblank_crtc;
|
|
|
|
|
|
|
|
|
|
if ((vblank_crtc &
|
|
|
|
|
(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) ==
|
|
|
|
|
(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
|
|
|
|
|
if (stat & RADEON_CRTC_VBLANK_STAT)
|
|
|
|
|
atomic_inc(&dev->vbl_received);
|
|
|
|
|
if (stat & RADEON_CRTC2_VBLANK_STAT)
|
|
|
|
|
atomic_inc(&dev->vbl_received2);
|
|
|
|
|
} else if (((stat & RADEON_CRTC_VBLANK_STAT) &&
|
|
|
|
|
(vblank_crtc & DRM_RADEON_VBLANK_CRTC1)) ||
|
|
|
|
|
((stat & RADEON_CRTC2_VBLANK_STAT) &&
|
|
|
|
|
(vblank_crtc & DRM_RADEON_VBLANK_CRTC2)))
|
|
|
|
|
atomic_inc(&dev->vbl_received);
|
|
|
|
|
|
2002-09-29 15:19:01 -06:00
|
|
|
|
DRM_WAKEUP(&dev->vbl_queue);
|
2004-09-30 15:12:10 -06:00
|
|
|
|
drm_vbl_send_signals(dev);
|
2002-09-25 11:18:19 -06:00
|
|
|
|
}
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2003-07-29 04:11:48 -06:00
|
|
|
|
return IRQ_HANDLED;
|
2002-09-25 11:18:19 -06:00
|
|
|
|
}
|
2002-09-27 15:47:52 -06:00
|
|
|
|
|
2005-02-01 04:08:31 -07:00
|
|
|
|
static int radeon_emit_irq(drm_device_t * dev)
|
2002-09-23 11:26:43 -06:00
|
|
|
|
{
|
|
|
|
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
2002-09-27 15:47:52 -06:00
|
|
|
|
unsigned int ret;
|
2002-09-23 11:26:43 -06:00
|
|
|
|
RING_LOCALS;
|
|
|
|
|
|
2002-09-25 11:18:19 -06:00
|
|
|
|
atomic_inc(&dev_priv->swi_emitted);
|
2002-09-27 15:47:52 -06:00
|
|
|
|
ret = atomic_read(&dev_priv->swi_emitted);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
BEGIN_RING(4);
|
|
|
|
|
OUT_RING_REG(RADEON_LAST_SWI_REG, ret);
|
|
|
|
|
OUT_RING_REG(RADEON_GEN_INT_STATUS, RADEON_SW_INT_FIRE);
|
|
|
|
|
ADVANCE_RING();
|
|
|
|
|
COMMIT_RING();
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2002-09-27 15:47:52 -06:00
|
|
|
|
return ret;
|
2002-09-23 11:26:43 -06:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-01 04:08:31 -07:00
|
|
|
|
static int radeon_wait_irq(drm_device_t * dev, int swi_nr)
|
2002-09-23 11:26:43 -06:00
|
|
|
|
{
|
2004-09-30 15:12:10 -06:00
|
|
|
|
drm_radeon_private_t *dev_priv =
|
|
|
|
|
(drm_radeon_private_t *) dev->dev_private;
|
2002-09-23 11:26:43 -06:00
|
|
|
|
int ret = 0;
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
if (RADEON_READ(RADEON_LAST_SWI_REG) >= swi_nr)
|
|
|
|
|
return 0;
|
2002-09-29 15:19:01 -06:00
|
|
|
|
|
2002-09-23 11:26:43 -06:00
|
|
|
|
dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
DRM_WAIT_ON(ret, dev_priv->swi_queue, 3 * DRM_HZ,
|
|
|
|
|
RADEON_READ(RADEON_LAST_SWI_REG) >= swi_nr);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-03 00:28:21 -06:00
|
|
|
|
int radeon_driver_vblank_do_wait(drm_device_t * dev, unsigned int *sequence,
|
2007-06-12 11:44:21 -06:00
|
|
|
|
int crtc, int relative)
|
2002-09-26 06:49:18 -06:00
|
|
|
|
{
|
2004-09-30 15:12:10 -06:00
|
|
|
|
drm_radeon_private_t *dev_priv =
|
|
|
|
|
(drm_radeon_private_t *) dev->dev_private;
|
2007-06-12 11:44:21 -06:00
|
|
|
|
unsigned int cur_vblank, diff, irqflags, current_cnt;
|
2002-09-26 06:49:18 -06:00
|
|
|
|
int ret = 0;
|
2007-06-03 02:30:52 -06:00
|
|
|
|
int ack = 0;
|
|
|
|
|
atomic_t *counter;
|
2007-06-12 11:44:21 -06:00
|
|
|
|
unsigned int *last_cnt;
|
|
|
|
|
int crtc_cnt_reg;
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
if (!dev_priv) {
|
|
|
|
|
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
|
2002-09-26 06:49:18 -06:00
|
|
|
|
return DRM_ERR(EINVAL);
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-03 02:30:52 -06:00
|
|
|
|
if (crtc == DRM_RADEON_VBLANK_CRTC1) {
|
|
|
|
|
counter = &dev->vbl_received;
|
2007-06-12 11:44:21 -06:00
|
|
|
|
ack = RADEON_CRTC_VBLANK_STAT;
|
|
|
|
|
last_cnt = &dev_priv->crtc_last_cnt;
|
|
|
|
|
crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME;
|
2007-06-03 02:30:52 -06:00
|
|
|
|
} else if (crtc == DRM_RADEON_VBLANK_CRTC2) {
|
|
|
|
|
counter = &dev->vbl_received2;
|
2007-06-12 11:44:21 -06:00
|
|
|
|
ack = RADEON_CRTC2_VBLANK_STAT;
|
|
|
|
|
last_cnt = &dev_priv->crtc2_last_cnt;
|
|
|
|
|
crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME;
|
2007-06-03 02:30:52 -06:00
|
|
|
|
} else
|
|
|
|
|
return DRM_ERR(EINVAL);
|
|
|
|
|
|
|
|
|
|
radeon_acknowledge_irqs(dev_priv, ack);
|
2002-09-29 15:19:01 -06:00
|
|
|
|
|
|
|
|
|
dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
|
|
|
|
|
|
2007-06-12 11:44:21 -06:00
|
|
|
|
if (!relative) {
|
|
|
|
|
/*
|
|
|
|
|
* Assume we haven't missed more than several hours of vblank
|
|
|
|
|
* events, or that it won't matter if they're not accounted
|
|
|
|
|
* for in the master counter.
|
|
|
|
|
*/
|
|
|
|
|
spin_lock_irqsave(&dev->vbl_lock, irqflags);
|
|
|
|
|
current_cnt = RADEON_READ(crtc_cnt_reg);
|
|
|
|
|
if (current_cnt < *last_cnt) {
|
|
|
|
|
current_cnt += (1 << 21) - *last_cnt;
|
|
|
|
|
*last_cnt = 0;
|
|
|
|
|
}
|
|
|
|
|
diff = current_cnt - *last_cnt;
|
|
|
|
|
*last_cnt = RADEON_READ(crtc_cnt_reg);
|
|
|
|
|
spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
|
|
|
|
|
atomic_add(diff, counter);
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-29 15:19:01 -06:00
|
|
|
|
/* Assume that the user has missed the current sequence number
|
|
|
|
|
* by about a day rather than she wants to wait for years
|
2004-09-30 15:12:10 -06:00
|
|
|
|
* using vertical blanks...
|
2002-09-26 06:49:18 -06:00
|
|
|
|
*/
|
2007-06-12 11:44:21 -06:00
|
|
|
|
radeon_irq_set_state(dev, ack, 1);
|
2004-09-30 15:12:10 -06:00
|
|
|
|
DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
|
2007-06-03 00:28:21 -06:00
|
|
|
|
(((cur_vblank = atomic_read(counter))
|
2004-09-30 15:12:10 -06:00
|
|
|
|
- *sequence) <= (1 << 23)));
|
2007-06-12 11:44:21 -06:00
|
|
|
|
radeon_irq_set_state(dev, ack, 0);
|
2002-09-26 06:49:18 -06:00
|
|
|
|
*sequence = cur_vblank;
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-12 11:44:21 -06:00
|
|
|
|
int radeon_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence, int relative)
|
2007-06-03 00:28:21 -06:00
|
|
|
|
{
|
2007-06-12 11:44:21 -06:00
|
|
|
|
return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC1, relative);
|
2007-06-03 00:28:21 -06:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-12 11:44:21 -06:00
|
|
|
|
int radeon_driver_vblank_wait2(drm_device_t *dev, unsigned int *sequence, int relative)
|
2007-06-03 00:28:21 -06:00
|
|
|
|
{
|
2007-06-12 11:44:21 -06:00
|
|
|
|
return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC2, relative);
|
2007-06-03 00:28:21 -06:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-23 11:26:43 -06:00
|
|
|
|
/* Needs the lock as it touches the ring.
|
|
|
|
|
*/
|
2004-09-30 15:12:10 -06:00
|
|
|
|
int radeon_irq_emit(DRM_IOCTL_ARGS)
|
2002-09-23 11:26:43 -06:00
|
|
|
|
{
|
|
|
|
|
DRM_DEVICE;
|
|
|
|
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
|
|
|
|
drm_radeon_irq_emit_t emit;
|
|
|
|
|
int result;
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
LOCK_TEST_WITH_RETURN(dev, filp);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
if (!dev_priv) {
|
|
|
|
|
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
return DRM_ERR(EINVAL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
DRM_COPY_FROM_USER_IOCTL(emit, (drm_radeon_irq_emit_t __user *) data,
|
|
|
|
|
sizeof(emit));
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
result = radeon_emit_irq(dev);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) {
|
|
|
|
|
DRM_ERROR("copy_to_user\n");
|
2002-09-23 11:26:43 -06:00
|
|
|
|
return DRM_ERR(EFAULT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Doesn't need the hardware lock.
|
|
|
|
|
*/
|
2004-09-30 15:12:10 -06:00
|
|
|
|
int radeon_irq_wait(DRM_IOCTL_ARGS)
|
2002-09-23 11:26:43 -06:00
|
|
|
|
{
|
|
|
|
|
DRM_DEVICE;
|
|
|
|
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
|
|
|
|
drm_radeon_irq_wait_t irqwait;
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
if (!dev_priv) {
|
|
|
|
|
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
return DRM_ERR(EINVAL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_radeon_irq_wait_t __user *) data,
|
|
|
|
|
sizeof(irqwait));
|
2002-09-23 11:26:43 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
return radeon_wait_irq(dev, irqwait.irq_seq);
|
2002-09-23 11:26:43 -06:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-03 00:28:21 -06:00
|
|
|
|
|
|
|
|
|
|
2002-09-27 15:47:52 -06:00
|
|
|
|
/* drm_dma.h hooks
|
|
|
|
|
*/
|
2004-09-30 15:12:10 -06:00
|
|
|
|
void radeon_driver_irq_preinstall(drm_device_t * dev)
|
|
|
|
|
{
|
2002-09-25 11:18:19 -06:00
|
|
|
|
drm_radeon_private_t *dev_priv =
|
2004-09-30 15:12:10 -06:00
|
|
|
|
(drm_radeon_private_t *) dev->dev_private;
|
2002-09-25 11:18:19 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
/* Disable *all* interrupts */
|
|
|
|
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
2002-09-25 11:18:19 -06:00
|
|
|
|
|
|
|
|
|
/* Clear bits if they're already high */
|
2005-11-11 03:02:10 -07:00
|
|
|
|
radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
|
2007-06-12 11:44:21 -06:00
|
|
|
|
RADEON_CRTC_VBLANK_STAT |
|
|
|
|
|
RADEON_CRTC2_VBLANK_STAT));
|
2002-09-25 11:18:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
void radeon_driver_irq_postinstall(drm_device_t * dev)
|
|
|
|
|
{
|
2002-09-25 11:18:19 -06:00
|
|
|
|
drm_radeon_private_t *dev_priv =
|
2004-09-30 15:12:10 -06:00
|
|
|
|
(drm_radeon_private_t *) dev->dev_private;
|
2002-09-25 11:18:19 -06:00
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
atomic_set(&dev_priv->swi_emitted, 0);
|
|
|
|
|
DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
|
2002-09-25 11:18:19 -06:00
|
|
|
|
|
2007-06-12 11:44:21 -06:00
|
|
|
|
radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
|
2002-09-25 11:18:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
|
void radeon_driver_irq_uninstall(drm_device_t * dev)
|
|
|
|
|
{
|
2002-09-25 11:18:19 -06:00
|
|
|
|
drm_radeon_private_t *dev_priv =
|
2004-09-30 15:12:10 -06:00
|
|
|
|
(drm_radeon_private_t *) dev->dev_private;
|
2003-04-26 16:28:56 -06:00
|
|
|
|
if (!dev_priv)
|
|
|
|
|
return;
|
|
|
|
|
|
2007-06-03 00:28:21 -06:00
|
|
|
|
dev_priv->irq_enabled = 0;
|
|
|
|
|
|
2003-04-26 16:28:56 -06:00
|
|
|
|
/* Disable *all* interrupts */
|
2004-09-30 15:12:10 -06:00
|
|
|
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
2002-09-25 11:18:19 -06:00
|
|
|
|
}
|
2007-06-03 00:28:21 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int radeon_vblank_crtc_get(drm_device_t *dev)
|
|
|
|
|
{
|
|
|
|
|
drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
|
|
|
|
|
u32 flag;
|
|
|
|
|
u32 value;
|
|
|
|
|
|
|
|
|
|
flag = RADEON_READ(RADEON_GEN_INT_CNTL);
|
|
|
|
|
value = 0;
|
|
|
|
|
|
|
|
|
|
if (flag & RADEON_CRTC_VBLANK_MASK)
|
|
|
|
|
value |= DRM_RADEON_VBLANK_CRTC1;
|
|
|
|
|
|
|
|
|
|
if (flag & RADEON_CRTC2_VBLANK_MASK)
|
|
|
|
|
value |= DRM_RADEON_VBLANK_CRTC2;
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int radeon_vblank_crtc_set(drm_device_t *dev, int64_t value)
|
|
|
|
|
{
|
|
|
|
|
drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
|
|
|
|
|
if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
|
|
|
|
|
DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value);
|
|
|
|
|
return DRM_ERR(EINVAL);
|
|
|
|
|
}
|
|
|
|
|
dev_priv->vblank_crtc = (unsigned int)value;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|