From f9b04d4f1c1952e94f2bc02aeba54914054bab20 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 21 Jun 2024 11:18:22 +0900 Subject: [PATCH] memory: Add empty function Tizen C# TCT blame there is no memory backend. At least, it requires empty backend. Change-Id: I932232afd0fe5e8c8391410a9e92657320565791 Signed-off-by: Youngjae Cho --- CMakeLists.txt | 3 +- hw/memory/CMakeLists.txt | 18 +++++++++++ hw/memory/memory.c | 67 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 hw/memory/CMakeLists.txt create mode 100644 hw/memory/memory.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 44acd81..e73b8ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,4 +16,5 @@ ENDIF() INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.Apache-2.0 DESTINATION ${HAL_LICENSE_DIR}/${PROJECT_NAME}) -ADD_SUBDIRECTORY(hw/display) \ No newline at end of file +ADD_SUBDIRECTORY(hw/display) +ADD_SUBDIRECTORY(hw/memory) \ No newline at end of file diff --git a/hw/memory/CMakeLists.txt b/hw/memory/CMakeLists.txt new file mode 100644 index 0000000..a35248a --- /dev/null +++ b/hw/memory/CMakeLists.txt @@ -0,0 +1,18 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(hal-backend-device-memory C) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(hal-backend-device-memory_pkgs REQUIRED dlog) + +FOREACH(flag ${hal-backend-device-memory_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_LIBRARY(${PROJECT_NAME} MODULE memory.c) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${hal-backend-device-memory_pkgs_LDFLAGS}) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${HAL_LIB_DIR} COMPONENT RuntimeLibraries) diff --git a/hw/memory/memory.c b/hw/memory/memory.c new file mode 100644 index 0000000..84f4c9b --- /dev/null +++ b/hw/memory/memory.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * + * 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 +#include +#include + +#include +#include + +#include "hal-backend-device-visionfive2-common.h" + +static int memory_get_gpu_info(const int pid, hal_device_memory_gpu_info_s *info) +{ + return -ENODEV; +} + +static int memory_get_gem_info(const int pid, hal_device_memory_gem_info_s *info) +{ + return -ENODEV; +} + +static int memory_init(void **data) +{ + hal_backend_device_memory_funcs *device_memory_funcs; + + if (!data) { + _E("Invalid parameter"); + return -EINVAL; + } + + device_memory_funcs = *(hal_backend_device_memory_funcs **) data; + if (!device_memory_funcs) + return -EINVAL; + + device_memory_funcs->get_gpu_info = memory_get_gpu_info; + device_memory_funcs->get_gem_info = memory_get_gem_info; + + return 0; +} + +static int memory_exit(void *data) +{ + return 0; +} + +hal_backend EXPORT hal_backend_device_memory_data = { + .name = "memory", + .vendor = "VisionFive2", + .init = memory_init, + .exit = memory_exit, + .major_version = 1, + .minor_version = 0, +}; -- 2.34.1