Re: [PATCH v9] dma-buf: Add ioctls to allow userspace to flush

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 25, 2016 at 06:01:22PM +0000, Chris Wilson wrote:
> On Thu, Feb 11, 2016 at 08:04:51PM -0200, Tiago Vignatti wrote:
> > +static long dma_buf_ioctl(struct file *file,
> > +			  unsigned int cmd, unsigned long arg)
> > +{
> > +	struct dma_buf *dmabuf;
> > +	struct dma_buf_sync sync;
> > +	enum dma_data_direction direction;
> > +
> > +	dmabuf = file->private_data;
> > +
> > +	switch (cmd) {
> > +	case DMA_BUF_IOCTL_SYNC:
> > +		if (copy_from_user(&sync, (void __user *) arg, sizeof(sync)))
> > +			return -EFAULT;
> > +
> > +		if (sync.flags & ~DMA_BUF_SYNC_VALID_FLAGS_MASK)
> > +			return -EINVAL;
> > +
> > +		switch (sync.flags & DMA_BUF_SYNC_RW) {
> > +		case DMA_BUF_SYNC_READ:
> > +			direction = DMA_FROM_DEVICE;
> > +			break;
> > +		case DMA_BUF_SYNC_WRITE:
> > +			direction = DMA_TO_DEVICE;
> > +			break;
> > +		case DMA_BUF_SYNC_RW:
> > +			direction = DMA_BIDIRECTIONAL;
> > +			break;
> > +		default:
> > +			return -EINVAL;
> > +		}
> > +
> > +		if (sync.flags & DMA_BUF_SYNC_END)
> > +			dma_buf_end_cpu_access(dmabuf, direction);
> > +		else
> > +			dma_buf_begin_cpu_access(dmabuf, direction);
> 
> We forgot to report the error back to userspace. Might as well fixup the
> callchain to propagate error from end-cpu-access as well. Found after
> updating igt/gem_concurrent_blit to exercise dmabuf mmaps vs the GPU.

EINTR? Do we need to make this ABI - I guess so? Tiago, do you have
patches? See drmIoctl() in libdrm for what's needed on the userspace side
if my guess is right.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux