Ejemplo n.º 1
0
int mga_dma_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_device_dma_t *dma = dev->dma;
    drm_mga_private_t *dev_priv = dev->dev_private;
    drm_buf_t *buf;
    drm_mga_buf_priv_t *buf_priv;
    drm_mga_iload_t iload;
    DRM_DEBUG( __FUNCTION__ ":\n" );

    LOCK_TEST_WITH_RETURN( dev );

    if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) )
        return -EFAULT;

#if 0
    if ( mga_do_wait_for_idle( dev_priv ) < 0 ) {
        if ( MGA_DMA_DEBUG )
            DRM_INFO( __FUNCTION__": -EBUSY\n" );
        return -EBUSY;
    }
#endif
    if(iload.idx < 0 || iload.idx > dma->buf_count) return -EINVAL;

    buf = dma->buflist[iload.idx];
    buf_priv = buf->dev_private;

    if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) {
        mga_freelist_put( dev, buf );
        return -EINVAL;
    }

    WRAP_TEST_WITH_RETURN( dev_priv );

    mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length );

    /* Make sure we restore the 3D state next time.
     */
    dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;

    return 0;
}
Ejemplo n.º 2
0
static int mga_dma_iload(DRM_IOCTL_ARGS)
{
	DRM_DEVICE;
	struct drm_device_dma *dma = dev->dma;
	drm_mga_private_t *dev_priv = dev->dev_private;
	struct drm_buf *buf;
	drm_mga_buf_priv_t *buf_priv;
	drm_mga_iload_t iload;
	DRM_DEBUG("\n");

	LOCK_TEST_WITH_RETURN(dev, filp);

	DRM_COPY_FROM_USER_IOCTL(iload, (drm_mga_iload_t __user *) data,
				 sizeof(iload));

#if 0
	if (mga_do_wait_for_idle(dev_priv) < 0) {
		if (MGA_DMA_DEBUG)
			DRM_INFO("%s: -EBUSY\n", __FUNCTION__);
		return DRM_ERR(EBUSY);
	}
#endif
	if (iload.idx < 0 || iload.idx > dma->buf_count)
		return DRM_ERR(EINVAL);

	buf = dma->buflist[iload.idx];
	buf_priv = buf->dev_private;

	if (mga_verify_iload(dev_priv, iload.dstorg, iload.length)) {
		mga_freelist_put(dev, buf);
		return DRM_ERR(EINVAL);
	}

	WRAP_TEST_WITH_RETURN(dev_priv);

	mga_dma_dispatch_iload(dev, buf, iload.dstorg, iload.length);

	/* Make sure we restore the 3D state next time.
	 */
	dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;

	return 0;
}
Ejemplo n.º 3
0
static int mga_dma_iload(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
	struct drm_device_dma *dma = dev->dma;
	drm_mga_private_t *dev_priv = dev->dev_private;
	struct drm_buf *buf;
	drm_mga_buf_priv_t *buf_priv;
	drm_mga_iload_t *iload = data;
	DRM_DEBUG("\n");

	LOCK_TEST_WITH_RETURN(dev, file_priv);

#if 0
	if (mga_do_wait_for_idle(dev_priv) < 0) {
		if (MGA_DMA_DEBUG)
			DRM_INFO("-EBUSY\n");
		return -EBUSY;
	}
#endif
	if (iload->idx < 0 || iload->idx > dma->buf_count)
		return -EINVAL;

	buf = dma->buflist[iload->idx];
	buf_priv = buf->dev_private;

	if (mga_verify_iload(dev_priv, iload->dstorg, iload->length)) {
		mga_freelist_put(dev, buf);
		return -EINVAL;
	}

	WRAP_TEST_WITH_RETURN(dev_priv);

	mga_dma_dispatch_iload(dev, buf, iload->dstorg, iload->length);

	/* Make sure we restore the 3D state next time.
	 */
	dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT;

	return 0;
}