summaryrefslogtreecommitdiff
path: root/drv.h
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2017-11-06 11:07:52 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-16 13:52:02 -0800
commit1ef809ecd434bfc0fd1d669ba925d58b1255d163 (patch)
tree2021d33b377ae8aec16d1eee63854ab24f24954b /drv.h
parentee43c301c21976fb82538261c4e4288ffc754777 (diff)
minigbm: plumb buffer access region
This will allow drivers to tile or detile only the regions requested by the user. Note that the gralloc spec states that: "This address will represent the top-left corner of the entire buffer, even if accessRegion does not begin at the top-left corner." (see hardware/interfaces/graphics/mapper/2.0/IMapper.hal in AOSP) Also, the gralloc API makes it difficult to maintain two mappings of the same buffer. For example, say you have two access regions: module->lock(mod, handle1, 0, 0, 5, 5, &addr); module->lock(mod, handle1, 5, 5, 10, 10, &addr); module->unlock(mod, handle1); // which access region should be unlocked? In practice, this scenario never happens on Android. It's not exactly clear what gbm should return. Let's just return the top left of the access region because that's what we where doing before. BUG=chromium:764871 TEST=gbmtest, mmap_test -g, the following CTS tests: android.view.cts.SurfaceViewSyncTests android.media.cts.EncodeDecodeTest android.video.cts.VideoEncoderDecoderTest Change-Id: I7ca0713871e03928b1d4402aa161588990c7e775 Reviewed-on: https://chromium-review.googlesource.com/758147 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 'drv.h')
-rw-r--r--drv.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/drv.h b/drv.h
index bfde327..18653e5 100644
--- a/drv.h
+++ b/drv.h
@@ -87,8 +87,17 @@ struct vma {
void *priv;
};
+struct rectangle {
+ uint32_t x;
+ uint32_t y;
+ uint32_t width;
+ uint32_t height;
+};
+
struct mapping {
struct vma *vma;
+ struct rectangle rect;
+ uint32_t refcount;
};
struct driver *drv_create(int fd);
@@ -114,8 +123,8 @@ void drv_bo_destroy(struct bo *bo);
struct bo *drv_bo_import(struct driver *drv, struct drv_import_fd_data *data);
-void *drv_bo_map(struct bo *bo, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- uint32_t map_flags, struct mapping **map_data, size_t plane);
+void *drv_bo_map(struct bo *bo, const struct rectangle *rect, uint32_t map_flags,
+ struct mapping **map_data, size_t plane);
int drv_bo_unmap(struct bo *bo, struct mapping *mapping);
@@ -147,6 +156,8 @@ uint32_t drv_bo_get_format(struct bo *bo);
uint32_t drv_bo_get_stride_in_pixels(struct bo *bo);
+uint32_t drv_stride_from_format(uint32_t format, uint32_t width, size_t plane);
+
uint32_t drv_resolve_format(struct driver *drv, uint32_t format, uint64_t use_flags);
size_t drv_num_planes_from_format(uint32_t format);