Skip to content
Snippets Groups Projects
Commit 75b24b47 authored by Robert Drab's avatar Robert Drab
Browse files

openharmony-standard-3.0: Backport gralloc implementation from 3.1


In OpenHarmony 3.1 there is a gralloc implementation for a HiHope board which
is generic enough to be used with qemu virtio gpu.

Signed-off-by: default avatarRobert Drab <robert.drab@huawei.com>
parent 91827b46
No related branches found
No related tags found
1 merge request!25Graphic stack bringup
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
display: Use temporary qemuarm implementation
OpenHarmony 3.0 requires two display components:
- hdi_display_device
- hdi_display_gralloc
none of which is available for qemuarm standard system. Therefore we have to
provide mock implementation of non-essential hdi_display_device and a proper
implementation of hdi_display_gralloc without which OpenHarmony graphic stack
will not work.
Signed-off-by: Robert Drab <robert.drab@huawei.com>
Upstream-Status: Inappropriate
diff --git a/display/hal/BUILD.gn b/display/hal/BUILD.gn
index a232730b..80f03706 100644
--- a/display/hal/BUILD.gn
+++ b/display/hal/BUILD.gn
@@ -11,10 +11,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import("//build/ohos.gni")
+
if (defined(ohos_lite)) {
group("hdi_display") {
public_deps = [ "//device/${device_company}/hardware/display:hdi_display" ]
}
+} else if (product_name == "yocto-ohos-qemuarm") {
+ config("display_hdi_public_config") {
+ visibility = [ ":*" ]
+ include_dirs = [
+ "//drivers/peripheral/base",
+ "//drivers/peripheral/display/interfaces/include",
+ "//drivers/peripheral/display/hal",
+ "//drivers/framework/include/utils",
+ "//drivers/adapter/uhdf2/osal/include",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "//third_party/bounds_checking_function/include",
+ ]
+ }
+
+ group("hdi_display") {
+ deps = [
+ ":hdi_display_device",
+ ":hdi_display_gralloc",
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ }
+
+ ohos_shared_library("hdi_display_device") {
+ sources = [
+ "//drivers/peripheral/display/hal/default/standard_system/display_device.c",
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ subsystem_name = "hdf"
+ part_name = "display_device_driver"
+ }
+
+ group("hdi_display_gralloc") {
+ deps = [
+ "//device/hihope/hardware/display:display_gralloc"
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ }
} else {
config("display_hdi_public_config") {
visibility = [ ":*" ]
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
display_gralloc_gbm.c: Use card drm node
DRM_IOCTL_MODE_CREATE_DUMB ioctl is not allowed for render nodes.
This patch is applied to //device/hihope directory containing Apache-2.0
licensed HiHope gralloc implementation. This directory is a part of the
OpenHarmony 3.1 device_board_hihope.git repository.
Signed-off-by: Robert Drab <robert.drab@huawei.com>
Upstream-Status: Inappropriate
diff --git a/hardware/display/src/display_gralloc/display_gralloc_gbm.c b/hardware/display/src/display_gralloc/display_gralloc_gbm.c
index 2dad8c1..1445819 100644
--- a/hardware/display/src/display_gralloc/display_gralloc_gbm.c
+++ b/hardware/display/src/display_gralloc/display_gralloc_gbm.c
@@ -34,7 +34,7 @@
#include "display_gralloc_private.h"
#include "display_common.h"
-const char *g_drmFileNode = "/dev/dri/renderD128";
+const char *g_drmFileNode = "/dev/dri/card0";
static GrallocManager *g_grallocManager = NULL;
static pthread_mutex_t g_lock;
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Backport just the gralloc implementation to 3.0 from the HiHope 3.1 repository.
Signed-off-by: Robert Drab <robert.drab@huawei.com>
Upstream-Status: Inappropriate
diff --git a/hardware/display/BUILD.gn b/hardware/display/BUILD.gn
index f403896..e9adb4f 100644
--- a/hardware/display/BUILD.gn
+++ b/hardware/display/BUILD.gn
@@ -13,13 +13,17 @@
import("//build/ohos.gni")
-group("display_group") {
- deps = [
- ":display_device",
- ":display_gfx",
- ":display_gralloc",
- ":higbm",
- ]
+#group("display_group") {
+# deps = [
+# ":display_device",
+# ":display_gfx",
+# ":display_gralloc",
+# ":higbm",
+# ]
+#}
+
+declare_args() {
+ chipset_base_dir = "system"
}
ohos_static_library("higbm") {
@@ -79,87 +83,87 @@
part_name = "display_device_driver"
}
-ohos_shared_library("display_gfx") {
- sources = [ "src/display_gfx/display_gfx.c" ]
- include_dirs = [
- "include",
- "//drivers/peripheral/display/interfaces/include",
- "//drivers/peripheral/base",
- "//drivers/framework/include/utils",
- "//drivers/adapter/uhdf2/adapter/osal/include/",
- "//utils/native/base/include",
- "//foundation/graphic/standard/utils/include",
- "//device/hihope/hardware/rga/include/",
- "//base/hiviewdfx/interfaces/innerkits/libhilog/include",
- ]
- output_name = "display_gfx"
- cflags = [ "-Wno-macro-redefined" ]
- deps = [
- ":display_gralloc",
- "//device/hihope/hardware/rga:librga",
- "//utils/native/base:utils",
- ]
-
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
-
- install_enable = true
- install_images = [ chipset_base_dir ]
- subsystem_name = "hdf"
- part_name = "display_device_driver"
-}
-
-ohos_shared_library("display_device") {
- sources = [
- "src/display_device/drm_connector.cpp",
- "src/display_device/drm_crtc.cpp",
- "src/display_device/drm_device.cpp",
- "src/display_device/drm_display.cpp",
- "src/display_device/drm_encoder.cpp",
- "src/display_device/drm_plane.cpp",
- "src/display_device/drm_vsync_worker.cpp",
- "src/display_device/hdi_composer.cpp",
- "src/display_device/hdi_device_interface.cpp",
- "src/display_device/hdi_display.cpp",
- "src/display_device/hdi_drm_composition.cpp",
- "src/display_device/hdi_drm_layer.cpp",
- "src/display_device/hdi_gfx_composition.cpp",
- "src/display_device/hdi_layer.cpp",
- "src/display_device/hdi_netlink_monitor.cpp",
- "src/display_device/hdi_session.cpp",
- ]
- output_name = "display_device"
- include_dirs = [
- "src/display_device",
- "include",
- "//drivers/peripheral/display/interfaces/include",
- "//drivers/peripheral/base",
- "//drivers/framework/include/utils",
- "//drivers/adapter/uhdf2/osal/include",
- "//utils/native/base/include",
- "//foundation/graphic/standard/utils/include",
- "//foundation/graphic/standard/prebuilts/librarys/drm/include",
- "//base/hiviewdfx/interfaces/innerkits/libhilog/include",
- ]
- deps = [
- ":display_gfx",
- ":display_gralloc",
- "//third_party/libdrm:libdrm",
- "//utils/native/base:utils",
- ]
- cflags = [ "-Wno-unused-function" ]
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
-
- install_enable = true
- install_images = [ chipset_base_dir ]
- subsystem_name = "hdf"
- part_name = "display_device_driver"
-}
-
-group("display_layer") {
- deps = [
- ":display_device",
- ":display_gfx",
- ":display_gralloc",
- ":higbm",
- ]
-}
+#ohos_shared_library("display_gfx") {
+# sources = [ "src/display_gfx/display_gfx.c" ]
+# include_dirs = [
+# "include",
+# "//drivers/peripheral/display/interfaces/include",
+# "//drivers/peripheral/base",
+# "//drivers/framework/include/utils",
+# "//drivers/adapter/uhdf2/adapter/osal/include/",
+# "//utils/native/base/include",
+# "//foundation/graphic/standard/utils/include",
+# "//device/hihope/hardware/rga/include/",
+# "//base/hiviewdfx/interfaces/innerkits/libhilog/include",
+# ]
+# output_name = "display_gfx"
+# cflags = [ "-Wno-macro-redefined" ]
+# deps = [
+# ":display_gralloc",
+# "//device/hihope/hardware/rga:librga",
+# "//utils/native/base:utils",
+# ]
+#
+# external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+#
+# install_enable = true
+# install_images = [ chipset_base_dir ]
+# subsystem_name = "hdf"
+# part_name = "display_device_driver"
+#}
+
+#ohos_shared_library("display_device") {
+# sources = [
+# "src/display_device/drm_connector.cpp",
+# "src/display_device/drm_crtc.cpp",
+# "src/display_device/drm_device.cpp",
+# "src/display_device/drm_display.cpp",
+# "src/display_device/drm_encoder.cpp",
+# "src/display_device/drm_plane.cpp",
+# "src/display_device/drm_vsync_worker.cpp",
+# "src/display_device/hdi_composer.cpp",
+# "src/display_device/hdi_device_interface.cpp",
+# "src/display_device/hdi_display.cpp",
+# "src/display_device/hdi_drm_composition.cpp",
+# "src/display_device/hdi_drm_layer.cpp",
+# "src/display_device/hdi_gfx_composition.cpp",
+# "src/display_device/hdi_layer.cpp",
+# "src/display_device/hdi_netlink_monitor.cpp",
+# "src/display_device/hdi_session.cpp",
+# ]
+# output_name = "display_device"
+# include_dirs = [
+# "src/display_device",
+# "include",
+# "//drivers/peripheral/display/interfaces/include",
+# "//drivers/peripheral/base",
+# "//drivers/framework/include/utils",
+# "//drivers/adapter/uhdf2/osal/include",
+# "//utils/native/base/include",
+# "//foundation/graphic/standard/utils/include",
+# "//foundation/graphic/standard/prebuilts/librarys/drm/include",
+# "//base/hiviewdfx/interfaces/innerkits/libhilog/include",
+# ]
+# deps = [
+# ":display_gfx",
+# ":display_gralloc",
+# "//third_party/libdrm:libdrm",
+# "//utils/native/base:utils",
+# ]
+# cflags = [ "-Wno-unused-function" ]
+# external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+#
+# install_enable = true
+# install_images = [ chipset_base_dir ]
+# subsystem_name = "hdf"
+# part_name = "display_device_driver"
+#}
+
+#group("display_layer") {
+# deps = [
+# ":display_device",
+# ":display_gfx",
+# ":display_gralloc",
+# ":higbm",
+# ]
+#}
...@@ -2,93 +2,16 @@ ...@@ -2,93 +2,16 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
diff --git a/drivers/peripheral/display/hal/BUILD.gn b/drivers/peripheral/display/hal/BUILD.gn peripherals: Limit list to supported by the qemuarm
index a232730b..3e374d56 100644
--- a/drivers/peripheral/display/hal/BUILD.gn Signed-off-by: Robert Drab <robert.drab@huawei.com>
+++ b/drivers/peripheral/display/hal/BUILD.gn Upstream-Status: Inappropriate
@@ -15,6 +15,77 @@ if (defined(ohos_lite)) {
group("hdi_display") { diff --git a/uhdf2/ohos.build b/uhdf2/ohos.build
public_deps = [ "//device/${device_company}/hardware/display:hdi_display" ] index f56e333..38db541 100644
} --- a/uhdf2/ohos.build
+} else if (true) { +++ b/uhdf2/ohos.build
+ import("//build/ohos.gni") @@ -6,43 +6,17 @@
+
+ config("display_hdi_public_config") {
+ visibility = [ ":*" ]
+ include_dirs = [
+ "//drivers/peripheral/base",
+ "//drivers/peripheral/display/interfaces/include",
+ "//drivers/peripheral/display/hal",
+ "//drivers/framework/include/utils",
+ "//drivers/adapter/uhdf2/osal/include",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "//third_party/bounds_checking_function/include",
+ ]
+ }
+
+ group("hdi_display") {
+ deps = [
+ ":hdi_display_device",
+ ":hdi_display_gfx",
+ ":hdi_display_gralloc",
+ ":hdi_display_layer",
+ ]
+ }
+
+ ohos_shared_library("hdi_display_device") {
+ sources = [
+ "//drivers/peripheral/display/hal/default/standard_system/display_device.c",
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ subsystem_name = "hdf"
+ part_name = "mocks"
+ }
+
+ ohos_shared_library("hdi_display_layer") {
+ sources = [
+ "//device/qemu/hardware/display/display_layer.c",
+ ]
+ deps = [
+ "//third_party/bounds_checking_function:libsec_static",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog"
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ subsystem_name = "hdf"
+ part_name = "mocks"
+ }
+
+ ohos_shared_library("hdi_display_gfx") {
+ sources = [
+ "//device/qemu/hardware/display/display_gfx.c",
+ ]
+ deps = [
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog"
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ subsystem_name = "hdf"
+ part_name = "mocks"
+ }
+
+ ohos_shared_library("hdi_display_gralloc") {
+ sources = [
+ "//device/qemu/hardware/display/display_gralloc.c",
+ ]
+ deps = [
+ "//third_party/bounds_checking_function:libsec_static",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog"
+ ]
+ public_configs = [ ":display_hdi_public_config" ]
+ subsystem_name = "hdf"
+ part_name = "mocks"
+ }
} else {
config("display_hdi_public_config") {
visibility = [ ":*" ]
diff --git a/drivers/adapter/uhdf2/ohos.build b/drivers/adapter/uhdf2/ohos.build
index f56e333..f897f4b 100644
--- a/drivers/adapter/uhdf2/ohos.build
+++ b/drivers/adapter/uhdf2/ohos.build
@@ -6,43 +6,16 @@
"//drivers/adapter/uhdf2/osal:libhdf_utils", "//drivers/adapter/uhdf2/osal:libhdf_utils",
"//drivers/adapter/uhdf2/ipc:libhdf_ipc_adapter", "//drivers/adapter/uhdf2/ipc:libhdf_ipc_adapter",
"//drivers/adapter/uhdf2/hdi:libhdi", "//drivers/adapter/uhdf2/hdi:libhdi",
...@@ -134,9 +57,10 @@ index f56e333..f897f4b 100644 ...@@ -134,9 +57,10 @@ index f56e333..f897f4b 100644
+ "//drivers/adapter/uhdf2/osal/test:unittest" + "//drivers/adapter/uhdf2/osal/test:unittest"
+ ] + ]
+ }, + },
+ "mocks": { + "display_device_driver": {
+ "module_list": [ + "module_list": [
+ "//drivers/peripheral/display/hal:hdi_display" + "//drivers/peripheral/display/hal:hdi_display",
+ "//device/hihope/hardware/display:display_gralloc"
] ]
} }
} }
...@@ -65,6 +65,15 @@ SRC_URI += "${GITEE_URL}/developtools_profiler.git;protocol=https;branch=OpenHar ...@@ -65,6 +65,15 @@ SRC_URI += "${GITEE_URL}/developtools_profiler.git;protocol=https;branch=OpenHar
SRC_URI += "${GITEE_URL}/device_qemu.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=00bf590c9d04ee5af641ccff7e8a02eb6ff727e0;destsuffix=${OH_SRCDIR}/device/qemu" SRC_URI += "${GITEE_URL}/device_qemu.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=00bf590c9d04ee5af641ccff7e8a02eb6ff727e0;destsuffix=${OH_SRCDIR}/device/qemu"
SRC_URI += "${GITEE_URL}/drivers_adapter.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=9f6cd92cfa61cae193328e53577899f51d5b5fca;destsuffix=${OH_SRCDIR}/drivers/adapter" SRC_URI += "${GITEE_URL}/drivers_adapter.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=9f6cd92cfa61cae193328e53577899f51d5b5fca;destsuffix=${OH_SRCDIR}/drivers/adapter"
# TODO: This should be removed whenever upstream OpenHarmony provides qemu
# compatible gralloc implementation. Currently we have to use OpenHarmony 3.1
# HiHope implementation from a repository that contains, alongside required
# sources, binaries that we do not want. Therefore it is cloned to temporary
# repository, from which only necessary files will be copied to the OH_SRCDIR
# and the rest will be removed in the do_unpack stage postfunc.
OH_GRALLOC_TMP_DIR = "tmp_hihope"
SRC_URI += "${GITEE_URL}/device_board_hihope.git;protocol=https;branch=OpenHarmony-3.1-Release;rev=baab11f2692d9ddbebf8790a5e4a0edd48bdb9bf;destsuffix=${OH_GRALLOC_TMP_DIR}"
# The 2 next repositories are set to different revisions from the ones # The 2 next repositories are set to different revisions from the ones
# they are set to in the official release of OpenHarmony 3.0-LTS. # they are set to in the official release of OpenHarmony 3.0-LTS.
# These revisions are known to boot the Linux kernel on the HiSpark AI # These revisions are known to boot the Linux kernel on the HiSpark AI
...@@ -225,6 +234,22 @@ create_symlinks() { ...@@ -225,6 +234,22 @@ create_symlinks() {
fi fi
} }
# TODO: This should be removed whenever upstream OpenHarmony provides qemu
# compatible gralloc implementation.
# Cherry-pick display directory containing required gralloc implementation
# out of hihope board repository and remove the rest
cherry_pick_sources() {
if [ ! -d "${WORKDIR}/${OH_GRALLOC_TMP_DIR}" ]; then
bbfatal "OH_GRALLOC_TMP_DIR (${WORKDIR}/${OH_GRALLOC_TMP_DIR}) not found!"
fi
TARGET_DIR="${WORKDIR}/${OH_SRCDIR}/device/hihope/hardware/"
install -d "${TARGET_DIR}"
cp -R "${WORKDIR}/${OH_GRALLOC_TMP_DIR}/hardware/display" "${TARGET_DIR}"
rm -r "${WORKDIR}/${OH_GRALLOC_TMP_DIR}"
}
do_unpack[postfuncs] += "create_symlinks" do_unpack[postfuncs] += "create_symlinks"
do_unpack[postfuncs] += "cherry_pick_sources"
require oniro-prebuilts.inc require oniro-prebuilts.inc
...@@ -54,8 +54,12 @@ SRC_URI += "file://hdc-build-system-files.patch;patchdir=${S}/developtools/hdc_s ...@@ -54,8 +54,12 @@ SRC_URI += "file://hdc-build-system-files.patch;patchdir=${S}/developtools/hdc_s
SRC_URI += "file://vendor-qemu-uhdf-files.patch;patchdir=${S}/drivers/peripheral" SRC_URI += "file://vendor-qemu-uhdf-files.patch;patchdir=${S}/drivers/peripheral"
SRC_URI += "git://gitlab.eclipse.org/eclipse/oniro-core/openharmony-vendor-oniro.git;protocol=https;branch=main;rev=c7f69115d7af1a37f81bd4fc0462100d0aa87c2d;destsuffix=${S}/vendor/oniro" SRC_URI += "git://gitlab.eclipse.org/eclipse/oniro-core/openharmony-vendor-oniro.git;protocol=https;branch=main;rev=c7f69115d7af1a37f81bd4fc0462100d0aa87c2d;destsuffix=${S}/vendor/oniro"
SRC_URI += "file://display-Mock-interface-for-standard-system.patch" SRC_URI += "file://peripherals-Limit-drivers-list-to-supported-by-the-qemuarm.patch;patchdir=${S}/drivers/adapter"
SRC_URI += "file://display_device.c;subdir=${S}/drivers/peripheral/display/hal/default/standard_system" SRC_URI += "file://display_device.c;subdir=${S}/drivers/peripheral/display/hal/default/standard_system"
SRC_URI += "file://display-Use-temporary-qemuarm-implementation.patch;patchdir=${S}/drivers/peripheral"
SRC_URI += "file://display_gralloc_gbm.c-Use-card-drm-node.patch;patchdir=${S}/device/hihope"
SRC_URI += "file://hihope-gralloc-Backport-to-3.0.patch;patchdir=${S}/device/hihope"
inherit python3native gn_base ptest inherit python3native gn_base ptest
...@@ -265,7 +269,7 @@ generate_parts_json() { ...@@ -265,7 +269,7 @@ generate_parts_json() {
"global:resmgr_standard", "global:resmgr_standard",
"graphic:graphic_standard", "graphic:graphic_standard",
"hdf:hdf", "hdf:hdf",
"hdf:mocks", "hdf:display_device_driver",
"hiviewdfx:faultloggerd", "hiviewdfx:faultloggerd",
"hiviewdfx:hilog", "hiviewdfx:hilog",
"hiviewdfx:hilog_native", "hiviewdfx:hilog_native",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment