Alexandre Julliard : wineandroid: Load the gralloc module in all processes.

Alexandre Julliard julliard at winehq.org
Tue Jun 6 15:23:26 CDT 2017


Module: wine
Branch: master
Commit: 6396f9f5229466230747e03b64ab711176e17d77
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6396f9f5229466230747e03b64ab711176e17d77

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun  6 08:30:23 2017 +0200

wineandroid: Load the gralloc module in all processes.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wineandroid.drv/android.h |  2 ++
 dlls/wineandroid.drv/init.c    | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h
index 3d9ac5a..bfdd697 100644
--- a/dlls/wineandroid.drv/android.h
+++ b/dlls/wineandroid.drv/android.h
@@ -107,4 +107,6 @@ int send_event( const union event_data *data );
 extern JavaVM *wine_get_java_vm(void);
 extern jobject wine_get_java_object(void);
 
+extern struct gralloc_module_t *gralloc_module;
+
 #endif  /* __WINE_ANDROID_H */
diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c
index ecf32ad..45117bc 100644
--- a/dlls/wineandroid.drv/init.c
+++ b/dlls/wineandroid.drv/init.c
@@ -402,6 +402,31 @@ static const JNINativeMethod methods[] =
 DECL_FUNCPTR( __android_log_print );
 DECL_FUNCPTR( ANativeWindow_fromSurface );
 DECL_FUNCPTR( ANativeWindow_release );
+DECL_FUNCPTR( hw_get_module );
+
+struct gralloc_module_t *gralloc_module = NULL;
+
+static void load_hardware_libs(void)
+{
+    const struct hw_module_t *module;
+    void *libhardware;
+    char error[256];
+
+    if ((libhardware = wine_dlopen( "libhardware.so", RTLD_GLOBAL, error, sizeof(error) )))
+    {
+        LOAD_FUNCPTR( libhardware, hw_get_module );
+    }
+    else
+    {
+        ERR( "failed to load libhardware: %s\n", error );
+        return;
+    }
+
+    if (phw_get_module( GRALLOC_HARDWARE_MODULE_ID, &module ) == 0)
+        gralloc_module = (struct gralloc_module_t *)module;
+    else
+        ERR( "failed to load gralloc module\n" );
+}
 
 static void load_android_libs(void)
 {
@@ -433,6 +458,8 @@ static BOOL process_attach(void)
     JNIEnv *jni_env;
     JavaVM *java_vm;
 
+    load_hardware_libs();
+
     if ((java_vm = wine_get_java_vm()))  /* running under Java */
     {
 #ifdef __i386__




More information about the wine-cvs mailing list