goldfish: handle null handle

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
Bo Hu
2024-03-21 13:42:25 -07:00
committed by Marge Bot
parent 677b398ea4
commit 2f958ad3f8
@@ -44,7 +44,14 @@ void GoldfishGralloc::acquire(AHardwareBuffer* ahb) { AHardwareBuffer_acquire(ah
void GoldfishGralloc::release(AHardwareBuffer* ahb) { AHardwareBuffer_release(ahb); }
uint32_t GoldfishGralloc::getHostHandle(native_handle_t const* handle) {
return cb_handle_t::from(handle)->hostHandle;
const uint32_t INVALID_HOST_HANDLE = 0;
const cb_handle_t* cb = cb_handle_t::from(handle);
if (cb) {
return cb->hostHandle;
} else {
return INVALID_HOST_HANDLE;
}
}
uint32_t GoldfishGralloc::getHostHandle(const AHardwareBuffer* ahb) {