The libshared library is to be used for shared functionalities.
For now, it only provides converting pixel format functionality for both
tbm_server and video implementation, but it will be expanded as needed.
Video implementation will use it in a future patch.
Change-Id: I94d7cd6479abbdcc4e0860fb41c878b96ac9296e
libds_tizen_bindir = join_paths(dir_prefix, get_option('bindir'))
libds_tizen_inc = include_directories('include')
-common_inc = [ include_directories('.'), libds_tizen_inc ]
cdata = configuration_data()
cdata.set('LIBDS_VERSION_MAJOR', libds_tizen_version_major)
+common_inc = [ include_directories('.'), libds_tizen_inc ]
+
math = meson.get_compiler('c').find_library('m')
wayland_server = dependency('wayland-server', required: true)
rt = meson.get_compiler('c').find_library('rt')
rt,
]
+dep_libds = dependency('libds', required: true)
+
deps_libds_tizen = [
deps_base,
wayland_server,
- dependency('libds', required: true),
+ dep_libds,
]
tizen_security_files = [
dependency('libsmack', required: true)
]
+subdir('shared')
subdir('allocator')
subdir('tbm_server')
subdir('backend')
--- /dev/null
+libshared_srcs = [
+ 'pixel_format.c',
+]
+
+libshared_deps = [
+ dep_libds,
+ dependency('libdrm', required: true),
+ dependency('libtbm', required: true),
+]
+
+lib_libshared = static_library(
+ 'shared',
+ libshared_srcs,
+ dependencies: libshared_deps,
+ pic: true,
+ install: false,
+)
+
+dep_libshared = declare_dependency(
+ link_with: lib_libshared,
+ dependencies: libshared_deps,
+)
--- /dev/null
+#include <inttypes.h>
+#include <drm_fourcc.h>
+#include <tbm_type.h>
+
+#include <libds/log.h>
+#include "pixel_format.h"
+
+#ifdef ARRAY_LENGTH
+#undef ARRAY_LENGTH
+#endif
+
+#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
+
+struct ds_tbm_format
+{
+ uint32_t drm_format;
+ uint32_t tbm_format;
+};
+
+static const struct ds_tbm_format formats[] =
+{
+ {
+ .drm_format = DRM_FORMAT_ARGB8888,
+ .tbm_format = TBM_FORMAT_ARGB8888,
+ },
+ {
+ .drm_format = DRM_FORMAT_XRGB8888,
+ .tbm_format = TBM_FORMAT_XRGB8888,
+ },
+ /* TODO more format */
+};
+
+uint32_t
+convert_drm_format_to_tbm(uint32_t fmt)
+{
+ size_t i;
+
+ for (i = 0; i < ARRAY_LENGTH(formats); i++) {
+ if (formats[i].drm_format == fmt)
+ return formats[i].tbm_format;
+ }
+
+ ds_err("DRM format 0x%"PRIX32" has no TBM equivalent", fmt);
+
+ return 0;
+}
+
+uint32_t
+convert_tbm_format_to_drm(uint32_t fmt)
+{
+ size_t i;
+
+ for (i = 0; i < ARRAY_LENGTH(formats); i++) {
+ if (formats[i].tbm_format == fmt)
+ return formats[i].drm_format;
+ }
+
+ ds_err("TBM format 0x%"PRIX32" has no DRM equivalent", fmt);
+
+ return 0;
+}
--- /dev/null
+#ifndef DS_TIZEN_PIXEL_FORMAT_H
+#define DS_TIZEN_PIXEL_FORMAT_H
+
+#include <stdint.h>
+
+uint32_t convert_drm_format_to_tbm(uint32_t fmt);
+
+uint32_t convert_tbm_format_to_drm(uint32_t fmt);
+
+#endif
libds_tizen_tbm_server_files = [
- 'pixel_format.c',
'tbm_server.c',
]
libds_tizen_tbm_server_deps = [
deps_libds_tizen,
- dependency('libdrm', required: true),
+ dep_libshared,
dependency('libtbm', required: true),
dependency('wayland-tbm-server', required: true),
]
+++ /dev/null
-#include <inttypes.h>
-#include <drm_fourcc.h>
-#include <tbm_type.h>
-
-#include <libds/log.h>
-#include "pixel_format.h"
-
-#ifdef ARRAY_LENGTH
-#undef ARRAY_LENGTH
-#endif
-
-#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
-
-struct ds_tbm_format
-{
- uint32_t drm_format;
- uint32_t tbm_format;
-};
-
-static const struct ds_tbm_format formats[] =
-{
- {
- .drm_format = DRM_FORMAT_ARGB8888,
- .tbm_format = TBM_FORMAT_ARGB8888,
- },
- {
- .drm_format = DRM_FORMAT_XRGB8888,
- .tbm_format = TBM_FORMAT_XRGB8888,
- },
- /* TODO more format */
-};
-
-uint32_t
-convert_drm_format_to_tbm(uint32_t fmt)
-{
- size_t i;
-
- for (i = 0; i < ARRAY_LENGTH(formats); i++) {
- if (formats[i].drm_format == fmt)
- return formats[i].tbm_format;
- }
-
- ds_err("DRM format 0x%"PRIX32" has no TBM equivalent", fmt);
-
- return 0;
-}
-
-uint32_t
-convert_tbm_format_to_drm(uint32_t fmt)
-{
- size_t i;
-
- for (i = 0; i < ARRAY_LENGTH(formats); i++) {
- if (formats[i].tbm_format == fmt)
- return formats[i].drm_format;
- }
-
- ds_err("TBM format 0x%"PRIX32" has no DRM equivalent", fmt);
-
- return 0;
-}
+++ /dev/null
-#ifndef DS_TIZEN_PIXEL_FORMAT_H
-#define DS_TIZEN_PIXEL_FORMAT_H
-
-#include <stdint.h>
-
-uint32_t convert_drm_format_to_tbm(uint32_t fmt);
-
-uint32_t convert_tbm_format_to_drm(uint32_t fmt);
-
-#endif
#include <tbm_bufmgr.h>
#include <libds/log.h>
-#include "pixel_format.h"
+#include "shared/pixel_format.h"
#include "tbm_server.h"
static const struct ds_buffer_resource_interface tbm_buffer_resource_iface;