Snap for 6533464 from 952139b7026354a72017356c35b7a4894050b341 to sdk-release
Change-Id: I393d45d0b5bdd8689686489459be58fdb917c2c4
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..482e5a6
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 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.
+ */
+
+soong_namespace {}
diff --git a/Android.mk b/Android.mk
index 7afa40a..90d028b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -130,6 +130,9 @@
# Note that the build system will complain if you try to import a
# module that hasn't been declared yet anyway.
#
+include $(GOLDFISH_OPENGL_PATH)/shared/qemupipe/Android.mk
+include $(GOLDFISH_OPENGL_PATH)/shared/gralloc_cb/Android.mk
+include $(GOLDFISH_OPENGL_PATH)/shared/GoldfishAddressSpace/Android.mk
include $(GOLDFISH_OPENGL_PATH)/shared/OpenglCodecCommon/Android.mk
# Encoder shared libraries
@@ -154,8 +157,6 @@
include $(GOLDFISH_OPENGL_PATH)/system/hals/Android.mk
endif
-include $(GOLDFISH_OPENGL_PATH)/system/cbmanager/Android.mk
-
include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
ifeq (true,$(BUILD_EMULATOR_VULKAN)) # Vulkan libs
diff --git a/BUILD.gn b/BUILD.gn
index 0e2fea1..62cb990 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -28,14 +28,19 @@
"android-emu/android/base/threads/AndroidWorkPool.cpp",
"android-emu/android/base/Tracing.cpp",
"android-emu/android/base/Tracing.h",
+ "shared/GoldfishAddressSpace/goldfish_address_space.cpp",
+ "shared/GoldfishAddressSpace/goldfish_address_space.h",
"shared/OpenglCodecCommon/ChecksumCalculator.cpp",
"shared/OpenglCodecCommon/ChecksumCalculator.h",
"shared/OpenglCodecCommon/glUtils.cpp",
"shared/OpenglCodecCommon/glUtils.h",
- "shared/OpenglCodecCommon/goldfish_address_space.cpp",
- "shared/OpenglCodecCommon/goldfish_address_space.h",
"shared/OpenglCodecCommon/goldfish_dma.cpp",
"shared/OpenglCodecCommon/goldfish_dma.h",
+ "shared/gralloc_cb/include/gralloc_cb_bp.h",
+ "shared/qemupipe/include/qemu_pipe_bp.h",
+ "shared/qemupipe/include-types/qemu_pipe_types_bp.h",
+ "shared/qemupipe/qemu_pipe_common.cpp",
+ "shared/qemupipe/qemu_pipe_guest.cpp",
"system/OpenglSystemCommon/AddressSpaceStream.cpp",
"system/OpenglSystemCommon/HostConnection.cpp",
"system/OpenglSystemCommon/HostConnection.h",
@@ -77,7 +82,11 @@
include_dirs = [
"android-emu",
"host/include/libOpenglRender",
+ "shared/GoldfishAddressSpace/include",
"shared/OpenglCodecCommon",
+ "shared/gralloc_cb/include",
+ "shared/qemupipe/include",
+ "shared/qemupipe/include-types",
"system/OpenglSystemCommon",
"system/renderControl_enc",
"system/vulkan_enc",
@@ -131,12 +140,12 @@
deps = [
"//sdk/fidl/fuchsia.hardware.goldfish",
- "//zircon/system/fidl/fuchsia-sysmem",
- "//zircon/public/lib/trace-with-static-engine",
- "//zircon/public/lib/syslog-static",
+ "//sdk/fidl/fuchsia.logger:fuchsia.logger_llcpp",
+ "//sdk/fidl/fuchsia.sysmem",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxio",
- "//zircon/system/fidl/fuchsia-logger:llcpp",
+ "//zircon/system/ulib/syslog:syslog-static",
+ "//zircon/system/ulib/trace:trace-with-static-engine",
]
defines += [
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c58ad1..80c99c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,10 @@
# instead run make from .../device/generic/goldfish-opengl
# which will re-generate this file.
set(GOLDFISH_DEVICE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
-android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/./Android.mk" "c8e5536771d09cd120c3e396beac994a1e2d2880f37b4e3bd1844be4cfc31555")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/./Android.mk" "a370ddecca4c7d13811527b2f1f30e2f0ef5153a58edeb36eeb306c41efb9158")
+add_subdirectory(shared/qemupipe)
+add_subdirectory(shared/gralloc_cb)
+add_subdirectory(shared/GoldfishAddressSpace)
add_subdirectory(shared/OpenglCodecCommon)
add_subdirectory(system/GLESv1_enc)
add_subdirectory(system/GLESv2_enc)
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+ license_type: NOTICE
+}
diff --git a/android-emu/Android.bp b/android-emu/Android.bp
new file mode 100644
index 0000000..68df03e
--- /dev/null
+++ b/android-emu/Android.bp
@@ -0,0 +1,35 @@
+cc_library_shared {
+ name: "libandroidemu",
+ vendor: true,
+ srcs: [
+ "android/base/AlignedBuf.cpp",
+ "android/base/files/MemStream.cpp",
+ "android/base/files/Stream.cpp",
+ "android/base/files/StreamSerializing.cpp",
+ "android/base/Pool.cpp",
+ "android/base/ring_buffer.c",
+ "android/base/StringFormat.cpp",
+ "android/base/AndroidSubAllocator.cpp",
+ "android/base/synchronization/AndroidMessageChannel.cpp",
+ "android/base/threads/AndroidFunctorThread.cpp",
+ "android/base/threads/AndroidThreadStore.cpp",
+ "android/base/threads/AndroidThread_pthread.cpp",
+ "android/base/threads/AndroidWorkPool.cpp",
+ "android/base/Tracing.cpp",
+ "android/utils/debug.c",
+ ],
+ shared_libs: [
+ "libcutils",
+ "libutils",
+ "liblog",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+ cflags: [
+ "-DLOG_TAG=\"androidemu\"",
+ "-Wno-missing-field-initializers",
+ "-fvisibility=default",
+ "-fstrict-aliasing",
+ ],
+}
diff --git a/android-emu/Android.mk b/android-emu/Android.mk
index 4be199b..ef67ddc 100644
--- a/android-emu/Android.mk
+++ b/android-emu/Android.mk
@@ -1,3 +1,4 @@
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
LOCAL_PATH := $(call my-dir)
$(call emugl-begin-shared-library,libandroidemu)
@@ -28,3 +29,4 @@
android/utils/debug.c \
$(call emugl-end-module)
+endif
diff --git a/android-emu/CMakeLists.txt b/android-emu/CMakeLists.txt
index f490697..cfdf39b 100644
--- a/android-emu/CMakeLists.txt
+++ b/android-emu/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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}/android-emu/Android.mk" "e7c9acc2277e7c651d6e722f96705a1fd445441b5ab6bb5b6d5b4c46dddfc702")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/android-emu/Android.mk" "bd7f25228f5fed42d7a66a35c585d88bd77221db773a6aeb42403089703819e9")
set(androidemu_src android/base/AlignedBuf.cpp android/base/files/MemStream.cpp android/base/files/Stream.cpp android/base/files/StreamSerializing.cpp android/base/Pool.cpp android/base/ring_buffer.c android/base/StringFormat.cpp android/base/AndroidSubAllocator.cpp android/base/synchronization/AndroidMessageChannel.cpp android/base/threads/AndroidFunctorThread.cpp android/base/threads/AndroidThreadStore.cpp android/base/threads/AndroidThread_pthread.cpp android/base/threads/AndroidWorkPool.cpp android/base/Tracing.cpp android/utils/debug.c)
android_add_library(TARGET androidemu SHARED LICENSE Apache-2.0 SRC android/base/AlignedBuf.cpp android/base/files/MemStream.cpp android/base/files/Stream.cpp android/base/files/StreamSerializing.cpp android/base/Pool.cpp android/base/ring_buffer.c android/base/StringFormat.cpp android/base/AndroidSubAllocator.cpp android/base/synchronization/AndroidMessageChannel.cpp android/base/threads/AndroidFunctorThread.cpp android/base/threads/AndroidThreadStore.cpp android/base/threads/AndroidThread_pthread.cpp android/base/threads/AndroidWorkPool.cpp android/base/Tracing.cpp android/utils/debug.c)
target_include_directories(androidemu PRIVATE ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
target_compile_definitions(androidemu PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"androidemu\"")
target_compile_options(androidemu PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-fstrict-aliasing")
-target_link_libraries(androidemu PRIVATE cutils utils log OpenglCodecCommon_host android-emu-shared)
\ No newline at end of file
+target_link_libraries(androidemu PRIVATE cutils utils log OpenglCodecCommon_host android-emu-shared PRIVATE qemupipe_host)
\ No newline at end of file
diff --git a/android-emu/android/base/AlignedBuf.h b/android-emu/android/base/AlignedBuf.h
index fc74e32..5955fa1 100644
--- a/android-emu/android/base/AlignedBuf.h
+++ b/android-emu/android/base/AlignedBuf.h
@@ -1,13 +1,16 @@
// Copyright 2018 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/Compiler.h b/android-emu/android/base/Compiler.h
index ddfd992..00261b0 100644
--- a/android-emu/android/base/Compiler.h
+++ b/android-emu/android/base/Compiler.h
@@ -1,13 +1,16 @@
// Copyright 2014 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/EnumFlags.h b/android-emu/android/base/EnumFlags.h
index fec56b9..1597dda 100644
--- a/android-emu/android/base/EnumFlags.h
+++ b/android-emu/android/base/EnumFlags.h
@@ -1,13 +1,16 @@
// Copyright 2015 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/Optional.h b/android-emu/android/base/Optional.h
index c599828..4ed0c39 100644
--- a/android-emu/android/base/Optional.h
+++ b/android-emu/android/base/Optional.h
@@ -1,13 +1,16 @@
// Copyright 2015-2016 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/StringFormat.cpp b/android-emu/android/base/StringFormat.cpp
index 73a0e7a..58fb947 100644
--- a/android-emu/android/base/StringFormat.cpp
+++ b/android-emu/android/base/StringFormat.cpp
@@ -1,13 +1,16 @@
// Copyright 2014 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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 "android/base/StringFormat.h"
diff --git a/android-emu/android/base/StringFormat.h b/android-emu/android/base/StringFormat.h
index 184ee5f..d0fd3df 100644
--- a/android-emu/android/base/StringFormat.h
+++ b/android-emu/android/base/StringFormat.h
@@ -1,13 +1,16 @@
// Copyright 2014 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/StringView.h b/android-emu/android/base/StringView.h
index f97ac5f..a6d9a61 100644
--- a/android-emu/android/base/StringView.h
+++ b/android-emu/android/base/StringView.h
@@ -1,13 +1,16 @@
// Copyright 2014 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/Tracing.cpp b/android-emu/android/base/Tracing.cpp
index ff72093..a4c097f 100644
--- a/android-emu/android/base/Tracing.cpp
+++ b/android-emu/android/base/Tracing.cpp
@@ -37,7 +37,7 @@
#elif __Fuchsia__
#ifndef FUCHSIA_NO_TRACE
-#include <trace/event.h>
+#include <lib/trace/event.h>
#endif
#define VK_TRACE_TAG "gfx"
diff --git a/android-emu/android/base/containers/SmallVector.h b/android-emu/android/base/containers/SmallVector.h
index dc49a70..92e2d27 100644
--- a/android-emu/android/base/containers/SmallVector.h
+++ b/android-emu/android/base/containers/SmallVector.h
@@ -1,13 +1,16 @@
// Copyright 2016 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/files/MemStream.cpp b/android-emu/android/base/files/MemStream.cpp
index 4f8291f..f2b0055 100644
--- a/android-emu/android/base/files/MemStream.cpp
+++ b/android-emu/android/base/files/MemStream.cpp
@@ -1,13 +1,16 @@
// Copyright 2015 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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 "android/base/files/MemStream.h"
diff --git a/android-emu/android/base/files/MemStream.h b/android-emu/android/base/files/MemStream.h
index e256a68..5c5b0f6 100644
--- a/android-emu/android/base/files/MemStream.h
+++ b/android-emu/android/base/files/MemStream.h
@@ -1,13 +1,16 @@
// Copyright 2015 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/files/Stream.cpp b/android-emu/android/base/files/Stream.cpp
index dd4c9ef..db34ed3 100644
--- a/android-emu/android/base/files/Stream.cpp
+++ b/android-emu/android/base/files/Stream.cpp
@@ -1,13 +1,16 @@
// Copyright 2015 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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 "android/base/files/Stream.h"
diff --git a/android-emu/android/base/files/Stream.h b/android-emu/android/base/files/Stream.h
index 8e2b0a0..3a5632e 100644
--- a/android-emu/android/base/files/Stream.h
+++ b/android-emu/android/base/files/Stream.h
@@ -1,13 +1,16 @@
// Copyright 2015 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/base/files/StreamSerializing.cpp b/android-emu/android/base/files/StreamSerializing.cpp
index 2a9d77a..d88a1fc 100644
--- a/android-emu/android/base/files/StreamSerializing.cpp
+++ b/android-emu/android/base/files/StreamSerializing.cpp
@@ -1,13 +1,16 @@
// Copyright 2017 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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 "android/base/files/StreamSerializing.h"
diff --git a/android-emu/android/base/files/StreamSerializing.h b/android-emu/android/base/files/StreamSerializing.h
index 8e56a6e..56613f5 100644
--- a/android-emu/android/base/files/StreamSerializing.h
+++ b/android-emu/android/base/files/StreamSerializing.h
@@ -1,13 +1,16 @@
// Copyright 2017 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/utils/compiler.h b/android-emu/android/utils/compiler.h
index 0d72fee..fae0918 100644
--- a/android-emu/android/utils/compiler.h
+++ b/android-emu/android/utils/compiler.h
@@ -1,13 +1,16 @@
// Copyright 2014 The Android Open Source Project
//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
+// 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
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// 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.
#pragma once
diff --git a/android-emu/android/utils/debug.c b/android-emu/android/utils/debug.c
index 238bd87..27ad1d6 100644
--- a/android-emu/android/utils/debug.c
+++ b/android-emu/android/utils/debug.c
@@ -1,14 +1,16 @@
-/* Copyright (C) 2007-2008 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-*/
+// Copyright 2007-2008 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 "android/utils/debug.h"
#include <fcntl.h>
diff --git a/android-emu/android/utils/debug.h b/android-emu/android/utils/debug.h
index a6cdc02..be1c1b2 100644
--- a/android-emu/android/utils/debug.h
+++ b/android-emu/android/utils/debug.h
@@ -1,14 +1,16 @@
-/* Copyright (C) 2007-2008 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-*/
+// Copyright 2007-2008 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.
#pragma once
diff --git a/cmake_transform.py b/cmake_transform.py
index 3583ec8..298e454 100644
--- a/cmake_transform.py
+++ b/cmake_transform.py
@@ -106,7 +106,7 @@
flags = [escape(d) for d in module['cflags'] if not d.startswith('-D')]
# Make sure we remove the lib prefix from all our dependencies.
- libs = [remove_lib_prefix(l) for l in module['libs']]
+ libs = [remove_lib_prefix(l) for l in module.get('libs', [])]
staticlibs = [remove_lib_prefix(l) for l in
module.get('staticlibs', [])
if l != "libandroidemu"]
diff --git a/host/include/libOpenglRender/IOStream.h b/host/include/libOpenglRender/IOStream.h
index 159da1d..93954ab 100644
--- a/host/include/libOpenglRender/IOStream.h
+++ b/host/include/libOpenglRender/IOStream.h
@@ -93,6 +93,9 @@
return readFully(buf, len);
}
+ // These two methods are defined and used in GLESv2_enc. Any reference
+ // outside of GLESv2_enc will produce a link error. This is intentional
+ // (technical debt).
void readbackPixels(void* context, int width, int height, unsigned int format, unsigned int type, void* pixels);
void uploadPixels(void* context, int width, int height, unsigned int format, unsigned int type, const void* pixels);
diff --git a/shared/GoldfishAddressSpace/Android.bp b/shared/GoldfishAddressSpace/Android.bp
new file mode 100644
index 0000000..6dcdb56
--- /dev/null
+++ b/shared/GoldfishAddressSpace/Android.bp
@@ -0,0 +1,16 @@
+cc_library_static {
+ name: "libGoldfishAddressSpace",
+ vendor: true,
+ srcs: [
+ "goldfish_address_space.cpp",
+ ],
+ shared_libs: [
+ "liblog",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+ cflags: [
+ "-DLOG_TAG=\"goldfish-address-space\"",
+ ],
+}
diff --git a/shared/GoldfishAddressSpace/Android.mk b/shared/GoldfishAddressSpace/Android.mk
new file mode 100644
index 0000000..221ea8b
--- /dev/null
+++ b/shared/GoldfishAddressSpace/Android.mk
@@ -0,0 +1,15 @@
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+
+LOCAL_PATH := $(call my-dir)
+
+$(call emugl-begin-static-library,libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX))
+
+LOCAL_SRC_FILES := goldfish_address_space.cpp
+
+LOCAL_CFLAGS += -DLOG_TAG=\"goldfish-address-space\"
+
+$(call emugl-export,SHARED_LIBRARIES,liblog android-emu-shared)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
+$(call emugl-end-module)
+
+endif
diff --git a/shared/GoldfishAddressSpace/CMakeLists.txt b/shared/GoldfishAddressSpace/CMakeLists.txt
new file mode 100644
index 0000000..c89a436
--- /dev/null
+++ b/shared/GoldfishAddressSpace/CMakeLists.txt
@@ -0,0 +1,10 @@
+# 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}/shared/GoldfishAddressSpace/Android.mk" "2b12d7f8c4c62c3a909b9771662cf18c9e4d16c58c95a11e225fe2b46432e862")
+set(GoldfishAddressSpace_host_src goldfish_address_space.cpp)
+android_add_library(TARGET GoldfishAddressSpace_host LICENSE Apache-2.0 SRC goldfish_address_space.cpp)
+target_include_directories(GoldfishAddressSpace_host PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_compile_definitions(GoldfishAddressSpace_host PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"goldfish-address-space\"")
+target_compile_options(GoldfishAddressSpace_host PRIVATE "-fvisibility=default" "-Wno-unused-parameter")
+target_link_libraries(GoldfishAddressSpace_host PRIVATE log android-emu-shared)
\ No newline at end of file
diff --git a/shared/OpenglCodecCommon/goldfish_address_space.cpp b/shared/GoldfishAddressSpace/goldfish_address_space.cpp
similarity index 100%
rename from shared/OpenglCodecCommon/goldfish_address_space.cpp
rename to shared/GoldfishAddressSpace/goldfish_address_space.cpp
diff --git a/shared/OpenglCodecCommon/goldfish_address_space.h b/shared/GoldfishAddressSpace/include/goldfish_address_space.h
similarity index 89%
rename from shared/OpenglCodecCommon/goldfish_address_space.h
rename to shared/GoldfishAddressSpace/include/goldfish_address_space.h
index 66a2522..044e18a 100644
--- a/shared/OpenglCodecCommon/goldfish_address_space.h
+++ b/shared/GoldfishAddressSpace/include/goldfish_address_space.h
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2018 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// 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.
#ifndef ANDROID_INCLUDE_HARDWARE_GOLDFISH_ADDRESS_SPACE_H
#define ANDROID_INCLUDE_HARDWARE_GOLDFISH_ADDRESS_SPACE_H
diff --git a/shared/OpenglCodecCommon/goldfish_address_space_android.impl b/shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl
similarity index 99%
rename from shared/OpenglCodecCommon/goldfish_address_space_android.impl
rename to shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl
index 1ee59f7..8ff7e78 100644
--- a/shared/OpenglCodecCommon/goldfish_address_space_android.impl
+++ b/shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl
@@ -25,11 +25,7 @@
#include <errno.h>
#include <memory>
-#if PLATFORM_SDK_VERSION < 26
-#include <cutils/log.h>
-#else
#include <log/log.h>
-#endif
#include "goldfish_address_space.h"
diff --git a/shared/OpenglCodecCommon/goldfish_address_space_fuchsia.impl b/shared/GoldfishAddressSpace/include/goldfish_address_space_fuchsia.impl
similarity index 100%
rename from shared/OpenglCodecCommon/goldfish_address_space_fuchsia.impl
rename to shared/GoldfishAddressSpace/include/goldfish_address_space_fuchsia.impl
diff --git a/shared/OpenglCodecCommon/goldfish_address_space_host.impl b/shared/GoldfishAddressSpace/include/goldfish_address_space_host.impl
similarity index 100%
rename from shared/OpenglCodecCommon/goldfish_address_space_host.impl
rename to shared/GoldfishAddressSpace/include/goldfish_address_space_host.impl
diff --git a/shared/OpenglCodecCommon/Android.bp b/shared/OpenglCodecCommon/Android.bp
deleted file mode 100644
index e56dfcd..0000000
--- a/shared/OpenglCodecCommon/Android.bp
+++ /dev/null
@@ -1,5 +0,0 @@
-cc_library_headers {
- name: "goldfish_pipe_headers",
- vendor_available: true,
- export_include_dirs: ["."],
-}
diff --git a/shared/OpenglCodecCommon/Android.mk b/shared/OpenglCodecCommon/Android.mk
index af7c65d..d9970d5 100644
--- a/shared/OpenglCodecCommon/Android.mk
+++ b/shared/OpenglCodecCommon/Android.mk
@@ -13,13 +13,11 @@
SocketStream.cpp \
TcpStream.cpp \
auto_goldfish_dma_context.cpp \
- goldfish_address_space.cpp \
ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
commonSources += \
goldfish_dma_host.cpp \
- qemu_pipe_host.cpp \
else
@@ -31,6 +29,12 @@
### CodecCommon guest ##############################################
$(call emugl-begin-shared-library,libOpenglCodecCommon$(GOLDFISH_OPENGL_LIB_SUFFIX))
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+$(call emugl-import,libqemupipe$(GOLDFISH_OPENGL_LIB_SUFFIX))
+else
+$(call emugl-export,STATIC_LIBRARIES,libqemupipe.ranchu)
+endif
+
LOCAL_SRC_FILES := $(commonSources)
LOCAL_CFLAGS += -DLOG_TAG=\"eglCodecCommon\"
diff --git a/shared/OpenglCodecCommon/CMakeLists.txt b/shared/OpenglCodecCommon/CMakeLists.txt
index 4528e13..6a1ac4a 100644
--- a/shared/OpenglCodecCommon/CMakeLists.txt
+++ b/shared/OpenglCodecCommon/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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}/shared/OpenglCodecCommon/Android.mk" "b93e7098601bba92b0e1b4d4a94cee25d2181a9842c7902d5f339c405c862cea")
-set(OpenglCodecCommon_host_src GLClientState.cpp GLESTextureUtils.cpp ChecksumCalculator.cpp GLSharedGroup.cpp glUtils.cpp IndexRangeCache.cpp SocketStream.cpp TcpStream.cpp auto_goldfish_dma_context.cpp goldfish_address_space.cpp goldfish_dma_host.cpp qemu_pipe_host.cpp)
-android_add_library(TARGET OpenglCodecCommon_host SHARED LICENSE Apache-2.0 SRC GLClientState.cpp GLESTextureUtils.cpp ChecksumCalculator.cpp GLSharedGroup.cpp glUtils.cpp IndexRangeCache.cpp SocketStream.cpp TcpStream.cpp auto_goldfish_dma_context.cpp goldfish_address_space.cpp goldfish_dma_host.cpp qemu_pipe_host.cpp)
-target_include_directories(OpenglCodecCommon_host PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon/Android.mk" "87f5c2c694647e3a38b4da1b4c653b99cd27d934b60ecd43aff59d3765daabfd")
+set(OpenglCodecCommon_host_src GLClientState.cpp GLESTextureUtils.cpp ChecksumCalculator.cpp GLSharedGroup.cpp glUtils.cpp IndexRangeCache.cpp SocketStream.cpp TcpStream.cpp auto_goldfish_dma_context.cpp goldfish_dma_host.cpp)
+android_add_library(TARGET OpenglCodecCommon_host SHARED LICENSE Apache-2.0 SRC GLClientState.cpp GLESTextureUtils.cpp ChecksumCalculator.cpp GLSharedGroup.cpp glUtils.cpp IndexRangeCache.cpp SocketStream.cpp TcpStream.cpp auto_goldfish_dma_context.cpp goldfish_dma_host.cpp)
+target_include_directories(OpenglCodecCommon_host PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${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)
target_compile_definitions(OpenglCodecCommon_host PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"eglCodecCommon\"")
target_compile_options(OpenglCodecCommon_host PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-unused-private-field")
-target_link_libraries(OpenglCodecCommon_host PRIVATE android-emu-shared cutils utils log)
\ No newline at end of file
+target_link_libraries(OpenglCodecCommon_host PRIVATE android-emu-shared cutils utils log PRIVATE qemupipe_host)
\ No newline at end of file
diff --git a/shared/OpenglCodecCommon/ErrorLog.h b/shared/OpenglCodecCommon/ErrorLog.h
index fa2b0a2..7f693b7 100644
--- a/shared/OpenglCodecCommon/ErrorLog.h
+++ b/shared/OpenglCodecCommon/ErrorLog.h
@@ -17,11 +17,7 @@
#define _ERROR_LOG_H_
#if defined(__ANDROID__)
-# if PLATFORM_SDK_VERSION < 26
-# include <cutils/log.h>
-# else
-# include <log/log.h>
-# endif
+# include <log/log.h>
# define ERR(...) ALOGE(__VA_ARGS__)
# ifdef EMUGL_DEBUG
# define DBG(...) ALOGD(__VA_ARGS__)
@@ -29,7 +25,7 @@
# define DBG(...) ((void)0)
# endif
#else
-# include <stdio.h>
+# include <stdio.h>
# define ERR(...) fprintf(stderr, __VA_ARGS__)
# ifdef EMUGL_DEBUG
# define DBG(...) fprintf(stderr, __VA_ARGS__)
diff --git a/shared/OpenglCodecCommon/FixedBuffer.h b/shared/OpenglCodecCommon/FixedBuffer.h
deleted file mode 100644
index 8c34749..0000000
--- a/shared/OpenglCodecCommon/FixedBuffer.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* Copyright (C) 2011 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.
-*/
-#ifndef _FIXED_BUFFER_H
-#define _FIXED_BUFFER_H
-
-#if PLATFORM_SDK_VERSION < 26
-#include <cutils/log.h>
-#else
-#include <log/log.h>
-#endif
-
-class FixedBuffer {
-public:
- FixedBuffer(size_t initialSize = 0) {
- m_buffer = NULL;
- m_bufferLen = initialSize;
- alloc(m_bufferLen);
- }
-
- ~FixedBuffer() {
- delete [] m_buffer;
- m_bufferLen = 0;
- }
-
- void * alloc(size_t size) {
- if (m_bufferLen >= size)
- return (void *)(m_buffer);
-
- if (m_buffer != NULL)
- delete[] m_buffer;
-
- m_bufferLen = size;
- m_buffer = new unsigned char[m_bufferLen];
- if (m_buffer == NULL)
- m_bufferLen = 0;
-
- return m_buffer;
- }
- void *ptr() { return m_buffer; }
- size_t len() { return m_bufferLen; }
-private:
- unsigned char *m_buffer;
- size_t m_bufferLen;
-};
-
-#endif
diff --git a/shared/OpenglCodecCommon/GLSharedGroup.cpp b/shared/OpenglCodecCommon/GLSharedGroup.cpp
index 46d94a9..5273e4c 100755
--- a/shared/OpenglCodecCommon/GLSharedGroup.cpp
+++ b/shared/OpenglCodecCommon/GLSharedGroup.cpp
@@ -25,11 +25,13 @@
BufferData::BufferData(GLsizeiptr size, const void* data) :
m_size(size), m_usage(0), m_mapped(false) {
- void * buffer = NULL;
+ if (size > 0) {
+ m_fixedBuffer.resize(size);
+ }
- if (size>0) buffer = m_fixedBuffer.alloc(size);
-
- if (data) memcpy(buffer, data, size);
+ if (data) {
+ memcpy(m_fixedBuffer.data(), data, size);
+ }
}
/**** ProgramData ****/
@@ -271,7 +273,7 @@
return GL_INVALID_VALUE;
}
- memcpy((char*)buf->m_fixedBuffer.ptr() + offset, data, size);
+ memcpy(&buf->m_fixedBuffer[offset], data, size);
buf->m_indexRangeCache.invalidateRange((size_t)offset, (size_t)size);
return GL_NO_ERROR;
diff --git a/shared/OpenglCodecCommon/GLSharedGroup.h b/shared/OpenglCodecCommon/GLSharedGroup.h
index d471795..bbee27a 100755
--- a/shared/OpenglCodecCommon/GLSharedGroup.h
+++ b/shared/OpenglCodecCommon/GLSharedGroup.h
@@ -37,7 +37,6 @@
#include <stdlib.h>
#include "ErrorLog.h"
#include <utils/threads.h>
-#include "FixedBuffer.h"
#include "auto_goldfish_dma_context.h"
#include "IndexRangeCache.h"
#include "SmartPtr.h"
@@ -58,7 +57,7 @@
uint64_t m_guest_paddr;
// Internal bookkeeping
- FixedBuffer m_fixedBuffer; // actual buffer is shadowed here
+ std::vector<char> m_fixedBuffer; // actual buffer is shadowed here
IndexRangeCache m_indexRangeCache;
// DMA support
diff --git a/shared/OpenglCodecCommon/auto_goldfish_dma_context.cpp b/shared/OpenglCodecCommon/auto_goldfish_dma_context.cpp
index 280262d..c638c2b 100644
--- a/shared/OpenglCodecCommon/auto_goldfish_dma_context.cpp
+++ b/shared/OpenglCodecCommon/auto_goldfish_dma_context.cpp
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2018 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// 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 "auto_goldfish_dma_context.h"
diff --git a/shared/OpenglCodecCommon/auto_goldfish_dma_context.h b/shared/OpenglCodecCommon/auto_goldfish_dma_context.h
index 7d97fc2..c8ee738 100644
--- a/shared/OpenglCodecCommon/auto_goldfish_dma_context.h
+++ b/shared/OpenglCodecCommon/auto_goldfish_dma_context.h
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2018 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// 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.
#ifndef ANDROID_INCLUDE_HARDWARE_AUTO_GOLDFISH_DMA_CONTEXT_H
#define ANDROID_INCLUDE_HARDWARE_AUTO_GOLDFISH_DMA_CONTEXT_H
diff --git a/shared/OpenglCodecCommon/glUtils.cpp b/shared/OpenglCodecCommon/glUtils.cpp
index 58ca392..a0ec240 100644
--- a/shared/OpenglCodecCommon/glUtils.cpp
+++ b/shared/OpenglCodecCommon/glUtils.cpp
@@ -417,8 +417,7 @@
s = 16;
break;
default:
- ERR("glUtilsParamSize: unknow param 0x%08x\n", param);
- s = 1; // assume 1
+ s = 1; // assume 1 for everything else
}
return s;
}
diff --git a/shared/OpenglCodecCommon/goldfish_dma.cpp b/shared/OpenglCodecCommon/goldfish_dma.cpp
index dbb1f8d..f3cefec 100644
--- a/shared/OpenglCodecCommon/goldfish_dma.cpp
+++ b/shared/OpenglCodecCommon/goldfish_dma.cpp
@@ -1,19 +1,20 @@
-/*
- * Copyright (C) 2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// Copyright 2016 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 "goldfish_dma.h"
-#include "qemu_pipe.h"
+
+#include <qemu_pipe_bp.h>
#if PLATFORM_SDK_VERSION < 26
#include <cutils/log.h>
@@ -32,6 +33,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
/* There is an ioctl associated with goldfish dma driver.
* Make it conflict with ioctls that are not likely to be used
diff --git a/shared/OpenglCodecCommon/goldfish_dma.h b/shared/OpenglCodecCommon/goldfish_dma.h
index ee3df59..278e035 100644
--- a/shared/OpenglCodecCommon/goldfish_dma.h
+++ b/shared/OpenglCodecCommon/goldfish_dma.h
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// Copyright 2016 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.
#ifndef ANDROID_INCLUDE_HARDWARE_GOLDFISH_DMA_H
#define ANDROID_INCLUDE_HARDWARE_GOLDFISH_DMA_H
diff --git a/shared/OpenglCodecCommon/qemu_pipe.h b/shared/OpenglCodecCommon/qemu_pipe.h
deleted file mode 100644
index 55ebb74..0000000
--- a/shared/OpenglCodecCommon/qemu_pipe.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-#ifndef ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H
-#define ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H
-
-#include <sys/types.h>
-#include <stdint.h>
-#include <errno.h>
-
-#ifdef HOST_BUILD
-
-#ifndef QEMU_PIPE_RETRY
-#define QEMU_PIPE_RETRY TEMP_FAILURE_RETRY
-#endif
-
-typedef void* QEMU_PIPE_HANDLE;
-
-#define QEMU_PIPE_INVALID_HANDLE NULL
-
-QEMU_PIPE_HANDLE qemu_pipe_open(const char* pipeName);
-void qemu_pipe_close(QEMU_PIPE_HANDLE pipe);
-
-ssize_t qemu_pipe_read(QEMU_PIPE_HANDLE pipe, void* buffer, size_t len);
-ssize_t qemu_pipe_write(QEMU_PIPE_HANDLE pipe, const void* buffer, size_t len);
-
-bool qemu_pipe_try_again();
-bool qemu_pipe_valid(QEMU_PIPE_HANDLE pipe);
-
-void qemu_pipe_print_error(QEMU_PIPE_HANDLE pipe);
-
-#else
-
-typedef int QEMU_PIPE_HANDLE;
-
-#define QEMU_PIPE_INVALID_HANDLE (-1)
-
-#ifndef QEMU_PIPE_RETRY
-#define QEMU_PIPE_RETRY(exp) ({ \
- __typeof__(exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && (errno == EINTR || errno == EAGAIN)); \
- _rc; }) \
-
-#endif
-
-#ifndef QEMU_PIPE_PATH
-#define QEMU_PIPE_PATH "/dev/qemu_pipe"
-#endif
-
-#if PLATFORM_SDK_VERSION < 26
-#include <cutils/log.h>
-#else
-#include <log/log.h>
-#endif
-#ifdef __ANDROID__
-#include <sys/cdefs.h>
-#endif
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <pthread.h> /* for pthread_once() */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifndef D
-# define D(...) do{}while(0)
-#endif
-
-/* Try to open a new Qemu fast-pipe. This function returns a file descriptor
- * that can be used to communicate with a named service managed by the
- * emulator.
- *
- * This file descriptor can be used as a standard pipe/socket descriptor.
- *
- * 'pipeName' is the name of the emulator service you want to connect to.
- * E.g. 'opengles' or 'camera'.
- *
- * On success, return a valid file descriptor
- * Returns -1 on error, and errno gives the error code, e.g.:
- *
- * EINVAL -> unknown/unsupported pipeName
- * ENOSYS -> fast pipes not available in this system.
- *
- * ENOSYS should never happen, except if you're trying to run within a
- * misconfigured emulator.
- *
- * You should be able to open several pipes to the same pipe service,
- * except for a few special cases (e.g. GSM modem), where EBUSY will be
- * returned if more than one client tries to connect to it.
- */
-
-static __inline__ ssize_t
-qemu_pipe_write_fully(QEMU_PIPE_HANDLE pipe, const void* buffer, ssize_t len);
-
-static __inline__ QEMU_PIPE_HANDLE
-qemu_pipe_open_ns(const char* ns, const char* pipeName, int flags) {
- char buff[256];
- int buffLen;
- QEMU_PIPE_HANDLE fd;
-
- if (pipeName == NULL || pipeName[0] == '\0') {
- errno = EINVAL;
- return -1;
- }
-
- if (ns) {
- buffLen = snprintf(buff, sizeof(buff), "pipe:%s:%s", ns, pipeName);
- } else {
- buffLen = snprintf(buff, sizeof(buff), "pipe:%s", pipeName);
- }
-
- fd = QEMU_PIPE_RETRY(open(QEMU_PIPE_PATH, flags));
- if (fd < 0 && errno == ENOENT) {
- fd = QEMU_PIPE_RETRY(open("/dev/goldfish_pipe", flags));
- }
- if (fd < 0) {
- D("%s: Could not open " QEMU_PIPE_PATH ": %s", __FUNCTION__, strerror(errno));
- //errno = ENOSYS;
- return -1;
- }
-
- if (qemu_pipe_write_fully(fd, buff, buffLen + 1)) {
- D("%s: Could not connect to %s pipe service: %s", __FUNCTION__, pipeName, strerror(errno));
- return -1;
- }
-
- return fd;
-}
-
-static __inline__ QEMU_PIPE_HANDLE
-qemu_pipe_open(const char* pipeName) {
- return qemu_pipe_open_ns(NULL, pipeName, O_RDWR | O_NONBLOCK);
-}
-
-static __inline__ void
-qemu_pipe_close(QEMU_PIPE_HANDLE pipe) {
- close(pipe);
-}
-
-static __inline__ ssize_t
-qemu_pipe_read(QEMU_PIPE_HANDLE pipe, void* buffer, size_t len) {
- return read(pipe, buffer, len);
-}
-
-static __inline__ ssize_t
-qemu_pipe_write(QEMU_PIPE_HANDLE pipe, const void* buffer, size_t len) {
- return write(pipe, buffer, len);
-}
-
-static __inline__ bool
-qemu_pipe_try_again() {
- return errno == EINTR || errno == EAGAIN;
-}
-
-static __inline__ bool
-qemu_pipe_valid(QEMU_PIPE_HANDLE pipe) {
- return pipe >= 0;
-}
-
-static __inline__ void
-qemu_pipe_print_error(QEMU_PIPE_HANDLE pipe) {
- ALOGE("pipe error: fd %d errno %d", pipe, errno);
-}
-
-
-#endif // !HOST_BUILD
-
-#ifndef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(exp) ({ \
- __typeof__(exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; })
-#endif
-
-static __inline__ ssize_t
-qemu_pipe_read_fully(QEMU_PIPE_HANDLE pipe, void* buffer, ssize_t len) {
- char* p = (char*)buffer;
-
- while (len > 0) {
- ssize_t n = QEMU_PIPE_RETRY(qemu_pipe_read(pipe, p, len));
- if (n < 0) return n;
-
- p += n;
- len -= n;
- }
-
- return 0;
-}
-
-static __inline__ ssize_t
-qemu_pipe_write_fully(QEMU_PIPE_HANDLE pipe, const void* buffer, ssize_t len) {
- const char* p = (const char*)buffer;
-
- while (len > 0) {
- ssize_t n = QEMU_PIPE_RETRY(qemu_pipe_write(pipe, p, len));
- if (n < 0) return n;
-
- p += n;
- len -= n;
- }
-
- return 0;
-}
-
-#endif /* ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H */
diff --git a/shared/gralloc_cb/Android.bp b/shared/gralloc_cb/Android.bp
new file mode 100644
index 0000000..faea798
--- /dev/null
+++ b/shared/gralloc_cb/Android.bp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 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_headers {
+ name: "libgralloc_cb.ranchu",
+ vendor_available: true,
+ export_include_dirs: ["include"],
+ header_libs: [
+ "libcutils_headers",
+ "libqemupipe-types.ranchu",
+ ],
+ export_header_lib_headers: [
+ "libcutils_headers",
+ "libqemupipe-types.ranchu"
+ ],
+}
diff --git a/shared/gralloc_cb/Android.mk b/shared/gralloc_cb/Android.mk
new file mode 100644
index 0000000..9c1f038
--- /dev/null
+++ b/shared/gralloc_cb/Android.mk
@@ -0,0 +1,10 @@
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+
+LOCAL_PATH := $(call my-dir)
+
+$(call emugl-begin-static-library,libgralloc_cb$(GOLDFISH_OPENGL_LIB_SUFFIX))
+LOCAL_SRC_FILES := empty.cpp
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
+$(call emugl-end-module)
+
+endif
diff --git a/shared/gralloc_cb/CMakeLists.txt b/shared/gralloc_cb/CMakeLists.txt
new file mode 100644
index 0000000..f9e7b71
--- /dev/null
+++ b/shared/gralloc_cb/CMakeLists.txt
@@ -0,0 +1,10 @@
+# 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}/shared/gralloc_cb/Android.mk" "8d9adf5ce35036abff985952ba984a3fcefcc2156ff36facfe51ba7d7adaab9d")
+set(gralloc_cb_host_src empty.cpp)
+android_add_library(TARGET gralloc_cb_host LICENSE Apache-2.0 SRC empty.cpp)
+target_include_directories(gralloc_cb_host PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_compile_definitions(gralloc_cb_host PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN")
+target_compile_options(gralloc_cb_host PRIVATE "-fvisibility=default" "-Wno-unused-parameter")
+target_link_libraries(gralloc_cb_host PRIVATE android-emu-shared)
\ No newline at end of file
diff --git a/shared/gralloc_cb/empty.cpp b/shared/gralloc_cb/empty.cpp
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/shared/gralloc_cb/empty.cpp
@@ -0,0 +1 @@
+/* empty */
diff --git a/shared/OpenglCodecCommon/gralloc_cb.h b/shared/gralloc_cb/include/gralloc_cb_bp.h
similarity index 98%
rename from shared/OpenglCodecCommon/gralloc_cb.h
rename to shared/gralloc_cb/include/gralloc_cb_bp.h
index 26d6026..259ed85 100644
--- a/shared/OpenglCodecCommon/gralloc_cb.h
+++ b/shared/gralloc_cb/include/gralloc_cb_bp.h
@@ -18,7 +18,7 @@
#define __GRALLOC_CB_H__
#include <cutils/native_handle.h>
-#include "qemu_pipe.h"
+#include <qemu_pipe_types_bp.h>
const uint32_t CB_HANDLE_MAGIC_MASK = 0xFFFFFFF0;
const uint32_t CB_HANDLE_MAGIC_BASE = 0xABFABFA0;
diff --git a/shared/qemupipe/Android.bp b/shared/qemupipe/Android.bp
new file mode 100644
index 0000000..fe72943
--- /dev/null
+++ b/shared/qemupipe/Android.bp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 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_headers {
+ name: "libqemupipe-types.ranchu",
+ vendor_available: true,
+ export_include_dirs: ["include-types"],
+}
+
+cc_library {
+ name: "libqemupipe.ranchu",
+ vendor_available: true,
+ srcs: [
+ "qemu_pipe_common.cpp",
+ "qemu_pipe_guest.cpp",
+ ],
+ header_libs: ["libqemupipe-types.ranchu"],
+ export_header_lib_headers: ["libqemupipe-types.ranchu"],
+ shared_libs: ["liblog"],
+ export_include_dirs: ["include"],
+}
diff --git a/shared/qemupipe/Android.mk b/shared/qemupipe/Android.mk
new file mode 100644
index 0000000..f665982
--- /dev/null
+++ b/shared/qemupipe/Android.mk
@@ -0,0 +1,16 @@
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+
+LOCAL_PATH := $(call my-dir)
+
+$(call emugl-begin-static-library,libqemupipe$(GOLDFISH_OPENGL_LIB_SUFFIX))
+
+LOCAL_SRC_FILES := \
+ qemu_pipe_common.cpp \
+ qemu_pipe_host.cpp
+
+$(call emugl-export,SHARED_LIBRARIES,android-emu-shared)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include-types)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
+$(call emugl-end-module)
+
+endif
diff --git a/shared/qemupipe/CMakeLists.txt b/shared/qemupipe/CMakeLists.txt
new file mode 100644
index 0000000..2229681
--- /dev/null
+++ b/shared/qemupipe/CMakeLists.txt
@@ -0,0 +1,10 @@
+# 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}/shared/qemupipe/Android.mk" "8554a162304f69cc357d5e35cf614ca278135bf4cea3431da69a08b9af234777")
+set(qemupipe_host_src qemu_pipe_common.cpp qemu_pipe_host.cpp)
+android_add_library(TARGET qemupipe_host LICENSE Apache-2.0 SRC qemu_pipe_common.cpp qemu_pipe_host.cpp)
+target_include_directories(qemupipe_host PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_compile_definitions(qemupipe_host PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN")
+target_compile_options(qemupipe_host PRIVATE "-fvisibility=default" "-Wno-unused-parameter")
+target_link_libraries(qemupipe_host PRIVATE android-emu-shared)
\ No newline at end of file
diff --git a/shared/qemupipe/include-types/qemu_pipe_types_bp.h b/shared/qemupipe/include-types/qemu_pipe_types_bp.h
new file mode 100644
index 0000000..d786fe5
--- /dev/null
+++ b/shared/qemupipe/include-types/qemu_pipe_types_bp.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#pragma once
+#include <stddef.h>
+#include <stdbool.h>
+
+#ifdef HOST_BUILD
+
+typedef void* QEMU_PIPE_HANDLE;
+#define QEMU_PIPE_INVALID_HANDLE NULL
+
+inline bool qemu_pipe_valid(QEMU_PIPE_HANDLE h) {
+ return h != QEMU_PIPE_INVALID_HANDLE;
+}
+
+#else // ifdef HOST_BUILD
+
+typedef int QEMU_PIPE_HANDLE;
+#define QEMU_PIPE_INVALID_HANDLE (-1)
+
+inline bool qemu_pipe_valid(QEMU_PIPE_HANDLE h) {
+ return h > QEMU_PIPE_INVALID_HANDLE;
+}
+
+#endif // ifdef HOST_BUILD
diff --git a/shared/qemupipe/include/qemu_pipe_bp.h b/shared/qemupipe/include/qemu_pipe_bp.h
new file mode 100644
index 0000000..4338ee5
--- /dev/null
+++ b/shared/qemupipe/include/qemu_pipe_bp.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#pragma once
+#include <qemu_pipe_types_bp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+QEMU_PIPE_HANDLE qemu_pipe_open_ns(const char* ns, const char* pipeName, int flags);
+QEMU_PIPE_HANDLE qemu_pipe_open(const char* pipeName);
+void qemu_pipe_close(QEMU_PIPE_HANDLE pipe);
+
+int qemu_pipe_read_fully(QEMU_PIPE_HANDLE pipe, void* buffer, int size);
+int qemu_pipe_write_fully(QEMU_PIPE_HANDLE pipe, const void* buffer, int size);
+int qemu_pipe_read(QEMU_PIPE_HANDLE pipe, void* buffer, int size);
+int qemu_pipe_write(QEMU_PIPE_HANDLE pipe, const void* buffer, int size);
+
+int qemu_pipe_try_again(int ret);
+void qemu_pipe_print_error(QEMU_PIPE_HANDLE pipe);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#define QEMU_PIPE_RETRY(exp) ({ \
+ __typeof__(exp) _rc; \
+ do { \
+ _rc = (exp); \
+ } while (qemu_pipe_try_again(_rc)); \
+ _rc; })
diff --git a/shared/qemupipe/qemu_pipe_common.cpp b/shared/qemupipe/qemu_pipe_common.cpp
new file mode 100644
index 0000000..859bd3f
--- /dev/null
+++ b/shared/qemupipe/qemu_pipe_common.cpp
@@ -0,0 +1,43 @@
+// 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 <qemu_pipe_bp.h>
+
+int qemu_pipe_read_fully(QEMU_PIPE_HANDLE pipe, void* buffer, int size) {
+ char* p = (char*)buffer;
+
+ while (size > 0) {
+ int n = QEMU_PIPE_RETRY(qemu_pipe_read(pipe, p, size));
+ if (n < 0) return n;
+
+ p += n;
+ size -= n;
+ }
+
+ return 0;
+}
+
+int qemu_pipe_write_fully(QEMU_PIPE_HANDLE pipe, const void* buffer, int size) {
+ const char* p = (const char*)buffer;
+
+ while (size > 0) {
+ int n = QEMU_PIPE_RETRY(qemu_pipe_write(pipe, p, size));
+ if (n < 0) return n;
+
+ p += n;
+ size -= n;
+ }
+
+ return 0;
+}
diff --git a/shared/qemupipe/qemu_pipe_guest.cpp b/shared/qemupipe/qemu_pipe_guest.cpp
new file mode 100644
index 0000000..1732a51
--- /dev/null
+++ b/shared/qemupipe/qemu_pipe_guest.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#include <errno.h>
+#include <log/log.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <qemu_pipe_bp.h>
+
+namespace {
+int open_verbose(const char* name, int flags) {
+ const int fd = QEMU_PIPE_RETRY(open(name, flags));
+ if (fd < 0) {
+ ALOGE("%s:%d: Could not open '%s': %s",
+ __func__, __LINE__, name, strerror(errno));
+ }
+ return fd;
+}
+
+} // namespace
+
+extern "C" {
+
+int qemu_pipe_open_ns(const char* ns, const char* pipeName, int flags) {
+ if (pipeName == NULL || pipeName[0] == '\0') {
+ errno = EINVAL;
+ return -1;
+ }
+
+ const int fd = open_verbose("/dev/goldfish_pipe", flags);
+ if (fd < 0) {
+ return fd;
+ }
+
+ char buf[256];
+ int bufLen;
+ if (ns) {
+ bufLen = snprintf(buf, sizeof(buf), "pipe:%s:%s", ns, pipeName);
+ } else {
+ bufLen = snprintf(buf, sizeof(buf), "pipe:%s", pipeName);
+ }
+
+ if (qemu_pipe_write_fully(fd, buf, bufLen + 1)) {
+ ALOGE("%s:%d: Could not connect to the '%s' service: %s",
+ __func__, __LINE__, buf, strerror(errno));
+ return -1;
+ }
+
+ return fd;
+}
+
+int qemu_pipe_open(const char* pipeName) {
+ return qemu_pipe_open_ns(NULL, pipeName, O_RDWR | O_NONBLOCK);
+}
+
+void qemu_pipe_close(int pipe) {
+ close(pipe);
+}
+
+int qemu_pipe_read(int pipe, void* buffer, int size) {
+ return read(pipe, buffer, size);
+}
+
+int qemu_pipe_write(int pipe, const void* buffer, int size) {
+ return write(pipe, buffer, size);
+}
+
+int qemu_pipe_try_again(int ret) {
+ return (ret < 0) && (errno == EINTR || errno == EAGAIN);
+}
+
+void qemu_pipe_print_error(int pipe) {
+ ALOGE("pipe error: fd %d errno %d", pipe, errno);
+}
+
+} // extern "C"
diff --git a/shared/OpenglCodecCommon/qemu_pipe_host.cpp b/shared/qemupipe/qemu_pipe_host.cpp
similarity index 77%
rename from shared/OpenglCodecCommon/qemu_pipe_host.cpp
rename to shared/qemupipe/qemu_pipe_host.cpp
index c53a8eb..38f2f63 100644
--- a/shared/OpenglCodecCommon/qemu_pipe_host.cpp
+++ b/shared/qemupipe/qemu_pipe_host.cpp
@@ -11,7 +11,8 @@
// 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 "qemu_pipe.h"
+
+#include <qemu_pipe_bp.h>
#include "android/emulation/hostdevices/HostGoldfishPipe.h"
@@ -33,21 +34,21 @@
HostGoldfishPipeDevice::get()->close(pipe);
}
-ssize_t qemu_pipe_read(QEMU_PIPE_HANDLE pipe, void* buffer, size_t len) {
+int qemu_pipe_read(QEMU_PIPE_HANDLE pipe, void* buffer, int len) {
return HostGoldfishPipeDevice::get()->read(pipe, buffer, len);
}
-ssize_t qemu_pipe_write(QEMU_PIPE_HANDLE pipe, const void* buffer, size_t len) {
+int qemu_pipe_write(QEMU_PIPE_HANDLE pipe, const void* buffer, int len) {
return HostGoldfishPipeDevice::get()->write(pipe, buffer, len);
}
-bool qemu_pipe_try_again() {
- int err = HostGoldfishPipeDevice::get()->getErrno();
- return err == EINTR || err == EAGAIN;
-}
-
-bool qemu_pipe_valid(QEMU_PIPE_HANDLE pipe) {
- return pipe != NULL;
+int qemu_pipe_try_again(int ret) {
+ if (ret < 0) {
+ int err = HostGoldfishPipeDevice::get()->getErrno();
+ return err == EINTR || err == EAGAIN;
+ } else {
+ return false;
+ }
}
void qemu_pipe_print_error(QEMU_PIPE_HANDLE pipe) {
diff --git a/system/GLESv1/CMakeLists.txt b/system/GLESv1/CMakeLists.txt
index a8dc669..5436e5f 100644
--- a/system/GLESv1/CMakeLists.txt
+++ b/system/GLESv1/CMakeLists.txt
@@ -4,7 +4,7 @@
android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/GLESv1/Android.mk" "e095cb082e3791719749cfc80b90560afd7348eb0d7895449d2509aa129bea75")
set(GLESv1_CM_emulation_src gl.cpp)
android_add_library(TARGET GLESv1_CM_emulation SHARED LICENSE Apache-2.0 SRC gl.cpp)
-target_include_directories(GLESv1_CM_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}/android-emu ${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}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(GLESv1_CM_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}/android-emu ${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}/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)
target_compile_definitions(GLESv1_CM_emulation PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"GLES_emulation\"")
target_compile_options(GLESv1_CM_emulation PRIVATE "-fvisibility=default" "-Wno-unused-parameter")
-target_link_libraries(GLESv1_CM_emulation PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host)
\ No newline at end of file
+target_link_libraries(GLESv1_CM_emulation PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/GLESv1_enc/CMakeLists.txt b/system/GLESv1_enc/CMakeLists.txt
index 8acc4ff..0a9bc52 100644
--- a/system/GLESv1_enc/CMakeLists.txt
+++ b/system/GLESv1_enc/CMakeLists.txt
@@ -4,7 +4,7 @@
android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc/Android.mk" "953e6b7371d10eed63a4be555f8f1fb6f347338484a78102fa8f55dff96f5d3b")
set(GLESv1_enc_src GLEncoder.cpp GLEncoderUtils.cpp gl_client_context.cpp gl_enc.cpp gl_entry.cpp)
android_add_library(TARGET GLESv1_enc SHARED LICENSE Apache-2.0 SRC GLEncoder.cpp GLEncoderUtils.cpp gl_client_context.cpp gl_enc.cpp gl_entry.cpp)
-target_include_directories(GLESv1_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(GLESv1_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${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)
target_compile_definitions(GLESv1_enc PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"emuglGLESv1_enc\"")
target_compile_options(GLESv1_enc PRIVATE "-fvisibility=default" "-Wno-unused-parameter")
-target_link_libraries(GLESv1_enc PRIVATE OpenglCodecCommon_host cutils utils log android-emu-shared)
\ No newline at end of file
+target_link_libraries(GLESv1_enc PRIVATE OpenglCodecCommon_host cutils utils log android-emu-shared PRIVATE qemupipe_host)
\ No newline at end of file
diff --git a/system/GLESv1_enc/GLEncoder.cpp b/system/GLESv1_enc/GLEncoder.cpp
index 1fa0dac..20f2c02 100644
--- a/system/GLESv1_enc/GLEncoder.cpp
+++ b/system/GLESv1_enc/GLEncoder.cpp
@@ -15,15 +15,9 @@
*/
#include "GLEncoder.h"
#include "glUtils.h"
-#include "FixedBuffer.h"
-
-#if PLATFORM_SDK_VERSION < 26
-#include <cutils/log.h>
-#else
#include <log/log.h>
-#endif
-
#include <assert.h>
+#include <vector>
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -584,7 +578,7 @@
} else {
BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, 0);
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
+ indices = &buf->m_fixedBuffer[(GLintptr)indices];
}
}
if (adjustIndices) {
@@ -596,7 +590,8 @@
case GL_UNSIGNED_BYTE:
GLUtils::minmax<unsigned char>((unsigned char *)indices, count, &minIndex, &maxIndex);
if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
+ ctx->m_fixedBuffer.resize(glSizeof(type) * count);
+ adjustedIndices = ctx->m_fixedBuffer.data();
GLUtils::shiftIndices<unsigned char>((unsigned char *)indices,
(unsigned char *)adjustedIndices,
count, -minIndex);
@@ -606,7 +601,8 @@
case GL_UNSIGNED_SHORT:
GLUtils::minmax<unsigned short>((unsigned short *)indices, count, &minIndex, &maxIndex);
if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
+ ctx->m_fixedBuffer.resize(glSizeof(type) * count);
+ adjustedIndices = ctx->m_fixedBuffer.data();
GLUtils::shiftIndices<unsigned short>((unsigned short *)indices,
(unsigned short *)adjustedIndices,
count, -minIndex);
@@ -616,7 +612,8 @@
case GL_UNSIGNED_INT:
GLUtils::minmax<unsigned int>((unsigned int *)indices, count, &minIndex, &maxIndex);
if (minIndex != 0) {
- adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
+ ctx->m_fixedBuffer.resize(glSizeof(type) * count);
+ adjustedIndices = ctx->m_fixedBuffer.data();
GLUtils::shiftIndices<unsigned int>((unsigned int *)indices,
(unsigned int *)adjustedIndices,
count, -minIndex);
diff --git a/system/GLESv1_enc/GLEncoder.h b/system/GLESv1_enc/GLEncoder.h
index 95537a2..a26636c 100644
--- a/system/GLESv1_enc/GLEncoder.h
+++ b/system/GLESv1_enc/GLEncoder.h
@@ -16,10 +16,11 @@
#ifndef _GL_ENCODER_H_
#define _GL_ENCODER_H_
+#include <vector>
+
#include "gl_enc.h"
#include "GLClientState.h"
#include "GLSharedGroup.h"
-#include "FixedBuffer.h"
#include "ChecksumCalculator.h"
class GLEncoder : public gl_encoder_context_t {
@@ -53,7 +54,7 @@
GLClientState *m_state;
GLSharedGroupPtr m_shared;
GLenum m_error;
- FixedBuffer m_fixedBuffer;
+ std::vector<char> m_fixedBuffer;
GLint *m_compressedTextureFormats;
GLint m_num_compressedTextureFormats;
diff --git a/system/GLESv2/CMakeLists.txt b/system/GLESv2/CMakeLists.txt
index e2f5f4e..d90502a 100644
--- a/system/GLESv2/CMakeLists.txt
+++ b/system/GLESv2/CMakeLists.txt
@@ -4,7 +4,7 @@
android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/GLESv2/Android.mk" "d8f9dda69ec57ad8b7a65f02c3335b16a4724f612dec1d1a2cd793c28c0a10f9")
set(GLESv2_emulation_src gl2.cpp)
android_add_library(TARGET GLESv2_emulation SHARED LICENSE Apache-2.0 SRC gl2.cpp)
-target_include_directories(GLESv2_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}/android-emu ${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}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(GLESv2_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}/android-emu ${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}/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)
target_compile_definitions(GLESv2_emulation PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"GLESv2_emulation\"")
target_compile_options(GLESv2_emulation PRIVATE "-fvisibility=default" "-Wno-unused-parameter")
-target_link_libraries(GLESv2_emulation PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host)
\ No newline at end of file
+target_link_libraries(GLESv2_emulation PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/GLESv2_enc/Android.mk b/system/GLESv2_enc/Android.mk
index af95736..40acfc5 100644
--- a/system/GLESv2_enc/Android.mk
+++ b/system/GLESv2_enc/Android.mk
@@ -10,7 +10,7 @@
gl2_client_context.cpp \
gl2_enc.cpp \
gl2_entry.cpp \
- ../enc_common/IOStream_common.cpp \
+ IOStream2.cpp \
LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv2_enc\"
LOCAL_CFLAGS += -Wno-unused-private-field
diff --git a/system/GLESv2_enc/CMakeLists.txt b/system/GLESv2_enc/CMakeLists.txt
index 72afa76..39a479f 100644
--- a/system/GLESv2_enc/CMakeLists.txt
+++ b/system/GLESv2_enc/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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/GLESv2_enc/Android.mk" "d4fc971ccdbafbf971253b27bbc2168682b2994476079f4f81fb7a33c27070e0")
-set(GLESv2_enc_src GL2EncoderUtils.cpp GL2Encoder.cpp GLESv2Validation.cpp gl2_client_context.cpp gl2_enc.cpp gl2_entry.cpp ../enc_common/IOStream_common.cpp)
-android_add_library(TARGET GLESv2_enc SHARED LICENSE Apache-2.0 SRC GL2EncoderUtils.cpp GL2Encoder.cpp GLESv2Validation.cpp gl2_client_context.cpp gl2_enc.cpp gl2_entry.cpp ../enc_common/IOStream_common.cpp)
-target_include_directories(GLESv2_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc/Android.mk" "df543672d1f36e43fb783b08200aa85dbf3a2e7167f8ecd7e4c01c80e6fd1650")
+set(GLESv2_enc_src GL2EncoderUtils.cpp GL2Encoder.cpp GLESv2Validation.cpp gl2_client_context.cpp gl2_enc.cpp gl2_entry.cpp IOStream2.cpp)
+android_add_library(TARGET GLESv2_enc SHARED LICENSE Apache-2.0 SRC GL2EncoderUtils.cpp GL2Encoder.cpp GLESv2Validation.cpp gl2_client_context.cpp gl2_enc.cpp gl2_entry.cpp IOStream2.cpp)
+target_include_directories(GLESv2_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
target_compile_definitions(GLESv2_enc PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"emuglGLESv2_enc\"")
target_compile_options(GLESv2_enc PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-unused-private-field")
-target_link_libraries(GLESv2_enc PRIVATE OpenglCodecCommon_host cutils utils log android-emu-shared)
\ No newline at end of file
+target_link_libraries(GLESv2_enc PRIVATE OpenglCodecCommon_host cutils utils log android-emu-shared PRIVATE qemupipe_host)
\ No newline at end of file
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index cc009a9..3ad9420 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -1119,7 +1119,8 @@
void* adjustedIndices = (void*)src;
if (minIndex != 0) {
- adjustedIndices = m_fixedBuffer.alloc(glSizeof(type) * count);
+ m_fixedBuffer.resize(glSizeof(type) * count);
+ adjustedIndices = m_fixedBuffer.data();
switch(type) {
case GL_BYTE:
case GL_UNSIGNED_BYTE:
@@ -1371,7 +1372,7 @@
if (ctx->m_state->currentIndexVbo() != 0) {
buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
offset = (GLintptr)indices;
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
+ indices = &buf->m_fixedBuffer[offset];
ctx->getBufferIndexRange(buf,
indices,
type,
@@ -1486,7 +1487,7 @@
} else {
buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
offset = (GLintptr)indices;
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
+ indices = &buf->m_fixedBuffer[offset];
ctx->getBufferIndexRange(buf,
indices,
type,
@@ -2937,7 +2938,7 @@
void* GL2Encoder::s_glMapBufferRangeAEMUImpl(GL2Encoder* ctx, GLenum target,
GLintptr offset, GLsizeiptr length,
GLbitfield access, BufferData* buf) {
- char* bits = (char*)buf->m_fixedBuffer.ptr() + offset;
+ char* bits = &buf->m_fixedBuffer[offset];
if ((access & GL_MAP_READ_BIT) ||
((access & GL_MAP_WRITE_BIT) &&
@@ -3048,7 +3049,7 @@
GLboolean host_res = GL_TRUE;
if (buf->dma_buffer.get().mapped_addr) {
- memcpy(static_cast<char*>(buf->m_fixedBuffer.ptr()) + buf->m_mappedOffset,
+ memcpy(&buf->m_fixedBuffer[buf->m_mappedOffset],
reinterpret_cast<void*>(buf->dma_buffer.get().mapped_addr),
buf->m_mappedLength);
@@ -3066,7 +3067,7 @@
buf->m_mappedOffset,
buf->m_mappedLength,
buf->m_mappedAccess,
- (void*)((char*)buf->m_fixedBuffer.ptr() + buf->m_mappedOffset),
+ &buf->m_fixedBuffer[buf->m_mappedOffset],
&host_res);
} else {
if (buf->m_mappedAccess & GL_MAP_WRITE_BIT) {
@@ -3075,7 +3076,7 @@
buf->m_mappedOffset,
buf->m_mappedLength,
buf->m_mappedAccess,
- (void*)((char*)buf->m_fixedBuffer.ptr() + buf->m_mappedOffset),
+ &buf->m_fixedBuffer[buf->m_mappedOffset],
&host_res);
}
}
@@ -3116,14 +3117,14 @@
totalOffset,
length,
buf->m_mappedAccess,
- (void*)((char*)buf->m_fixedBuffer.ptr() + totalOffset));
+ &buf->m_fixedBuffer[totalOffset]);
} else {
ctx->glFlushMappedBufferRangeAEMU(
ctx, target,
totalOffset,
length,
buf->m_mappedAccess,
- (void*)((char*)buf->m_fixedBuffer.ptr() + totalOffset));
+ &buf->m_fixedBuffer[totalOffset]);
}
}
@@ -3482,7 +3483,7 @@
if (!buf || !buf->m_mapped) { *params = NULL; return; }
- *params = (GLvoid*)((char*)buf->m_fixedBuffer.ptr() + buf->m_mappedOffset);
+ *params = &buf->m_fixedBuffer[buf->m_mappedOffset];
}
static const char* const kNameDelimiter = ";";
@@ -4174,7 +4175,7 @@
if (ctx->m_state->currentIndexVbo() != 0) {
buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
offset = (GLintptr)indices;
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
+ indices = &buf->m_fixedBuffer[offset];
ctx->getBufferIndexRange(buf,
indices,
type,
@@ -4264,13 +4265,13 @@
// caching previous results.
if (ctx->m_state->currentIndexVbo() != 0) {
buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
- ALOGV("%s: current index vbo: %p len %zu count %zu\n", __func__, buf, (size_t)buf->m_fixedBuffer.len(), (size_t)count);
+ ALOGV("%s: current index vbo: %p len %zu count %zu\n", __func__, buf, buf->m_fixedBuffer.size(), (size_t)count);
offset = (GLintptr)indices;
void* oldIndices = (void*)indices;
- indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices);
+ indices = &buf->m_fixedBuffer[offset];
ALOGV("%s: indices arg: %p buffer start: %p indices: %p\n", __func__,
(void*)(uintptr_t)(oldIndices),
- buf->m_fixedBuffer.ptr(),
+ buf->m_fixedBuffer.data(),
indices);
ctx->getBufferIndexRange(buf,
indices,
diff --git a/system/GLESv2_enc/GL2Encoder.h b/system/GLESv2_enc/GL2Encoder.h
index d016898..b85bc0d 100644
--- a/system/GLESv2_enc/GL2Encoder.h
+++ b/system/GLESv2_enc/GL2Encoder.h
@@ -16,10 +16,11 @@
#ifndef _GL2_ENCODER_H_
#define _GL2_ENCODER_H_
+#include <vector>
+
#include "gl2_enc.h"
#include "GLClientState.h"
#include "GLSharedGroup.h"
-#include "FixedBuffer.h"
#include <string>
#include <vector>
@@ -136,7 +137,7 @@
GLuint m_ssbo_offset_align;
GLuint m_ubo_offset_align;
- FixedBuffer m_fixedBuffer;
+ std::vector<char> m_fixedBuffer;
uint32_t m_drawCallFlushInterval;
uint32_t m_drawCallFlushCount;
diff --git a/system/enc_common/IOStream_common.cpp b/system/GLESv2_enc/IOStream2.cpp
similarity index 100%
rename from system/enc_common/IOStream_common.cpp
rename to system/GLESv2_enc/IOStream2.cpp
diff --git a/system/GLESv2_enc/gl2_enc.cpp b/system/GLESv2_enc/gl2_enc.cpp
index fb70443..de5033d 100644
--- a/system/GLESv2_enc/gl2_enc.cpp
+++ b/system/GLESv2_enc/gl2_enc.cpp
@@ -3344,7 +3344,7 @@
stream->writeFully(&__size_pixels,4);
if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
if (pixels != NULL) {
- stream->uploadPixels(self, width, height, format, type, pixels);
+ stream->uploadPixels(self, width, height, format, type, pixels);
if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
}
buf = stream->alloc(checksumSize);
@@ -3497,7 +3497,7 @@
stream->writeFully(&__size_pixels,4);
if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
if (pixels != NULL) {
- stream->uploadPixels(self, width, height, format, type, pixels);
+ stream->uploadPixels(self, width, height, format, type, pixels);
if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
}
buf = stream->alloc(checksumSize);
diff --git a/system/OpenglSystemCommon/Android.mk b/system/OpenglSystemCommon/Android.mk
index bb9e14f..fa24719 100644
--- a/system/OpenglSystemCommon/Android.mk
+++ b/system/OpenglSystemCommon/Android.mk
@@ -2,6 +2,15 @@
$(call emugl-begin-shared-library,libOpenglSystemCommon)
$(call emugl-import,libGLESv1_enc libGLESv2_enc lib_renderControl_enc)
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+$(call emugl-import,libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX))
+$(call emugl-import,libqemupipe$(GOLDFISH_OPENGL_LIB_SUFFIX))
+$(call emugl-import,libgralloc_cb$(GOLDFISH_OPENGL_LIB_SUFFIX))
+else
+$(call emugl-export,STATIC_LIBRARIES,libGoldfishAddressSpace)
+$(call emugl-export,STATIC_LIBRARIES,libqemupipe.ranchu)
+$(call emugl-export,HEADER_LIBRARIES,libgralloc_cb.ranchu)
+endif
LOCAL_SRC_FILES := \
FormatConversions.cpp \
diff --git a/system/OpenglSystemCommon/CMakeLists.txt b/system/OpenglSystemCommon/CMakeLists.txt
index 7feb903..ff4947a 100644
--- a/system/OpenglSystemCommon/CMakeLists.txt
+++ b/system/OpenglSystemCommon/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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/OpenglSystemCommon/Android.mk" "6fedb15afaabb2c4e6cd24123f711639d6574b47356b2fa626a668bb497b8977")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/Android.mk" "1a769e79e22604f569e4345e4f432bb4bd41ca810d479b69887007b5d9bec528")
set(OpenglSystemCommon_src FormatConversions.cpp HostConnection.cpp QemuPipeStream.cpp ProcessPipe.cpp AddressSpaceStream.cpp ThreadInfo_host.cpp)
android_add_library(TARGET OpenglSystemCommon SHARED LICENSE Apache-2.0 SRC FormatConversions.cpp HostConnection.cpp QemuPipeStream.cpp ProcessPipe.cpp AddressSpaceStream.cpp ThreadInfo_host.cpp)
-target_include_directories(OpenglSystemCommon PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon ${GOLDFISH_DEVICE_ROOT}/bionic/libc/platform ${GOLDFISH_DEVICE_ROOT}/bionic/libc/private ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/bionic-include ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/android-emu ${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}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(OpenglSystemCommon PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon ${GOLDFISH_DEVICE_ROOT}/bionic/libc/platform ${GOLDFISH_DEVICE_ROOT}/bionic/libc/private ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/bionic-include ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/android-emu ${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}/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)
target_compile_definitions(OpenglSystemCommon PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN")
target_compile_options(OpenglSystemCommon PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-unused-variable")
-target_link_libraries(OpenglSystemCommon PRIVATE android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host)
\ No newline at end of file
+target_link_libraries(OpenglSystemCommon PRIVATE android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/OpenglSystemCommon/FormatConversions.cpp b/system/OpenglSystemCommon/FormatConversions.cpp
index ca4286c..cc976ed 100644
--- a/system/OpenglSystemCommon/FormatConversions.cpp
+++ b/system/OpenglSystemCommon/FormatConversions.cpp
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// Copyright 2016 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 <hardware/gralloc.h>
#include "FormatConversions.h"
diff --git a/system/OpenglSystemCommon/FormatConversions.h b/system/OpenglSystemCommon/FormatConversions.h
index f9d7806..51aab6d 100644
--- a/system/OpenglSystemCommon/FormatConversions.h
+++ b/system/OpenglSystemCommon/FormatConversions.h
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// Copyright 2016 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.
#ifndef __GOLDFISH_FORMATCONVERSIONS_H__
#define __GOLDFISH_FORMATCONVERSIONS_H__
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index fbb946f..b9c97c9 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -66,8 +66,7 @@
#include "QemuPipeStream.h"
#include "TcpStream.h"
#include "ThreadInfo.h"
-
-#include "gralloc_cb.h"
+#include <gralloc_cb_bp.h>
#ifdef VIRTIO_GPU
diff --git a/system/OpenglSystemCommon/ProcessPipe.cpp b/system/OpenglSystemCommon/ProcessPipe.cpp
index 40cb298..84764f4 100644
--- a/system/OpenglSystemCommon/ProcessPipe.cpp
+++ b/system/OpenglSystemCommon/ProcessPipe.cpp
@@ -16,7 +16,8 @@
#include "ProcessPipe.h"
#include "renderControl_enc.h"
-#include "qemu_pipe.h"
+
+#include <qemu_pipe_bp.h>
#if PLATFORM_SDK_VERSION < 26
#include <cutils/log.h>
@@ -98,7 +99,7 @@
ALOGE("%s: failed write confirm int", __FUNCTION__);
return;
}
- status = pipe->Call(sizeof(confirmInt), 0, sizeof(sProcUID), 0, &status2, &actual);
+ status = pipe->DoCall(sizeof(confirmInt), 0, sizeof(sProcUID), 0, &status2, &actual);
if (status != ZX_OK || status2 != ZX_OK) {
ALOGD("%s: failed to get per-process ID: %d:%d", __FUNCTION__,
status, status2);
diff --git a/system/OpenglSystemCommon/QemuPipeStream.cpp b/system/OpenglSystemCommon/QemuPipeStream.cpp
index 57b60d1..d5fca2b 100644
--- a/system/OpenglSystemCommon/QemuPipeStream.cpp
+++ b/system/OpenglSystemCommon/QemuPipeStream.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "QemuPipeStream.h"
+#include <qemu_pipe_bp.h>
#if PLATFORM_SDK_VERSION < 26
#include <cutils/log.h>
@@ -105,43 +106,7 @@
int QemuPipeStream::writeFully(const void *buf, size_t len)
{
- //DBG(">> QemuPipeStream::writeFully %d\n", len);
- if (!valid()) return -1;
- if (!buf) {
- if (len>0) {
- // If len is non-zero, buf must not be NULL. Otherwise the pipe would be
- // in a corrupted state, which is lethal for the emulator.
- ERR("QemuPipeStream::writeFully failed, buf=NULL, len %zu,"
- " lethal error, exiting", len);
- abort();
- }
- return 0;
- }
-
- size_t res = len;
- int retval = 0;
-
- while (res > 0) {
- ssize_t stat = qemu_pipe_write(m_sock, (const char *)(buf) + (len - res), res);
- if (stat > 0) {
- res -= stat;
- continue;
- }
- if (stat == 0) { /* EOF */
- ERR("QemuPipeStream::writeFully failed: premature EOF\n");
- retval = -1;
- break;
- }
- if (qemu_pipe_try_again()) {
- continue;
- }
- retval = stat;
- ERR("QemuPipeStream::writeFully failed: %s, lethal error, exiting.\n",
- strerror(errno));
- abort();
- }
- //DBG("<< QemuPipeStream::writeFully %d\n", len );
- return retval;
+ return qemu_pipe_write_fully(m_sock, buf, len);
}
QEMU_PIPE_HANDLE QemuPipeStream::getSocket() const {
@@ -233,7 +198,7 @@
continue;
}
- if (!qemu_pipe_try_again()) {
+ if (!qemu_pipe_try_again(actual)) {
ALOGD("%s: Error reading from pipe: %d", __FUNCTION__, errno);
return NULL;
}
@@ -278,7 +243,7 @@
if (res == 0) { /* EOF */
break;
}
- if (qemu_pipe_try_again()) {
+ if (qemu_pipe_try_again(res)) {
continue;
}
diff --git a/system/OpenglSystemCommon/QemuPipeStream.h b/system/OpenglSystemCommon/QemuPipeStream.h
index 87638af..4e779eb 100644
--- a/system/OpenglSystemCommon/QemuPipeStream.h
+++ b/system/OpenglSystemCommon/QemuPipeStream.h
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include "IOStream.h"
-#include "qemu_pipe.h"
+#include <qemu_pipe_bp.h>
#ifdef __Fuchsia__
#include <fuchsia/hardware/goldfish/cpp/fidl.h>
diff --git a/system/OpenglSystemCommon/QemuPipeStreamFuchsia.cpp b/system/OpenglSystemCommon/QemuPipeStreamFuchsia.cpp
index 66dec13..5472f30 100644
--- a/system/OpenglSystemCommon/QemuPipeStreamFuchsia.cpp
+++ b/system/OpenglSystemCommon/QemuPipeStreamFuchsia.cpp
@@ -180,7 +180,7 @@
uint64_t actual = 0;
zx_status_t status2 = ZX_OK;
- zx_status_t status = m_pipe->Call(size, kWriteOffset, 0, 0, &status2, &actual);
+ zx_status_t status = m_pipe->DoCall(size, kWriteOffset, 0, 0, &status2, &actual);
if (status != ZX_OK || status2 != ZX_OK) {
ALOGD("%s: Pipe call failed: %d:%d", __FUNCTION__, status, status2);
return -1;
@@ -238,7 +238,7 @@
size_t maxRead = (m_readLeft || !remaining) ? 0 : kReadSize;
uint64_t actual = 0;
zx_status_t status2 = ZX_OK;
- zx_status_t status = m_pipe->Call(size, kWriteOffset, maxRead, 0, &status2, &actual);
+ zx_status_t status = m_pipe->DoCall(size, kWriteOffset, maxRead, 0, &status2, &actual);
if (status != ZX_OK) {
ALOGD("%s: Pipe call failed: %d", __FUNCTION__, status);
return nullptr;
diff --git a/system/cbmanager/Android.mk b/system/cbmanager/Android.mk
deleted file mode 100644
index 753f00a..0000000
--- a/system/cbmanager/Android.mk
+++ /dev/null
@@ -1,53 +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_CFLAGS += \
- -DLOG_TAG=\"cbmanager\" \
- -Werror \
-
-ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-LOCAL_CFLAGS += \
- -DHOST_BUILD \
-
-LOCAL_SRC_FILES := host.cpp
-else
-LOCAL_SHARED_LIBRARIES += \
- liblog \
- libcutils \
- libutils \
- libhidlbase \
- android.hardware.graphics.mapper@2.0 \
- android.hardware.graphics.mapper@3.0 \
- android.hardware.graphics.allocator@2.0 \
- android.hardware.graphics.allocator@3.0 \
-
-LOCAL_CFLAGS += \
- -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
-
-LOCAL_SRC_FILES := hidl.cpp
-
-endif
-
-LOCAL_C_INCLUDES += \
- device/generic/goldfish-opengl/system/include \
- device/generic/goldfish-opengl/shared/OpenglCodecCommon \
-
-LOCAL_MODULE := libcbmanager
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/system/cbmanager/debug.h b/system/cbmanager/debug.h
deleted file mode 100644
index 23899bd..0000000
--- a/system/cbmanager/debug.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_DEBUG_H
-#define ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_DEBUG_H
-
-#include <log/log.h>
-
-#define CRASH(MSG) \
- do { \
- ALOGE("%s:%d crashed with '%s'", __func__, __LINE__, MSG); \
- ::abort(); \
- } while (false)
-
-#define CRASH_IF(COND, MSG) \
- do { \
- if ((COND)) { \
- ALOGE("%s:%d crashed on '%s' with '%s'", __func__, __LINE__, #COND, MSG); \
- ::abort(); \
- } \
- } while (false)
-
-#define RETURN_ERROR_CODE(X) \
- do { \
- ALOGE("%s:%d failed with '%s' (%d)", \
- __func__, __LINE__, strerror(-(X)), -(X)); \
- return (X); \
- } while (false)
-
-#define RETURN_ERROR(X) \
- do { \
- ALOGE("%s:%d failed with '%s'", __func__, __LINE__, #X); \
- return (X); \
- } while (false)
-
-#define RETURN(X) return (X)
-
-#endif // ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_DEBUG_H
diff --git a/system/cbmanager/hidl.cpp b/system/cbmanager/hidl.cpp
deleted file mode 100644
index 46b6b1b..0000000
--- a/system/cbmanager/hidl.cpp
+++ /dev/null
@@ -1,387 +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.
- */
-
-#include <cutils/native_handle.h>
-#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
-#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
-#include <android/hardware/graphics/mapper/2.0/IMapper.h>
-#include <android/hardware/graphics/mapper/3.0/IMapper.h>
-#include <log/log.h>
-
-#include "cbmanager.h"
-#include "debug.h"
-
-namespace android {
-namespace {
-using hardware::hidl_handle;
-using hardware::hidl_vec;
-
-namespace IMapper2ns = hardware::graphics::mapper::V2_0;
-namespace IMapper3ns = hardware::graphics::mapper::V3_0;
-namespace IAllocator2ns = hardware::graphics::allocator::V2_0;
-namespace IAllocator3ns = hardware::graphics::allocator::V3_0;
-
-class CbManagerHidlV3Impl : public CbManager::CbManagerImpl {
-public:
- typedef CbManager::BufferUsage BufferUsage;
- typedef CbManager::PixelFormat PixelFormat;
- typedef CbManager::YCbCrLayout YCbCrLayout;
- typedef hardware::hidl_bitfield<BufferUsage> BufferUsageBits;
-
- CbManagerHidlV3Impl(sp<IMapper3ns::IMapper> mapper,
- sp<IAllocator3ns::IAllocator> allocator)
- : mMapper(mapper), mAllocator(allocator) {}
-
- native_handle_t* allocateBuffer(int width, int height,
- PixelFormat format, BufferUsageBits usage) {
- using IMapper3ns::Error;
- using IMapper3ns::BufferDescriptor;
-
- IMapper3ns::IMapper::BufferDescriptorInfo descriptor_info;
- descriptor_info.width = width;
- descriptor_info.height = height;
- descriptor_info.layerCount = 1;
- descriptor_info.format =
- static_cast<hardware::graphics::common::V1_2::PixelFormat>(format);
- descriptor_info.usage = usage;
- Error hidl_err = Error::NONE;
-
- BufferDescriptor descriptor;
- mMapper->createDescriptor(descriptor_info,
- [&](const Error &_error,
- const BufferDescriptor &_descriptor) {
- hidl_err = _error;
- descriptor = _descriptor;
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- hidl_handle raw_handle = nullptr;
- mAllocator->allocate(descriptor, 1,
- [&](const Error &_error,
- uint32_t _stride,
- const hidl_vec<hidl_handle> &_buffers) {
- hidl_err = _error;
- (void)_stride;
- raw_handle = _buffers[0];
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- native_handle_t *buf = nullptr;
- mMapper->importBuffer(raw_handle, [&](const Error &_error,
- void *_buf) {
- hidl_err = _error;
- buf = static_cast<native_handle_t*>(_buf);
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- RETURN(buf);
- }
-
- void freeBuffer(const native_handle_t* _h) {
- using IMapper2ns::Error;
-
- native_handle_t* h = const_cast<native_handle_t*>(_h);
-
- mMapper->freeBuffer(h);
- native_handle_close(h);
- native_handle_delete(h);
- }
-
- int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- using IMapper3ns::Error;
-
- Error hidl_err = Error::NONE;
- mMapper->lock(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, vaddr](const Error &_error,
- void* _ptr,
- int32_t /*bytesPerPixel*/,
- int32_t /*bytesPerStride*/) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- *vaddr = _ptr;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- using IMapper3ns::Error;
- typedef IMapper3ns::YCbCrLayout YCbCrLayout3;
-
- Error hidl_err = Error::NONE;
- mMapper->lockYCbCr(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, ycbcr](const Error &_error,
- const YCbCrLayout3 &_ycbcr) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- ycbcr->y = _ycbcr.y;
- ycbcr->cb = _ycbcr.cb;
- ycbcr->cr = _ycbcr.cr;
- ycbcr->yStride = _ycbcr.yStride;
- ycbcr->cStride = _ycbcr.cStride;
- ycbcr->chromaStep = _ycbcr.chromaStep;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int unlockBuffer(native_handle_t& handle) {
- using IMapper3ns::Error;
-
- Error hidl_err = Error::NONE;
- int fence = -1;
- mMapper->unlock(
- &handle,
- [&hidl_err, &fence](const Error &_error,
- const hidl_handle &_fence) {
- hidl_err = _error;
- (void)_fence;
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
-private:
- const sp<IMapper3ns::IMapper> mMapper;
- const sp<IAllocator3ns::IAllocator> mAllocator;
-};
-
-class CbManagerHidlV2Impl : public CbManager::CbManagerImpl {
-public:
- typedef CbManager::BufferUsage BufferUsage;
- typedef CbManager::PixelFormat PixelFormat;
- typedef CbManager::YCbCrLayout YCbCrLayout;
- typedef hardware::hidl_bitfield<BufferUsage> BufferUsageBits;
-
- CbManagerHidlV2Impl(sp<IMapper2ns::IMapper> mapper,
- sp<IAllocator2ns::IAllocator> allocator)
- : mMapper(mapper), mAllocator(allocator) {}
-
- native_handle_t* allocateBuffer(int width, int height,
- PixelFormat format, BufferUsageBits usage) {
- using IMapper2ns::Error;
- using IMapper2ns::BufferDescriptor;
-
- IMapper2ns::IMapper::BufferDescriptorInfo descriptor_info;
- descriptor_info.width = width;
- descriptor_info.height = height;
- descriptor_info.layerCount = 1;
- descriptor_info.format = format;
- descriptor_info.usage = usage;
- Error hidl_err = Error::NONE;
-
- BufferDescriptor descriptor;
- mMapper->createDescriptor(descriptor_info,
- [&](const Error &_error,
- const BufferDescriptor &_descriptor) {
- hidl_err = _error;
- descriptor = _descriptor;
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- hidl_handle raw_handle = nullptr;
- mAllocator->allocate(descriptor, 1,
- [&](const Error &_error,
- uint32_t _stride,
- const hidl_vec<hidl_handle> &_buffers) {
- hidl_err = _error;
- (void)_stride;
- raw_handle = _buffers[0];
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- native_handle_t *buf = nullptr;
- mMapper->importBuffer(raw_handle, [&](const Error &_error,
- void *_buf) {
- hidl_err = _error;
- buf = static_cast<native_handle_t*>(_buf);
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- RETURN(buf);
- }
-
- void freeBuffer(const native_handle_t* _h) {
- using IMapper2ns::Error;
-
- native_handle_t* h = const_cast<native_handle_t*>(_h);
-
- mMapper->freeBuffer(h);
- native_handle_close(h);
- native_handle_delete(h);
- }
-
- int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- using IMapper2ns::Error;
-
- Error hidl_err = Error::NONE;
- mMapper->lock(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, vaddr](const Error &_error,
- void* _ptr) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- *vaddr = _ptr;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- using IMapper2ns::Error;
-
- Error hidl_err = Error::NONE;
- mMapper->lockYCbCr(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, ycbcr](const Error &_error,
- const YCbCrLayout &_ycbcr) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- *ycbcr = _ycbcr;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int unlockBuffer(native_handle_t& handle) {
- using IMapper2ns::Error;
-
- Error hidl_err = Error::NONE;
- int fence = -1;
- mMapper->unlock(
- &handle,
- [&hidl_err, &fence](const Error &_error,
- const hidl_handle &_fence) {
- hidl_err = _error;
- (void)_fence;
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
-private:
- const sp<IMapper2ns::IMapper> mMapper;
- const sp<IAllocator2ns::IAllocator> mAllocator;
-};
-
-std::unique_ptr<CbManager::CbManagerImpl> buildHidlImpl() {
- {
- sp<IMapper3ns::IMapper> mapper =
- IMapper3ns::IMapper::getService();
- if (!mapper) {
- ALOGW("%s:%d: no IMapper@3.0 implementation found", __func__, __LINE__);
- }
-
- sp<IAllocator3ns::IAllocator> allocator =
- IAllocator3ns::IAllocator::getService();
- if (!allocator) {
- ALOGW("%s:%d: no IAllocator@3.0 implementation found", __func__, __LINE__);
- }
-
- if (mapper && allocator) {
- return std::make_unique<CbManagerHidlV3Impl>(mapper, allocator);
- }
- }
- {
- sp<IMapper2ns::IMapper> mapper =
- IMapper2ns::IMapper::getService();
- if (!mapper) {
- ALOGW("%s:%d: no IMapper@2.0 implementation found", __func__, __LINE__);
- }
-
- sp<IAllocator2ns::IAllocator> allocator =
- IAllocator2ns::IAllocator::getService();
- if (!allocator) {
- ALOGW("%s:%d: no IAllocator@2.0 implementation found", __func__, __LINE__);
- }
-
- return std::make_unique<CbManagerHidlV2Impl>(mapper, allocator);
- }
-
- return nullptr;
-}
-
-} // namespace
-
-CbManager::CbManager() : mImpl(buildHidlImpl()) {}
-
-} // namespace android
diff --git a/system/cbmanager/host.cpp b/system/cbmanager/host.cpp
deleted file mode 100644
index c1a46af..0000000
--- a/system/cbmanager/host.cpp
+++ /dev/null
@@ -1,46 +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.
- */
-
-#include <hardware/gralloc.h>
-#include "cbmanager.h"
-
-namespace android {
-namespace {
-
-class CbManagerHostImpl : public CbManager::CbManagerImpl {
-public:
- CbManagerHostImpl() {}
-
- ~CbManagerHostImpl() {}
-
- const cb_handle_t* allocateBuffer(int width, int height, int format) {
- return nullptr;
- }
-
- void freeBuffer(const cb_handle_t* h) {
- }
-
-private:
-};
-
-std::unique_ptr<CbManager::CbManagerImpl> buildHostImpl() {
- return std::make_unique<CbManagerHostImpl>();
-}
-} // namespace
-
-CbManager::CbManager() : mImpl(buildHostImpl()) {}
-
-} // namespace android
diff --git a/system/codecs/omx/avcdec/Android.mk b/system/codecs/omx/avcdec/Android.mk
index 798255f..4ab6db3 100644
--- a/system/codecs/omx/avcdec/Android.mk
+++ b/system/codecs/omx/avcdec/Android.mk
@@ -49,6 +49,8 @@
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)
diff --git a/system/codecs/omx/avcdec/GoldfishAVCDec.h b/system/codecs/omx/avcdec/GoldfishAVCDec.h
index dc9dc96..0fd52b0 100644
--- a/system/codecs/omx/avcdec/GoldfishAVCDec.h
+++ b/system/codecs/omx/avcdec/GoldfishAVCDec.h
@@ -25,7 +25,7 @@
#include <vector>
#include <map>
-#include "gralloc_cb.h"
+#include <gralloc_cb_bp.h>
#include <utils/RefBase.h>
#include <utils/threads.h>
#include <utils/Vector.h>
diff --git a/system/codecs/omx/avcdec/exports.lds b/system/codecs/omx/avcdec/exports.lds
deleted file mode 100644
index e6674f2..0000000
--- a/system/codecs/omx/avcdec/exports.lds
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- global:
- _Z26createGoldfishOMXComponentPKcPK16OMX_CALLBACKTYPEPvPP17OMX_COMPONENTTYPE;
- local: *;
-};
diff --git a/system/codecs/omx/common/Android.mk b/system/codecs/omx/common/Android.mk
index 50ce286..9e233e7 100644
--- a/system/codecs/omx/common/Android.mk
+++ b/system/codecs/omx/common/Android.mk
@@ -28,5 +28,11 @@
$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-import,libOpenglSystemCommon)
+
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+$(call emugl-import,libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX))
+else
+$(call emugl-export,STATIC_LIBRARIES,libGoldfishAddressSpace)
+endif
+
$(call emugl-end-module)
diff --git a/system/codecs/omx/common/goldfish_media_utils.cpp b/system/codecs/omx/common/goldfish_media_utils.cpp
index 9cd5063..a2057ab 100644
--- a/system/codecs/omx/common/goldfish_media_utils.cpp
+++ b/system/codecs/omx/common/goldfish_media_utils.cpp
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2018 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// 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 "goldfish_media_utils.h"
diff --git a/system/codecs/omx/common/goldfish_media_utils.h b/system/codecs/omx/common/goldfish_media_utils.h
index da57689..d25ee30 100644
--- a/system/codecs/omx/common/goldfish_media_utils.h
+++ b/system/codecs/omx/common/goldfish_media_utils.h
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2018 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// 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 <linux/types.h>
#include <stdint.h>
diff --git a/system/codecs/omx/plugin/Android.mk b/system/codecs/omx/plugin/Android.mk
index 77a2091..4adfd8a 100644
--- a/system/codecs/omx/plugin/Android.mk
+++ b/system/codecs/omx/plugin/Android.mk
@@ -35,15 +35,13 @@
$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-
-LOCAL_HEADER_LIBRARIES := media_plugin_headers \
+LOCAL_HEADER_LIBRARIES += media_plugin_headers \
libmedia_headers \
libbinder_headers \
libhidlbase_impl_internal \
libbase
-LOCAL_SHARED_LIBRARIES := \
+LOCAL_SHARED_LIBRARIES += \
libbinder \
libutils \
liblog \
diff --git a/system/codecs/omx/vpxdec/Android.mk b/system/codecs/omx/vpxdec/Android.mk
index ce2ab89..e7ec2d4 100644
--- a/system/codecs/omx/vpxdec/Android.mk
+++ b/system/codecs/omx/vpxdec/Android.mk
@@ -40,7 +40,9 @@
libarect_headers \
libarect_headers_for_ndk
-LOCAL_SHARED_LIBRARIES := \
+LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
+
+LOCAL_SHARED_LIBRARIES += \
libbinder \
libutils \
liblog \
diff --git a/system/codecs/omx/vpxdec/GoldfishVPX.h b/system/codecs/omx/vpxdec/GoldfishVPX.h
index 2eb762c..cb9321f 100644
--- a/system/codecs/omx/vpxdec/GoldfishVPX.h
+++ b/system/codecs/omx/vpxdec/GoldfishVPX.h
@@ -31,7 +31,7 @@
#include <utils/RefBase.h>
#include <utils/Vector.h>
#include <utils/threads.h>
-#include "gralloc_cb.h"
+#include <gralloc_cb_bp.h>
namespace android {
diff --git a/system/codecs/omx/vpxdec/exports.lds b/system/codecs/omx/vpxdec/exports.lds
deleted file mode 100644
index e6674f2..0000000
--- a/system/codecs/omx/vpxdec/exports.lds
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- global:
- _Z26createGoldfishOMXComponentPKcPK16OMX_CALLBACKTYPEPvPP17OMX_COMPONENTTYPE;
- local: *;
-};
diff --git a/system/egl/Android.mk b/system/egl/Android.mk
index 58663e5..6e239b2 100644
--- a/system/egl/Android.mk
+++ b/system/egl/Android.mk
@@ -6,6 +6,12 @@
$(call emugl-import,libOpenglSystemCommon)
$(call emugl-set-shared-library-subpath,egl)
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+$(call emugl-import,libqemupipe$(GOLDFISH_OPENGL_LIB_SUFFIX))
+else
+$(call emugl-export,STATIC_LIBRARIES,libqemupipe.ranchu)
+endif
+
LOCAL_CFLAGS += -DLOG_TAG=\"EGL_emulation\" -DEGL_EGLEXT_PROTOTYPES -DWITH_GLES2
LOCAL_CFLAGS += -Wno-gnu-designator
diff --git a/system/egl/CMakeLists.txt b/system/egl/CMakeLists.txt
index 25b4cdd..08db0c8 100644
--- a/system/egl/CMakeLists.txt
+++ b/system/egl/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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" "53f944775eac93c4fff6cb2b10ec932462422eb0e4ae0fb616f2f16bb0baf4af")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/egl/Android.mk" "597fba46fce0876a62ef3c0bc8f3a0264503214b62b0b0da092ee90fe60f09e1")
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}/android-emu ${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}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+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}/android-emu ${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}/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)
target_compile_definitions(EGL_emulation PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"EGL_emulation\"" "-DEGL_EGLEXT_PROTOTYPES")
target_compile_options(EGL_emulation PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-gnu-designator")
-target_link_libraries(EGL_emulation PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host)
\ No newline at end of file
+target_link_libraries(EGL_emulation PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp
index aaa763a..834207b 100644
--- a/system/egl/egl.cpp
+++ b/system/egl/egl.cpp
@@ -33,7 +33,8 @@
#include "ClientAPIExts.h"
#include "EGLImage.h"
#include "ProcessPipe.h"
-#include "qemu_pipe.h"
+
+#include <qemu_pipe_bp.h>
#include "GLEncoder.h"
#ifdef WITH_GLES2
@@ -1714,7 +1715,6 @@
//Now make the local bind
if (context) {
- ALOGD("%s: %p: ver %d %d (tinfo %p)", __FUNCTION__, context, context->majorVersion, context->minorVersion, tInfo);
// This is a nontrivial context.
// The thread cannot be gralloc-only anymore.
hostCon->setGrallocOnly(false);
@@ -1731,6 +1731,9 @@
context->getClientState();
if (!hostCon->gl2Encoder()->isInitialized()) {
+ ALOGD("%s: %p: ver %d %d (tinfo %p) (first time)",
+ __FUNCTION__,
+ context, context->majorVersion, context->minorVersion, tInfo);
s_display.gles2_iface()->init();
hostCon->gl2Encoder()->setInitialized();
ClientAPIExts::initClientFuncs(s_display.gles2_iface(), 1);
@@ -1834,6 +1837,9 @@
}
else {
if (!hostCon->glEncoder()->isInitialized()) {
+ ALOGD("%s: %p: ver %d %d (tinfo %p) (first time)",
+ __FUNCTION__,
+ context, context->majorVersion, context->minorVersion, tInfo);
s_display.gles_iface()->init();
hostCon->glEncoder()->setInitialized();
ClientAPIExts::initClientFuncs(s_display.gles_iface(), 0);
diff --git a/system/egl/goldfish_sync.h b/system/egl/goldfish_sync.h
index 18e3083..bb0cf44 100644
--- a/system/egl/goldfish_sync.h
+++ b/system/egl/goldfish_sync.h
@@ -1,16 +1,16 @@
-/*
- * Copyright (C) 2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// Copyright 2016 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.
#ifndef ANDROID_INCLUDE_HARDWARE_GOLDFISH_SYNC_H
#define ANDROID_INCLUDE_HARDWARE_GOLDFISH_SYNC_H
diff --git a/system/gralloc/CMakeLists.txt b/system/gralloc/CMakeLists.txt
index cf65352..b972006 100644
--- a/system/gralloc/CMakeLists.txt
+++ b/system/gralloc/CMakeLists.txt
@@ -4,17 +4,17 @@
android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/gralloc/Android.mk" "09618d9293855148fb310e67065028da8c7f6dcf936b02b5695292c82ed4724e")
set(gralloc.goldfish_src gralloc_old.cpp)
android_add_library(TARGET gralloc.goldfish SHARED LICENSE Apache-2.0 SRC gralloc_old.cpp)
-target_include_directories(gralloc.goldfish 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}/android-emu ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(gralloc.goldfish 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}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${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)
target_compile_definitions(gralloc.goldfish PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"gralloc_goldfish\"")
target_compile_options(gralloc.goldfish PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-Wno-gnu-designator")
-target_link_libraries(gralloc.goldfish PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log GLESv2_enc _renderControl_enc GLESv1_enc OpenglCodecCommon_host)
+target_link_libraries(gralloc.goldfish PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log GLESv2_enc _renderControl_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
# 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/gralloc/Android.mk" "09618d9293855148fb310e67065028da8c7f6dcf936b02b5695292c82ed4724e")
set(gralloc.ranchu_src gralloc_old.cpp)
android_add_library(TARGET gralloc.ranchu SHARED LICENSE Apache-2.0 SRC gralloc_old.cpp)
-target_include_directories(gralloc.ranchu 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}/android-emu ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(gralloc.ranchu 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}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${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)
target_compile_definitions(gralloc.ranchu PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"gralloc_ranchu\"")
target_compile_options(gralloc.ranchu PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-Wno-gnu-designator")
-target_link_libraries(gralloc.ranchu PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log GLESv2_enc _renderControl_enc GLESv1_enc OpenglCodecCommon_host)
\ No newline at end of file
+target_link_libraries(gralloc.ranchu PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log GLESv2_enc _renderControl_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/gralloc/gralloc_30.cpp b/system/gralloc/gralloc_30.cpp
index 49591e3..b67f4c5 100644
--- a/system/gralloc/gralloc_30.cpp
+++ b/system/gralloc/gralloc_30.cpp
@@ -32,12 +32,12 @@
#include <hardware/hardware.h>
#include <hardware/gralloc.h>
-#include "../../shared/OpenglCodecCommon/gralloc_cb.h"
+#include <gralloc_cb_bp.h>
#include "gralloc_common.h"
#include "goldfish_address_space.h"
#include "HostConnection.h"
#include "FormatConversions.h"
-#include "qemu_pipe.h"
+#include <qemu_pipe_bp.h>
#define CRASH(MSG) \
do { \
diff --git a/system/gralloc/gralloc_old.cpp b/system/gralloc/gralloc_old.cpp
index 6959ed1..7af9dfe 100644
--- a/system/gralloc/gralloc_old.cpp
+++ b/system/gralloc/gralloc_old.cpp
@@ -23,12 +23,7 @@
#include <sys/mman.h>
#include <hardware/gralloc.h>
-#if PLATFORM_SDK_VERSION < 28
-#include "gralloc_cb.h"
-#else
-#include "../../shared/OpenglCodecCommon/gralloc_cb.h"
-#endif
-
+#include <gralloc_cb_bp.h>
#include "gralloc_common.h"
#include "goldfish_dma.h"
@@ -38,7 +33,7 @@
#include "ProcessPipe.h"
#include "ThreadInfo.h"
#include "glUtils.h"
-#include "qemu_pipe.h"
+#include <qemu_pipe_bp.h>
#if PLATFORM_SDK_VERSION < 26
#include <cutils/log.h>
diff --git a/system/hals/Android.mk b/system/hals/Android.mk
index b762a78..3cdb4bf 100644
--- a/system/hals/Android.mk
+++ b/system/hals/Android.mk
@@ -34,9 +34,13 @@
liblog \
libutils
+LOCAL_STATIC_LIBRARIES += libqemupipe.ranchu libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX)
+LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
+
LOCAL_C_INCLUDES += \
device/generic/goldfish-opengl/system/include \
device/generic/goldfish-opengl/system/OpenglSystemCommon \
+ device/generic/goldfish-opengl/shared/GoldfishAddressSpace/include \
device/generic/goldfish-opengl/shared/OpenglCodecCommon \
device/generic/goldfish-opengl/host/include/libOpenglRender \
device/generic/goldfish-opengl/system/renderControl_enc \
@@ -63,9 +67,13 @@
libutils \
libsync
+LOCAL_STATIC_LIBRARIES += libqemupipe.ranchu libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX)
+LOCAL_HEADER_LIBRARIES += libgralloc_cb.ranchu
+
LOCAL_C_INCLUDES += \
device/generic/goldfish-opengl/system/include \
device/generic/goldfish-opengl/system/OpenglSystemCommon \
+ device/generic/goldfish-opengl/shared/GoldfishAddressSpace/include \
device/generic/goldfish-opengl/shared/OpenglCodecCommon \
device/generic/goldfish-opengl/host/include/libOpenglRender \
device/generic/goldfish-opengl/system/renderControl_enc \
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index 2e5c23e..8b433c2 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -17,6 +17,7 @@
#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
#include <android/hardware/graphics/mapper/3.0/IMapper.h>
#include <hidl/LegacySupport.h>
+#include <qemu_pipe_bp.h>
#include "glUtils.h"
#include "cb_handle_30.h"
diff --git a/system/hals/cb_handle_30.h b/system/hals/cb_handle_30.h
index 11ce322..374008e 100644
--- a/system/hals/cb_handle_30.h
+++ b/system/hals/cb_handle_30.h
@@ -17,7 +17,7 @@
#ifndef SYSTEM_HALS_CB_HANDLE_30_H
#define SYSTEM_HALS_CB_HANDLE_30_H
-#include "gralloc_cb.h"
+#include <gralloc_cb_bp.h>
#include "goldfish_address_space.h"
const uint32_t CB_HANDLE_MAGIC_30 = CB_HANDLE_MAGIC_BASE | 0x2;
diff --git a/system/include/cbmanager.h b/system/include/cbmanager.h
deleted file mode 100644
index 4bddedb..0000000
--- a/system/include/cbmanager.h
+++ /dev/null
@@ -1,143 +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.
- */
-
-#ifndef ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_CBMANAGER_H
-#define ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_CBMANAGER_H
-
-#include <cutils/native_handle.h>
-#include <log/log.h>
-
-#include <memory>
-#include <android/hardware/graphics/common/1.0/types.h>
-#include <android/hardware/graphics/mapper/2.0/IMapper.h>
-
-#include "gralloc_cb.h"
-
-namespace android {
-
-class CbManager {
-public:
- typedef hardware::graphics::common::V1_0::BufferUsage BufferUsage;
- typedef hardware::graphics::common::V1_0::PixelFormat PixelFormat;
- typedef hardware::graphics::mapper::V2_0::YCbCrLayout YCbCrLayout;
- typedef hardware::hidl_bitfield<BufferUsage> BufferUsageBits;
-
- CbManager();
-
- class CbManagerImpl {
- public:
- virtual ~CbManagerImpl() {}
- virtual native_handle_t* allocateBuffer(int width,
- int height,
- PixelFormat format,
- BufferUsageBits usage) = 0;
- virtual void freeBuffer(const native_handle_t* h) = 0;
-
- virtual int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) = 0;
-
- virtual int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) = 0;
-
- virtual int unlockBuffer(native_handle_t& handle) = 0;
- };
-
- native_handle_t* allocateBuffer(
- int width, int height, PixelFormat format, BufferUsageBits usage) {
- return mImpl->allocateBuffer(width, height, format, usage);
- }
-
- void freeBuffer(const native_handle_t* h) {
- mImpl->freeBuffer(h);
- }
-
- int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- return mImpl->lockBuffer(handle, usage, left, top, width, height, vaddr);
- }
-
- int lockBuffer(buffer_handle_t h,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- native_handle_t* cb = const_cast<native_handle_t*>(h);
- if (cb) {
- return lockBuffer(*cb, usage, left, top, width, height, vaddr);
- } else {
- return -1;
- }
- }
-
-
- int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- return mImpl->lockYCbCrBuffer(handle, usage, left, top, width, height, ycbcr);
- }
-
- int lockYCbCrBuffer(buffer_handle_t h,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- native_handle_t* cb = const_cast<native_handle_t*>(h);
- if (cb) {
- return lockYCbCrBuffer(*cb, usage, left, top, width, height, ycbcr);
- } else {
- return -1;
- }
- }
-
- int unlockBuffer(native_handle_t& handle) {
- return mImpl->unlockBuffer(handle);
- }
-
- int unlockBuffer(buffer_handle_t h) {
- native_handle_t* cb = const_cast<native_handle_t*>(h);
- if (cb) {
- return unlockBuffer(*cb);
- } else {
- return -1;
- }
- }
-
- // Specific to goldfish, for obtaining offsets
- // into host coherent memory
- // (requires address space devce)
- static uint64_t getOffset(const buffer_handle_t h) {
- const cb_handle_t* cb = cb_handle_t::from(h);
- if (!cb->isValid()) {
- ALOGE("%s: FATAL: using incompatible native_handle_t for "
- "host coherent mapping offset",
- __func__);
- abort();
- }
- return cb ? cb->getMmapedOffset() : -1;
- }
-
-private:
- std::unique_ptr<CbManagerImpl> mImpl;
-};
-
-} // namespace android
-
-#endif // ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_CBMANAGER_H
diff --git a/system/renderControl_enc/CMakeLists.txt b/system/renderControl_enc/CMakeLists.txt
index c874e25..8a42acb 100644
--- a/system/renderControl_enc/CMakeLists.txt
+++ b/system/renderControl_enc/CMakeLists.txt
@@ -4,7 +4,7 @@
android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc/Android.mk" "780a007ac7a3d2255372ddf40e03aeb10e4c759343d2532f6ddf769f4df73810")
set(_renderControl_enc_src renderControl_client_context.cpp renderControl_enc.cpp renderControl_entry.cpp)
android_add_library(TARGET _renderControl_enc SHARED LICENSE Apache-2.0 SRC renderControl_client_context.cpp renderControl_enc.cpp renderControl_entry.cpp)
-target_include_directories(_renderControl_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
+target_include_directories(_renderControl_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
target_compile_definitions(_renderControl_enc PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN")
target_compile_options(_renderControl_enc PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-unused-function")
-target_link_libraries(_renderControl_enc PRIVATE OpenglCodecCommon_host cutils utils log android-emu-shared)
\ No newline at end of file
+target_link_libraries(_renderControl_enc PRIVATE OpenglCodecCommon_host cutils utils log android-emu-shared PRIVATE qemupipe_host)
\ No newline at end of file
diff --git a/system/renderControl_enc/renderControl_client_context.cpp b/system/renderControl_enc/renderControl_client_context.cpp
index 54c3f93..bf22e55 100644
--- a/system/renderControl_enc/renderControl_client_context.cpp
+++ b/system/renderControl_enc/renderControl_client_context.cpp
@@ -58,6 +58,7 @@
rcSetColorBufferVulkanMode = (rcSetColorBufferVulkanMode_client_proc_t) getProc("rcSetColorBufferVulkanMode", userData);
rcReadColorBufferYUV = (rcReadColorBufferYUV_client_proc_t) getProc("rcReadColorBufferYUV", userData);
rcIsSyncSignaled = (rcIsSyncSignaled_client_proc_t) getProc("rcIsSyncSignaled", userData);
+ rcCreateColorBufferWithHandle = (rcCreateColorBufferWithHandle_client_proc_t) getProc("rcCreateColorBufferWithHandle", userData);
return 0;
}
diff --git a/system/renderControl_enc/renderControl_client_context.h b/system/renderControl_enc/renderControl_client_context.h
index 12486c3..7f20e97 100644
--- a/system/renderControl_enc/renderControl_client_context.h
+++ b/system/renderControl_enc/renderControl_client_context.h
@@ -58,6 +58,7 @@
rcSetColorBufferVulkanMode_client_proc_t rcSetColorBufferVulkanMode;
rcReadColorBufferYUV_client_proc_t rcReadColorBufferYUV;
rcIsSyncSignaled_client_proc_t rcIsSyncSignaled;
+ rcCreateColorBufferWithHandle_client_proc_t rcCreateColorBufferWithHandle;
virtual ~renderControl_client_context_t() {}
typedef renderControl_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
diff --git a/system/renderControl_enc/renderControl_client_proc.h b/system/renderControl_enc/renderControl_client_proc.h
index d64cf5c..53535d6 100644
--- a/system/renderControl_enc/renderControl_client_proc.h
+++ b/system/renderControl_enc/renderControl_client_proc.h
@@ -60,6 +60,7 @@
typedef GLint (renderControl_APIENTRY *rcSetColorBufferVulkanMode_client_proc_t) (void * ctx, uint32_t, uint32_t);
typedef void (renderControl_APIENTRY *rcReadColorBufferYUV_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, void*, uint32_t);
typedef int (renderControl_APIENTRY *rcIsSyncSignaled_client_proc_t) (void * ctx, uint64_t);
+typedef void (renderControl_APIENTRY *rcCreateColorBufferWithHandle_client_proc_t) (void * ctx, uint32_t, uint32_t, GLenum, uint32_t);
#endif
diff --git a/system/renderControl_enc/renderControl_enc.cpp b/system/renderControl_enc/renderControl_enc.cpp
index d0c3c75..b352527 100644
--- a/system/renderControl_enc/renderControl_enc.cpp
+++ b/system/renderControl_enc/renderControl_enc.cpp
@@ -1873,6 +1873,34 @@
return retval;
}
+void rcCreateColorBufferWithHandle_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat, uint32_t handle)
+{
+
+ renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
+ IOStream *stream = ctx->m_stream;
+ ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+ bool useChecksum = checksumCalculator->getVersion() > 0;
+
+ unsigned char *ptr;
+ unsigned char *buf;
+ const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_rcCreateColorBufferWithHandle;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ memcpy(ptr, &width, 4); ptr += 4;
+ memcpy(ptr, &height, 4); ptr += 4;
+ memcpy(ptr, &internalFormat, 4); ptr += 4;
+ memcpy(ptr, &handle, 4); ptr += 4;
+
+ if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+ if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+}
+
} // namespace
renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
@@ -1928,5 +1956,6 @@
this->rcSetColorBufferVulkanMode = &rcSetColorBufferVulkanMode_enc;
this->rcReadColorBufferYUV = &rcReadColorBufferYUV_enc;
this->rcIsSyncSignaled = &rcIsSyncSignaled_enc;
+ this->rcCreateColorBufferWithHandle = &rcCreateColorBufferWithHandle_enc;
}
diff --git a/system/renderControl_enc/renderControl_entry.cpp b/system/renderControl_enc/renderControl_entry.cpp
index 0395d8b..35876cb 100644
--- a/system/renderControl_enc/renderControl_entry.cpp
+++ b/system/renderControl_enc/renderControl_entry.cpp
@@ -53,6 +53,7 @@
GLint rcSetColorBufferVulkanMode(uint32_t colorBuffer, uint32_t mode);
void rcReadColorBufferYUV(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, void* pixels, uint32_t pixels_size);
int rcIsSyncSignaled(uint64_t sync);
+ void rcCreateColorBufferWithHandle(uint32_t width, uint32_t height, GLenum internalFormat, uint32_t handle);
};
#ifndef GET_CONTEXT
@@ -349,3 +350,9 @@
return ctx->rcIsSyncSignaled(ctx, sync);
}
+void rcCreateColorBufferWithHandle(uint32_t width, uint32_t height, GLenum internalFormat, uint32_t handle)
+{
+ GET_CONTEXT;
+ ctx->rcCreateColorBufferWithHandle(ctx, width, height, internalFormat, handle);
+}
+
diff --git a/system/renderControl_enc/renderControl_ftable.h b/system/renderControl_enc/renderControl_ftable.h
index 662ade8..165def5 100644
--- a/system/renderControl_enc/renderControl_ftable.h
+++ b/system/renderControl_enc/renderControl_ftable.h
@@ -56,6 +56,7 @@
{"rcSetColorBufferVulkanMode", (void*)rcSetColorBufferVulkanMode},
{"rcReadColorBufferYUV", (void*)rcReadColorBufferYUV},
{"rcIsSyncSignaled", (void*)rcIsSyncSignaled},
+ {"rcCreateColorBufferWithHandle", (void*)rcCreateColorBufferWithHandle},
};
static const int renderControl_num_funcs = sizeof(renderControl_funcs_by_name) / sizeof(struct _renderControl_funcs_by_name);
diff --git a/system/renderControl_enc/renderControl_opcodes.h b/system/renderControl_enc/renderControl_opcodes.h
index 338a38e..57edad5 100644
--- a/system/renderControl_enc/renderControl_opcodes.h
+++ b/system/renderControl_enc/renderControl_opcodes.h
@@ -51,7 +51,8 @@
#define OP_rcSetColorBufferVulkanMode 10045
#define OP_rcReadColorBufferYUV 10046
#define OP_rcIsSyncSignaled 10047
-#define OP_last 10048
+#define OP_rcCreateColorBufferWithHandle 10048
+#define OP_last 10049
#endif
diff --git a/system/vulkan/Android.mk b/system/vulkan/Android.mk
index ebaa3c0..2bec494 100644
--- a/system/vulkan/Android.mk
+++ b/system/vulkan/Android.mk
@@ -17,7 +17,7 @@
# Only import androidemu if not building for host.
# if building for host, we already import android-emu.
-$(call emugl-import,libandroidemu)
+$(call emugl-export,SHARED_LIBRARIES,libandroidemu)
LOCAL_HEADER_LIBRARIES += \
hwvulkan_headers \
diff --git a/system/vulkan/CMakeLists.txt b/system/vulkan/CMakeLists.txt
index a71c07f..65bc00a 100644
--- a/system/vulkan/CMakeLists.txt
+++ b/system/vulkan/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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/vulkan/Android.mk" "691427017f29de6b082ad25cb73b87443d4072a04b4316897bb92983674ad5bf")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/vulkan/Android.mk" "5cb873c72cc859fac3800961059c1b203ed1abb400ee643178c18e04961d49e8")
set(vulkan.ranchu_src func_table.cpp goldfish_vulkan.cpp)
android_add_library(TARGET vulkan.ranchu SHARED LICENSE Apache-2.0 SRC func_table.cpp goldfish_vulkan.cpp)
-target_include_directories(vulkan.ranchu 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}/android-emu ${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}/system/vulkan ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/host/include)
+target_include_directories(vulkan.ranchu 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}/android-emu ${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}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/vulkan ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/host/include)
target_compile_definitions(vulkan.ranchu PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"goldfish_vulkan\"" "-DVK_USE_PLATFORM_ANDROID_KHR" "-DVK_NO_PROTOTYPES")
target_compile_options(vulkan.ranchu PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-fvisibility=hidden" "-fstrict-aliasing" "-Wno-unused-function")
-target_link_libraries(vulkan.ranchu PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host)
\ No newline at end of file
+target_link_libraries(vulkan.ranchu PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui androidemu cutils utils log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host PRIVATE gralloc_cb_host GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/vulkan_enc/Android.mk b/system/vulkan_enc/Android.mk
index 984db7f..e49aac4 100644
--- a/system/vulkan_enc/Android.mk
+++ b/system/vulkan_enc/Android.mk
@@ -1,18 +1,15 @@
-
-# Autogenerated makefile
-# android/android-emugl/host/libs/libOpenglRender/vulkan-registry/xml/genvk.py -registry android/android-emugl/host/libs/libOpenglRender/vulkan-registry/xml/vk.xml cereal -o android/android-emugl/host/libs/libOpenglRender/vulkan/cereal
-# Please do not modify directly;
-# re-run android/scripts/generate-vulkan-sources.sh,
-# or directly from Python by defining:
-# VULKAN_REGISTRY_XML_DIR : Directory containing genvk.py and vk.xml
-# CEREAL_OUTPUT_DIR: Where to put the generated sources.
-# python3 $VULKAN_REGISTRY_XML_DIR/genvk.py -registry $VULKAN_REGISTRY_XML_DIR/vk.xml cereal -o $CEREAL_OUTPUT_DIR
-
LOCAL_PATH := $(call my-dir)
$(call emugl-begin-shared-library,libvulkan_enc)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-$(call emugl-import,libOpenglCodecCommon$(GOLDFISH_OPENGL_LIB_SUFFIX) libandroidemu lib_renderControl_enc)
+$(call emugl-import,libOpenglCodecCommon$(GOLDFISH_OPENGL_LIB_SUFFIX) lib_renderControl_enc)
+ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+$(call emugl-import,libandroidemu)
+$(call emugl-import,libGoldfishAddressSpace$(GOLDFISH_OPENGL_LIB_SUFFIX))
+else
+$(call emugl-export,SHARED_LIBRARIES,libandroidemu)
+$(call emugl-export,STATIC_LIBRARIES,libGoldfishAddressSpace)
+endif
# Vulkan include dir
ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
@@ -55,12 +52,11 @@
VulkanHandleMapping.cpp \
ResourceTracker.cpp \
VkEncoder.cpp \
-goldfish_vk_extension_structs_guest.cpp \
-goldfish_vk_marshaling_guest.cpp \
-goldfish_vk_deepcopy_guest.cpp \
-goldfish_vk_handlemap_guest.cpp \
-goldfish_vk_transform_guest.cpp \
-
+ goldfish_vk_extension_structs_guest.cpp \
+ goldfish_vk_marshaling_guest.cpp \
+ goldfish_vk_deepcopy_guest.cpp \
+ goldfish_vk_handlemap_guest.cpp \
+ goldfish_vk_transform_guest.cpp \
ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
LOCAL_CFLAGS += -D__ANDROID_API__=28
diff --git a/system/vulkan_enc/CMakeLists.txt b/system/vulkan_enc/CMakeLists.txt
index dec0c66..5b97015 100644
--- a/system/vulkan_enc/CMakeLists.txt
+++ b/system/vulkan_enc/CMakeLists.txt
@@ -1,10 +1,10 @@
# 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/vulkan_enc/Android.mk" "a4b1fb11cf3e68cc49f055258b6b590798eeecb2d3e6e565c78549a39a341911")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc/Android.mk" "103f3f10c8af73d3d5c4263c4faa5bb70ebdbfbc9ed6f068a338d57344e2aa45")
set(vulkan_enc_src AndroidHardwareBuffer.cpp HostVisibleMemoryVirtualization.cpp Resources.cpp Validation.cpp VulkanStreamGuest.cpp VulkanHandleMapping.cpp ResourceTracker.cpp VkEncoder.cpp goldfish_vk_extension_structs_guest.cpp goldfish_vk_marshaling_guest.cpp goldfish_vk_deepcopy_guest.cpp goldfish_vk_handlemap_guest.cpp goldfish_vk_transform_guest.cpp)
android_add_library(TARGET vulkan_enc SHARED LICENSE Apache-2.0 SRC AndroidHardwareBuffer.cpp HostVisibleMemoryVirtualization.cpp Resources.cpp Validation.cpp VulkanStreamGuest.cpp VulkanHandleMapping.cpp ResourceTracker.cpp VkEncoder.cpp goldfish_vk_extension_structs_guest.cpp goldfish_vk_marshaling_guest.cpp goldfish_vk_deepcopy_guest.cpp goldfish_vk_handlemap_guest.cpp goldfish_vk_transform_guest.cpp)
-target_include_directories(vulkan_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/host/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/host/include/vulkan)
+target_include_directories(vulkan_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/host/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/host/include/vulkan)
target_compile_definitions(vulkan_enc PRIVATE "-DWITH_GLES2" "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DEMULATOR_OPENGL_POST_O=1" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGOLDFISH_VULKAN" "-DLOG_TAG=\"goldfish_vulkan\"" "-DVK_ANDROID_native_buffer" "-DVK_GOOGLE_address_space" "-DVK_USE_PLATFORM_ANDROID_KHR" "-DVK_NO_PROTOTYPES" "-D__ANDROID_API__=28")
target_compile_options(vulkan_enc PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-Werror" "-fstrict-aliasing")
-target_link_libraries(vulkan_enc PRIVATE gui _renderControl_enc androidemu cutils utils log OpenglCodecCommon_host android-emu-shared)
\ No newline at end of file
+target_link_libraries(vulkan_enc PRIVATE gui log android-emu-shared androidemu cutils utils _renderControl_enc OpenglCodecCommon_host PRIVATE GoldfishAddressSpace_host qemupipe_host)
\ No newline at end of file
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index b81a6ab..c5bf514 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -1849,14 +1849,14 @@
(unsigned long long)hvaSizeId[2]);
mLock.lock();
- struct drm_virtgpu_resource_create_v2 drm_rc_v2 = { 0 };
- drm_rc_v2.args = (uint64_t)&hvaSizeId[2];
- drm_rc_v2.args_size = sizeof(uint64_t);
- drm_rc_v2.size = hvaSizeId[1];
- drm_rc_v2.flags = VIRTGPU_RESOURCE_TYPE_HOST;
+ struct drm_virtgpu_resource_create_blob drm_rc_blob = { 0 };
+ drm_rc_blob.blob_mem = VIRTGPU_BLOB_MEM_HOST;
+ drm_rc_blob.blob_flags = VIRTGPU_BLOB_FLAG_MAPPABLE;
+ drm_rc_blob.blob_id = hvaSizeId[2];
+ drm_rc_blob.size = hvaSizeId[1];
int res = drmIoctl(
- mRendernodeFd, DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_V2, &drm_rc_v2);
+ mRendernodeFd, DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB, &drm_rc_blob);
if (res) {
ALOGE("%s: Failed to resource create v2: sterror: %s errno: %d\n", __func__,
@@ -1865,7 +1865,7 @@
}
struct drm_virtgpu_map map_info = {
- .handle = drm_rc_v2.bo_handle,
+ .handle = drm_rc_blob.bo_handle,
};
res = drmIoctl(mRendernodeFd, DRM_IOCTL_VIRTGPU_MAP, &map_info);
@@ -2778,7 +2778,7 @@
VkSamplerCreateInfo localCreateInfo = vk_make_orphan_copy(*pCreateInfo);
vk_struct_chain_iterator structChainIter = vk_make_chain_iterator(&localCreateInfo);
-#ifdef VK_USE_PLATFORM_ANDROID_KHR
+#if defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(VK_USE_PLATFORM_FUCHSIA_KHR)
VkSamplerYcbcrConversionInfo localVkSamplerYcbcrConversionInfo;
const VkSamplerYcbcrConversionInfo* samplerYcbcrConversionInfo =
vk_find_struct<VkSamplerYcbcrConversionInfo>(pCreateInfo);
diff --git a/system/vulkan_enc/VirtioGpuNext.h b/system/vulkan_enc/VirtioGpuNext.h
index 4037973..7da7da2 100644
--- a/system/vulkan_enc/VirtioGpuNext.h
+++ b/system/vulkan_enc/VirtioGpuNext.h
@@ -18,43 +18,37 @@
#include "drm.h"
#endif
-#define DRM_VIRTGPU_RESOURCE_CREATE_V2 0x0a
+#define DRM_VIRTGPU_RESOURCE_CREATE_BLOB 0x0a
-struct drm_virtgpu_resource_create_v2 {
-#define VIRTGPU_RESOURCE_TYPE_MASK 0x0000f
-#define VIRTGPU_RESOURCE_TYPE_DEFAULT_V1 0x00001
-#define VIRTGPU_RESOURCE_TYPE_DEFAULT_V2 0x00002
-#define VIRTGPU_RESOURCE_TYPE_HOST 0x00003
-#define VIRTGPU_RESOURCE_TYPE_GUEST 0x00004
-/*
- * Error cases:
- * HOST_VISIBLE_BIT without VIRTGPU_RESOURCE_TYPE_HOST
- */
-#define VIRTGPU_RESOURCE_HOST_MASK 0x000f0
-#define VIRTGPU_RESOURCE_HOST_VISIBLE_BIT 0x00010
+#define VIRTGPU_PARAM_RESOURCE_BLOB 3 /* DRM_VIRTGPU_RESOURCE_CREATE_BLOB */
+#define VIRTGPU_PARAM_HOST_VISIBLE 4
-#define VIRTGPU_RESOURCE_GUEST_MASK 0x00f00
-#define VIRTGPU_RESOURCE_GUEST_SHARED_BIT 0x00100
-#define VIRTGPU_RESOURCE_GUEST_EMULATED_COHERENT_BIT 0x00200
+struct drm_virtgpu_resource_create_blob {
+#define VIRTGPU_BLOB_MEM_GUEST 0x0001
+#define VIRTGPU_BLOB_MEM_HOST 0x0002
+#define VIRTGPU_BLOB_MEM_HOST_GUEST 0x0003
-#define VIRTGPU_RESOURCE_CACHE_MASK 0x0f000
-#define VIRTGPU_RESOURCE_CACHE_CACHED 0x01000
-#define VIRTGPU_RESOURCE_CACHE_UNCACHED 0x02000
-#define VIRTGPU_RESOURCE_CACHE_WC 0x03000
-/*
- * VIRTGPU_RESOURCE_EXPORTABLE_BIT - host resource *can* be exported as an fd.
- */
-#define VIRTGPU_RESOURCE_EXPORT_MASK 0xf0000
-#define VIRTGPU_RESOURCE_EXPORTABLE_BIT 0x10000
- uint32_t flags;
- uint32_t args_size;
- uint64_t size;
- uint32_t bo_handle;
- uint32_t res_handle;
- uint64_t args;
+#define VIRTGPU_BLOB_FLAG_MAPPABLE 0x0001
+#define VIRTGPU_BLOB_FLAG_SHAREABLE 0x0002
+#define VIRTGPU_BLOB_FLAG_CROSS_DEVICE 0x0004
+ /* zero is invalid blob_mem */
+ uint32_t blob_mem;
+ uint32_t blob_flags;
+ uint32_t bo_handle;
+ uint32_t res_handle;
+ uint64_t size;
+
+ /*
+ * for 3D contexts with VIRTGPU_BLOB_MEM_HOSTGUEST and
+ * VIRTGPU_BLOB_MEM_HOST otherwise, must be zero.
+ */
+ uint32_t pad;
+ uint32_t cmd_size;
+ uint64_t cmd;
+ uint64_t blob_id;
};
-#define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_V2 \
- DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_V2, \
- struct drm_virtgpu_resource_create_v2)
+#define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB \
+ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_BLOB, \
+ struct drm_virtgpu_resource_create_blob)
diff --git a/system/vulkan_enc/VulkanHandles.h b/system/vulkan_enc/VulkanHandles.h
index 376f2fc..54699aa 100644
--- a/system/vulkan_enc/VulkanHandles.h
+++ b/system/vulkan_enc/VulkanHandles.h
@@ -26,6 +26,18 @@
f(VkCommandBuffer) \
GOLDFISH_VK_LIST_TRIVIAL_DISPATCHABLE_HANDLE_TYPES(f)
+#ifdef VK_NVX_device_generated_commands
+
+#define __GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES_NVX_DEVICE_GENERATED_COMMANDS(f) \
+ f(VkObjectTableNVX) \
+ f(VkIndirectCommandsLayoutNVX) \
+
+#else
+
+#define __GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES_NVX_DEVICE_GENERATED_COMMANDS(f)
+
+#endif // VK_NVX_device_generated_commands
+
#define GOLDFISH_VK_LIST_TRIVIAL_NON_DISPATCHABLE_HANDLE_TYPES(f) \
f(VkBufferView) \
f(VkImageView) \
@@ -44,11 +56,10 @@
f(VkSwapchainKHR) \
f(VkDisplayKHR) \
f(VkDisplayModeKHR) \
- f(VkObjectTableNVX) \
- f(VkIndirectCommandsLayoutNVX) \
f(VkValidationCacheEXT) \
f(VkDebugReportCallbackEXT) \
f(VkDebugUtilsMessengerEXT) \
+ __GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES_NVX_DEVICE_GENERATED_COMMANDS(f)
#define GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(f) \
f(VkDeviceMemory) \