TPL_HEADERS += $(SRC_DIR)/tpl_worker_thread.h
TPL_HEADERS += $(SRC_DIR)/tpl_wayland_egl_thread.h
TPL_SRCS += $(SRC_DIR)/tpl_wayland_egl.c
-TPL_SRCS += $(SRC_DIR)/tpl_wayland_egl_thread.c
+#TPL_SRCS += $(SRC_DIR)/tpl_wayland_egl_thread.c
TPL_SRCS += $(SRC_DIR)/tpl_wayland_vk_wsi.c
TPL_SRCS += $(SRC_DIR)/tpl_gbm.c
TPL_SRCS += $(SRC_DIR)/protocol/tizen-surface-protocol.c
OBJS = $(TPL_SRCS:%.c=%.o)
################################################################################
-all: $(BIN_NAME)
+all: $(BIN_NAME) glib_wl_test
$(BIN_NAME) : $(OBJS) $(TPL_HEADERS)
$(CC) -o $@ $(OBJS) -shared -Wl,-soname,$(SO_NAME) $(CFLAGS) $(LDFLAGS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
+#Make for test file
+glib_wl_test : $(OBJS) $(TPL_HEADERS)
+ $(CC) -o glib_wl_test $(SRC_DIR)/tpl_wayland_egl_thread.c -O0 $(CFLAGS) -DWORKER_TEST_ONLY $(LDFLAGS)
+
clean:
find . -name "*.o" -exec rm -vf {} \;
find . -name "*~" -exec rm -vf {} \;
install: all
cp -va $(BIN_NAME) $(INST_DIR)/
+ cp glib_wl_test $(bindir)/
uninstall:
rm -f $(INST_DIR)/$(BIN_NAME)
+ rm -f $(bindir)/glib_wl_test
%define ENABLE_DEFAULT_LOG 0
%define ENABLE_DEFAULT_DUMP 0
%define ENABLE_OBJECT_HASH_CHECK 1
+%define ENABLE_WORKER_TEST_ONLY 1
#TPL INSTALL OPTION
%define ENABLE_TPL_TEST 0
TPL_OPTIONS=${TPL_OPTIONS}-object_hash_check
%endif
+%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
+TPL_OPTIONS=${TPL_OPTIONS}-worker_test
+%endif
+
%ifarch %arm aarch64
TPL_OPTIONS=${TPL_OPTIONS}-arm_atomic_operation
%endif
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_libdir}/pkgconfig
+%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
+mkdir -p %{buildroot}%{_bindir}
+%endif
export TPL_VER_MAJOR=%{TPL_VER_MAJOR}
export TPL_VER_MINOR=%{TPL_VER_MINOR}
export TPL_RELEASE=%{TPL_RELEASE}
+%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
+make install libdir=%{buildroot}%{_libdir} bindir=%{buildroot}%{_bindir}
+%endif
+
+%if "%{ENABLE_WORKER_TEST_ONLY}" == "0"
make install libdir=%{buildroot}%{_libdir}
+%endif
ln -sf libtpl-egl.so.%{TPL_VER_FULL} %{buildroot}%{_libdir}/libtpl-egl.so.%{TPL_VERSION}
ln -sf libtpl-egl.so.%{TPL_VERSION} %{buildroot}%{_libdir}/libtpl-egl.so.%{TPL_VER_MAJOR}
ln -sf libtpl-egl.so.%{TPL_VER_MAJOR} %{buildroot}%{_libdir}/libtpl-egl.so
%{_libdir}/libtpl-egl.so.%{TPL_VERSION}
%{_libdir}/libtpl-egl.so.%{TPL_VER_FULL}
+%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
+%{_bindir}/glib_wl_test
+%endif
+
#tpl-test files
%if "%{ENABLE_TPL_TEST}" == "1"
%dir /opt/usr/tpl-test/
#include <glib.h>
#include <glib-unix.h>
+#ifdef WORKER_TEST_ONLY
+#include <glib.h>
+#include <sys/syscall.h>
+
+#define FONT_DEFAULT "\033[0m" /* for reset to default color */
+#define FONT_RED "\033[31m" /* for error logs */
+#define FONT_GREEN "\033[32m" /* for frontend API logs */
+#define FONT_MAGENTA "\033[35m" /* for debug logs */
+
+#define tpl_log_d(t, f, x...) \
+ fprintf(stderr, FONT_MAGENTA t FONT_DEFAULT "[(tid:%li)(%s)] " f "\n",\
+ syscall(SYS_gettid), __func__, ##x)
+#define tpl_log_t(t, f, x...) \
+ fprintf(stderr, FONT_GREEN t FONT_DEFAULT "[(tid:%li)(%s)] " f "\n", \
+ syscall(SYS_gettid), __func__, ##x)
+#define tpl_log_e(t, f, x...) \
+ fprintf(stderr, FONT_RED t "[(tid:%li)(%s)] " f FONT_DEFAULT "\n", \
+ syscall(SYS_gettid), __func__, ##x)
+
+#define TPL_ERR(f, x...) tpl_log_e("[TPL_ERROR]", f, ##x)
+#define TPL_DEBUG_M(f, x...) tpl_log_d("[MAIN]", f, ##x)
+#define TPL_DEBUG_T(f, x...) tpl_log_t("[THREAD]", f, ##x)
+
+typedef struct _twe_thread twe_thread;
+typedef struct _twe_thread_context twe_thread_context;
+#else
#include "wayland-egl/wayland-egl-priv.h"
#include "tpl_wayland_egl_thread.h"
#include "tpl_utils.h"
-
+#endif
typedef struct _twe_wl_disp_source twe_wl_disp_source;
typedef struct _twe_wl_surf_source twe_wl_surf_source;
g_source_destroy(&source->gsource);
g_source_unref(&source->gsource);
}
+
+#ifdef WORKER_TEST_ONLY
+static void reg_global(void *data,
+ struct wl_registry *wl_registry,
+ uint32_t name,
+ const char *interface,
+ uint32_t version)
+{
+ TPL_DEBUG_M("reg_global: %s_v_%d\n", interface, version);
+}
+
+
+static void reg_global_remove(void *data,
+ struct wl_registry *wl_registry,
+ uint32_t name)
+{
+}
+
+
+static const struct wl_registry_listener registry_listener = {
+ reg_global,
+ reg_global_remove
+};
+
+void
+main(void)
+{
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_event_queue *ev_queue;
+ int count = 0;
+
+ twe_thread *t_thread = NULL;
+
+ TPL_DEBUG_M("[[GLIB_WL_THREAD_TEST]]");
+
+ /*Create the twe_thread*/
+ t_thread = twe_thread_create();
+
+ /*Add the wl_display to twe_thread*/
+ display = wl_display_connect(NULL);
+ ev_queue = wl_display_create_queue(display);
+
+ wl_proxy_set_queue((struct wl_proxy *)display, ev_queue);
+
+ registry = wl_display_get_registry(display);
+ wl_registry_add_listener(registry, ®istry_listener, NULL);
+
+ twe_thread_add_wl_display(t_thread, display);
+
+ while (1) {
+ sleep(1);
+ count++;
+
+ if (count == 3) {
+ TPL_DEBUG_M("#### PRE_DEL");
+ twe_thread_del_wl_display(t_thread, display);
+ TPL_DEBUG_M("#### DEL");
+ }
+ }
+
+ twe_thread_destroy(t_thread);
+}
+
+#endif
+