mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
igt: Add a helper function for mapping VC4 BOs.
v2: Use do_ioctl(). Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
4880e13d04
commit
b8badc2436
@ -25,6 +25,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -101,3 +102,20 @@ uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval)
|
|||||||
|
|
||||||
return create.handle;
|
return create.handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot)
|
||||||
|
{
|
||||||
|
struct drm_vc4_mmap_bo mmap_bo = {
|
||||||
|
.handle = handle,
|
||||||
|
};
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
|
do_ioctl(fd, DRM_IOCTL_VC4_MMAP_BO, &mmap_bo);
|
||||||
|
|
||||||
|
ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_bo.offset);
|
||||||
|
if (ptr == MAP_FAILED)
|
||||||
|
return NULL;
|
||||||
|
else
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
@ -25,5 +25,6 @@
|
|||||||
#define IGT_VC4_H
|
#define IGT_VC4_H
|
||||||
|
|
||||||
uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval);
|
uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval);
|
||||||
|
void *igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
|
||||||
|
|
||||||
#endif /* IGT_VC4_H */
|
#endif /* IGT_VC4_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user