tegra: Fix mmap() of GEM buffer objects

Store 64-bit offset values and use libdrm's built-in drm_mmap() function
instead of mmap() to ensure the full 64-bit offset is used.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
main
Thierry Reding 2021-07-09 20:05:54 +02:00
parent e44e781603
commit 1842707183
2 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ struct drm_tegra {
struct drm_tegra_bo { struct drm_tegra_bo {
struct drm_tegra *drm; struct drm_tegra *drm;
uint32_t handle; uint32_t handle;
uint32_t offset; uint64_t offset;
uint32_t flags; uint32_t flags;
uint32_t size; uint32_t size;
atomic_t ref; atomic_t ref;

View File

@ -211,7 +211,7 @@ drm_public int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
bo->offset = args.offset; bo->offset = args.offset;
bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->map = drm_mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
drm->fd, bo->offset); drm->fd, bo->offset);
if (bo->map == MAP_FAILED) { if (bo->map == MAP_FAILED) {
bo->map = NULL; bo->map = NULL;