summaryrefslogtreecommitdiff
path: root/mediatek.c
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2017-09-14 14:18:43 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-27 23:52:08 -0700
commit8e02e05537eab60fc39e2c660d41e43be2ac522b (patch)
tree512b5e6ba669461943547858f8a0ce63e6ce6060 /mediatek.c
parentff7414151e34a82fc290f79168553d01f5e654eb (diff)
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>
Diffstat (limited to 'mediatek.c')
-rw-r--r--mediatek.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mediatek.c b/mediatek.c
index a4879d9..46c37b3 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -113,7 +113,6 @@ static int mediatek_bo_unmap(struct bo *bo, struct map_info *data)
{
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 @@ static int mediatek_bo_unmap(struct bo *bo, struct map_info *data)
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 @@ struct backend backend_mediatek = {
.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,
};