diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 1174a0fa..e4bc53bc 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -27,7 +27,7 @@ * Authors: Rickard E. (Rik) Faith * Kevin E. Martin * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.10 2000/02/23 04:47:23 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.14 2000/06/27 16:42:07 alanh Exp $ * */ @@ -68,6 +68,13 @@ extern int xf86RemoveSIGIOHandler(int fd); # endif #endif +#ifdef __alpha__ +extern unsigned long _bus_base(void); +#define BUS_BASE _bus_base() +#else +#define BUS_BASE (0) +#endif + /* Not all systems have MAP_FAILED defined */ #ifndef MAP_FAILED #define MAP_FAILED ((void *)-1) @@ -270,7 +277,7 @@ static int drmOpenByName(const char *name) #if defined(XFree86Server) mode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; - group = xf86ConfigDRI.group ? xf86ConfigDRI.group : DRM_DEV_GID; + group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID; #endif #if defined(XFree86Server) @@ -496,6 +503,10 @@ int drmAddMap(int fd, drm_map_t map; map.offset = offset; +#ifdef __alpha__ + if (!(type & DRM_SHM)) + map.offset += BUS_BASE; +#endif map.size = size; map.handle = 0; map.type = type; diff --git a/libdrm/xf86drmHash.c b/libdrm/xf86drmHash.c index 17089e44..24b698cc 100644 --- a/libdrm/xf86drmHash.c +++ b/libdrm/xf86drmHash.c @@ -25,7 +25,7 @@ * * Authors: Rickard E. (Rik) Faith * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.2 2000/02/23 04:47:23 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.3 2000/06/17 00:03:34 martin Exp $ * * DESCRIPTION * diff --git a/libdrm/xf86drmRandom.c b/libdrm/xf86drmRandom.c index 71ef1155..9e1e9ee2 100644 --- a/libdrm/xf86drmRandom.c +++ b/libdrm/xf86drmRandom.c @@ -25,7 +25,7 @@ * * Authors: Rickard E. (Rik) Faith * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRandom.c,v 1.3 2000/02/23 04:47:23 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRandom.c,v 1.4 2000/06/17 00:03:34 martin Exp $ * * DESCRIPTION * diff --git a/libdrm/xf86drmSL.c b/libdrm/xf86drmSL.c index f67434be..dd634c30 100644 --- a/libdrm/xf86drmSL.c +++ b/libdrm/xf86drmSL.c @@ -25,7 +25,7 @@ * * Authors: Rickard E. (Rik) Faith * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSL.c,v 1.2 2000/02/23 04:47:24 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSL.c,v 1.3 2000/06/17 00:03:34 martin Exp $ * * DESCRIPTION * diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel index a169473a..e262213a 100644 --- a/linux-core/Makefile.kernel +++ b/linux-core/Makefile.kernel @@ -9,7 +9,7 @@ # Note 2! The CFLAGS definitions are now inherited from the # parent makes.. # -# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.5 2000/02/14 06:27:25 martin Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.6 2000/06/17 00:03:34 martin Exp $ L_TARGET := libdrm.a diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c index 94f35b61..96b7a44f 100644 --- a/linux-core/i810_dma.c +++ b/linux-core/i810_dma.c @@ -211,7 +211,7 @@ static int i810_unmap_buffer(drm_buf_t *buf) if(buf_priv->currently_mapped != I810_BUF_MAPPED) return -EINVAL; down(¤t->mm->mmap_sem); - retcode = do_munmap((unsigned long)buf_priv->virtual, + retcode = do_munmap(current->mm, (unsigned long)buf_priv->virtual, (size_t) buf->total); buf_priv->currently_mapped = I810_BUF_UNMAPPED; buf_priv->virtual = 0; diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel index a169473a..e262213a 100644 --- a/linux/Makefile.kernel +++ b/linux/Makefile.kernel @@ -9,7 +9,7 @@ # Note 2! The CFLAGS definitions are now inherited from the # parent makes.. # -# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.5 2000/02/14 06:27:25 martin Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.6 2000/06/17 00:03:34 martin Exp $ L_TARGET := libdrm.a diff --git a/linux/i810_dma.c b/linux/i810_dma.c index 94f35b61..96b7a44f 100644 --- a/linux/i810_dma.c +++ b/linux/i810_dma.c @@ -211,7 +211,7 @@ static int i810_unmap_buffer(drm_buf_t *buf) if(buf_priv->currently_mapped != I810_BUF_MAPPED) return -EINVAL; down(¤t->mm->mmap_sem); - retcode = do_munmap((unsigned long)buf_priv->virtual, + retcode = do_munmap(current->mm, (unsigned long)buf_priv->virtual, (size_t) buf->total); buf_priv->currently_mapped = I810_BUF_UNMAPPED; buf_priv->virtual = 0; diff --git a/linux/mga_dma.c b/linux/mga_dma.c index 25e3622c..28e8811c 100644 --- a/linux/mga_dma.c +++ b/linux/mga_dma.c @@ -572,10 +572,12 @@ int mga_dma_schedule(drm_device_t *dev, int locked) { drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; drm_device_dma_t *dma = dev->dma; + int retval = 0; if (test_and_set_bit(0, &dev->dma_flag)) { atomic_inc(&dma->total_missed_dma); - return -EBUSY; + retval = -EBUSY; + goto sch_out_wakeup; } DRM_DEBUG("%s\n", __FUNCTION__); @@ -591,7 +593,8 @@ int mga_dma_schedule(drm_device_t *dev, int locked) atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); DRM_DEBUG("Not locked\n"); - return -EBUSY; + retval = -EBUSY; + goto sch_out_wakeup; } DRM_DEBUG("I'm locked\n"); @@ -621,12 +624,12 @@ int mga_dma_schedule(drm_device_t *dev, int locked) } } +sch_out_wakeup: if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords == 0 && atomic_read(&dev_priv->pending_bufs) == 0) { - /* Everything has been processed by the hardware */ + /* Everything has been processed by the hardware */ clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); - wake_up_interruptible(&dev_priv->flush_queue); + wake_up_interruptible(&dev_priv->flush_queue); } if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && @@ -641,7 +644,7 @@ int mga_dma_schedule(drm_device_t *dev, int locked) } clear_bit(0, &dev->dma_flag); - return 0; + return retval; } static void mga_dma_service(int irq, void *device, struct pt_regs *regs) @@ -956,11 +959,11 @@ static int mga_flush_queue(drm_device_t *dev) } if(dev_priv->next_prim->num_dwords != 0) { - set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); current->state = TASK_INTERRUPTIBLE; add_wait_queue(&dev_priv->flush_queue, &entry); + set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); + mga_dma_schedule(dev, 0); for (;;) { - mga_dma_schedule(dev, 0); if (!test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status)) break; @@ -1093,14 +1096,15 @@ int mga_flush_ioctl(struct inode *inode, struct file *filp, } if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) { - drm_mga_prim_buf_t *temp_buf = - dev_priv->prim_bufs[dev_priv->current_prim_idx]; + drm_mga_prim_buf_t *temp_buf; + + temp_buf = dev_priv->current_prim; if(temp_buf && temp_buf->num_dwords) { set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status); mga_advance_primary(dev); - mga_dma_schedule(dev, 1); } + mga_dma_schedule(dev, 1); } if(lock.flags & _DRM_LOCK_QUIESCENT) { mga_flush_queue(dev); diff --git a/linux/mga_state.c b/linux/mga_state.c index 0f7da2c7..723ccc53 100644 --- a/linux/mga_state.c +++ b/linux/mga_state.c @@ -546,7 +546,6 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) 10 + 15 * MGA_NR_SAREA_CLIPRECTS); PRIM_OVERFLOW(dev, dev_priv, primary_needed); mgaEmitState(dev_priv); - do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" @@ -572,7 +571,6 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) PRIMADVANCE(dev_priv); } while (++i < sarea_priv->nbox); } - if (buf_priv->discard) { if (buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv); @@ -748,10 +746,15 @@ static void mga_dma_dispatch_swap(drm_device_t * dev) DRM_DEBUG("%s\n", __FUNCTION__); primary_needed = nbox * 5; - primary_needed += 60; + primary_needed += 65; PRIM_OVERFLOW(dev, dev_priv, primary_needed); PRIMGETPTR(dev_priv); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7100); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset);