sync from std to master

fix mistake about free buffer handle
    change rc to cfg
    change socket patch
    fix bufferhandle init bug

Signed-off-by: 黄磊 <huanglei0704@thundersoft.com>
Change-Id: Id89bd9b2301e4035a9ad152a76e01058be8f05a1
Signed-off-by: 黄磊 <huanglei0704@thundersoft.com>
This commit is contained in:
黄磊 2021-07-19 17:28:31 +08:00
parent aa9fde16c2
commit 2077815aa3
9 changed files with 74 additions and 6 deletions

View File

@ -14,8 +14,19 @@
import("//build/ohos.gni")
## Install graphic.rc to /system/etc/init/graphic.rc {{{
#ohos_prebuilt_etc("graphic.rc") {
# source = "graphic.rc"
# relative_install_dir = "init"
# part_name = "graphic_standard"
# subsystem_name = "graphic"
#}
ohos_prebuilt_etc("graphic.rc") {
source = "graphic.rc"
if (use_musl) {
source = "graphic.cfg"
} else {
source = "graphic.rc"
}
relative_install_dir = "init"
part_name = "graphic_standard"
subsystem_name = "graphic"

View File

@ -20,6 +20,7 @@
#include <surface_buffer.h>
#include <buffer_handle_parcel.h>
#include <buffer_handle_utils.h>
namespace OHOS {
enum ExtraDataType {

View File

@ -59,7 +59,7 @@ SurfaceBufferImpl::~SurfaceBufferImpl()
}
if (this->bufferData_.handle_) {
delete[] reinterpret_cast<uint8_t*>(this->bufferData_.handle_);
FreeBufferHandle(this->bufferData_.handle_);
}
}

View File

@ -145,7 +145,7 @@ static int32_t GetDrmFmtByPixelFmt(int32_t pixelFmt)
static int32_t CreateShmFile(int32_t size)
{
static const char tempPath[] = "/weston-shared-XXXXXX";
static const char path[] = "/dev/socket";
static const char path[] = "/data/weston";
size_t len = sizeof(path) + sizeof(tempPath) + 1;
std::unique_ptr<char[]> name = std::make_unique<char[]>(len);
auto ret = strcpy_s(name.get(), len, path);

21
graphic.cfg Normal file
View File

@ -0,0 +1,21 @@
{
"jobs" : [{
"name" : "weston_start",
"cmds" : [
"start wms_service",
"start bootanimation"
]
}
],
"services" : [{
"name" : "wms_service",
"path" : ["/system/bin/wms_service"],
"disabled" : 1
}, {
"name" : "bootanimation",
"path" : ["/system/bin/bootanimation"],
"disabled" : 1,
"once" : 1
}
]
}

View File

@ -24,13 +24,23 @@ ohos_prebuilt_etc("udevd.rc") {
## Install udevd.rc to /system/etc/init/udevd.rc }}}
## Install weston.rc to /system/etc/init/weston.rc {{{
#ohos_prebuilt_etc("weston.rc") {
# source = "weston.rc"
# relative_install_dir = "init"
# part_name = "graphic_standard"
# subsystem_name = "graphic"
#}
ohos_prebuilt_etc("weston.rc") {
source = "weston.rc"
if (use_musl) {
source = "weston.cfg"
} else {
source = "weston.rc"
}
relative_install_dir = "init"
part_name = "graphic_standard"
subsystem_name = "graphic"
}
## Install weston.rc to /system/etc/init/weston.rc }}}
## Install weston.ini to /system/etc/./weston.ini {{{

22
prebuilts/etcs/weston.cfg Normal file
View File

@ -0,0 +1,22 @@
{
"jobs" : [{
"name" : "post-fs",
"cmds" : [
"export WESTON_MODULE_MAP drm-backend.so=libdrm-backend.z.so",
"export XDG_RUNTIME_DIR /data/weston",
"export XKB_CONFIG_ROOT /etc/xkb",
"export XKB_CONFIG_EXTRA_PATH /etc/xkb",
"mkdir /data/weston",
"chmod 777 /data/weston",
"start weston",
"trigger weston_start"
]
}
],
"services" : [{
"name" : "weston",
"path" : ["/system/bin/weston", "-c", "/system/etc/weston.ini", "-B", "drm-backend.so", "--tty=1", "--use-pixman"],
"disabled" : 1
}
]
}

View File

@ -42,9 +42,11 @@ on post-fs
start mmi_uinput_service
exec /system/bin/sleep 2
export WESTON_MODULE_MAP "drm-backend.so=libdrm-backend.z.so"
export XDG_RUNTIME_DIR "/dev/socket"
export XDG_RUNTIME_DIR "/data/weston"
export XKB_CONFIG_ROOT "/etc/xkb"
export XKB_CONFIG_EXTRA_PATH "/etc/xkb"
mkdir /data/weston
chmod 777 /data/weston
start weston
trigger weston_start

View File

@ -42,6 +42,7 @@ BufferHandle *AllocateBufferHandle(uint32_t reserveFds, uint32_t reserveInts)
size_t handleSize = sizeof(BufferHandle) + (sizeof(int32_t) * (reserveFds + reserveInts));
BufferHandle *handle = static_cast<BufferHandle *>(malloc(handleSize));
if (handle != nullptr) {
(void)memset_s(handle, handleSize, 0, handleSize);
handle->fd = -1;
for (uint32_t i = 0; i < reserveFds; i++) {
handle->reserve[i] = -1;