memory: Add empty function 63/313263/1 accepted/tizen/unified/toolchain/20240624.121159 accepted/tizen/unified/x/20240621.093622 accepted/tizen/unified/x/asan/20240625.091355
authorYoungjae Cho <y0.cho@samsung.com>
Fri, 21 Jun 2024 02:18:22 +0000 (11:18 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Fri, 21 Jun 2024 02:20:53 +0000 (11:20 +0900)
Tizen C# TCT blame there is no memory backend. At least, it requires
empty backend.

Change-Id: I932232afd0fe5e8c8391410a9e92657320565791
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
CMakeLists.txt
hw/memory/CMakeLists.txt [new file with mode: 0644]
hw/memory/memory.c [new file with mode: 0644]

index 44acd810eec433d16fa8c1c84bddfc8fd3e42074..e73b8cae91212184800d254b5f63e0c97c373ac6 100644 (file)
@@ -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 (file)
index 0000000..a35248a
--- /dev/null
@@ -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 (file)
index 0000000..84f4c9b
--- /dev/null
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <hal/hal-device-memory-interface.h>
+#include <hal/hal-common-interface.h>
+
+#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,
+};