[PATCH 1/7] prime_mmap: Add new test for calling mmap() on dma-buf fds

Daniel Vetter daniel at ffwll.ch
Tue Aug 25 00:46:15 PDT 2015


On Fri, Aug 14, 2015 at 07:17:05PM -0300, Tiago Vignatti wrote:
> Hi Daniel,
> 
> On 08/13/2015 04:04 AM, Daniel Vetter wrote:
> >On Wed, Aug 12, 2015 at 08:29:14PM -0300, Tiago Vignatti wrote:
> >>+	/* Map too big */
> >>+	handle = gem_create(fd, BO_SIZE);
> >>+	fill_bo(handle, BO_SIZE);
> >>+	dma_buf_fd = prime_handle_to_fd(fd, handle);
> >>+	igt_assert(errno == 0);
> >>+	ptr = mmap(NULL, BO_SIZE * 2, PROT_READ, MAP_SHARED, dma_buf_fd, 0);
> >>+	igt_assert(ptr == MAP_FAILED && errno == EINVAL);
> >>+	errno = 0;
> >>+	close(dma_buf_fd);
> >>+	gem_close(fd, handle);
> >
> >That only checks for one of the conditions, trying to map something
> >offset/overlapping the end of the buffer, but small enough needs to be
> >tested separately.
> 
> you mean test for smaller length with a non-zero offset? I don't think I get
> what you wanted to say here maybe.

Atm you test size=2*bo_size, offset=0. I also want to test size=bo_size,
offset=bo_size/2 since there seems to be a bug for that case in your code.

> >Also I think a testcase for invalid buffer2fd flags would be good, just
> >for completeness - we seem to be missing that one.
> 
> you mean test for different flags than the ones supported by
> DRM_IOCTL_PRIME_HANDLE_TO_FD?

Yup, just the normal "fill in missing coverage" we do when extending an
existing interface.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list