diff options
author | Thomas Hellstrom <unichrome@shipmail.org> | 2005-03-14 22:50:21 +0000 |
---|---|---|
committer | Thomas Hellstrom <unichrome@shipmail.org> | 2005-03-14 22:50:21 +0000 |
commit | d2fd9200956a94cfd91a39e76994f326bdfc6ac0 (patch) | |
tree | 9151ee4ea20c3ea53be1370b058afec101858b54 /shared | |
parent | a396617dbc15abafdc172b972a02c04007ad579f (diff) |
via changes:
1. Initialize futex locks to zero on device init.
2. Remove some stray defines from via_drm.h
3. Prepare via_drm.h for drm client inclusion. The goal is to share a
common file with common definitions.
4. Sync shared / shared-core via_drm.h
5. Bump minor, because of the futex lock initialization.
Diffstat (limited to 'shared')
-rw-r--r-- | shared/via.h | 6 | ||||
-rw-r--r-- | shared/via_drm.h | 77 | ||||
-rw-r--r-- | shared/via_map.c | 7 | ||||
-rw-r--r-- | shared/via_mm.c | 7 |
4 files changed, 50 insertions, 47 deletions
diff --git a/shared/via.h b/shared/via.h index 05ed9df3..b35164e4 100644 --- a/shared/via.h +++ b/shared/via.h @@ -30,11 +30,11 @@ #define DRIVER_NAME "via" #define DRIVER_DESC "VIA Unichrome" -#define DRIVER_DATE "20050214" +#define DRIVER_DATE "20050314" #define DRIVER_MAJOR 2 -#define DRIVER_MINOR 4 -#define DRIVER_PATCHLEVEL 6 +#define DRIVER_MINOR 5 +#define DRIVER_PATCHLEVEL 0 #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_VIA_ALLOCMEM)] = { via_mem_alloc, 1, 0 }, \ diff --git a/shared/via_drm.h b/shared/via_drm.h index 2327bec5..f3b4a28a 100644 --- a/shared/via_drm.h +++ b/shared/via_drm.h @@ -31,18 +31,19 @@ #ifndef _VIA_DEFINES_ #define _VIA_DEFINES_ -#define VIA_DMA_BUF_ORDER 12 -#define VIA_DMA_BUF_SZ (1 << VIA_DMA_BUF_ORDER) -#define VIA_DMA_BUF_NR 256 +#ifndef __KERNEL__ +#include "via_drmclient.h" +#endif + #define VIA_NR_SAREA_CLIPRECTS 8 #define VIA_NR_XVMC_PORTS 10 #define VIA_NR_XVMC_LOCKS 5 #define VIA_MAX_CACHELINE_SIZE 64 #define XVMCLOCKPTR(saPriv,lockNo) \ - ((volatile int *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ - (VIA_MAX_CACHELINE_SIZE - 1)) & \ - ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ - VIA_MAX_CACHELINE_SIZE*(lockNo))) + ((volatile drm_hw_lock_t *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ + (VIA_MAX_CACHELINE_SIZE - 1)) & \ + ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ + VIA_MAX_CACHELINE_SIZE*(lockNo))) /* Each region is a minimum of 64k, and there are at most 64 of them. */ @@ -60,18 +61,31 @@ #define VIA_UPLOAD_ALL 0xff /* VIA specific ioctls */ -#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t) -#define DRM_IOCTL_VIA_FREEMEM DRM_IOW(0x41, drm_via_mem_t) -#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(0x42, drm_via_agp_t) -#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(0x43, drm_via_fb_t) -#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(0x44, drm_via_init_t) -#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW(0x45, drm_via_futex_t) -#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(0x47, drm_via_dma_init_t) -#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW(0x48, drm_via_cmdbuffer_t) -#define DRM_IOCTL_VIA_FLUSH DRM_IO(0x49) -#define DRM_IOCTL_VIA_PCICMD DRM_IOW(0x4A, drm_via_cmdbuffer_t) -#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR(0x4B, drm_via_cmdbuf_size_t) - +#define DRM_VIA_ALLOCMEM 0x00 +#define DRM_VIA_FREEMEM 0x01 +#define DRM_VIA_AGP_INIT 0x02 +#define DRM_VIA_FB_INIT 0x03 +#define DRM_VIA_MAP_INIT 0x04 +#define DRM_VIA_DEC_FUTEX 0x05 +#define NOT_USED +#define DRM_VIA_DMA_INIT 0x07 +#define DRM_VIA_CMDBUFFER 0x08 +#define DRM_VIA_FLUSH 0x09 +#define DRM_VIA_PCICMD 0x0a +#define DRM_VIA_CMDBUF_SIZE 0x0b + +#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) +#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) +#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t) +#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t) +#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t) +#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t) +#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t) +#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t) +#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH) +#define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t) +#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ + drm_via_cmdbuf_size_t) /* Indices into buf.Setup where various bits of state are mirrored per * context and per buffer. These can be fired at the card as a unit, @@ -89,19 +103,19 @@ #define VIDEO 0 #define AGP 1 typedef struct { - unsigned long offset; - unsigned long size; + uint32_t offset; + uint32_t size; } drm_via_agp_t; typedef struct { - unsigned long offset; - unsigned long size; + uint32_t offset; + uint32_t size; } drm_via_fb_t; typedef struct { uint32_t context; uint32_t type; - unsigned long size; + uint32_t size; unsigned long index; unsigned long offset; } drm_via_mem_t; @@ -177,20 +191,6 @@ typedef struct _drm_via_sarea { } drm_via_sarea_t; -typedef struct _drm_via_flush_agp { - unsigned int offset; - unsigned int size; - unsigned int index; - int discard; /* client is finished with the buffer? */ -} drm_via_flush_agp_t; - -typedef struct _drm_via_flush_sys { - unsigned int offset; - unsigned int size; - unsigned long index; - int discard; /* client is finished with the buffer? */ -} drm_via_flush_sys_t; - typedef struct _drm_via_cmdbuf_size { enum { VIA_CMDBUF_SPACE = 0x01, @@ -200,6 +200,7 @@ typedef struct _drm_via_cmdbuf_size { uint32_t size; } drm_via_cmdbuf_size_t; + #ifdef __KERNEL__ int via_fb_init(DRM_IOCTL_ARGS); diff --git a/shared/via_map.c b/shared/via_map.c index ac8f105f..178284c1 100644 --- a/shared/via_map.c +++ b/shared/via_map.c @@ -69,8 +69,10 @@ int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) dev_priv->agpAddr = init->agpAddr; - for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) + for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) { DRM_INIT_WAITQUEUE(&(dev_priv->decoder_queue[i])); + XVMCLOCKPTR(dev_priv->sarea_priv, i)->lock = 0; + } dev->dev_private = (void *)dev_priv; @@ -111,6 +113,7 @@ int via_map_init(DRM_IOCTL_ARGS) return -EINVAL; } + int via_decoder_futex(DRM_IOCTL_ARGS) { DRM_DEVICE; @@ -125,7 +128,7 @@ int via_decoder_futex(DRM_IOCTL_ARGS) if (fx.lock > VIA_NR_XVMC_LOCKS) return -EFAULT; - lock = XVMCLOCKPTR(sAPriv, fx.lock); + lock = (int *)XVMCLOCKPTR(sAPriv, fx.lock); switch (fx.func) { case VIA_FUTEX_WAIT: diff --git a/shared/via_mm.c b/shared/via_mm.c index 96f3335d..fadfbfba 100644 --- a/shared/via_mm.c +++ b/shared/via_mm.c @@ -177,10 +177,9 @@ int via_final_context(struct drm_device *dev, int context) */ for (i=0; i < VIA_NR_XVMC_LOCKS; ++i) { - lock = XVMCLOCKPTR(sAPriv, i); - if ( (_DRM_LOCKING_CONTEXT( *lock ) == context) && - (_DRM_LOCK_IS_HELD( *lock ))) { - if ( *lock & _DRM_LOCK_CONT) { + lock = (int *) XVMCLOCKPTR(sAPriv, i); + if ( (_DRM_LOCKING_CONTEXT( *lock ) == context)) { + if (_DRM_LOCK_IS_HELD( *lock ) && (*lock & _DRM_LOCK_CONT)) { DRM_WAKEUP( &(dev_priv->decoder_queue[i])); } *lock = 0; |