From: Tao Wu Date: Tue, 13 Mar 2018 01:07:43 +0000 (-0700) Subject: minigbm: virtio_gpu: set vma->length when mmap. X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-minigbm.git;a=commitdiff_plain;h=3381588d35f78e1c1d3f3fac3927f3cde9462e66 minigbm: virtio_gpu: set vma->length when mmap. Othewise bo_unmap won't work. Also add a ifdef guard for PAGE_SIZE to make it also compile under ARC++. BUG=b:70179880 TEST=Run /usr/local/autotest/bin/screenshot.py with qemu+virgl TEST=Run Android App under ARC++ with qemu+virgl Change-Id: I586446c56da091dd82d9bc9c1010d9b4ee4d92ee Reviewed-on: https://chromium-review.googlesource.com/959527 Commit-Ready: Lepton Wu Tested-by: Lepton Wu Reviewed-by: Gurchetan Singh --- diff --git a/virtio_virgl.c b/virtio_virgl.c index b33677b..d5429bd 100644 --- a/virtio_virgl.c +++ b/virtio_virgl.c @@ -19,7 +19,9 @@ #include "util.h" #include "virgl_hw.h" +#ifndef PAGE_SIZE #define PAGE_SIZE 0x1000 +#endif #define PIPE_TEXTURE_2D 2 static const uint32_t render_target_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888, @@ -139,6 +141,7 @@ static void *virgl_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t return MAP_FAILED; } + vma->length = bo->total_size; return mmap(0, bo->total_size, drv_get_prot(map_flags), MAP_SHARED, bo->drv->fd, gem_map.offset); }