diff options
author | Tiago Vignatti <tiago.vignatti@intel.com> | 2015-07-29 18:26:29 -0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-02-11 18:15:59 +0100 |
commit | 4edfa09ae4c184177389e339c57d090914936421 (patch) | |
tree | 84a37af7ed3a6e752536f6e31e5865c10db17638 /lib/ioctl_wrappers.h | |
parent | e0efeb97a970fbbd5adaeef472bf9f78777c6cb4 (diff) |
prime_mmap: Add basic tests to write in a bo using CPU
This patch adds test_correct_cpu_write, which maps the texture buffer through a
prime fd and then writes directly to it using the CPU. It stresses the driver
to guarantee cache synchronization among the different domains.
This test also adds test_forked_cpu_write, which creates the GEM bo in one
process and pass the prime handle of the it to another process, which in turn
uses the handle only to map and write. Roughly speaking this test simulates
Chrome OS architecture, where the Web content ("unpriviledged process") maps
and CPU-draws a buffer, which was previously allocated in the GPU process
("priviledged process").
This requires kernel modifications (Daniel Thompson's "drm: prime: Honour
O_RDWR during prime-handle-to-fd") and therefore prime_handle_to_fd_for_mmap is
added to fail in case these lack. Also, upcoming tests (e.g. next patch) are
going to use it as well, so make it public and available in the lib.
v2: adds prime_handle_to_fd_with_mmap for skipping test in older kernels and
test for invalid flags.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'lib/ioctl_wrappers.h')
-rw-r--r-- | lib/ioctl_wrappers.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index b9a4db6b..57e0a00b 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -154,6 +154,10 @@ void gem_require_ring(int fd, int ring_id); /* prime */ int prime_handle_to_fd(int fd, uint32_t handle); +#ifndef DRM_RDWR +#define DRM_RDWR O_RDWR +#endif +int prime_handle_to_fd_for_mmap(int fd, uint32_t handle); uint32_t prime_fd_to_handle(int fd, int dma_buf_fd); off_t prime_get_size(int dma_buf_fd); |