diff options
author | Jeff Hartmann <jhartmann@valinux.com> | 2000-02-06 01:20:42 +0000 |
---|---|---|
committer | Jeff Hartmann <jhartmann@valinux.com> | 2000-02-06 01:20:42 +0000 |
commit | 7a830549597666ac5ccc482b41410f38294d1134 (patch) | |
tree | 52da54172c0df5b8fd7750f9d34bbeaeedcc988c | |
parent | 4db40c2a8b53b1e02e6607fb301a5ca886d461ce (diff) |
A few state infrastructure things
-rw-r--r-- | linux-core/mga_drv.c | 3 | ||||
-rw-r--r-- | linux/mga_clear.c | 70 | ||||
-rw-r--r-- | linux/mga_drm_public.h | 6 | ||||
-rw-r--r-- | linux/mga_drv.c | 3 | ||||
-rw-r--r-- | linux/mga_drv.h | 7 | ||||
-rw-r--r-- | linux/mga_state.c | 2 |
6 files changed, 76 insertions, 15 deletions
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c index 60cf9b1d..5d93d1b6 100644 --- a/linux-core/mga_drv.c +++ b/linux-core/mga_drv.c @@ -105,6 +105,9 @@ static drm_ioctl_desc_t mga_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_clear_bufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_swap_bufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_iload, 1, 1 }, }; #define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls) diff --git a/linux/mga_clear.c b/linux/mga_clear.c index 8dfcac42..403c1928 100644 --- a/linux/mga_clear.c +++ b/linux/mga_clear.c @@ -48,11 +48,10 @@ DC_pattern_disable | DC_transc_disable | \ DC_clipdis_enable) \ - -void mgaClearBuffers( drm_device_t *dev, - int clear_color, - int clear_depth, - int flags ) +static int mgaClearBuffers(drm_device_t *dev, + int clear_color, + int clear_depth, + int flags) { int cmd, i; drm_device_dma_t *dma = dev->dma; @@ -67,7 +66,7 @@ void mgaClearBuffers( drm_device_t *dev, if (!nbox) - return; + return -EINVAL; if ( dev_priv->sgram ) cmd = MGA_CLEAR_CMD | DC_atype_blk; @@ -132,10 +131,10 @@ void mgaClearBuffers( drm_device_t *dev, d.granted_count = 0; drm_dma_enqueue(dev, &d); + return 0; } - -void mgaSwapBuffers( drm_device_t *dev ) +int mgaSwapBuffers(drm_device_t *dev, int flags) { drm_device_dma_t *dma = dev->dma; drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; @@ -149,11 +148,11 @@ void mgaSwapBuffers( drm_device_t *dev ) DMALOCALS; if (!nbox) - return; + return -EINVAL; buf = drm_freelist_get(&dma->bufs[order].freelist, _DRM_DMA_WAIT); - DMAGETPTR( buf ); + DMAGETPTR(buf); DMAOUTREG(MGAREG_DSTORG, dev_priv->frontOrg); DMAOUTREG(MGAREG_MACCESS, dev_priv->mAccess); @@ -199,5 +198,56 @@ void mgaSwapBuffers( drm_device_t *dev ) d.granted_count = 0; drm_dma_enqueue(dev, &d); + return 0; +} + + +int mga_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_clear_t clear; + int retcode; + + copy_from_user_ret(&clear, (drm_mga_clear_t *)arg, + sizeof(clear), -EFAULT); + + retcode = mgaClearBuffers(dev, clear.clear_color, + clear.clear_depth, + clear.flags); + + return retcode; +} + +int mga_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_swap_t swap; + int retcode = 0; + + copy_from_user_ret(&swap, (drm_mga_swap_t *)arg, + sizeof(swap), -EFAULT); + + retcode = mgaSwapBuffers(dev, swap.flags); + + return retcode; } +int mga_iload(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_iload_t iload; + int retcode = 0; + + copy_from_user_ret(&iload, (drm_mga_iload_t *)arg, + sizeof(iload), -EFAULT); + + retcode = mgaIload(dev, &iload); + + return retcode; +} diff --git a/linux/mga_drm_public.h b/linux/mga_drm_public.h index 20c033c3..28d3b5b9 100644 --- a/linux/mga_drm_public.h +++ b/linux/mga_drm_public.h @@ -215,7 +215,7 @@ typedef struct _drm_mga_sarea { #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x40, drm_mga_swap_t) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x40, drm_mga_clear_t) - +#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t) #endif diff --git a/linux/mga_drv.c b/linux/mga_drv.c index 60cf9b1d..5d93d1b6 100644 --- a/linux/mga_drv.c +++ b/linux/mga_drv.c @@ -105,6 +105,9 @@ static drm_ioctl_desc_t mga_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_clear_bufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_swap_bufs, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_iload, 1, 1 }, }; #define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls) diff --git a/linux/mga_drv.h b/linux/mga_drv.h index 0491ed92..3dd50827 100644 --- a/linux/mga_drv.h +++ b/linux/mga_drv.h @@ -116,6 +116,13 @@ extern int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int mga_addmap(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); + /* mga_state.c */ +extern int mga_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int mga_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int mga_iload(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); diff --git a/linux/mga_state.c b/linux/mga_state.c index f52f054c..450e3b78 100644 --- a/linux/mga_state.c +++ b/linux/mga_state.c @@ -310,8 +310,6 @@ static int mgaG200EmitPipe( drm_device_t *dev, drm_buf_t *buf ) return 0; } - - void mgaEmitState( drm_device_t *dev ) { drm_buf_t *buf; |