aboutsummaryrefslogtreecommitdiff
path: root/bufferinfo/legacy/BufferInfoImagination.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bufferinfo/legacy/BufferInfoImagination.cpp')
-rw-r--r--bufferinfo/legacy/BufferInfoImagination.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/bufferinfo/legacy/BufferInfoImagination.cpp b/bufferinfo/legacy/BufferInfoImagination.cpp
index 691dd14..1858ddb 100644
--- a/bufferinfo/legacy/BufferInfoImagination.cpp
+++ b/bufferinfo/legacy/BufferInfoImagination.cpp
@@ -29,24 +29,24 @@ 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
@@ -55,14 +55,14 @@ int BufferInfoImagination::ConvertBoInfo(buffer_handle_t handle,
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