graphics: improve preloading for IMapper default impl

When GraphicBufferMapper::preloadHal dlopens the default impl, make sure
the gralloc module is also dlopen'ed.

Bug: 269664560
Test: android.view.cts.PixelCopyTest#testVideoProducer on grunt

Change-Id: I57418338d5212fb9a2c1ea82eba63d855f69ff32
This commit is contained in:
Chia-I Wu
2023-02-27 14:19:12 -08:00
parent 657934eebb
commit 6d189b71a2
2 changed files with 16 additions and 0 deletions

View File

@@ -19,6 +19,14 @@
using android::hardware::graphics::mapper::V2_0::IMapper;
using android::hardware::graphics::mapper::V2_0::passthrough::GrallocLoader;
// Preload the gralloc module such that GraphicBufferMapper::preloadHal is
// meaningful
class GrallocPreloader {
public:
GrallocPreloader() { GrallocLoader::loadModule(); }
};
static GrallocPreloader sGrallocPreloader;
extern "C" IMapper* HIDL_FETCH_IMapper(const char* /*name*/) {
return GrallocLoader::load();
}

View File

@@ -19,6 +19,14 @@
using android::hardware::graphics::mapper::V2_1::IMapper;
using android::hardware::graphics::mapper::V2_1::passthrough::GrallocLoader;
// Preload the gralloc module such that GraphicBufferMapper::preloadHal is
// meaningful
class GrallocPreloader {
public:
GrallocPreloader() { GrallocLoader::loadModule(); }
};
static GrallocPreloader sGrallocPreloader;
extern "C" IMapper* HIDL_FETCH_IMapper(const char* /*name*/) {
return GrallocLoader::load();
}