minigbm: More sophisticated gbm_bo_map/gbm_bo_unmap
We previously added the gbm_bo_map/gbm_bo_unmap (see CL:393927)
entry points since we wanted to do driver-specific detiling during
screenshot capture tests. We ignored most the parameters and mapped
the entire buffer. This CL adds the ability to:
1) Return the starting address within a byte given a specific x, y
in the buffer.
2) Handle the case where there are more than one kernel buffers
per buffer object. Currently, only the Exynos driver would use
this capability.
BUG=chromium:653284
TEST=Ran cros_gralloc with modified code
CQ-DEPEND=CL:393927
Change-Id: I19d75d2f16489c0184e96305fb643f18477e1cdb
Reviewed-on: https://chromium-review.googlesource.com/395066
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/drv_priv.h b/drv_priv.h
index 53b8da6..67376b9 100644
--- a/drv_priv.h
+++ b/drv_priv.h
@@ -28,7 +28,6 @@
uint64_t format_modifiers[DRV_MAX_PLANES];
size_t total_size;
void *priv;
- void *map_data;
};
struct driver {
@@ -36,9 +35,17 @@
struct backend *backend;
void *priv;
void *buffer_table;
+ void *map_table;
pthread_mutex_t table_lock;
};
+struct map_info {
+ void *addr;
+ size_t length;
+ uint32_t handle;
+ int32_t refcount;
+};
+
struct backend
{
char *name;
@@ -46,7 +53,7 @@
void (*close)(struct driver *drv);
int (*bo_create)(struct bo *bo, uint32_t width, uint32_t height,
drv_format_t format, uint32_t flags);
- void* (*bo_map)(struct bo *bo);
+ void* (*bo_map)(struct bo *bo, struct map_info *data, size_t plane);
int (*bo_destroy)(struct bo *bo);
drv_format_t (*resolve_format)(drv_format_t format);
struct format_supported {