diff options
-rw-r--r-- | bsd-core/drm_dma.c | 1 | ||||
-rw-r--r-- | bsd-core/drm_os_freebsd.h | 4 | ||||
-rw-r--r-- | bsd/drm_dma.h | 1 | ||||
-rw-r--r-- | bsd/drm_os_freebsd.h | 4 | ||||
-rw-r--r-- | libdrm/xf86drm.c | 1 | ||||
-rw-r--r-- | linux-core/drm_dma.c | 1 | ||||
-rw-r--r-- | linux/Makefile.linux | 2 | ||||
-rw-r--r-- | linux/drm_dma.h | 1 | ||||
-rw-r--r-- | shared-core/radeon_drm.h | 2 | ||||
-rw-r--r-- | shared-core/radeon_drv.h | 16 | ||||
-rw-r--r-- | shared-core/radeon_irq.c | 13 | ||||
-rw-r--r-- | shared/radeon_drm.h | 2 | ||||
-rw-r--r-- | shared/radeon_drv.h | 16 | ||||
-rw-r--r-- | shared/radeon_irq.c | 13 |
14 files changed, 46 insertions, 31 deletions
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c index 69c66c9a9..0f0dd4fdf 100644 --- a/bsd-core/drm_dma.c +++ b/bsd-core/drm_dma.c @@ -619,6 +619,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS ) if (vblwait.request.type & _DRM_VBLANK_RELATIVE) { vblwait.request.sequence += atomic_read(&dev->vbl_received); + vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; } flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h index ff2a64609..1a3feb6e8 100644 --- a/bsd-core/drm_os_freebsd.h +++ b/bsd-core/drm_os_freebsd.h @@ -188,6 +188,10 @@ do { \ #define PAGE_ALIGN(addr) round_page(addr) + +#ifndef M_WAITOK /* M_WAITOK (=0) name removed in -current */ +#define M_WAITOK 0 +#endif #define malloctype DRM(M_DRM) /* The macros confliced in the MALLOC_DEFINE */ diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h index 69c66c9a9..0f0dd4fdf 100644 --- a/bsd/drm_dma.h +++ b/bsd/drm_dma.h @@ -619,6 +619,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS ) if (vblwait.request.type & _DRM_VBLANK_RELATIVE) { vblwait.request.sequence += atomic_read(&dev->vbl_received); + vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; } flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h index ff2a64609..1a3feb6e8 100644 --- a/bsd/drm_os_freebsd.h +++ b/bsd/drm_os_freebsd.h @@ -188,6 +188,10 @@ do { \ #define PAGE_ALIGN(addr) round_page(addr) + +#ifndef M_WAITOK /* M_WAITOK (=0) name removed in -current */ +#define M_WAITOK 0 +#endif #define malloctype DRM(M_DRM) /* The macros confliced in the MALLOC_DEFINE */ diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 6c830664b..d250365e3 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -1105,6 +1105,7 @@ int drmWaitVBlank(int fd, drmVBlankPtr vbl) do { ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); + vbl->request.type &= ~DRM_VBLANK_RELATIVE; } while (ret && errno == EINTR); return ret; diff --git a/linux-core/drm_dma.c b/linux-core/drm_dma.c index 33af34be2..df4ed809f 100644 --- a/linux-core/drm_dma.c +++ b/linux-core/drm_dma.c @@ -628,6 +628,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS ) 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: diff --git a/linux/Makefile.linux b/linux/Makefile.linux index 4505e6c11..633d96c4e 100644 --- a/linux/Makefile.linux +++ b/linux/Makefile.linux @@ -66,7 +66,7 @@ WARNINGS = -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \ -Wstrict-prototypes -Wnested-externs \ -Wpointer-arith # -Wshadow -Winline -- make output too noisy -MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer +MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer -fno-strict-aliasing PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ -I../../../../../../include -I../../../../../../../../include \ diff --git a/linux/drm_dma.h b/linux/drm_dma.h index 33af34be2..df4ed809f 100644 --- a/linux/drm_dma.h +++ b/linux/drm_dma.h @@ -628,6 +628,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS ) 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: diff --git a/shared-core/radeon_drm.h b/shared-core/radeon_drm.h index f05507e2f..512d36b94 100644 --- a/shared-core/radeon_drm.h +++ b/shared-core/radeon_drm.h @@ -382,7 +382,7 @@ typedef struct { #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) -#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( 0x4f, drm_radeon_vertex_t) +#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( 0x4f, drm_radeon_vertex2_t) #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( 0x50, drm_radeon_cmd_buffer_t) #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(0x51, drm_radeon_getparam_t) #define DRM_IOCTL_RADEON_FLIP DRM_IO( 0x52) diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h index 0b5ef8c78..8d80b6566 100644 --- a/shared-core/radeon_drv.h +++ b/shared-core/radeon_drv.h @@ -825,13 +825,6 @@ do { \ * Ring control */ -#if defined(__powerpc__) -#define radeon_flush_write_combine() (void) GET_RING_HEAD( &dev_priv->ring ) -#else -#define radeon_flush_write_combine() DRM_WRITEMEMORYBARRIER() -#endif - - #define RADEON_VERBOSE 0 #define RING_LOCALS int write, _nr; unsigned int mask; u32 *ring; @@ -865,8 +858,13 @@ do { \ dev_priv->ring.tail = write; \ } while (0) -#define COMMIT_RING() do { \ - RADEON_WRITE( RADEON_CP_RB_WPTR, dev_priv->ring.tail ); \ +#define COMMIT_RING() do { \ + /* Flush writes to ring */ \ + DRM_READMEMORYBARRIER(); \ + GET_RING_HEAD( &dev_priv->ring ); \ + RADEON_WRITE( RADEON_CP_RB_WPTR, dev_priv->ring.tail ); \ + /* read from PCI bus to ensure correct posting */ \ + RADEON_READ( RADEON_CP_RB_RPTR ); \ } while (0) #define OUT_RING( x ) do { \ diff --git a/shared-core/radeon_irq.c b/shared-core/radeon_irq.c index c5cd61c5b..596706bf3 100644 --- a/shared-core/radeon_irq.c +++ b/shared-core/radeon_irq.c @@ -61,7 +61,11 @@ void DRM(dma_service)( DRM_IRQ_ARGS ) (drm_radeon_private_t *)dev->dev_private; u32 stat; - stat = RADEON_READ(RADEON_GEN_INT_STATUS); + /* Only consider the bits we're interested in - others could be used + * outside the DRM + */ + stat = RADEON_READ(RADEON_GEN_INT_STATUS) + & (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT); if (!stat) return; @@ -77,15 +81,14 @@ void DRM(dma_service)( DRM_IRQ_ARGS ) DRM(vbl_send_signals)( dev ); } - /* Acknowledge all the bits in GEN_INT_STATUS -- seem to get - * more than we asked for... - */ + /* Acknowledge interrupts we handle */ RADEON_WRITE(RADEON_GEN_INT_STATUS, stat); } static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv) { - u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS ); + u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS ) + & (RADEON_SW_INT_TEST_ACK | RADEON_CRTC_VBLANK_STAT); if (tmp) RADEON_WRITE( RADEON_GEN_INT_STATUS, tmp ); } diff --git a/shared/radeon_drm.h b/shared/radeon_drm.h index f05507e2f..512d36b94 100644 --- a/shared/radeon_drm.h +++ b/shared/radeon_drm.h @@ -382,7 +382,7 @@ typedef struct { #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) -#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( 0x4f, drm_radeon_vertex_t) +#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( 0x4f, drm_radeon_vertex2_t) #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( 0x50, drm_radeon_cmd_buffer_t) #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(0x51, drm_radeon_getparam_t) #define DRM_IOCTL_RADEON_FLIP DRM_IO( 0x52) diff --git a/shared/radeon_drv.h b/shared/radeon_drv.h index 0b5ef8c78..8d80b6566 100644 --- a/shared/radeon_drv.h +++ b/shared/radeon_drv.h @@ -825,13 +825,6 @@ do { \ * Ring control */ -#if defined(__powerpc__) -#define radeon_flush_write_combine() (void) GET_RING_HEAD( &dev_priv->ring ) -#else -#define radeon_flush_write_combine() DRM_WRITEMEMORYBARRIER() -#endif - - #define RADEON_VERBOSE 0 #define RING_LOCALS int write, _nr; unsigned int mask; u32 *ring; @@ -865,8 +858,13 @@ do { \ dev_priv->ring.tail = write; \ } while (0) -#define COMMIT_RING() do { \ - RADEON_WRITE( RADEON_CP_RB_WPTR, dev_priv->ring.tail ); \ +#define COMMIT_RING() do { \ + /* Flush writes to ring */ \ + DRM_READMEMORYBARRIER(); \ + GET_RING_HEAD( &dev_priv->ring ); \ + RADEON_WRITE( RADEON_CP_RB_WPTR, dev_priv->ring.tail ); \ + /* read from PCI bus to ensure correct posting */ \ + RADEON_READ( RADEON_CP_RB_RPTR ); \ } while (0) #define OUT_RING( x ) do { \ diff --git a/shared/radeon_irq.c b/shared/radeon_irq.c index c5cd61c5b..596706bf3 100644 --- a/shared/radeon_irq.c +++ b/shared/radeon_irq.c @@ -61,7 +61,11 @@ void DRM(dma_service)( DRM_IRQ_ARGS ) (drm_radeon_private_t *)dev->dev_private; u32 stat; - stat = RADEON_READ(RADEON_GEN_INT_STATUS); + /* Only consider the bits we're interested in - others could be used + * outside the DRM + */ + stat = RADEON_READ(RADEON_GEN_INT_STATUS) + & (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT); if (!stat) return; @@ -77,15 +81,14 @@ void DRM(dma_service)( DRM_IRQ_ARGS ) DRM(vbl_send_signals)( dev ); } - /* Acknowledge all the bits in GEN_INT_STATUS -- seem to get - * more than we asked for... - */ + /* Acknowledge interrupts we handle */ RADEON_WRITE(RADEON_GEN_INT_STATUS, stat); } static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv) { - u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS ); + u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS ) + & (RADEON_SW_INT_TEST_ACK | RADEON_CRTC_VBLANK_STAT); if (tmp) RADEON_WRITE( RADEON_GEN_INT_STATUS, tmp ); } |