aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk156
-rw-r--r--common.mk267
-rw-r--r--system/codecs/Android.mk1
-rw-r--r--system/codecs/omx/Android.mk16
-rw-r--r--system/codecs/omx/avcdec/Android.bp53
-rw-r--r--system/codecs/omx/avcdec/Android.mk57
-rw-r--r--system/codecs/omx/avcdec/GoldfishAVCDec.cpp3
-rw-r--r--system/codecs/omx/avcdec/include/GoldfishAVCDec.h (renamed from system/codecs/omx/avcdec/GoldfishAVCDec.h)0
-rw-r--r--system/codecs/omx/avcdec/include/MediaH264Decoder.h (renamed from system/codecs/omx/avcdec/MediaH264Decoder.h)0
-rw-r--r--system/codecs/omx/common/Android.bp41
-rw-r--r--system/codecs/omx/common/Android.mk48
-rw-r--r--system/codecs/omx/common/include/goldfish_media_utils.h (renamed from system/codecs/omx/common/goldfish_media_utils.h)0
-rw-r--r--system/codecs/omx/plugin/Android.bp44
-rw-r--r--system/codecs/omx/plugin/Android.mk54
-rw-r--r--system/codecs/omx/plugin/include/GoldfishOMXComponent.h (renamed from system/codecs/omx/plugin/GoldfishOMXComponent.h)0
-rw-r--r--system/codecs/omx/plugin/include/GoldfishVideoDecoderOMXComponent.h (renamed from system/codecs/omx/plugin/GoldfishVideoDecoderOMXComponent.h)0
-rw-r--r--system/codecs/omx/plugin/include/SimpleGoldfishOMXComponent.h (renamed from system/codecs/omx/plugin/SimpleGoldfishOMXComponent.h)0
-rw-r--r--system/codecs/omx/vpxdec/Android.bp52
-rw-r--r--system/codecs/omx/vpxdec/Android.mk59
-rw-r--r--system/codecs/omx/vpxdec/GoldfishVPX.cpp3
-rw-r--r--system/codecs/omx/vpxdec/include/GoldfishVPX.h (renamed from system/codecs/omx/vpxdec/GoldfishVPX.h)0
-rw-r--r--system/codecs/omx/vpxdec/include/goldfish_vpx_defs.h (renamed from system/codecs/omx/vpxdec/goldfish_vpx_defs.h)0
-rw-r--r--system/hals/Android.bp57
-rw-r--r--system/hals/Android.mk99
-rw-r--r--system/hwc3/GuestFrameComposer.cpp75
-rw-r--r--system/hwc3/GuestFrameComposer.h8
26 files changed, 282 insertions, 811 deletions
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 6ab1d7d6..00000000
--- a/Android.mk
+++ /dev/null
@@ -1,156 +0,0 @@
-# This is the top-level build file for the Android HW OpenGL ES emulation
-# in Android.
-#
-# You must define BUILD_EMULATOR_OPENGL to 'true' in your environment to
-# build the following files.
-#
-# Also define BUILD_EMULATOR_OPENGL_DRIVER to 'true' to build the gralloc
-# stuff as well.
-#
-# Top-level for all modules
-GOLDFISH_OPENGL_PATH := $(call my-dir)
-
-HARDWARE_GOOGLE_GFXSTREAM_PATH := $(GOLDFISH_OPENGL_PATH)/../../../hardware/google/gfxstream
-
-ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-ENABLE_GOLDFISH_OPENGL_FOLDER := true
-else
-ifneq ($(filter $(GOLDFISH_OPENGL_PATH),$(PRODUCT_SOONG_NAMESPACES)),)
-ENABLE_GOLDFISH_OPENGL_FOLDER := true
-endif
-endif
-
-ifeq (true,$(ENABLE_GOLDFISH_OPENGL_FOLDER))
-
-# There are two kinds of builds for goldfish-opengl:
-# 1. The standard guest build, denoted by BUILD_EMULATOR_OPENGL
-# 2. The host-side build, denoted by GOLDFISH_OPENGL_BUILD_FOR_HOST
-#
-# Variable controlling whether the build for goldfish-opengl
-# libraries (including their Android.mk's) should be triggered.
-GOLDFISH_OPENGL_SHOULD_BUILD := false
-
-# In the host build, some libraries have name collisions with
-# other libraries, so we have this variable here to control
-# adding a suffix to the names of libraries. Should be blank
-# for the guest build.
-GOLDFISH_OPENGL_LIB_SUFFIX :=
-
-# Directory containing common headers used by several modules
-# This is always set to a module's LOCAL_C_INCLUDES
-# See the definition of emugl-begin-module in common.mk
-EMUGL_COMMON_INCLUDES := \
- $(HARDWARE_GOOGLE_GFXSTREAM_PATH)/guest/iostream/include/libOpenglRender \
- $(HARDWARE_GOOGLE_GFXSTREAM_PATH)/guest/include
-
-# This is always set to a module's LOCAL_CFLAGS
-# See the definition of emugl-begin-module in common.mk
-EMUGL_COMMON_CFLAGS :=
-
-# Whether or not to build the Vulkan library.
-GFXSTREAM := false
-
-# Host build
-ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-
-GOLDFISH_OPENGL_SHOULD_BUILD := true
-GOLDFISH_OPENGL_LIB_SUFFIX := _host
-
-GFXSTREAM := true
-
-# Set modern defaults for the codename, version, etc.
-PLATFORM_VERSION_CODENAME:=Q
-PLATFORM_SDK_VERSION:=29
-IS_AT_LEAST_OPD1:=true
-
-# The host-side Android framework implementation
-HOST_EMUGL_PATH := $(GOLDFISH_OPENGL_PATH)/../../../external/qemu/android/android-emugl
-EMUGL_COMMON_INCLUDES += $(HOST_EMUGL_PATH)/guest
-
-EMUGL_COMMON_CFLAGS += \
- -DPLATFORM_SDK_VERSION=29 \
- -DGOLDFISH_HIDL_GRALLOC \
- -DHOST_BUILD \
- -DANDROID \
- -DGL_GLEXT_PROTOTYPES \
- -fvisibility=default \
- -DPAGE_SIZE=4096 \
- -DGFXSTREAM \
- -DENABLE_ANDROID_HEALTH_MONITOR \
- -Wno-unused-parameter
-
-endif # GOLDFISH_OPENGL_BUILD_FOR_HOST
-
-ifeq (true,$(BUILD_EMULATOR_OPENGL)) # Guest build
-
-GOLDFISH_OPENGL_SHOULD_BUILD := true
-
-EMUGL_COMMON_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
-
-ifeq (O, $(PLATFORM_VERSION_CODENAME))
-EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
-endif
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25 && echo isApi26OrHigher),isApi26OrHigher)
-EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
-endif
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 18 && echo PreJellyBeanMr2),PreJellyBeanMr2)
- ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- EMUGL_COMMON_CFLAGS += -DHAVE_ARM_TLS_REGISTER
- endif
-endif
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 16 && echo PreJellyBean),PreJellyBean)
- EMUGL_COMMON_CFLAGS += -DALOG_ASSERT=LOG_ASSERT
- EMUGL_COMMON_CFLAGS += -DALOGE=LOGE
- EMUGL_COMMON_CFLAGS += -DALOGW=LOGW
- EMUGL_COMMON_CFLAGS += -DALOGD=LOGD
- EMUGL_COMMON_CFLAGS += -DALOGV=LOGV
-endif
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27 && echo isApi28OrHigher),isApi28OrHigher)
- GFXSTREAM := true
- EMUGL_COMMON_CFLAGS += -DGFXSTREAM
-endif
-
-# Include common definitions used by all the modules included later
-# in this build file. This contains the definition of all useful
-# emugl-xxxx functions.
-#
-include $(GOLDFISH_OPENGL_PATH)/common.mk
-
-endif # BUILD_EMULATOR_OPENGL (guest build)
-
-ifeq (true,$(GOLDFISH_OPENGL_SHOULD_BUILD))
-
-# Uncomment the following line if you want to enable debug traces
-# in the GLES emulation libraries.
-# EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1
-
-# IMPORTANT: ORDER IS CRUCIAL HERE
-#
-# For the import/export feature to work properly, you must include
-# modules below in correct order. That is, if module B depends on
-# module A, then it must be included after module A below.
-#
-# This ensures that anything exported by module A will be correctly
-# be imported by module B when it is declared.
-#
-# Note that the build system will complain if you try to import a
-# module that hasn't been declared yet anyway.
-#
-ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-include $(GOLDFISH_OPENGL_PATH)/system/hals/Android.mk
-endif
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28 -o $(IS_AT_LEAST_QPR1) = true && echo isApi29OrHigher),isApi29OrHigher)
- # hardware codecs enabled after P
- include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/common/Android.mk
- include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/plugin/Android.mk
- include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/avcdec/Android.mk
- include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/vpxdec/Android.mk
-endif
-
-endif
-
-endif # ENABLE_GOLDFISH_OPENGL_FOLDER
diff --git a/common.mk b/common.mk
deleted file mode 100644
index 79917126..00000000
--- a/common.mk
+++ /dev/null
@@ -1,267 +0,0 @@
-# This top-level build file is included by all modules that implement
-# the hardware OpenGL ES emulation for Android.
-#
-# We use it to ensure that all sub-Makefiles are included in the right
-# order for various variable definitions and usage to happen in the correct
-# order.
-#
-
-# The following macros are used to start a new GLES emulation module.
-#
-# This will define LOCAL_MODULE as $1, plus a few other variables
-# needed by the build system (e.g. LOCAL_MODULE_TAGS, LOCAL_MODULE_CLASS...)
-#
-# NOTE: You still need to define LOCAL_PATH before this
-#
-# Usage example:
-#
-# $(call emugl-begin-static-library,<name>)
-# LOCAL_SRC_FILES := ....
-# LOCAL_C_INCLUDES += ....
-# $(call emugl-end-module)
-#
-emugl-begin-static-library = $(call emugl-begin-module,$1,STATIC_LIBRARY)
-emugl-begin-shared-library = $(call emugl-begin-module,$1,SHARED_LIBRARY)
-
-# Internal list of all declared modules (used for sanity checking)
-_emugl_modules :=
-_emugl_HOST_modules :=
-
-# do not use directly, see functions above instead
-emugl-begin-module = \
- $(eval include $(CLEAR_VARS)) \
- $(eval LOCAL_MODULE := $1) \
- $(eval LOCAL_MODULE_CLASS := $(patsubst HOST_%,%,$(patsubst %EXECUTABLE,%EXECUTABLES,$(patsubst %LIBRARY,%LIBRARIES,$2)))) \
- $(eval LOCAL_IS_HOST_MODULE := $(if $3,true,))\
- $(eval LOCAL_C_INCLUDES := $(EMUGL_COMMON_INCLUDES)) \
- $(eval LOCAL_CFLAGS := $(EMUGL_COMMON_CFLAGS)) \
- $(eval _EMUGL_INCLUDE_TYPE := $(BUILD_$2)) \
- $(call _emugl-init-module,$1,$2,$3)
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26 && echo TREBLE),TREBLE)
- emugl-begin-module += $(eval LOCAL_VENDOR_MODULE := true)
-endif
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
- emugl-begin-module += $(eval include external/stlport/libstlport.mk)
-endif
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 21 && echo PreLollipop),PreLollipop)
- emugl-begin-module += $(eval LOCAL_PRELINK_MODULE := false)
-endif
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 19 && echo PreKitkat),PreKitkat)
- emugl-begin-module += $(eval LOCAL_MODULE_TAGS := debug)
- emugl-begin-module += $(eval LOCAL_SHARED_LIBRARIES += libstlport)
-endif
-
-# Used to end a module definition, see function definitions above
-emugl-end-module = \
- $(eval include $(_EMUGL_INCLUDE_TYPE))\
- $(eval _EMUGL_INCLUDE_TYPE :=) \
- $(eval _emugl_$(_emugl_HOST)modules += $(_emugl_MODULE))\
- $(if $(EMUGL_DEBUG),$(call emugl-dump-module)) \
- $(if $(CMAKE_GENERATE), $(call dump-json-module))
-
-# Managing module exports and imports.
-#
-# A module can 'import' another module, by calling emugl-import. This will
-# make the current LOCAL_MODULE inherit various definitions exported from
-# the imported module.
-#
-# Module exports are defined by calling emugl-export. Here is an example:
-#
-# $(call emugl-begin-static-library,foo)
-# LOCAL_SRC_FILES := foo.c
-# $(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-# $(call emugl-export,SHARED_LIBRARIES,libcutils)
-# $(call emugl-end-module)
-#
-# $(call emugl-begin-shared-library,bar)
-# LOCAL_SRC_FILES := bar.cpp
-# $(call emugl-import,foo)
-# $(call emugl-end-module)
-#
-# Here, we define a static library named 'foo' which exports an include
-# path and a shared library requirement, and a shared library 'bar' which
-# imports it.
-#
-# What this means is that:
-#
-# - 'bar' will automatically inherit foo's LOCAL_PATH in its LOCAL_C_INCLUDES
-# - 'bar' will automatically inherit libcutils in its own LOCAL_SHARED_LIBRARIES
-#
-# Note that order of declaration matters. If 'foo' is defined after 'bar' in
-# the example above, nothing will work correctly because dependencies are
-# computed at import time.
-#
-#
-# IMPORTANT: Imports are transitive, i.e. when module A imports B,
-# it automatically imports anything imported by B too.
-
-# This is the list of recognized export types we support for now.
-EMUGL_EXPORT_TYPES := \
- CFLAGS \
- LDLIBS \
- LDFLAGS \
- C_INCLUDES \
- SHARED_LIBRARIES \
- STATIC_LIBRARIES \
- ADDITIONAL_DEPENDENCIES
-
-ifdef IS_AT_LEAST_OPD1
-EMUGL_EXPORT_TYPES += HEADER_LIBRARIES
-endif
-
-# Initialize a module in our database
-# $1: Module name
-# $2: Module type
-# $3: "HOST" for a host module, empty for a target one.
-_emugl-init-module = \
- $(eval _emugl_HOST := $(if $3,HOST_,))\
- $(eval _emugl_MODULE := $(_emugl_HOST)$1)\
- $(if $(filter $(_emugl_$(_emugl_HOST)modules),$(_emugl_MODULE)),\
- $(error There is already a $(if $3,host,) module named $1!)\
- )\
- $(eval _mod = $(_emugl_MODULE)) \
- $(eval _emugl.$(_mod).type := $(patsubst HOST_%,%,$2))\
- $(eval _emugl.$(_mod).imports :=) \
- $(eval _emugl,$(_mod).moved :=) \
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(eval _emugl.$(_mod).export.$(_type) :=)\
- )
-
-# Called to indicate that a module exports a given local variable for its
-# users. This also adds this to LOCAL_$1
-# $1: Local variable type (e.g. CFLAGS, LDLIBS, etc...)
-# $2: Value(s) to append to the export
-emugl-export = \
- $(eval _emugl.$(_emugl_MODULE).export.$1 += $2)\
- $(eval LOCAL_$1 := $2 $(LOCAL_$1))
-
-emugl-export-outer = \
- $(eval _emugl.$(_emugl_MODULE).export.$1 += $2)
-
-# Called to indicate that a module imports the exports of another module
-# $1: list of modules to import
-#
-emugl-import = \
- $(foreach _imod,$1,\
- $(call _emugl-module-import,$(_emugl_HOST)$(_imod))\
- )
-
-_emugl-module-import = \
- $(eval _mod := $(_emugl_MODULE))\
- $(if $(filter-out $(_emugl_$(_emugl_HOST)modules),$1),\
- $(info Unknown imported emugles module: $1)\
- $(if $(_emugl_HOST),\
- $(eval _names := $(patsubst HOST_%,%,$(_emugl_HOST_modules))),\
- $(eval _names := $(_emugl_modules))\
- )\
- $(info Please one of the following names: $(_names))\
- $(error Aborting)\
- )\
- $(if $(filter-out $(_emugl.$(_mod).imports),$1),\
- $(eval _emugl.$(_mod).imports += $1)\
- $(foreach _sub,$(_emugl.$1.imports),\
- $(call _emugl-module-import,$(_sub))\
- )\
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(eval LOCAL_$(_type) := $(_emugl.$1.export.$(_type)) $(LOCAL_$(_type)))\
- )\
- $(if $(filter EXECUTABLE SHARED_LIBRARY,$(_emugl.$(_emugl_MODULE).type)),\
- $(if $(filter STATIC_LIBRARY,$(_emugl.$1.type)),\
- $(eval LOCAL_STATIC_LIBRARIES := $(1:HOST_%=%) $(LOCAL_STATIC_LIBRARIES))\
- )\
- $(if $(filter SHARED_LIBRARY,$(_emugl.$1.type)),\
- $(if $(_emugl.$1.moved),,\
- $(eval LOCAL_SHARED_LIBRARIES := $(1:HOST_%=%) $(LOCAL_SHARED_LIBRARIES))\
- )\
- )\
- )\
- )
-
-_emugl-dump-list = \
- $(foreach _list_item,$(strip $1),$(info . $(_list_item)))
-
-emugl-dump-module = \
- $(info MODULE=$(_emugl_MODULE))\
- $(info . HOST=$(_emugl_HOST))\
- $(info . TYPE=$(_emugl.$(_emugl_MODULE).type))\
- $(info . IMPORTS=$(_emugl.$(_emugl_MODULE).imports))\
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(if $(filter C_INCLUDES ADDITIONAL_DEPENDENCIES,$(_type)),\
- $(info . EXPORT.$(_type) :=)\
- $(call _emugl-dump-list,$(_emugl.$(_emugl_MODULE).export.$(_type)))\
- $(info . LOCAL_$(_type) :=)\
- $(call _emugl-dump-list,$(LOCAL_$(_type)))\
- ,\
- $(info . EXPORT.$(_type) := $(strip $(_emugl.$(_emugl_MODULE).export.$(_type))))\
- $(info . LOCAL_$(_type) := $(strip $(LOCAL_$(_type))))\
- )\
- )\
- $(info . LOCAL_SRC_FILES := $(LOCAL_SRC_FILES))\
-
-# This function can be called to generate the wrapper source files.
-# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort.
-# Source files will be stored in the local intermediates directory that will
-# be automatically added to your LOCAL_C_INCLUDES.
-# Usage:
-# $(call emugl-gen-wrapper,<input-dir>,<basename>)
-#
-emugl-gen-wrapper = \
- $(eval _emugl_out := $(call local-intermediates-dir)) \
- $(call emugl-gen-wrapper-generic,$(_emugl_out),$1,$2) \
- $(call emugl-export,C_INCLUDES,$(_emugl_out))
-
-# DO NOT CALL DIRECTLY, USE emugl-gen-wrapper instead.
-#
-# The following function can be called to generate GL library wrapper
-# Usage is:
-#
-# $(call emugl-gen-wrapper-generic,<dst-dir>,<src-dir>,<basename>)
-#
-# <dst-dir> is the destination directory where the generated sources are stored
-# <src-dir> is the source directory where to find <basename>.attrib, etc..
-# <basename> is the emugen basename (see host/tools/emugen/README)
-#
-emugl-gen-wrapper-generic = $(eval $(emugl-gen-wrapper-generic-ev))
-
-define emugl-gen-wrapper-generic-ev
-_emugl_wrap := $$1/$$3
-_emugl_src := $$2/$$3
-GEN := $$(_emugl_wrap)_wrapper_entry.cpp \
- $$(_emugl_wrap)_wrapper_context.cpp \
- $$(_emugl_wrap)_wrapper_context.h \
- $$(_emugl_wrap)_wrapper_proc.h
-
-$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
-$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -W $$1 -i $$2 $$3
-$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types
- $$(transform-generated-source)
-
-$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN))
-LOCAL_GENERATED_SOURCES += $$(GEN)
-LOCAL_C_INCLUDES += $$1
-
-#ifneq ($$(HOST_OS),windows)
-$$(call emugl-export,LDFLAGS,-ldl)
-#endif
-
-endef
-
-# Call this function when your shared library must be placed in a non-standard
-# library path (i.e. not under /system/lib
-# $1: library sub-path,relative to /system/lib
-# For example: $(call emugl-set-shared-library-subpath,egl)
-
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 21 && echo PreLollipop),PreLollipop)
- emugl-set-shared-library-subpath = \
- $(eval LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$1)\
- $(eval LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$1)\
- $(eval _emugl.$(LOCAL_MODULE).moved := true)\
- $(call emugl-export-outer,ADDITIONAL_DEPENDENCIES,$(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)$(TARGET_SHLIB_SUFFIX))
-else
- emugl-set-shared-library-subpath = \
- $(eval LOCAL_MODULE_RELATIVE_PATH := $1)\
- $(eval _emugl.$(LOCAL_MODULE).moved := true)
-endif
-
diff --git a/system/codecs/Android.mk b/system/codecs/Android.mk
deleted file mode 100644
index 5053e7d6..00000000
--- a/system/codecs/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/system/codecs/omx/Android.mk b/system/codecs/omx/Android.mk
deleted file mode 100644
index c307f8eb..00000000
--- a/system/codecs/omx/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright 2018 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-include $(call all-subdir-makefiles)
diff --git a/system/codecs/omx/avcdec/Android.bp b/system/codecs/omx/avcdec/Android.bp
new file mode 100644
index 00000000..2fc1c2f3
--- /dev/null
+++ b/system/codecs/omx/avcdec/Android.bp
@@ -0,0 +1,53 @@
+//
+// Copyright 2019 The Android Open-Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libstagefright_goldfish_avcdec",
+ vendor: true,
+ srcs: [
+ "GoldfishAVCDec.cpp",
+ "MediaH264Decoder.cpp",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+ shared_libs: [
+ "libstagefrighthw",
+ "android.hardware.media.omx@1.0",
+ "android.hardware.graphics.common@1.2",
+ "libstagefright_foundation",
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "liblog",
+ "libui",
+ "libutils",
+ ],
+ static_libs: [
+ "libgoldfish_codecs_common",
+ ],
+ header_libs: [
+ "media_plugin_headers",
+ "libmedia_headers",
+ "libnativewindow_headers",
+ "libhardware_headers",
+ "libgralloc_cb.ranchu",
+ ],
+ cflags: [
+ "-DLOG_TAG=\"goldfish_avcdec\"",
+ "-Wno-unused-private-field",
+ ],
+}
diff --git a/system/codecs/omx/avcdec/Android.mk b/system/codecs/omx/avcdec/Android.mk
deleted file mode 100644
index 4ab6db3d..00000000
--- a/system/codecs/omx/avcdec/Android.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Copyright 2019 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-commonSources := \
- GoldfishAVCDec.cpp \
- MediaH264Decoder.cpp
-
-$(call emugl-begin-shared-library,libstagefright_goldfish_avcdec$(GOLDFISH_OPENGL_LIB_SUFFIX))
-
-LOCAL_SRC_FILES := $(commonSources)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"goldfish_avcdec\"
-LOCAL_CFLAGS += -Wno-unused-private-field
-
-$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
-
-LOCAL_HEADER_LIBRARIES := media_plugin_headers \
- libmedia_headers \
- libbinder_headers \
- libhidlbase_impl_internal \
- libbase
-LOCAL_HEADER_LIBRARIES += libui_headers \
- libnativewindow_headers \
- libhardware_headers \
- libarect_headers \
- libarect_headers_for_ndk
-LOCAL_SHARED_LIBRARIES := \
- libbinder \
- libutils \
- liblog \
- libcutils \
- libui \
- android.hardware.media.omx@1.0 \
- android.hardware.graphics.allocator@3.0 \
- android.hardware.graphics.mapper@3.0 \
- libstagefright_foundation
-
-LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
-
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-import,libgoldfish_codecs_common)
-$(call emugl-import,libstagefrighthw)
-$(call emugl-end-module)
diff --git a/system/codecs/omx/avcdec/GoldfishAVCDec.cpp b/system/codecs/omx/avcdec/GoldfishAVCDec.cpp
index 02c0dc16..a49d7e89 100644
--- a/system/codecs/omx/avcdec/GoldfishAVCDec.cpp
+++ b/system/codecs/omx/avcdec/GoldfishAVCDec.cpp
@@ -33,8 +33,7 @@
#include <nativebase/nativebase.h>
-#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
-#include <android/hardware/graphics/mapper/3.0/IMapper.h>
+#include <android/hardware/graphics/common/1.2/types.h>
#include <hidl/LegacySupport.h>
using ::android::hardware::graphics::common::V1_2::PixelFormat;
diff --git a/system/codecs/omx/avcdec/GoldfishAVCDec.h b/system/codecs/omx/avcdec/include/GoldfishAVCDec.h
index 0fd52b0d..0fd52b0d 100644
--- a/system/codecs/omx/avcdec/GoldfishAVCDec.h
+++ b/system/codecs/omx/avcdec/include/GoldfishAVCDec.h
diff --git a/system/codecs/omx/avcdec/MediaH264Decoder.h b/system/codecs/omx/avcdec/include/MediaH264Decoder.h
index a75758fa..a75758fa 100644
--- a/system/codecs/omx/avcdec/MediaH264Decoder.h
+++ b/system/codecs/omx/avcdec/include/MediaH264Decoder.h
diff --git a/system/codecs/omx/common/Android.bp b/system/codecs/omx/common/Android.bp
new file mode 100644
index 00000000..7a7f7270
--- /dev/null
+++ b/system/codecs/omx/common/Android.bp
@@ -0,0 +1,41 @@
+//
+// Copyright 2020 The Android Open-Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libgoldfish_codecs_common",
+ vendor: true,
+ srcs: [
+ "goldfish_media_utils.cpp",
+ ],
+ shared_libs: [
+ "libcutils",
+ "libutils",
+ "liblog",
+ ],
+ static_libs: [
+ "libGoldfishAddressSpace",
+ ],
+ whole_static_libs: [
+ "libGoldfishAddressSpace",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+ cflags: [
+ "-DLOG_TAG=\"goldfish_codecs_common\"",
+ "-Wno-unused-private-field",
+ ],
+}
diff --git a/system/codecs/omx/common/Android.mk b/system/codecs/omx/common/Android.mk
deleted file mode 100644
index 6b1674c9..00000000
--- a/system/codecs/omx/common/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright 2019 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-commonSources := \
- goldfish_media_utils.cpp
-
-$(call emugl-begin-shared-library,libgoldfish_codecs_common$(GOLDFISH_OPENGL_LIB_SUFFIX))
-
-LOCAL_SRC_FILES := $(commonSources)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"goldfish_codecs_common\"
-LOCAL_CFLAGS += -Wno-unused-private-field
-
-$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
-
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-$(call emugl-import,libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX))
-else
-$(call emugl-export,STATIC_LIBRARIES,libplatform)
-$(call emugl-export,STATIC_LIBRARIES,libGoldfishAddressSpace)
-
-ifeq (true,$(GFXSTREAM))
-
-LOCAL_CFLAGS += -DVIRTIO_GPU
-LOCAL_C_INCLUDES += external/libdrm external/minigbm/cros_gralloc
-LOCAL_SHARED_LIBRARIES += libdrm
-
-endif
-
-endif
-
-$(call emugl-end-module)
diff --git a/system/codecs/omx/common/goldfish_media_utils.h b/system/codecs/omx/common/include/goldfish_media_utils.h
index d25ee301..d25ee301 100644
--- a/system/codecs/omx/common/goldfish_media_utils.h
+++ b/system/codecs/omx/common/include/goldfish_media_utils.h
diff --git a/system/codecs/omx/plugin/Android.bp b/system/codecs/omx/plugin/Android.bp
new file mode 100644
index 00000000..bd0bb18d
--- /dev/null
+++ b/system/codecs/omx/plugin/Android.bp
@@ -0,0 +1,44 @@
+//
+// Copyright 2018 The Android Open-Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libstagefrighthw",
+ vendor: true,
+ srcs: [
+ "GoldfishOMXComponent.cpp",
+ "GoldfishOMXPlugin.cpp",
+ "GoldfishVideoDecoderOMXComponent.cpp",
+ "SimpleGoldfishOMXComponent.cpp",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+ shared_libs: [
+ "android.hardware.media.omx@1.0",
+ "libstagefright_foundation",
+ "libbase",
+ "libcutils",
+ "liblog",
+ "libutils",
+ ],
+ header_libs: [
+ "libmedia_headers",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+}
diff --git a/system/codecs/omx/plugin/Android.mk b/system/codecs/omx/plugin/Android.mk
deleted file mode 100644
index 4adfd8a8..00000000
--- a/system/codecs/omx/plugin/Android.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright 2018 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-commonSources := \
- GoldfishOMXComponent.cpp \
- GoldfishOMXPlugin.cpp \
- GoldfishVideoDecoderOMXComponent.cpp \
- SimpleGoldfishOMXComponent.cpp \
-
-$(call emugl-begin-shared-library,libstagefrighthw$(GOLDFISH_OPENGL_LIB_SUFFIX))
-
-LOCAL_SRC_FILES := $(commonSources)
-
-LOCAL_CFLAGS += $(PV_CFLAGS_MINUS_VISIBILITY) -Werror
-LOCAL_CFLAGS += -Wno-unused-private-field
-
-LOCAL_C_INCLUDES += \
- $(call include-path-for, frameworks-native)/media/hardware \
- $(call include-path-for, frameworks-native)/media/openmax \
-
-$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-LOCAL_HEADER_LIBRARIES += media_plugin_headers \
- libmedia_headers \
- libbinder_headers \
- libhidlbase_impl_internal \
- libbase
-
-LOCAL_SHARED_LIBRARIES += \
- libbinder \
- libutils \
- liblog \
- libcutils \
- android.hardware.media.omx@1.0 \
- libstagefright_foundation
-
-LOCAL_VENDOR_MODULE := true
-
-$(call emugl-end-module)
diff --git a/system/codecs/omx/plugin/GoldfishOMXComponent.h b/system/codecs/omx/plugin/include/GoldfishOMXComponent.h
index 87a65ae3..87a65ae3 100644
--- a/system/codecs/omx/plugin/GoldfishOMXComponent.h
+++ b/system/codecs/omx/plugin/include/GoldfishOMXComponent.h
diff --git a/system/codecs/omx/plugin/GoldfishVideoDecoderOMXComponent.h b/system/codecs/omx/plugin/include/GoldfishVideoDecoderOMXComponent.h
index bf60f615..bf60f615 100644
--- a/system/codecs/omx/plugin/GoldfishVideoDecoderOMXComponent.h
+++ b/system/codecs/omx/plugin/include/GoldfishVideoDecoderOMXComponent.h
diff --git a/system/codecs/omx/plugin/SimpleGoldfishOMXComponent.h b/system/codecs/omx/plugin/include/SimpleGoldfishOMXComponent.h
index d2a3bf5d..d2a3bf5d 100644
--- a/system/codecs/omx/plugin/SimpleGoldfishOMXComponent.h
+++ b/system/codecs/omx/plugin/include/SimpleGoldfishOMXComponent.h
diff --git a/system/codecs/omx/vpxdec/Android.bp b/system/codecs/omx/vpxdec/Android.bp
new file mode 100644
index 00000000..09a7f9cc
--- /dev/null
+++ b/system/codecs/omx/vpxdec/Android.bp
@@ -0,0 +1,52 @@
+//
+// Copyright 2018 The Android Open-Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libstagefright_goldfish_vpxdec",
+ vendor: true,
+ srcs: [
+ "GoldfishVPX.cpp",
+ "goldfish_vpx_impl.cpp",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+ shared_libs: [
+ "libstagefrighthw",
+ "android.hardware.media.omx@1.0",
+ "android.hardware.graphics.common@1.2",
+ "libstagefright_foundation",
+ "libbinder",
+ "libcutils",
+ "libutils",
+ "liblog",
+ "libui",
+ ],
+ static_libs: [
+ "libgoldfish_codecs_common",
+ ],
+ header_libs: [
+ "media_plugin_headers",
+ "libmedia_headers",
+ "libbinder_headers",
+ "libhardware_headers",
+ "libnativewindow_headers",
+ "libgralloc_cb.ranchu",
+ ],
+ cflags: [
+ "-DLOG_TAG=\"goldfish_vpxdec\"",
+ ],
+}
diff --git a/system/codecs/omx/vpxdec/Android.mk b/system/codecs/omx/vpxdec/Android.mk
deleted file mode 100644
index e7ec2d4f..00000000
--- a/system/codecs/omx/vpxdec/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright 2019 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-commonSources := \
- GoldfishVPX.cpp \
- goldfish_vpx_impl.cpp
-
-$(call emugl-begin-shared-library,libstagefright_goldfish_vpxdec$(GOLDFISH_OPENGL_LIB_SUFFIX))
-
-LOCAL_SRC_FILES := $(commonSources)
-
-LOCAL_CFLAGS += -DLOG_TAG=\"goldfish_vpxdec\"
-LOCAL_CFLAGS += -Wno-unused-private-field
-
-$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
-
-LOCAL_HEADER_LIBRARIES := media_plugin_headers \
- libmedia_headers \
- libbinder_headers \
- libhidlbase_impl_internal \
- libbase
-
-LOCAL_HEADER_LIBRARIES += libui_headers \
- libnativewindow_headers \
- libhardware_headers \
- libarect_headers \
- libarect_headers_for_ndk
-
-LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
-
-LOCAL_SHARED_LIBRARIES += \
- libbinder \
- libutils \
- liblog \
- libcutils \
- libui \
- android.hardware.media.omx@1.0 \
- android.hardware.graphics.allocator@3.0 \
- android.hardware.graphics.mapper@3.0 \
- libstagefright_foundation
-
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-import,libgoldfish_codecs_common)
-$(call emugl-import,libstagefrighthw)
-$(call emugl-end-module)
diff --git a/system/codecs/omx/vpxdec/GoldfishVPX.cpp b/system/codecs/omx/vpxdec/GoldfishVPX.cpp
index edf6aa3f..2a6e4bcf 100644
--- a/system/codecs/omx/vpxdec/GoldfishVPX.cpp
+++ b/system/codecs/omx/vpxdec/GoldfishVPX.cpp
@@ -36,8 +36,7 @@
#include <nativebase/nativebase.h>
-#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
-#include <android/hardware/graphics/mapper/3.0/IMapper.h>
+#include <android/hardware/graphics/common/1.2/types.h>
#include <hidl/LegacySupport.h>
using ::android::hardware::graphics::common::V1_0::BufferUsage;
diff --git a/system/codecs/omx/vpxdec/GoldfishVPX.h b/system/codecs/omx/vpxdec/include/GoldfishVPX.h
index cb9321f5..cb9321f5 100644
--- a/system/codecs/omx/vpxdec/GoldfishVPX.h
+++ b/system/codecs/omx/vpxdec/include/GoldfishVPX.h
diff --git a/system/codecs/omx/vpxdec/goldfish_vpx_defs.h b/system/codecs/omx/vpxdec/include/goldfish_vpx_defs.h
index 25fecde3..25fecde3 100644
--- a/system/codecs/omx/vpxdec/goldfish_vpx_defs.h
+++ b/system/codecs/omx/vpxdec/include/goldfish_vpx_defs.h
diff --git a/system/hals/Android.bp b/system/hals/Android.bp
index cec9efb3..d13c1a07 100644
--- a/system/hals/Android.bp
+++ b/system/hals/Android.bp
@@ -33,6 +33,61 @@ cc_library_headers {
],
export_header_lib_headers: [
"libcutils_headers",
- "libqemupipe-types.ranchu"
+ "libqemupipe-types.ranchu",
+ ],
+}
+
+cc_defaults {
+ name: "android.hardware.graphics_defaults",
+ relative_install_path: "hw",
+ vendor: true,
+ static_libs: [
+ "libqemupipe.ranchu",
+ "libGoldfishAddressSpace",
+ ],
+ shared_libs: [
+ "android.hardware.graphics.mapper@3.0",
+ "libbase",
+ "libcutils",
+ "libdrm",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ "libOpenglCodecCommon",
+ "libOpenglSystemCommon",
+ ],
+ header_libs: ["libgralloc_cb.ranchu"],
+ include_dirs: [
+ "external/libdrm",
+ "external/minigbm/cros_gralloc",
+ "hardware/google/gfxstream/guest/include",
+ // "hardware/google/gfxstream/guest/iostream/include/libOpenglRender" does not exist.
+ "hardware/google/gfxstream/guest/platform/include",
+ "hardware/google/gfxstream/guest/renderControl_enc",
+ "hardware/google/gfxstream/guest/GoldfishAddressSpace/include",
+ "hardware/google/gfxstream/guest/OpenglCodecCommon",
+ "hardware/google/gfxstream/guest/OpenglSystemCommon",
+ ],
+ cflags: ["-DVIRTIO_GPU"],
+}
+
+cc_binary {
+ name: "android.hardware.graphics.allocator@3.0-service.ranchu",
+ defaults: ["android.hardware.graphics_defaults"],
+ srcs: ["allocator3.cpp"],
+ init_rc: ["android.hardware.graphics.allocator@3.0-service.ranchu.rc"],
+ vintf_fragments: ["android.hardware.graphics.gralloc3.ranchu.xml"],
+ shared_libs: [
+ "android.hardware.graphics.allocator@3.0",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.graphics.mapper@3.0-impl-ranchu",
+ defaults: ["android.hardware.graphics_defaults"],
+ srcs: ["mapper3.cpp"],
+ shared_libs: [
+ "libsync",
+ "libandroidemu",
],
}
diff --git a/system/hals/Android.mk b/system/hals/Android.mk
deleted file mode 100644
index 1c5ed510..00000000
--- a/system/hals/Android.mk
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Copyright 2015 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := android.hardware.graphics.allocator@3.0-service.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 := allocator3.cpp
-LOCAL_INIT_RC := android.hardware.graphics.allocator@3.0-service.ranchu.rc
-LOCAL_VINTF_FRAGMENTS := android.hardware.graphics.gralloc3.ranchu.xml
-
-LOCAL_SHARED_LIBRARIES += \
- android.hardware.graphics.allocator@3.0 \
- android.hardware.graphics.mapper@3.0 \
- libOpenglSystemCommon \
- libOpenglCodecCommon$(GOLDFISH_OPENGL_LIB_SUFFIX) \
- libbase \
- libcutils \
- libhidlbase \
- liblog \
- libutils \
-
-LOCAL_STATIC_LIBRARIES += libqemupipe.ranchu libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX)
-LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
-
-LOCAL_C_INCLUDES += \
- hardware/google/gfxstream/guest/GoldfishAddressSpace/include \
- hardware/google/gfxstream/guest/include \
- hardware/google/gfxstream/guest/platform/include \
- hardware/google/gfxstream/guest/iostream/include/libOpenglRender \
- hardware/google/gfxstream/guest/OpenglCodecCommon \
- hardware/google/gfxstream/guest/OpenglSystemCommon \
- hardware/google/gfxstream/guest/renderControl_enc \
-
-LOCAL_CFLAGS += -DVIRTIO_GPU
-LOCAL_C_INCLUDES += external/libdrm external/minigbm/cros_gralloc
-LOCAL_SHARED_LIBRARIES += libdrm
-
-include $(BUILD_EXECUTABLE)
-
-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
-
-# android.hardware.graphics.allocator@3.0 \
-
-LOCAL_SHARED_LIBRARIES += \
- android.hardware.graphics.mapper@3.0 \
- libOpenglSystemCommon \
- libOpenglCodecCommon$(GOLDFISH_OPENGL_LIB_SUFFIX) \
- libbase \
- libcutils \
- libhidlbase \
- liblog \
- libutils \
- libsync \
- libandroidemu \
-
-LOCAL_STATIC_LIBRARIES += libqemupipe.ranchu libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX)
-LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
-
-LOCAL_C_INCLUDES += \
- hardware/google/gfxstream/guest/GoldfishAddressSpace/include \
- hardware/google/gfxstream/guest/include \
- hardware/google/gfxstream/guest/platform/include \
- hardware/google/gfxstream/guest/iostream/include/libOpenglRender \
- hardware/google/gfxstream/guest/OpenglCodecCommon \
- hardware/google/gfxstream/guest/OpenglSystemCommon \
- hardware/google/gfxstream/guest/renderControl_enc \
-
-LOCAL_CFLAGS += -DVIRTIO_GPU
-LOCAL_C_INCLUDES += external/libdrm external/minigbm/cros_gralloc
-LOCAL_SHARED_LIBRARIES += libdrm
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/system/hwc3/GuestFrameComposer.cpp b/system/hwc3/GuestFrameComposer.cpp
index f4c92678..24002b89 100644
--- a/system/hwc3/GuestFrameComposer.cpp
+++ b/system/hwc3/GuestFrameComposer.cpp
@@ -480,44 +480,25 @@ HWC3::Error GuestFrameComposer::onDisplayCreate(Display* display) {
DisplayInfo& displayInfo = mDisplayInfos[displayId];
- uint32_t bufferStride;
- buffer_handle_t bufferHandle;
-
- auto status = ::android::GraphicBufferAllocator::get().allocate(
- static_cast<uint32_t>(displayWidth), //
- static_cast<uint32_t>(displayHeight), //
- ::android::PIXEL_FORMAT_RGBA_8888, //
- /*layerCount=*/1, //
- ::android::GraphicBuffer::USAGE_HW_COMPOSER |
- ::android::GraphicBuffer::USAGE_SW_READ_OFTEN |
- ::android::GraphicBuffer::USAGE_SW_WRITE_OFTEN, //
- &bufferHandle, //
- &bufferStride, //
- "RanchuHwc");
- if (status != ::android::OK) {
- ALOGE("%s: failed to allocate composition buffer for display:%" PRIu32, __FUNCTION__,
- displayId);
- return HWC3::Error::NoResources;
- }
-
- displayInfo.compositionResultBuffer = bufferHandle;
-
- auto [drmBufferCreateError, drmBuffer] = mDrmClient.create(bufferHandle);
- if (drmBufferCreateError != HWC3::Error::None) {
- ALOGE("%s: failed to create drm buffer for display:%" PRIu32, __FUNCTION__, displayId);
- return drmBufferCreateError;
- }
- displayInfo.compositionResultDrmBuffer = std::move(drmBuffer);
+ displayInfo.swapchain = DrmSwapchain::create(static_cast<uint32_t>(displayWidth),
+ static_cast<uint32_t>(displayHeight),
+ ::android::GraphicBuffer::USAGE_HW_COMPOSER |
+ ::android::GraphicBuffer::USAGE_SW_READ_OFTEN |
+ ::android::GraphicBuffer::USAGE_SW_WRITE_OFTEN,
+ &mDrmClient);
if (displayId == 0) {
+ auto compositionResult = displayInfo.swapchain->getNextImage();
auto [flushError, flushSyncFd] =
- mDrmClient.flushToDisplay(displayId, displayInfo.compositionResultDrmBuffer, -1);
+ mDrmClient.flushToDisplay(displayId, compositionResult->getDrmBuffer(), -1);
if (flushError != HWC3::Error::None) {
ALOGW(
"%s: Initial display flush failed. HWComposer assuming that we are "
"running in QEMU without a display and disabling presenting.",
__FUNCTION__);
mPresentDisabled = true;
+ } else {
+ compositionResult->markAsInUse(std::move(flushSyncFd));
}
}
@@ -534,14 +515,10 @@ HWC3::Error GuestFrameComposer::onDisplayDestroy(Display* display) {
auto it = mDisplayInfos.find(displayId);
if (it == mDisplayInfos.end()) {
- ALOGE("%s: display:%" PRIu64 " missing display buffers?", __FUNCTION__, displayId);
+ ALOGE("%s: display:%" PRIu64 " missing display buffers?", __FUNCTION__,
+ displayId);
return HWC3::Error::BadDisplay;
}
-
- DisplayInfo& displayInfo = mDisplayInfos[displayId];
-
- ::android::GraphicBufferAllocator::get().free(displayInfo.compositionResultBuffer);
-
mDisplayInfos.erase(it);
return HWC3::Error::None;
@@ -686,19 +663,23 @@ HWC3::Error GuestFrameComposer::presentDisplay(
DisplayInfo& displayInfo = it->second;
- if (displayInfo.compositionResultBuffer == nullptr) {
- ALOGE("%s: display:%" PRIu32 " missing composition result buffer", __FUNCTION__, displayId);
+ auto compositionResult = displayInfo.swapchain->getNextImage();
+ compositionResult->wait();
+
+ if (compositionResult->getBuffer() == nullptr) {
+ ALOGE("%s: display:%" PRIu32 " missing composition result buffer",
+ __FUNCTION__, displayId);
return HWC3::Error::NoResources;
}
- if (displayInfo.compositionResultDrmBuffer == nullptr) {
- ALOGE("%s: display:%" PRIu32 " missing composition result drm buffer", __FUNCTION__,
- displayId);
+ if (compositionResult->getDrmBuffer() == nullptr) {
+ ALOGE("%s: display:%" PRIu32 " missing composition result drm buffer",
+ __FUNCTION__, displayId);
return HWC3::Error::NoResources;
}
std::optional<GrallocBuffer> compositionResultBufferOpt =
- mGralloc.Import(displayInfo.compositionResultBuffer);
+ mGralloc.Import(compositionResult->getBuffer());
if (!compositionResultBufferOpt) {
ALOGE("%s: display:%" PRIu32 " failed to import buffer", __FUNCTION__, displayId);
return HWC3::Error::NoResources;
@@ -830,15 +811,19 @@ HWC3::Error GuestFrameComposer::presentDisplay(
}
}
- DEBUG_LOG("%s display:%" PRIu32 " flushing drm buffer", __FUNCTION__, displayId);
+ DEBUG_LOG("%s display:%" PRIu32 " flushing drm buffer", __FUNCTION__,
+ displayId);
- auto [error, fence] =
- mDrmClient.flushToDisplay(displayId, displayInfo.compositionResultDrmBuffer, -1);
+ auto [error, fence] = mDrmClient.flushToDisplay(displayId, compositionResult->getDrmBuffer(), -1);
if (error != HWC3::Error::None) {
- ALOGE("%s: display:%" PRIu32 " failed to flush drm buffer" PRIu64, __FUNCTION__, displayId);
+ ALOGE("%s: display:%" PRIu32 " failed to flush drm buffer" PRIu64,
+ __FUNCTION__, displayId);
}
*outDisplayFence = std::move(fence);
+ compositionResult->markAsInUse(outDisplayFence->ok()
+ ? ::android::base::unique_fd(dup(*outDisplayFence))
+ : ::android::base::unique_fd());
return error;
}
diff --git a/system/hwc3/GuestFrameComposer.h b/system/hwc3/GuestFrameComposer.h
index 2d2ca202..9a054f10 100644
--- a/system/hwc3/GuestFrameComposer.h
+++ b/system/hwc3/GuestFrameComposer.h
@@ -21,6 +21,7 @@
#include "Common.h"
#include "Display.h"
#include "DrmClient.h"
+#include "DrmSwapchain.h"
#include "FrameComposer.h"
#include "Gralloc.h"
#include "Layer.h"
@@ -84,15 +85,14 @@ class GuestFrameComposer : public FrameComposer {
std::uint32_t dstBufferBytesPerPixel);
struct DisplayInfo {
- // Additional per display buffer for the composition result.
- buffer_handle_t compositionResultBuffer = nullptr;
-
- std::shared_ptr<DrmBuffer> compositionResultDrmBuffer;
+ // Additional per display buffers for the composition result.
+ std::unique_ptr<DrmSwapchain> swapchain = {};
// Scratch storage space for intermediate images during composition.
AlternatingImageStorage compositionIntermediateStorage;
};
+
std::unordered_map<int64_t, DisplayInfo> mDisplayInfos;
Gralloc mGralloc;