[FreeBSD] Add vblank-rework support and get drivers building.

The i915 driver now works again.
main
Robert Noland 2008-05-23 14:36:05 -04:00 committed by Eric Anholt
parent ad8eb0ed01
commit 8cd045079e
11 changed files with 296 additions and 43 deletions

View File

@ -621,10 +621,19 @@ struct drm_ati_pcigart_info {
int gart_reg_if; int gart_reg_if;
void *addr; void *addr;
dma_addr_t bus_addr; dma_addr_t bus_addr;
dma_addr_t table_mask;
dma_addr_t member_mask;
struct drm_dma_handle *table_handle;
drm_local_map_t mapping; drm_local_map_t mapping;
int table_size; int table_size;
}; };
#ifndef DMA_BIT_MASK
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
#endif
#define upper_32_bits(_val) (((u64)(_val)) >> 32)
struct drm_driver_info { struct drm_driver_info {
int (*load)(struct drm_device *, unsigned long flags); int (*load)(struct drm_device *, unsigned long flags);
int (*firstopen)(struct drm_device *); int (*firstopen)(struct drm_device *);
@ -649,11 +658,12 @@ struct drm_driver_info {
int new); int new);
int (*kernel_context_switch_unlock)(struct drm_device *dev); int (*kernel_context_switch_unlock)(struct drm_device *dev);
void (*irq_preinstall)(struct drm_device *dev); void (*irq_preinstall)(struct drm_device *dev);
void (*irq_postinstall)(struct drm_device *dev); int (*irq_postinstall)(struct drm_device *dev);
void (*irq_uninstall)(struct drm_device *dev); void (*irq_uninstall)(struct drm_device *dev);
void (*irq_handler)(DRM_IRQ_ARGS); void (*irq_handler)(DRM_IRQ_ARGS);
int (*vblank_wait)(struct drm_device *dev, unsigned int *sequence); u32 (*get_vblank_counter)(struct drm_device *dev, int crtc);
int (*vblank_wait2)(struct drm_device *dev, unsigned int *sequence); int (*enable_vblank)(struct drm_device *dev, int crtc);
void (*disable_vblank)(struct drm_device *dev, int crtc);
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */ drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
@ -775,7 +785,23 @@ struct drm_device {
atomic_t context_flag; /* Context swapping flag */ atomic_t context_flag; /* Context swapping flag */
int last_context; /* Last current context */ int last_context; /* Last current context */
int vbl_queue; /* vbl wait channel */ wait_queue_head_t *vbl_queue; /* vblank wait queue */
atomic_t *_vblank_count; /* number of VBLANK interrupts */
/* (driver must alloc the right number of counters) */
struct mtx vbl_lock;
struct drm_vbl_sig_list *vbl_sigs; /* signal list to send on VBLANK */
atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */
u32 *last_vblank; /* protected by dev->vbl_lock, used */
/* for wraparound handling */
u32 *vblank_offset; /* used to track how many vblanks */
int *vblank_enabled; /* so we don't call enable more than */
/* once per disable */
u32 *vblank_premodeset; /* were lost during modeset */
struct callout vblank_disable_timer;
unsigned long max_vblank_count; /* size of vblank counter register */
int num_crtcs;
atomic_t vbl_received; atomic_t vbl_received;
atomic_t vbl_received2; atomic_t vbl_received2;
@ -903,8 +929,16 @@ irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
void drm_driver_irq_preinstall(struct drm_device *dev); void drm_driver_irq_preinstall(struct drm_device *dev);
void drm_driver_irq_postinstall(struct drm_device *dev); void drm_driver_irq_postinstall(struct drm_device *dev);
void drm_driver_irq_uninstall(struct drm_device *dev); void drm_driver_irq_uninstall(struct drm_device *dev);
void drm_handle_vblank(struct drm_device *dev, int crtc);
u32 drm_vblank_count(struct drm_device *dev, int crtc);
int drm_vblank_get(struct drm_device *dev, int crtc);
void drm_vblank_put(struct drm_device *dev, int crtc);
void drm_update_vblank_count(struct drm_device *dev, int crtc);
int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
void drm_vbl_send_signals(struct drm_device *dev); int drm_vblank_init(struct drm_device *dev, int num_crtcs);
void drm_vbl_send_signals(struct drm_device *dev, int crtc);
int drm_modeset_ctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
/* AGP/PCI Express/GART support (drm_agpsupport.c) */ /* AGP/PCI Express/GART support (drm_agpsupport.c) */
int drm_device_is_agp(struct drm_device *dev); int drm_device_is_agp(struct drm_device *dev);
@ -1021,8 +1055,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,
int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv); int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
/* IRQ support (drm_irq.c) */ /* IRQ support (drm_irq.c) */
int drm_control(struct drm_device *dev, void *data, int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv);
struct drm_file *file_priv);
int drm_wait_vblank(struct drm_device *dev, void *data, int drm_wait_vblank(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
void drm_locked_tasklet(struct drm_device *dev, void drm_locked_tasklet(struct drm_device *dev,

View File

@ -208,12 +208,130 @@ int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv)
} }
} }
static void vblank_disable_fn(void *arg)
{
struct drm_device *dev = (struct drm_device *)arg;
unsigned long irqflags;
int i;
for (i = 0; i < dev->num_crtcs; i++) {
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
if (atomic_read(&dev->vblank_refcount[i]) == 0 &&
dev->vblank_enabled[i]) {
dev->driver.disable_vblank(dev, i);
dev->vblank_enabled[i] = 0;
}
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
}
}
u32 drm_vblank_count(struct drm_device *dev, int crtc)
{
return atomic_read(&dev->_vblank_count[crtc]) +
dev->vblank_offset[crtc];
}
int drm_vblank_get(struct drm_device *dev, int crtc)
{
unsigned long irqflags;
int ret = 0;
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
/* Going from 0->1 means we have to enable interrupts again */
atomic_add_acq_int(&dev->vblank_refcount[crtc], 1);
if (dev->vblank_refcount[crtc] == 1 &&
!dev->vblank_enabled[crtc]) {
ret = dev->driver.enable_vblank(dev, crtc);
if (ret)
atomic_dec(&dev->vblank_refcount[crtc]);
else
dev->vblank_enabled[crtc] = 1;
}
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
return ret;
}
void drm_vblank_put(struct drm_device *dev, int crtc)
{
/* Last user schedules interrupt disable */
atomic_subtract_acq_int(&dev->vblank_refcount[crtc], 1);
if (dev->vblank_refcount[crtc] == 0)
callout_reset(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ,
(timeout_t *)vblank_disable_fn, (void *)dev);
}
void drm_handle_vblank(struct drm_device *dev, int crtc)
{
drm_update_vblank_count(dev, crtc);
DRM_WAKEUP(&dev->vbl_queue[crtc]);
drm_vbl_send_signals(dev, crtc);
}
void drm_update_vblank_count(struct drm_device *dev, int crtc)
{
unsigned long irqflags;
u32 cur_vblank, diff;
/*
* Interrupts were disabled prior to this call, so deal with counter
* wrap if needed.
* NOTE! It's possible we lost a full dev->max_vblank_count events
* here if the register is small or we had vblank interrupts off for
* a long time.
*/
cur_vblank = dev->driver.get_vblank_counter(dev, crtc);
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
if (cur_vblank < dev->last_vblank[crtc]) {
diff = dev->max_vblank_count -
dev->last_vblank[crtc];
diff += cur_vblank;
} else {
diff = cur_vblank - dev->last_vblank[crtc];
}
dev->last_vblank[crtc] = cur_vblank;
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
atomic_add(diff, &dev->_vblank_count[crtc]);
}
int drm_modeset_ctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_modeset_ctl *modeset = data;
int crtc, ret = 0;
u32 new;
crtc = modeset->crtc;
if (crtc >= dev->num_crtcs) {
ret = -EINVAL;
goto out;
}
switch (modeset->cmd) {
case _DRM_PRE_MODESET:
dev->vblank_premodeset[crtc] =
dev->driver.get_vblank_counter(dev, crtc);
break;
case _DRM_POST_MODESET:
new = dev->driver.get_vblank_counter(dev, crtc);
dev->vblank_offset[crtc] = dev->vblank_premodeset[crtc] - new;
break;
default:
ret = -EINVAL;
break;
}
out:
return ret;
}
int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
drm_wait_vblank_t *vblwait = data; drm_wait_vblank_t *vblwait = data;
struct timeval now; struct timeval now;
int ret = 0; int ret = 0;
int flags, seq; int flags, seq, crtc;
if (!dev->irq_enabled) if (!dev->irq_enabled)
return EINVAL; return EINVAL;
@ -227,12 +345,13 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
} }
flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0;
if ((flags & _DRM_VBLANK_SECONDARY) && !dev->driver.use_vbl_irq2) if (crtc >= dev->num_crtcs)
return EINVAL; return EINVAL;
seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? drm_update_vblank_count(dev, crtc);
&dev->vbl_received2 : &dev->vbl_received); seq = drm_vblank_count(dev, crtc);
switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
case _DRM_VBLANK_RELATIVE: case _DRM_VBLANK_RELATIVE:
@ -269,16 +388,18 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
#endif #endif
ret = EINVAL; ret = EINVAL;
} else { } else {
unsigned long cur_vblank;
DRM_LOCK(); DRM_LOCK();
/* shared code returns -errno */ /* shared code returns -errno */
if (flags & _DRM_VBLANK_SECONDARY) {
if (dev->driver.vblank_wait2)
ret = -dev->driver.vblank_wait2(dev,
&vblwait->request.sequence);
} else if (dev->driver.vblank_wait)
ret = -dev->driver.vblank_wait(dev,
&vblwait->request.sequence);
ret = drm_vblank_get(dev, crtc);
if (ret)
return ret;
DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
(((cur_vblank = drm_vblank_count(dev, crtc))
- vblwait->request.sequence) <= (1 << 23)));
drm_vblank_put(dev, crtc);
DRM_UNLOCK(); DRM_UNLOCK();
microtime(&now); microtime(&now);
@ -289,12 +410,104 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
return ret; return ret;
} }
void drm_vbl_send_signals(struct drm_device *dev) static void drm_vblank_cleanup(struct drm_device *dev)
{
/* Bail if the driver didn't call drm_vblank_init() */
if (dev->num_crtcs == 0)
return;
callout_stop(&dev->vblank_disable_timer);
vblank_disable_fn((void *)dev);
drm_free(dev->vbl_queue, sizeof(*dev->vbl_queue) * dev->num_crtcs,
DRM_MEM_DRIVER);
drm_free(dev->vbl_sigs, sizeof(*dev->vbl_sigs) * dev->num_crtcs,
DRM_MEM_DRIVER);
drm_free(dev->_vblank_count, sizeof(*dev->_vblank_count) *
dev->num_crtcs, DRM_MEM_DRIVER);
drm_free(dev->vblank_refcount, sizeof(*dev->vblank_refcount) *
dev->num_crtcs, DRM_MEM_DRIVER);
drm_free(dev->vblank_enabled, sizeof(*dev->vblank_enabled) *
dev->num_crtcs, DRM_MEM_DRIVER);
drm_free(dev->last_vblank, sizeof(*dev->last_vblank) * dev->num_crtcs,
DRM_MEM_DRIVER);
drm_free(dev->vblank_premodeset, sizeof(*dev->vblank_premodeset) *
dev->num_crtcs, DRM_MEM_DRIVER);
drm_free(dev->vblank_offset, sizeof(*dev->vblank_offset) * dev->num_crtcs,
DRM_MEM_DRIVER);
dev->num_crtcs = 0;
}
int drm_vblank_init(struct drm_device *dev, int num_crtcs)
{
int i, ret = -ENOMEM;
callout_init(&dev->vblank_disable_timer, 0);
DRM_SPININIT(&dev->vbl_lock, "drm_vblk");
atomic_set(&dev->vbl_signal_pending, 0);
dev->num_crtcs = num_crtcs;
dev->vbl_queue = drm_alloc(sizeof(wait_queue_head_t) * num_crtcs,
DRM_MEM_DRIVER);
if (!dev->vbl_queue)
goto err;
dev->vbl_sigs = drm_alloc(sizeof(struct drm_vbl_sig) * num_crtcs,
DRM_MEM_DRIVER);
if (!dev->vbl_sigs)
goto err;
dev->_vblank_count = drm_alloc(sizeof(atomic_t) * num_crtcs,
DRM_MEM_DRIVER);
if (!dev->_vblank_count)
goto err;
dev->vblank_refcount = drm_alloc(sizeof(atomic_t) * num_crtcs,
DRM_MEM_DRIVER);
if (!dev->vblank_refcount)
goto err;
dev->vblank_enabled = drm_calloc(num_crtcs, sizeof(int),
DRM_MEM_DRIVER);
if (!dev->vblank_enabled)
goto err;
dev->last_vblank = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
if (!dev->last_vblank)
goto err;
dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32),
DRM_MEM_DRIVER);
if (!dev->vblank_premodeset)
goto err;
dev->vblank_offset = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
if (!dev->vblank_offset)
goto err;
/* Zero per-crtc vblank stuff */
for (i = 0; i < num_crtcs; i++) {
DRM_INIT_WAITQUEUE(&dev->vbl_queue[i]);
TAILQ_INIT(&dev->vbl_sigs[i]);
atomic_set(&dev->_vblank_count[i], 0);
atomic_set(&dev->vblank_refcount[i], 0);
}
return 0;
err:
drm_vblank_cleanup(dev);
return ret;
}
void drm_vbl_send_signals(struct drm_device *dev, int crtc)
{ {
} }
#if 0 /* disabled */ #if 0 /* disabled */
void drm_vbl_send_signals( struct drm_device *dev ) void drm_vbl_send_signals(struct drm_device *dev, int crtc )
{ {
drm_vbl_sig_t *vbl_sig; drm_vbl_sig_t *vbl_sig;
unsigned int vbl_seq = atomic_read( &dev->vbl_received ); unsigned int vbl_seq = atomic_read( &dev->vbl_received );

View File

@ -47,8 +47,9 @@ static void i915_configure(struct drm_device *dev)
dev->driver.preclose = i915_driver_preclose; dev->driver.preclose = i915_driver_preclose;
dev->driver.lastclose = i915_driver_lastclose; dev->driver.lastclose = i915_driver_lastclose;
dev->driver.device_is_agp = i915_driver_device_is_agp; dev->driver.device_is_agp = i915_driver_device_is_agp;
dev->driver.vblank_wait = i915_driver_vblank_wait; dev->driver.get_vblank_counter = i915_get_vblank_counter;
dev->driver.vblank_wait2 = i915_driver_vblank_wait2; dev->driver.enable_vblank = i915_enable_vblank;
dev->driver.disable_vblank = i915_disable_vblank;
dev->driver.irq_preinstall = i915_driver_irq_preinstall; dev->driver.irq_preinstall = i915_driver_irq_preinstall;
dev->driver.irq_postinstall = i915_driver_irq_postinstall; dev->driver.irq_postinstall = i915_driver_irq_postinstall;
dev->driver.irq_uninstall = i915_driver_irq_uninstall; dev->driver.irq_uninstall = i915_driver_irq_uninstall;

View File

@ -48,7 +48,9 @@ static void mach64_configure(struct drm_device *dev)
{ {
dev->driver.buf_priv_size = 1; /* No dev_priv */ dev->driver.buf_priv_size = 1; /* No dev_priv */
dev->driver.lastclose = mach64_driver_lastclose; dev->driver.lastclose = mach64_driver_lastclose;
dev->driver.vblank_wait = mach64_driver_vblank_wait; dev->driver.get_vblank_counter = mach64_get_vblank_counter;
dev->driver.enable_vblank = mach64_enable_vblank;
dev->driver.disable_vblank = mach64_disable_vblank;
dev->driver.irq_preinstall = mach64_driver_irq_preinstall; dev->driver.irq_preinstall = mach64_driver_irq_preinstall;
dev->driver.irq_postinstall = mach64_driver_irq_postinstall; dev->driver.irq_postinstall = mach64_driver_irq_postinstall;
dev->driver.irq_uninstall = mach64_driver_irq_uninstall; dev->driver.irq_uninstall = mach64_driver_irq_uninstall;

View File

@ -90,7 +90,9 @@ static void mga_configure(struct drm_device *dev)
dev->driver.load = mga_driver_load; dev->driver.load = mga_driver_load;
dev->driver.unload = mga_driver_unload; dev->driver.unload = mga_driver_unload;
dev->driver.lastclose = mga_driver_lastclose; dev->driver.lastclose = mga_driver_lastclose;
dev->driver.vblank_wait = mga_driver_vblank_wait; dev->driver.get_vblank_counter = mga_get_vblank_counter;
dev->driver.enable_vblank = mga_enable_vblank;
dev->driver.disable_vblank = mga_disable_vblank;
dev->driver.irq_preinstall = mga_driver_irq_preinstall; dev->driver.irq_preinstall = mga_driver_irq_preinstall;
dev->driver.irq_postinstall = mga_driver_irq_postinstall; dev->driver.irq_postinstall = mga_driver_irq_postinstall;
dev->driver.irq_uninstall = mga_driver_irq_uninstall; dev->driver.irq_uninstall = mga_driver_irq_uninstall;

View File

@ -47,7 +47,9 @@ static void r128_configure(struct drm_device *dev)
dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t); dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t);
dev->driver.preclose = r128_driver_preclose; dev->driver.preclose = r128_driver_preclose;
dev->driver.lastclose = r128_driver_lastclose; dev->driver.lastclose = r128_driver_lastclose;
dev->driver.vblank_wait = r128_driver_vblank_wait; dev->driver.get_vblank_counter = r128_get_vblank_counter;
dev->driver.enable_vblank = r128_enable_vblank;
dev->driver.disable_vblank = r128_disable_vblank;
dev->driver.irq_preinstall = r128_driver_irq_preinstall; dev->driver.irq_preinstall = r128_driver_irq_preinstall;
dev->driver.irq_postinstall = r128_driver_irq_postinstall; dev->driver.irq_postinstall = r128_driver_irq_postinstall;
dev->driver.irq_uninstall = r128_driver_irq_uninstall; dev->driver.irq_uninstall = r128_driver_irq_uninstall;

View File

@ -52,8 +52,9 @@ static void radeon_configure(struct drm_device *dev)
dev->driver.preclose = radeon_driver_preclose; dev->driver.preclose = radeon_driver_preclose;
dev->driver.postclose = radeon_driver_postclose; dev->driver.postclose = radeon_driver_postclose;
dev->driver.lastclose = radeon_driver_lastclose; dev->driver.lastclose = radeon_driver_lastclose;
dev->driver.vblank_wait = radeon_driver_vblank_wait; dev->driver.get_vblank_counter = radeon_get_vblank_counter;
dev->driver.vblank_wait2 = radeon_driver_vblank_wait2; dev->driver.enable_vblank = radeon_enable_vblank;
dev->driver.disable_vblank = radeon_disable_vblank;
dev->driver.irq_preinstall = radeon_driver_irq_preinstall; dev->driver.irq_preinstall = radeon_driver_irq_preinstall;
dev->driver.irq_postinstall = radeon_driver_irq_postinstall; dev->driver.irq_postinstall = radeon_driver_irq_postinstall;
dev->driver.irq_uninstall = radeon_driver_irq_uninstall; dev->driver.irq_uninstall = radeon_driver_irq_uninstall;

View File

@ -106,7 +106,7 @@ static int i915_dma_cleanup(struct drm_device * dev)
return 0; return 0;
} }
#if defined(I915_HAVE_BUFFER)
#define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16) #define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16)
#define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff) #define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff)
#define DRI2_SAREA_BLOCK_NEXT(p) \ #define DRI2_SAREA_BLOCK_NEXT(p) \
@ -165,15 +165,16 @@ setup_dri2_sarea(struct drm_device * dev,
return 0; return 0;
} }
#endif
static int i915_initialize(struct drm_device * dev, static int i915_initialize(struct drm_device * dev,
struct drm_file *file_priv, struct drm_file *file_priv,
drm_i915_init_t * init) drm_i915_init_t * init)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
#if defined(I915_HAVE_BUFFER)
int ret; int ret;
#endif
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("can not find sarea!\n"); DRM_ERROR("can not find sarea!\n");
@ -265,7 +266,7 @@ static int i915_initialize(struct drm_device * dev,
#ifdef I915_HAVE_BUFFER #ifdef I915_HAVE_BUFFER
mutex_init(&dev_priv->cmdbuf_mutex); mutex_init(&dev_priv->cmdbuf_mutex);
#endif #endif
#if defined(I915_HAVE_BUFFER)
if (init->func == I915_INIT_DMA2) { if (init->func == I915_INIT_DMA2) {
ret = setup_dri2_sarea(dev, file_priv, init); ret = setup_dri2_sarea(dev, file_priv, init);
if (ret) { if (ret) {
@ -274,7 +275,7 @@ static int i915_initialize(struct drm_device * dev,
return ret; return ret;
} }
} }
#endif
return 0; return 0;
} }
@ -790,7 +791,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
return 0; return 0;
} }
#if DRM_DEBUG_CODE #if defined(DRM_DEBUG_CODE)
#define DRM_DEBUG_RELOCATION (drm_debug != 0) #define DRM_DEBUG_RELOCATION (drm_debug != 0)
#else #else
#define DRM_DEBUG_RELOCATION 0 #define DRM_DEBUG_RELOCATION 0
@ -1078,7 +1079,7 @@ void i915_driver_lastclose(struct drm_device * dev)
i915_do_cleanup_pageflip(dev); i915_do_cleanup_pageflip(dev);
if (dev_priv->agp_heap) if (dev_priv->agp_heap)
i915_mem_takedown(&(dev_priv->agp_heap)); i915_mem_takedown(&(dev_priv->agp_heap));
#if defined(I915_HAVE_BUFFER)
if (dev_priv->sarea_kmap.virtual) { if (dev_priv->sarea_kmap.virtual) {
drm_bo_kunmap(&dev_priv->sarea_kmap); drm_bo_kunmap(&dev_priv->sarea_kmap);
dev_priv->sarea_kmap.virtual = NULL; dev_priv->sarea_kmap.virtual = NULL;
@ -1092,7 +1093,7 @@ void i915_driver_lastclose(struct drm_device * dev)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
dev_priv->sarea_bo = NULL; dev_priv->sarea_bo = NULL;
} }
#endif
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
} }

View File

@ -148,11 +148,11 @@ typedef struct drm_i915_private {
DRM_SPINTYPE swaps_lock; DRM_SPINTYPE swaps_lock;
drm_i915_vbl_swap_t vbl_swaps; drm_i915_vbl_swap_t vbl_swaps;
unsigned int swaps_pending; unsigned int swaps_pending;
#if defined(DRI2)
/* DRI2 sarea */ /* DRI2 sarea */
struct drm_buffer_object *sarea_bo; struct drm_buffer_object *sarea_bo;
struct drm_bo_kmap_obj sarea_kmap; struct drm_bo_kmap_obj sarea_kmap;
#endif
/* Register state */ /* Register state */
u8 saveLBB; u8 saveLBB;
u32 saveDSPACNTR; u32 saveDSPACNTR;

View File

@ -396,8 +396,7 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int plane)
low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL;
if (!i915_pipe_enabled(dev, pipe)) { if (!i915_pipe_enabled(dev, pipe)) {
printk(KERN_ERR "trying to get vblank count for disabled " DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe);
"pipe %d\n", pipe);
return 0; return 0;
} }

View File

@ -380,7 +380,6 @@ extern void radeon_do_release(struct drm_device * dev);
extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc); extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc);
extern int radeon_enable_vblank(struct drm_device *dev, int crtc); extern int radeon_enable_vblank(struct drm_device *dev, int crtc);
extern void radeon_disable_vblank(struct drm_device *dev, int crtc); extern void radeon_disable_vblank(struct drm_device *dev, int crtc);
extern void radeon_do_release(struct drm_device * dev);
extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS);
extern void radeon_driver_irq_preinstall(struct drm_device * dev); extern void radeon_driver_irq_preinstall(struct drm_device * dev);
extern int radeon_driver_irq_postinstall(struct drm_device * dev); extern int radeon_driver_irq_postinstall(struct drm_device * dev);