In the case where process A is writing to the buffer, and process
B is reading from the buffer via a shadow buffer, we should update
the shadow buffer.
This issue seems to only pop on renderscript tests on Mediatek devices,
but that's due the various differences between 3D driver implementations.
Let's modify rockchip for correctness as well.
BUG=b:
69700010
TEST=run cts -m CtsViewTestCases -t android.view.cts.SurfaceViewSyncTests
passes on Oak
Change-Id: Id551027a2093f5423ee380d8935637d6256d2295
Reviewed-on: https://chromium-review.googlesource.com/795038
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
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);
vma->priv = priv;
addr = priv->cached_addr;
}
return munmap(vma->addr, vma->length);
}
+static int mediatek_bo_invalidate(struct bo *bo, struct mapping *mapping)
+{
+ if (mapping->vma->priv) {
+ struct mediatek_private_map_data *priv = mapping->vma->priv;
+ memcpy(priv->cached_addr, priv->gem_addr, bo->total_size);
+ }
+
+ return 0;
+}
+
static int mediatek_bo_flush(struct bo *bo, struct mapping *mapping)
{
struct mediatek_private_map_data *priv = mapping->vma->priv;
.bo_import = drv_prime_bo_import,
.bo_map = mediatek_bo_map,
.bo_unmap = mediatek_bo_unmap,
+ .bo_invalidate = mediatek_bo_invalidate,
.bo_flush = mediatek_bo_flush,
.resolve_format = mediatek_resolve_format,
};
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);
vma->priv = priv;
addr = priv->cached_addr;
}
return munmap(vma->addr, vma->length);
}
+static int rockchip_bo_invalidate(struct bo *bo, struct mapping *mapping)
+{
+ if (mapping->vma->priv) {
+ struct rockchip_private_map_data *priv = mapping->vma->priv;
+ memcpy(priv->cached_addr, priv->gem_addr, bo->total_size);
+ }
+
+ return 0;
+}
+
static int rockchip_bo_flush(struct bo *bo, struct mapping *mapping)
{
struct rockchip_private_map_data *priv = mapping->vma->priv;
.bo_import = drv_prime_bo_import,
.bo_map = rockchip_bo_map,
.bo_unmap = rockchip_bo_unmap,
+ .bo_invalidate = rockchip_bo_invalidate,
.bo_flush = rockchip_bo_flush,
.resolve_format = rockchip_resolve_format,
};