diff options
Diffstat (limited to 'bufferinfo/legacy/BufferInfoMaliMeson.cpp')
-rw-r--r-- | bufferinfo/legacy/BufferInfoMaliMeson.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/bufferinfo/legacy/BufferInfoMaliMeson.cpp b/bufferinfo/legacy/BufferInfoMaliMeson.cpp index 9daf542..8160296 100644 --- a/bufferinfo/legacy/BufferInfoMaliMeson.cpp +++ b/bufferinfo/legacy/BufferInfoMaliMeson.cpp @@ -61,32 +61,32 @@ uint64_t BufferInfoMaliMeson::ConvertGrallocFormatToDrmModifiers( } #endif -int BufferInfoMaliMeson::ConvertBoInfo(buffer_handle_t handle, - hwc_drm_bo_t *bo) { +auto BufferInfoMaliMeson::GetBoInfo(buffer_handle_t handle) + -> std::optional<BufferInfo> { const auto *hnd = (private_handle_t const *)handle; if (!hnd) - return -EINVAL; + return {}; if (!(hnd->usage & GRALLOC_USAGE_HW_FB)) - return -EINVAL; + return {}; uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format); if (fmt == DRM_FORMAT_INVALID) - return -EINVAL; + return {}; - bo->modifiers[0] = BufferInfoMaliMeson::ConvertGrallocFormatToDrmModifiers( + BufferInfo bi{}; + + bi.modifiers[0] = BufferInfoMaliMeson::ConvertGrallocFormatToDrmModifiers( hnd->internal_format); - bo->width = hnd->width; - bo->height = hnd->height; - bo->hal_format = hnd->req_format; - bo->format = fmt; - bo->usage = hnd->usage; - bo->prime_fds[0] = hnd->share_fd; - bo->pitches[0] = hnd->byte_stride; - bo->offsets[0] = 0; + bi.width = hnd->width; + bi.height = hnd->height; + bi.format = fmt; + bi.prime_fds[0] = hnd->share_fd; + bi.pitches[0] = hnd->byte_stride; + bi.offsets[0] = 0; - return 0; + return bi; } } // namespace android |