drm_hwcomposer: Support Nvidia gralloc

When using an Nvidia gralloc implementation, ask Nvidia gralloc to import the
buffer_handle_t to the hwcomposer's drm device.

Arguably, the code to perform the import would more naturally belong to
drm_hwcomposer than Nvidia gralloc.  But letting Nvidia gralloc do it has two
advantages.  First, drm_hwcomposer doesn't need to include vendor headers or
link against vendor libraries.  This means that it's easy to support both
drm_gralloc and Nvidia gralloc from the same default build of drm_hwcomposer.
Second, Nvidia gralloc will take care of properly setting up any vendor
specific metadata (such as tiling parameters) of the imported GEM handle.

Change-Id: I0f77fb301e7e0bff2a8cd7befeae4bc4892220ad
Reviewed-on: https://chrome-internal-review.googlesource.com/195115
Reviewed-by: Stéphane Marchesin <marcheu@google.com>
Commit-Queue: Stéphane Marchesin <marcheu@google.com>
Tested-by: Stéphane Marchesin <marcheu@google.com>
diff --git a/Android.mk b/Android.mk
index 214e28f..c505476 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,7 +17,7 @@
 include $(CLEAR_VARS)
 
 # TODO: We should specify this in device.mk
-BUFFER_IMPORTER := gralloc
+BUFFER_IMPORTER := nvidia-gralloc
 
 LOCAL_SHARED_LIBRARIES := \
 	libcutils \
@@ -40,10 +40,14 @@
 LOCAL_CFLAGS :=
 LOCAL_SRC_FILES := hwcomposer.cpp
 
-ifeq ($(strip $(BUFFER_IMPORTER)),gralloc)
+ifeq ($(strip $(BUFFER_IMPORTER)),drm-gralloc)
 LOCAL_C_INCLUDES += external/drm_gralloc
 LOCAL_SRC_FILES += hwcomposer_import_drm_gralloc.cpp
 endif
+ifeq ($(strip $(BUFFER_IMPORTER)),nvidia-gralloc)
+LOCAL_C_INCLUDES += external/drm_gralloc
+LOCAL_SRC_FILES += hwcomposer_import_nv_gralloc.cpp
+endif
 
 LOCAL_MODULE := hwcomposer.drm
 LOCAL_MODULE_TAGS := optional