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

Tiago Vignatti tiago.vignatti at intel.com
Fri Aug 14 15:17:05 PDT 2015


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.

> 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?

Tiago


More information about the dri-devel mailing list