Merge changes If74ecec7,Ica20dd10

* changes:
  goldfish hwc drm: Use atomic modeset, export sync fd, respect modesetting's refresh rate
  Use VirioGpu flush to post framebuffer
diff --git a/Android.bp b/Android.bp
index 482e5a6..b4f361f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -15,3 +15,35 @@
  */
 
 soong_namespace {}
+
+package {
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+// See: http://go/android-license-faq
+license {
+    name: "device_generic_goldfish-opengl_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+        "SPDX-license-identifier-BSD",
+        "SPDX-license-identifier-GPL-2.0",
+        "SPDX-license-identifier-MIT",
+    ],
+    license_text: [
+        "LICENSE",
+    ],
+}
diff --git a/android-emu/Android.bp b/android-emu/Android.bp
index c32c986..b83cab9 100644
--- a/android-emu/Android.bp
+++ b/android-emu/Android.bp
@@ -1,3 +1,13 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    //   SPDX-license-identifier-GPL-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_shared {
     name: "libandroidemu",
     vendor: true,
diff --git a/shared/GoldfishAddressSpace/Android.bp b/shared/GoldfishAddressSpace/Android.bp
index 4e8d31d..11e2450 100644
--- a/shared/GoldfishAddressSpace/Android.bp
+++ b/shared/GoldfishAddressSpace/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_static {
     name: "libGoldfishAddressSpace",
     vendor: true,
diff --git a/shared/gralloc_cb/Android.bp b/shared/gralloc_cb/Android.bp
index faea798..2e5976a 100644
--- a/shared/gralloc_cb/Android.bp
+++ b/shared/gralloc_cb/Android.bp
@@ -14,6 +14,15 @@
  * limitations under the License.
  */
 
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_headers {
     name: "libgralloc_cb.ranchu",
     vendor_available: true,
diff --git a/shared/qemupipe/Android.bp b/shared/qemupipe/Android.bp
index fe72943..478328c 100644
--- a/shared/qemupipe/Android.bp
+++ b/shared/qemupipe/Android.bp
@@ -14,6 +14,15 @@
  * limitations under the License.
  */
 
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_headers {
     name: "libqemupipe-types.ranchu",
     vendor_available: true,
diff --git a/system/codecs/c2/decoders/avcdec/Android.bp b/system/codecs/c2/decoders/avcdec/Android.bp
index d31f658..78ffd82 100644
--- a/system/codecs/c2/decoders/avcdec/Android.bp
+++ b/system/codecs/c2/decoders/avcdec/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_shared {
     name: "libcodec2_goldfish_avcdec",
     vendor: true,
diff --git a/system/codecs/c2/decoders/base/Android.bp b/system/codecs/c2/decoders/base/Android.bp
index c9921f5..f4ebb5d 100644
--- a/system/codecs/c2/decoders/base/Android.bp
+++ b/system/codecs/c2/decoders/base/Android.bp
@@ -1,5 +1,14 @@
 // DO NOT DEPEND ON THIS DIRECTLY
 // use libcodec2_soft-defaults instead
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_shared {
     name: "libcodec2_goldfish_common",
     defaults: ["libcodec2-impl-defaults"],
diff --git a/system/codecs/c2/decoders/vpxdec/Android.bp b/system/codecs/c2/decoders/vpxdec/Android.bp
index a3085e6..7be2d50 100644
--- a/system/codecs/c2/decoders/vpxdec/Android.bp
+++ b/system/codecs/c2/decoders/vpxdec/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_shared {
     name: "libcodec2_goldfish_vp9dec",
     vendor: true,
diff --git a/system/codecs/c2/service/Android.bp b/system/codecs/c2/service/Android.bp
index e85fa31..0678116 100644
--- a/system/codecs/c2/service/Android.bp
+++ b/system/codecs/c2/service/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-BSD
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_binary {
     name: "android.hardware.media.c2@1.0-service-goldfish",
 
diff --git a/system/codecs/c2/store/Android.bp b/system/codecs/c2/store/Android.bp
index ee57806..56b1895 100644
--- a/system/codecs/c2/store/Android.bp
+++ b/system/codecs/c2/store/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "device_generic_goldfish-opengl_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-GPL-2.0
+    default_applicable_licenses: ["device_generic_goldfish-opengl_license"],
+}
+
 cc_library_shared {
     name: "libgoldfish_codec2_store",
     vendor: true,
@@ -24,4 +33,3 @@
       "-Wthread-safety",  // Check thread annotation at build time.
     ],
 }
-
diff --git a/system/egl/Android.mk b/system/egl/Android.mk
index f312efb..b72db0e 100644
--- a/system/egl/Android.mk
+++ b/system/egl/Android.mk
@@ -55,6 +55,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := egl.cfg
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
 
 LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
diff --git a/system/egl/CMakeLists.txt b/system/egl/CMakeLists.txt
index cf649a2..f3ff096 100644
--- a/system/egl/CMakeLists.txt
+++ b/system/egl/CMakeLists.txt
@@ -1,7 +1,7 @@
 # This is an autogenerated file! Do not edit!
 # instead run make from .../device/generic/goldfish-opengl
 # which will re-generate this file.
-android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/egl/Android.mk" "0d72068bb429ec9da33f7086a879a08b540b887538f21d0a9f468cead76c45df")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/egl/Android.mk" "f5246612246423fe4f70a245deb7b5eb63364aed3e582af5ff716d406846ecd5")
 set(EGL_emulation_src eglDisplay.cpp egl.cpp ClientAPIExts.cpp)
 android_add_library(TARGET EGL_emulation SHARED LICENSE Apache-2.0 SRC eglDisplay.cpp egl.cpp ClientAPIExts.cpp)
 target_include_directories(EGL_emulation PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/bionic-include ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon ${GOLDFISH_DEVICE_ROOT}/bionic/libc/private ${GOLDFISH_DEVICE_ROOT}/bionic/libc/platform ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
diff --git a/system/hals/Android.mk b/system/hals/Android.mk
index 1641d23..72ac6ce 100644
--- a/system/hals/Android.mk
+++ b/system/hals/Android.mk
@@ -18,6 +18,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := android.hardware.graphics.allocator@3.0-service
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_VENDOR_MODULE := true
 LOCAL_SRC_FILES := allocator3.cpp
@@ -54,6 +57,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := android.hardware.graphics.mapper@3.0-impl-ranchu
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_VENDOR_MODULE := true
 LOCAL_SRC_FILES := mapper3.cpp
@@ -87,4 +93,3 @@
 LOCAL_SHARED_LIBRARIES += libdrm
 
 include $(BUILD_SHARED_LIBRARY)
-
diff --git a/system/hwc2/Android.mk b/system/hwc2/Android.mk
index b07a7a2..e8f53f9 100644
--- a/system/hwc2/Android.mk
+++ b/system/hwc2/Android.mk
@@ -63,6 +63,9 @@
 LOCAL_MODULE_RELATIVE_PATH := $(emulator_hwcomposer_relative_path)
 
 LOCAL_MODULE := hwcomposer.ranchu
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/gles_android_wrapper/Android.mk b/tests/gles_android_wrapper/Android.mk
index 13e0cfc..78bab3c 100644
--- a/tests/gles_android_wrapper/Android.mk
+++ b/tests/gles_android_wrapper/Android.mk
@@ -53,6 +53,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := egl.cfg
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
 
 LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
@@ -66,6 +69,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := gles_emul.cfg
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
 
 LOCAL_MODULE_PATH := $(TARGET_OUT)/etc