aboutsummaryrefslogtreecommitdiff
path: root/bufferinfo/legacy/BufferInfoImagination.cpp
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:08:05 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:08:05 +0000
commitdc8559eade3cae25703b70f6e93417ff368b2c14 (patch)
tree0be8b55408ec891b7c275a1eb9e4f0310702b339 /bufferinfo/legacy/BufferInfoImagination.cpp
parent1d29a2e82fad8d0f4d00e62cbac070995ae40a43 (diff)
parent39e9dc65f3a608c85124d4014b07ede70680f18b (diff)
downloaddrm_hwcomposer-android14-mainline-sdkext-release.tar.gz
Change-Id: If430f272132aef6c1f7508bff477d243782cc7d2
Diffstat (limited to 'bufferinfo/legacy/BufferInfoImagination.cpp')
-rw-r--r--bufferinfo/legacy/BufferInfoImagination.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/bufferinfo/legacy/BufferInfoImagination.cpp b/bufferinfo/legacy/BufferInfoImagination.cpp
index 691dd14..6d917c2 100644
--- a/bufferinfo/legacy/BufferInfoImagination.cpp
+++ b/bufferinfo/legacy/BufferInfoImagination.cpp
@@ -29,40 +29,40 @@ namespace android {
LEGACY_BUFFER_INFO_GETTER(BufferInfoImagination);
-int BufferInfoImagination::ConvertBoInfo(buffer_handle_t handle,
- hwc_drm_bo_t *bo) {
+auto BufferInfoImagination::GetBoInfo(buffer_handle_t handle)
+ -> std::optional<BufferInfo> {
auto *hnd = (IMG_native_handle_t *)handle;
if (!hnd)
- return -EINVAL;
+ return {};
/* Extra bits are responsible for buffer compression and memory layout */
if (hnd->iFormat & ~0x10f) {
ALOGV("Special buffer formats are not supported");
- return -EINVAL;
+ return {};
}
- bo->width = hnd->iWidth;
- bo->height = hnd->iHeight;
- bo->usage = hnd->usage;
- bo->prime_fds[0] = hnd->fd[0];
- bo->pitches[0] = ALIGN(hnd->iWidth, HW_ALIGN) * hnd->uiBpp >> 3;
- bo->hal_format = hnd->iFormat;
+ BufferInfo bi{};
+
+ bi.width = hnd->iWidth;
+ bi.height = hnd->iHeight;
+ bi.prime_fds[0] = hnd->fd[0];
+ bi.pitches[0] = ALIGN(hnd->iWidth, HW_ALIGN) * hnd->uiBpp >> 3;
switch (hnd->iFormat) {
#ifdef HAL_PIXEL_FORMAT_BGRX_8888
case HAL_PIXEL_FORMAT_BGRX_8888:
- bo->format = DRM_FORMAT_XRGB8888;
+ bi.format = DRM_FORMAT_XRGB8888;
break;
#endif
default:
- bo->format = ConvertHalFormatToDrm(hnd->iFormat & 0xf);
- if (bo->format == DRM_FORMAT_INVALID) {
+ bi.format = ConvertHalFormatToDrm(hnd->iFormat & 0xf);
+ if (bi.format == DRM_FORMAT_INVALID) {
ALOGV("Cannot convert hal format to drm format %u", hnd->iFormat);
- return -EINVAL;
+ return {};
}
}
- return 0;
+ return bi;
}
} // namespace android