OSDN Git Service

Merge remote-tracking branch 'aosp/upstream-master' into HEAD
authorJason Macnak <natsu@google.com>
Fri, 18 Sep 2020 16:07:51 +0000 (09:07 -0700)
committerJason Macnak <natsu@google.com>
Fri, 18 Sep 2020 16:07:51 +0000 (09:07 -0700)
... to update Minigbm for Cuttlefish to have Gralloc3 and
Gralloc4 support.

Bug: b/161909468
Test: launch_cvd
Merged-In: I27f020b4f661890bcc2817deb09ffb9af1c76f1b
Change-Id: I11e31543d3298c2cac67d80e77058d7cd95907db

Android.bp [new file with mode: 0644]
Android.mk [deleted file]
METADATA [new file with mode: 0644]
MODULE_LICENSE_BSD [new file with mode: 0644]
OWNERS.android [new file with mode: 0644]
cros_gralloc/gralloc0/gralloc0.cc
virtio_gpu.c

diff --git a/Android.bp b/Android.bp
new file mode 100644 (file)
index 0000000..c3b56e5
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+cc_defaults {
+    name: "minigbm_defaults",
+
+    srcs: [
+        "amdgpu.c",
+        "drv.c",
+        "evdi.c",
+        "exynos.c",
+        "helpers_array.c",
+        "helpers.c",
+        "i915.c",
+        "marvell.c",
+        "mediatek.c",
+        "meson.c",
+        "msm.c",
+        "nouveau.c",
+        "radeon.c",
+        "rockchip.c",
+        "tegra.c",
+        "udl.c",
+        "vc4.c",
+        "vgem.c",
+        "virtio_gpu.c",
+    ],
+
+    cflags: [
+        "-D_GNU_SOURCE=1",
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Wsign-compare",
+        "-Wpointer-arith",
+        "-Wcast-qual",
+        "-Wcast-align",
+        "-Wno-unused-parameter",
+    ],
+
+    cppflags: ["-std=c++14"],
+}
+
+cc_defaults {
+    name: "minigbm_gralloc_defaults",
+
+    defaults: ["minigbm_defaults"],
+
+    header_libs: [
+        "libhardware_headers",
+        "libnativebase_headers",
+        "libnativewindow_headers",
+        "libsystem_headers",
+    ],
+
+    export_header_lib_headers: [
+        "libhardware_headers",
+        "libnativebase_headers",
+        "libnativewindow_headers",
+        "libsystem_headers",
+    ],
+
+    srcs: [
+        "cros_gralloc/cros_gralloc_buffer.cc",
+        "cros_gralloc/cros_gralloc_helpers.cc",
+        "cros_gralloc/cros_gralloc_driver.cc",
+    ],
+
+    static_libs: ["libarect"],
+
+    export_static_lib_headers: ["libarect"],
+
+    vendor: true,
+
+    shared_libs: [
+        "libcutils",
+        "libdrm",
+        "libnativewindow",
+        "libsync",
+        "liblog",
+    ],
+
+    relative_install_path: "hw",
+}
+
+cc_defaults {
+    name: "gbm_defaults",
+
+    defaults: ["minigbm_defaults"],
+
+    srcs: [
+        "gbm.c",
+        "gbm_helpers.c",
+    ],
+
+    export_include_dirs: ["."],
+}
+
+cc_library {
+    name: "libgbm",
+    defaults: ["gbm_defaults"],
+    host_supported: true,
+
+    target: {
+        host: {
+            // Avoid linking to another host copy of libdrm; this library will cause
+            // binary GPU drivers to be loaded from the host, which might be linked
+            // to a system copy of libdrm, which conflicts with the AOSP one
+            allow_undefined_symbols: true,
+            header_libs: ["libdrm"],
+        },
+        android: {
+            shared_libs: [
+                "libdrm",
+                "liblog"
+            ],
+        },
+    },
+}
+
+cc_library_static {
+    name: "libminigbm_gralloc",
+    defaults: ["minigbm_gralloc_defaults"],
+    shared_libs: ["liblog"],
+    static_libs: ["libdrm"],
+
+    export_include_dirs: ["."],
+}
+
+cc_library_shared {
+    name: "gralloc.minigbm",
+    defaults: ["minigbm_gralloc_defaults"],
+    srcs: ["cros_gralloc/gralloc0/gralloc0.cc"],
+}
+
+cc_library_shared {
+    name: "gralloc.minigbm_intel",
+    defaults: ["minigbm_gralloc_defaults"],
+    enabled: false,
+    arch: {
+        x86: {
+            enabled: true,
+        },
+        x86_64: {
+            enabled: true,
+        },
+    },
+    cflags: ["-DDRV_I915"],
+    srcs: ["cros_gralloc/gralloc0/gralloc0.cc"],
+}
+
+cc_library_shared {
+    name: "gralloc.minigbm_meson",
+    defaults: ["minigbm_gralloc_defaults"],
+    cflags: ["-DDRV_MESON"],
+    srcs: ["cros_gralloc/gralloc0/gralloc0.cc"],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644 (file)
index 3eab7ae..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-ifeq ($(strip $(BOARD_USES_MINIGBM)), true)
-
-MINIGBM_GRALLOC_MK := $(call my-dir)/Android.gralloc.mk
-LOCAL_PATH := $(call my-dir)
-intel_drivers := i915 i965
-
-MINIGBM_SRC := \
-       amdgpu.c \
-       dri.c \
-       drv.c \
-       evdi.c \
-       exynos.c \
-       helpers_array.c \
-       helpers.c \
-       i915.c \
-       marvell.c \
-       mediatek.c \
-       meson.c \
-       msm.c \
-       nouveau.c \
-       radeon.c \
-       rockchip.c \
-       synaptics.c \
-       tegra.c \
-       udl.c \
-       vc4.c \
-       vgem.c \
-       virtio_gpu.c
-
-MINIGBM_CPPFLAGS := -std=c++14
-MINIGBM_CFLAGS := \
-       -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 \
-       -Wall -Wsign-compare -Wpointer-arith \
-       -Wcast-qual -Wcast-align \
-       -Wno-unused-parameter
-
-ifneq ($(filter $(intel_drivers), $(BOARD_GPU_DRIVERS)),)
-MINIGBM_CPPFLAGS += -DDRV_I915
-MINIGBM_CFLAGS += -DDRV_I915
-LOCAL_SHARED_LIBRARIES += libdrm_intel
-endif
-
-ifneq ($(filter meson, $(BOARD_GPU_DRIVERS)),)
-MINIGBM_CPPFLAGS += -DDRV_MESON
-MINIGBM_CFLAGS += -DDRV_MESON
-endif
-
-include $(CLEAR_VARS)
-
-SUBDIRS := cros_gralloc
-
-LOCAL_SHARED_LIBRARIES := \
-       libcutils \
-       libdrm
-
-LOCAL_SRC_FILES := $(MINIGBM_SRC)
-
-include $(MINIGBM_GRALLOC_MK)
-
-LOCAL_CFLAGS := $(MINIGBM_CFLAGS)
-LOCAL_CPPFLAGS := $(MINIGBM_CPPFLAGS)
-
-LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM)
-LOCAL_MODULE_TAGS := optional
-# The preferred path for vendor HALs is /vendor/lib/hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
-LOCAL_HEADER_LIBRARIES += \
-       libhardware_headers libnativebase_headers libsystem_headers
-LOCAL_SHARED_LIBRARIES += libnativewindow libsync liblog
-LOCAL_STATIC_LIBRARIES += libarect
-include $(BUILD_SHARED_LIBRARY)
-
-
-include $(CLEAR_VARS)
-LOCAL_SHARED_LIBRARIES := libcutils
-LOCAL_STATIC_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES += $(MINIGBM_SRC) gbm.c gbm_helpers.c
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_CFLAGS := $(MINIGBM_CFLAGS)
-LOCAL_CPPFLAGS := $(MINIGBM_CPPFLAGS)
-
-LOCAL_MODULE := libminigbm
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
-
-endif
diff --git a/METADATA b/METADATA
new file mode 100644 (file)
index 0000000..b281ea4
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,17 @@
+name: "minigbm"
+description:
+    ""
+
+third_party {
+  url {
+    type: HOMEPAGE
+    value: "https://www.chromium.org/"
+  }
+  url {
+    type: GIT
+    value: "https://chromium.googlesource.com/chromiumos/platform/minigbm/"
+  }
+  version: ""
+  last_upgrade_date { year: 2018 month: 6 day: 25 }
+  license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_BSD b/MODULE_LICENSE_BSD
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/OWNERS.android b/OWNERS.android
new file mode 100644 (file)
index 0000000..be55e00
--- /dev/null
@@ -0,0 +1,2 @@
+adelva@google.com
+natsu@google.com
index 943c8e8..b0fe945 100644 (file)
@@ -495,6 +495,8 @@ struct gralloc0_module HAL_MODULE_INFO_SYM = {
                .lockAsync = gralloc0_lock_async,
                .unlockAsync = gralloc0_unlock_async,
                .lockAsync_ycbcr = gralloc0_lock_async_ycbcr,
+                .validateBufferSize = NULL,
+                .getTransportSize = NULL,
            },
 
        .alloc = nullptr,
index f9c13f4..a5fe732 100644 (file)
@@ -958,10 +958,9 @@ static uint32_t virtio_gpu_resolve_format(struct driver *drv, uint32_t format, u
 {
        switch (format) {
        case DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED:
-               /* Camera subsystem requires NV12. */
-               if (use_flags & (BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE))
-                       return DRM_FORMAT_NV12;
-               /*HACK: See b/28671744 */
+               // TODO(b/157902551): Cuttlefish's current camera hal implementation
+               // requires that the flex format is RGBA. Revert this edit and use YUV
+               // format when Cuttlefish switches to the newer camera hal.
                return DRM_FORMAT_XBGR8888;
        case DRM_FORMAT_FLEX_YCbCr_420_888:
                /*