OSDN Git Service

[cherry-pick] Refactor gralloc HAL to not repeat defintions
authorChristopher Wiley <wiley@google.com>
Fri, 12 Feb 2016 20:32:07 +0000 (12:32 -0800)
committerYahan Zhou <yahan@google.com>
Mon, 18 Jul 2016 16:47:00 +0000 (16:47 +0000)
Bug: 26936651

cherry-pick from:

https://android-review.googlesource.com/#/c/202619/

Change-Id: If11a2af0496cdaf86e3bc87ded37fc8d93b7fa16

system/gralloc/Android.mk

index 6af6f25..4b7a68d 100644 (file)
@@ -2,11 +2,12 @@ ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
 
 LOCAL_PATH := $(call my-dir)
 
-$(call emugl-begin-shared-library,gralloc.goldfish)
-$(call emugl-import,libGLESv1_enc lib_renderControl_enc libOpenglSystemCommon)
-$(call emugl-set-shared-library-subpath,hw)
+define gralloc_recipe
+$$(call emugl-begin-shared-library,gralloc.$(1))
+$$(call emugl-import,libGLESv1_enc lib_renderControl_enc libOpenglSystemCommon)
+$$(call emugl-set-shared-library-subpath,hw)
 
-LOCAL_CFLAGS += -DLOG_TAG=\"gralloc_goldfish\"
+LOCAL_CFLAGS += -DLOG_TAG=\"gralloc_$(1)\"
 LOCAL_CFLAGS += -Wno-missing-field-initializers
 
 LOCAL_SRC_FILES := gralloc.cpp
@@ -30,21 +31,10 @@ LOCAL_SRC_FILES := gralloc.cpp
 LOCAL_C_INCLUDES += bionic/libc/private
 LOCAL_SHARED_LIBRARIES += libdl
 
-$(call emugl-end-module)
+$$(call emugl-end-module)
+endef  # define gralloc_recipe
 
-$(call emugl-begin-shared-library,gralloc.ranchu)
-$(call emugl-import,libGLESv1_enc lib_renderControl_enc libOpenglSystemCommon)
-$(call emugl-set-shared-library-subpath,hw)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"gralloc_ranchu\"
-LOCAL_CFLAGS += -Wno-missing-field-initializers
-
-LOCAL_SRC_FILES := gralloc.cpp
-
-# Need to access the special OPENGL TLS Slot
-LOCAL_C_INCLUDES += bionic/libc/private
-LOCAL_SHARED_LIBRARIES += libdl
-
-$(call emugl-end-module)
+$(eval $(call gralloc_recipe,goldfish))
+$(eval $(call gralloc_recipe,ranchu))
 
 endif # BUILD_EMULATOR_OPENGL_DRIVER != false