summaryrefslogtreecommitdiffstats
path: root/cros_gralloc/gralloc0
diff options
context:
space:
mode:
authorJason Macnak <natsu@google.com>2020-09-18 09:07:51 -0700
committerJason Macnak <natsu@google.com>2020-09-18 09:07:51 -0700
commit910da248a7f7fef7414b59b9cb40c0b32d553faf (patch)
treeaf9157508f1a68e3b23614c14a347bd6036ec7e8 /cros_gralloc/gralloc0
parent56e3e9014e4e65864efd6eb62ad7b2755735eee8 (diff)
parentb42624c3e6a943b2a10a3623f9a30719289a57b8 (diff)
downloadplatform_external_minigbm-910da248a7f7fef7414b59b9cb40c0b32d553faf.tar.gz
platform_external_minigbm-910da248a7f7fef7414b59b9cb40c0b32d553faf.tar.bz2
platform_external_minigbm-910da248a7f7fef7414b59b9cb40c0b32d553faf.zip
Merge remote-tracking branch 'aosp/upstream-master' into HEAD
... to update Minigbm for Cuttlefish to have Gralloc3 and Gralloc4 support. Bug: b/161909468 Test: launch_cvd Merged-In: I27f020b4f661890bcc2817deb09ffb9af1c76f1b Change-Id: I11e31543d3298c2cac67d80e77058d7cd95907db
Diffstat (limited to 'cros_gralloc/gralloc0')
-rw-r--r--cros_gralloc/gralloc0/gralloc0.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/cros_gralloc/gralloc0/gralloc0.cc b/cros_gralloc/gralloc0/gralloc0.cc
index 170dae9..b0fe945 100644
--- a/cros_gralloc/gralloc0/gralloc0.cc
+++ b/cros_gralloc/gralloc0/gralloc0.cc
@@ -19,6 +19,15 @@ struct gralloc0_module {
std::mutex initialization_mutex;
};
+struct cros_gralloc0_buffer_info {
+ uint32_t drm_fourcc;
+ int num_fds;
+ int fds[4];
+ uint64_t modifier;
+ uint32_t offset[4];
+ uint32_t stride[4];
+};
+
/* This enumeration must match the one in <gralloc_drm.h>.
* The functions supported by this gralloc's temporary private API are listed
* below. Use of these functions is highly discouraged and should only be
@@ -31,6 +40,7 @@ enum {
GRALLOC_DRM_GET_FORMAT,
GRALLOC_DRM_GET_DIMENSIONS,
GRALLOC_DRM_GET_BACKING_STORE,
+ GRALLOC_DRM_GET_BUFFER_INFO,
};
// clang-format on
@@ -265,6 +275,7 @@ static int gralloc0_perform(struct gralloc_module_t const *module, int op, ...)
uint32_t *out_width, *out_height, *out_stride;
uint32_t strides[DRV_MAX_PLANES] = { 0, 0, 0, 0 };
uint32_t offsets[DRV_MAX_PLANES] = { 0, 0, 0, 0 };
+ struct cros_gralloc0_buffer_info *info;
auto mod = (struct gralloc0_module const *)module;
switch (op) {
@@ -272,6 +283,7 @@ static int gralloc0_perform(struct gralloc_module_t const *module, int op, ...)
case GRALLOC_DRM_GET_FORMAT:
case GRALLOC_DRM_GET_DIMENSIONS:
case GRALLOC_DRM_GET_BACKING_STORE:
+ case GRALLOC_DRM_GET_BUFFER_INFO:
break;
default:
return -EINVAL;
@@ -316,6 +328,17 @@ static int gralloc0_perform(struct gralloc_module_t const *module, int op, ...)
out_store = va_arg(args, uint64_t *);
ret = mod->driver->get_backing_store(handle, out_store);
break;
+ case GRALLOC_DRM_GET_BUFFER_INFO:
+ info = va_arg(args, struct cros_gralloc0_buffer_info *);
+ info->drm_fourcc = hnd->format;
+ info->num_fds = hnd->num_planes;
+ info->modifier = hnd->format_modifier;
+ for (uint32_t i = 0; i < hnd->num_planes; i++) {
+ info->fds[i] = hnd->fds[i];
+ info->offset[i] = hnd->offsets[i];
+ info->stride[i] = hnd->strides[i];
+ }
+ break;
default:
ret = -EINVAL;
}