diff options
author | Gurchetan Singh <gurchetansingh@chromium.org> | 2017-10-05 14:52:24 -0700 |
---|---|---|
committer | Gurchetan Singh <gurchetansingh@chromium.org> | 2017-10-13 16:17:33 +0000 |
commit | e29a640dd6f26d50e29cabac2611bd97841c2101 (patch) | |
tree | 53ca8bbb8ce359547fe77bbed9b9dd351a5c8c9f | |
parent | b57dffc6187a6bf810a36d491f0a0ddeade0d405 (diff) |
minigbm: respect map_flags in all cases
When the map flags do not feature BO_TRANSFER_WRITE, we should
not copy back any shadow buffers we maintain.
BUG=b:67434931
TEST=android.view.cts.SurfaceViewSyncTests on Mediatek/Rockchip
Change-Id: I7078bfc5a8d770a52949d43ea68efc4a870e9227
Reviewed-on: https://chromium-review.googlesource.com/703875
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
-rw-r--r-- | drv.c | 3 | ||||
-rw-r--r-- | drv.h | 1 | ||||
-rw-r--r-- | mediatek.c | 2 | ||||
-rw-r--r-- | rockchip.c | 2 | ||||
-rw-r--r-- | tegra.c | 4 |
5 files changed, 7 insertions, 5 deletions
@@ -401,6 +401,8 @@ void *drv_bo_map(struct bo *bo, uint32_t x, uint32_t y, uint32_t width, uint32_t if (!drmHashLookup(bo->drv->map_table, bo->handles[plane].u32, &ptr)) { data = (struct map_info *)ptr; + /* TODO(gsingh): support mapping same buffer with different flags. */ + assert(data->map_flags == map_flags); data->refcount++; goto success; } @@ -417,6 +419,7 @@ void *drv_bo_map(struct bo *bo, uint32_t x, uint32_t y, uint32_t width, uint32_t data->refcount = 1; data->addr = addr; data->handle = bo->handles[plane].u32; + data->map_flags = map_flags; drmHashInsert(bo->drv->map_table, bo->handles[plane].u32, (void *)data); success: @@ -82,6 +82,7 @@ struct map_info { void *addr; size_t length; uint32_t handle; + uint32_t map_flags; int32_t refcount; void *priv; }; @@ -126,7 +126,7 @@ static int mediatek_bo_unmap(struct bo *bo, struct map_info *data) static int mediatek_bo_flush(struct bo *bo, struct map_info *data) { struct mediatek_private_map_data *priv = data->priv; - if (priv) + if (priv && (data->map_flags & BO_MAP_WRITE)) memcpy(priv->gem_addr, priv->cached_addr, bo->total_size); return 0; @@ -292,7 +292,7 @@ static int rockchip_bo_unmap(struct bo *bo, struct map_info *data) static int rockchip_bo_flush(struct bo *bo, struct map_info *data) { struct rockchip_private_map_data *priv = data->priv; - if (priv) + if (priv && (data->map_flags & BO_MAP_WRITE)) memcpy(priv->gem_addr, priv->cached_addr, bo->total_size); return 0; @@ -44,7 +44,6 @@ enum tegra_map_type { struct tegra_private_map_data { void *tiled; void *untiled; - uint32_t map_flags; }; static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 }; @@ -323,7 +322,6 @@ static void *tegra_bo_map(struct bo *bo, struct map_info *data, size_t plane, ui priv = calloc(1, sizeof(*priv)); priv->untiled = calloc(1, bo->total_size); priv->tiled = addr; - priv->map_flags = map_flags; data->priv = priv; transfer_tiled_memory(bo, priv->tiled, priv->untiled, TEGRA_READ_TILED_BUFFER); addr = priv->untiled; @@ -349,7 +347,7 @@ static int tegra_bo_flush(struct bo *bo, struct map_info *data) { struct tegra_private_map_data *priv = data->priv; - if (priv && (priv->map_flags & BO_MAP_WRITE)) + if (priv && (data->map_flags & BO_MAP_WRITE)) transfer_tiled_memory(bo, priv->tiled, priv->untiled, TEGRA_WRITE_TILED_BUFFER); return 0; |