minigbm: add (*bo_flush) implementations
Let's take the flush and writeback steps in the driver unmap
functions and move them to the (*bo_flush) callback.
BUG=chromium:764871
TEST=gbmtest, mmap_test -g on eve
Change-Id: Iecccafc25642b120bc84f2d1b8538303c8ce36eb
Reviewed-on: https://chromium-review.googlesource.com/668219
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
diff --git a/mediatek.c b/mediatek.c
index a4879d9..46c37b3 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -113,7 +113,6 @@
{
if (data->priv) {
struct mediatek_private_map_data *priv = data->priv;
- memcpy(priv->gem_addr, priv->cached_addr, bo->total_size);
data->addr = priv->gem_addr;
free(priv->cached_addr);
free(priv);
@@ -123,6 +122,16 @@
return munmap(data->addr, data->length);
}
+static int mediatek_bo_flush(struct bo *bo, struct map_info *data)
+{
+ struct mediatek_private_map_data *priv = data->priv;
+
+ if (priv)
+ memcpy(priv->gem_addr, priv->cached_addr, bo->total_size);
+
+ return 0;
+}
+
static uint32_t mediatek_resolve_format(uint32_t format, uint64_t usage)
{
switch (format) {
@@ -144,6 +153,7 @@
.bo_import = drv_prime_bo_import,
.bo_map = mediatek_bo_map,
.bo_unmap = mediatek_bo_unmap,
+ .bo_flush = mediatek_bo_flush,
.resolve_format = mediatek_resolve_format,
};