summaryrefslogtreecommitdiff
path: root/mediatek.c
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2017-11-14 18:20:27 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-16 10:46:57 -0800
commitee43c301c21976fb82538261c4e4288ffc754777 (patch)
treeccf45cdc8da5ecb926333e659f68930f39063942 /mediatek.c
parentcfedbcc8d475fca39ac0a0d4bc6e4881937e2875 (diff)
minigbm: use struct vma for (*bo_map)/(*bo_unmap) callbacks
This sets better expectations for what we expect from the backends. BUG=chromium:764871 TEST=mmap_test Change-Id: I7fb815b58fae8e9fbd73bf7c0263c7db44488844 Reviewed-on: https://chromium-review.googlesource.com/770519 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Joe Kniss <djmk@google.com> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Diffstat (limited to 'mediatek.c')
-rw-r--r--mediatek.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mediatek.c b/mediatek.c
index 33f57fd..ebc000f 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -78,8 +78,7 @@ static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height, ui
return 0;
}
-static void *mediatek_bo_map(struct bo *bo, struct mapping *mapping, size_t plane,
- uint32_t map_flags)
+static void *mediatek_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
{
int ret;
struct drm_mtk_gem_map_off gem_map;
@@ -97,31 +96,31 @@ static void *mediatek_bo_map(struct bo *bo, struct mapping *mapping, size_t plan
void *addr = mmap(0, bo->total_size, drv_get_prot(map_flags), MAP_SHARED, bo->drv->fd,
gem_map.offset);
- mapping->vma->length = bo->total_size;
+ vma->length = bo->total_size;
if (bo->use_flags & BO_USE_RENDERSCRIPT) {
priv = calloc(1, sizeof(*priv));
priv->cached_addr = calloc(1, bo->total_size);
priv->gem_addr = addr;
memcpy(priv->cached_addr, priv->gem_addr, bo->total_size);
- mapping->vma->priv = priv;
+ vma->priv = priv;
addr = priv->cached_addr;
}
return addr;
}
-static int mediatek_bo_unmap(struct bo *bo, struct mapping *mapping)
+static int mediatek_bo_unmap(struct bo *bo, struct vma *vma)
{
- if (mapping->vma->priv) {
- struct mediatek_private_map_data *priv = mapping->vma->priv;
- mapping->vma->addr = priv->gem_addr;
+ if (vma->priv) {
+ struct mediatek_private_map_data *priv = vma->priv;
+ vma->addr = priv->gem_addr;
free(priv->cached_addr);
free(priv);
- mapping->vma->priv = NULL;
+ vma->priv = NULL;
}
- return munmap(mapping->vma->addr, mapping->vma->length);
+ return munmap(vma->addr, vma->length);
}
static int mediatek_bo_flush(struct bo *bo, struct mapping *mapping)