Hash :
38c01008
Author :
Date :
2022-09-13T15:11:54
Vulkan: Fix a cornercase bug when dynamically loading AHB APIs. The commit 122a1cc583f0 enabled dynamic loading of AHB APIs but did not handle the cornercase where some Android system services load "libnativewindow.so" with the RTLD_LOCAL flag. In such cases AHB APIs would not be resolvable through dlsym lookup. Explicitly dlopen "libnativewindow.so" in such cases. Bug: angleproject:7656 Change-Id: Ie74140ad816b756e1afc325d370f26bcb09428ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3894658 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Peng Huang <penghuang@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef LIBANGLE_RENDERER_VULKAN_ANDROID_AHBFUNCTIONS_H_
#define LIBANGLE_RENDERER_VULKAN_ANDROID_AHBFUNCTIONS_H_
#include <android/hardware_buffer.h>
namespace rx
{
class AHBFunctions
{
public:
AHBFunctions();
~AHBFunctions();
void acquire(AHardwareBuffer *buffer) const { mAcquireFn(buffer); }
void describe(const AHardwareBuffer *buffer, AHardwareBuffer_Desc *outDesc) const
{
mDescribeFn(buffer, outDesc);
}
void release(AHardwareBuffer *buffer) const { mReleaseFn(buffer); }
bool valid() const { return mAcquireFn && mDescribeFn && mReleaseFn; }
private:
using PFN_AHARDWAREBUFFER_acquire = void (*)(AHardwareBuffer *buffer);
using PFN_AHARDWAREBUFFER_describe = void (*)(const AHardwareBuffer *buffer,
AHardwareBuffer_Desc *outDesc);
using PFN_AHARDWAREBUFFER_release = void (*)(AHardwareBuffer *buffer);
PFN_AHARDWAREBUFFER_acquire mAcquireFn = nullptr;
PFN_AHARDWAREBUFFER_describe mDescribeFn = nullptr;
PFN_AHARDWAREBUFFER_release mReleaseFn = nullptr;
void getAhbProcAddresses(void *handle);
void *mLibNativeWindowHandle;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_ANDROID_AHBFUNCTIONS_H_