aboutsummaryrefslogtreecommitdiff
path: root/bufferinfo/legacy/BufferInfoMinigbm.cpp
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 04:53:59 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 04:53:59 +0000
commitceb1a518a92a668ddfc19af999e6202f219c2677 (patch)
tree0be8b55408ec891b7c275a1eb9e4f0310702b339 /bufferinfo/legacy/BufferInfoMinigbm.cpp
parentc2930d1f02a2c27acaeadf8703b4e4045b9247d1 (diff)
parent39e9dc65f3a608c85124d4014b07ede70680f18b (diff)
downloaddrm_hwcomposer-android14-mainline-mediaprovider-release.tar.gz
Change-Id: I184e2678931887b1f15230b421c704f85e1f5933
Diffstat (limited to 'bufferinfo/legacy/BufferInfoMinigbm.cpp')
-rw-r--r--bufferinfo/legacy/BufferInfoMinigbm.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/bufferinfo/legacy/BufferInfoMinigbm.cpp b/bufferinfo/legacy/BufferInfoMinigbm.cpp
index 777c2b7..c5a9e98 100644
--- a/bufferinfo/legacy/BufferInfoMinigbm.cpp
+++ b/bufferinfo/legacy/BufferInfoMinigbm.cpp
@@ -43,11 +43,14 @@ struct cros_gralloc0_buffer_info {
int stride[4];
};
-int BufferInfoMinigbm::ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
+auto BufferInfoMinigbm::GetBoInfo(buffer_handle_t handle)
+ -> std::optional<BufferInfo> {
if (handle == nullptr) {
- return -EINVAL;
+ return {};
}
+ BufferInfo bi{};
+
uint32_t width{};
uint32_t height{};
if (gralloc_->perform(gralloc_, CROS_GRALLOC_DRM_GET_DIMENSIONS, handle,
@@ -55,7 +58,7 @@ int BufferInfoMinigbm::ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
ALOGE(
"CROS_GRALLOC_DRM_GET_DIMENSIONS operation has failed. "
"Please ensure you are using the latest minigbm.");
- return -EINVAL;
+ return {};
}
int32_t droid_format{};
@@ -64,7 +67,7 @@ int BufferInfoMinigbm::ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
ALOGE(
"CROS_GRALLOC_DRM_GET_FORMAT operation has failed. "
"Please ensure you are using the latest minigbm.");
- return -EINVAL;
+ return {};
}
uint32_t usage{};
@@ -73,7 +76,7 @@ int BufferInfoMinigbm::ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
ALOGE(
"CROS_GRALLOC_DRM_GET_USAGE operation has failed. "
"Please ensure you are using the latest minigbm.");
- return -EINVAL;
+ return {};
}
struct cros_gralloc0_buffer_info info {};
@@ -82,25 +85,22 @@ int BufferInfoMinigbm::ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
ALOGE(
"CROS_GRALLOC_DRM_GET_BUFFER_INFO operation has failed. "
"Please ensure you are using the latest minigbm.");
- return -EINVAL;
+ return {};
}
- bo->width = width;
- bo->height = height;
+ bi.width = width;
+ bi.height = height;
- bo->hal_format = droid_format;
-
- bo->format = info.drm_fourcc;
- bo->usage = usage;
+ bi.format = info.drm_fourcc;
for (int i = 0; i < info.num_fds; i++) {
- bo->modifiers[i] = info.modifier;
- bo->prime_fds[i] = info.fds[i];
- bo->pitches[i] = info.stride[i];
- bo->offsets[i] = info.offset[i];
+ bi.modifiers[i] = info.modifier;
+ bi.prime_fds[i] = info.fds[i];
+ bi.pitches[i] = info.stride[i];
+ bi.offsets[i] = info.offset[i];
}
- return 0;
+ return bi;
}
constexpr char cros_gralloc_module_name[] = "CrOS Gralloc";