mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-22 07:16:14 +00:00
lib: Add helper kmstest_dumb_map_buffer
Which basically just calls DRM_IOCTL_MODE_MAP_DUMB and is similar to gem_mmap__gtt(). Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
dc84e7d6ad
commit
fb66a5df93
@ -462,6 +462,22 @@ uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp,
|
||||
return create.handle;
|
||||
}
|
||||
|
||||
void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
|
||||
unsigned prot)
|
||||
{
|
||||
struct drm_mode_map_dumb arg = {};
|
||||
void *ptr;
|
||||
|
||||
arg.handle = handle;
|
||||
|
||||
do_ioctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
|
||||
|
||||
ptr = mmap(NULL, size, prot, MAP_SHARED, fd, arg.offset);
|
||||
igt_assert(ptr != MAP_FAILED);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was
|
||||
* found and nothing was done.
|
||||
|
@ -178,6 +178,9 @@ uint32_t kmstest_find_crtc_for_connector(int fd, drmModeRes *res,
|
||||
uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp,
|
||||
unsigned *stride, unsigned *size);
|
||||
|
||||
void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
|
||||
unsigned prot);
|
||||
|
||||
/*
|
||||
* A small modeset API
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user