stubs/tdm_vblank.cpp \
stubs/stub_pthread.cpp \
stubs/stub_stdlib.cpp \
+ stubs/tdm_backend_module_subs.cpp \
stubs/stub_unistd.cpp \
stubs/stub_backend.cpp
*
**************************************************************************/
+#include "../stubs/stub_dlfcn.h"
#include "gtest/gtest.h"
+/*------ stubs -----------------*/
+#include "tdm_event_loop_stubs.h"
#include "tbm_stubs.h"
#include "stub_pthread.h"
+#include "stub_tdm_vblank.h"
#include "stub_stdlib.h"
-
+#include "stub_stdio.h"
+#include "stub_unistd.h"
+#include "tdm_event_loop_stubs.h"
#include "tdm.c"
-
-#include "tdm_private.h"
-
-static tdm_private_display ut_private_display;
+/*------ tested file -----------*/
static void _init_test()
{
stub_tbm_init();
stub_stdlib_init();
+ stub_dlfcn_init();
+ stub_stdio_init();
+ stub_tdm_vblank_init();
g_private_display = NULL;
}
+extern tdm_backend_module tdm_backend_module_stub;
+
+
/* tdm_display_update */
TEST(tdm_display_update, work_flow_success_1)
ASSERT_EQ(error, expected_error);
}
+/* tdm_display_init() */
+TEST(tdm_display_init, work_flow_success_1___first_call)
+{
+ tdm_error error = TDM_ERROR_BAD_REQUEST;
+ tdm_display *disp;
+
+ _init_test();
+
+ //to download tdm_backend_module;
+ stub_dlfcn_ctrl.dlopen_returned_val = (void*)1;
+ stub_dlfcn_ctrl.dlsym_returned_val = &tdm_backend_module_stub;
+
+ setenv("TDM_DEBUG_MODULE", "all", 1);
+ setenv("TDM_DEBUG_DUMP", "capture,pp,layer,all", 1);
+ setenv("TDM_DEBUG_PATH", "log.txt", 1);
+ stub_getenv_return_real_value = 1;
+
+ disp = tdm_display_init(&error);
+
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ ASSERT_TRUE(g_private_display != NULL);
+ ASSERT_TRUE(g_private_display == disp);
+ ASSERT_EQ(1, g_private_display->init_count);
+}
+
+TEST(tdm_display_init, work_flow_success_2___second_call)
+{
+ tdm_error error = TDM_ERROR_BAD_REQUEST;
+ tdm_display *disp;
+ tdm_private_display display;
+
+ _init_test();
+ memset(&display, 0, sizeof(display));
+ g_private_display = &display;
+ g_private_display->init_count = 1;
+
+ disp = tdm_display_init(&error);
+
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ ASSERT_TRUE(g_private_display != NULL);
+ ASSERT_TRUE(g_private_display == disp);
+ ASSERT_EQ(2, g_private_display->init_count);
+}
+
+
+TEST(tdm_display_init, work_flow_error_1___calloc_error)
+{
+ tdm_error error = TDM_ERROR_BAD_REQUEST;
+ tdm_display *disp;
+
+ _init_test();
+ CALLOC_ERROR = 1;
+
+ disp = tdm_display_init(&error);
+
+ ASSERT_EQ(TDM_ERROR_OUT_OF_MEMORY, error);
+ ASSERT_TRUE(disp == NULL);
+ ASSERT_TRUE(g_private_display == NULL);
+}
+
+TEST(tdm_display_init, work_flow_error_2___mutex_init_error)
+{
+ tdm_error error = TDM_ERROR_BAD_REQUEST;
+ tdm_display *disp;
+
+ _init_test();
+ PTHREAD_MUTEX_INIT_ERROR = 1;
+
+ disp = tdm_display_init(&error);
+
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ ASSERT_TRUE(disp == NULL);
+ ASSERT_TRUE(g_private_display == NULL);
+}
+
/* tdm_display_deinit */
-TEST(tdm_display_deinit, work_flow_success_1)
+TEST(tdm_display_deinit, work_flow_success_1___init_count_more_then_one)
{
tdm_private_display *dpy;
unsigned int expected = 2;
ASSERT_EQ(actual, expected);
}
-/* tdm_display_init() */
-TEST(tdm_display_init, work_flow_success_7)
+TEST(tdm_display_deinit, work_flow_success_2___init_count_is_one)
{
- int actual;
- int expected = 1;
+ unsigned int expected = 2;
+ unsigned int actual;
+
+ tdm_error error = TDM_ERROR_BAD_REQUEST;
+ tdm_display *disp;
_init_test();
- PTHREAD_MUTEX_INIT_ERROR = 1;
- FREE_CALLED = 0;
+ //to download tdm_backend_module;
+ stub_dlfcn_ctrl.dlopen_returned_val = (void*)1;
+ stub_dlfcn_ctrl.dlsym_returned_val = &tdm_backend_module_stub;
- tdm_display_init(NULL);
+ disp = tdm_display_init(&error);
- actual = FREE_CALLED;
+ ASSERT_EQ(TDM_ERROR_NONE, error);
- ASSERT_EQ(actual, expected);
+ //call tested function
+ tdm_display_deinit(disp);
+
+ ASSERT_EQ(NULL, g_private_display);
+ ASSERT_TRUE(FREE_CALLED);
}
-TEST(tdm_display_init, work_flow_success_6)
-{
- tdm_private_display *actual;
- tdm_private_display *expected;
- _init_test();
-
- PTHREAD_MUTEX_INIT_ERROR = 1;
+/* tdm_display_check_module_abi */
+TEST(tdm_display_check_module_abi, work_flow_success_1)
+{
+ int res;
+ tdm_private_display private_display;
+ tdm_backend_module module;
+ private_display.module_data = &module;
+ module.abi_version = 0x00010001;
- actual = (tdm_private_display *)tdm_display_init(NULL);
+ res = tdm_display_check_module_abi(&private_display, 1, 1);
- expected = NULL;
+ ASSERT_EQ(1, res);
+}
- ASSERT_EQ(actual, expected);
+TEST(tdm_display_check_module_abi, work_flow_error_1___wrong_version)
+{
+ int res;
+ tdm_private_display private_display;
+ tdm_backend_module module;
+ private_display.module_data = &module;
+ module.abi_version = 0x00010001;
+
+ /*minor*/
+ res = tdm_display_check_module_abi(&private_display, 1, 2);
+ ASSERT_EQ(0, res);
+
+ /*major*/
+ res = tdm_display_check_module_abi(&private_display, 2, 1);
+ ASSERT_EQ(0, res);
}
-TEST(tdm_display_init, work_flow_success_5)
+/* tdm_display_check_module_abi */
+TEST(tdm_display_enable_debug_module, work_flow_success_1)
{
tdm_error error;
- tdm_error expected_error;
-
- _init_test();
- error = TDM_ERROR_BAD_REQUEST;
- PTHREAD_MUTEX_INIT_ERROR = 1;
+ //check all
+ error = tdm_display_enable_debug_module("all");
+ ASSERT_EQ(0xFFFFFFFF, tdm_debug_module);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
- tdm_display_init(&error);
+ //check none
+ error = tdm_display_enable_debug_module("none");
+ ASSERT_EQ(0, tdm_debug_module);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
- expected_error = TDM_ERROR_OPERATION_FAILED;
+ //check buffer,thread,mutex,vblank
+ error = tdm_display_enable_debug_module("buffer,thread,mutex,vblank");
+ ASSERT_EQ((TDM_DEBUG_BUFFER | TDM_DEBUG_THREAD | TDM_DEBUG_MUTEX | TDM_DEBUG_VBLANK) ,
+ tdm_debug_module);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
- ASSERT_EQ(error, expected_error);
}
-TEST(tdm_display_init, work_flow_success_4)
+TEST(tdm_display_enable_debug_module, work_flow_error_1___bad_module)
{
- tdm_private_display *actual;
- tdm_private_display *expected = NULL;
-
- _init_test();
-
- CALLOC_ERROR = 1;
-
- actual = (tdm_private_display *)tdm_display_init(NULL);
+ tdm_error error;
- ASSERT_EQ(actual, expected);
+ //check bufer
+ error = tdm_display_enable_debug_module("bufer");
+ ASSERT_EQ(0 , tdm_debug_module);
+ ASSERT_NE(TDM_ERROR_NONE, error);
}
-TEST(tdm_display_init, work_flow_success_3)
+/* tdm_display_enable_ttrace_vblank */
+TEST(tdm_display_enable_ttrace_vblank, work_flow_success_1)
{
- tdm_error error = TDM_ERROR_BAD_REQUEST;
- tdm_error expected_error = TDM_ERROR_OUT_OF_MEMORY;
+ tdm_error error;
+ tdm_private_display private_display;
+ tdm_private_output output;
+ tdm_output_mode current_mode;
+ int vblank = 1;
_init_test();
+ stub_tdm_vblank_create_returned = &vblank;
- CALLOC_ERROR = 1;
+ output.current_mode = ¤t_mode;
+ output.private_display = &private_display;
- tdm_display_init(&error);
+ error = tdm_display_enable_ttrace_vblank(&private_display, &output, 1);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
- ASSERT_EQ(error, expected_error);
+ error = tdm_display_enable_ttrace_vblank(&private_display, &output, 0);
}
-TEST(tdm_display_init, work_flow_success_2)
+TEST(tdm_display_enable_ttrace_vblank, work_flow_error_1___vblank_wait_fail)
{
- tdm_error error = TDM_ERROR_BAD_REQUEST;
- tdm_error expected_error = TDM_ERROR_NONE;
+ tdm_error error;
+ tdm_private_display private_display;
+ tdm_private_output output;
+ tdm_output_mode current_mode;
+ int vblank = 1;
_init_test();
- g_private_display = &ut_private_display;
+ output.current_mode = ¤t_mode;
+ output.private_display = &private_display;
+ stub_tdm_vblank_create_returned = &vblank;
- tdm_display_init(&error);
+ stub_tdm_vblank_wait_error = 1;
- ASSERT_EQ(error, expected_error);
+ error = tdm_display_enable_ttrace_vblank(&private_display, &output, 1);
+ ASSERT_NE(TDM_ERROR_NONE, error);
}
-TEST(tdm_display_init, work_flow_success_1)
+TEST(tdm_display_enable_ttrace_vblank, work_flow_error_2___vblank_create_fail)
{
- tdm_private_display *actual;
- tdm_private_display *expected = &ut_private_display;
+ tdm_error error;
+ tdm_private_display private_display;
+ tdm_private_output output;
+ tdm_output_mode current_mode;
_init_test();
+ stub_tdm_vblank_create_returned = NULL;
- g_private_display = &ut_private_display;
+ output.current_mode = ¤t_mode;
+ output.private_display = &private_display;
- actual = (tdm_private_display *)tdm_display_init(NULL);
-
- ASSERT_TRUE(actual == expected);
+ error = tdm_display_enable_ttrace_vblank(&private_display, &output, 1);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
}
+
--- /dev/null
+#ifndef _DLFCN_STUBS_H_
+#define _DLFCN_STUBS_H_
+
+#include <dlfcn.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static struct _dlfcn_stub_ctrl {
+ void* dlsym_returned_val;
+ void* dlopen_returned_val;
+} stub_dlfcn_ctrl;
+
+static void stub_dlfcn_init()
+{
+ stub_dlfcn_ctrl.dlsym_returned_val = 0;
+ stub_dlfcn_ctrl.dlopen_returned_val = 0;
+}
+
+static void *ut_dlopen (const char *__file, int __mode)
+{
+ return stub_dlfcn_ctrl.dlopen_returned_val;
+}
+
+static int ut_dlclose (void *__handle)
+{
+ return 0;
+}
+
+static void *ut_dlsym (void *__restrict __handle, const char *__restrict __name)
+{
+ return stub_dlfcn_ctrl.dlsym_returned_val;
+}
+
+#define dlopen ut_dlopen
+#define dlclose ut_dlclose
+#define dlsym ut_dlsym
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DLFCN_STUBS_H_ */
#ifndef STUB_STDIO_H
#define STUB_STDIO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static struct _open_close_stub_ctrl {
+ int fopen_fd_returned;
+ int fclose_error;
+ int fclose_colled;
+ int close_error;
+ int close_colled;
+} open_close_stub_ctrl;
+
static int SSCANF_ERROR;
-static stub_stdio_init()
+static void stub_stdio_init()
{
SSCANF_ERROR = 0;
+ open_close_stub_ctrl.fopen_fd_returned = 1;
+ open_close_stub_ctrl.fclose_error = 0;
+ open_close_stub_ctrl.fclose_colled = 0;
+ open_close_stub_ctrl.close_error = 0;
+ open_close_stub_ctrl.close_colled = 0;
}
static int stub_sscanf(const char *buf, const char *format, ...)
return 0;
}
+#ifndef O_RDWR
+#define O_RDWR 02 /* copy from <bits/fcntl-linux.h>*/
+#endif
+#ifndef O_
+#define O_CLOEXEC 02000000 /* copy from <bits/fcntl-linux.h>*/
+#endif
+
+static int stub_fopen (const char *__file, int __oflag, ...)
+{
+ if (__file == NULL)
+ return -1;
+ return open_close_stub_ctrl.fopen_fd_returned;
+}
+
+static int stub_fclose (int __fd)
+{
+ if (open_close_stub_ctrl.fclose_error)
+ return -1;
+ if (__fd < 1)
+ return -1;
+
+ open_close_stub_ctrl.fclose_colled = 1;
+ return 1;
+}
+
+static int stub_fflush (FILE *__stream)
+{
+ return 1;
+}
+
+static int stub_fileno (FILE *__stream)
+{
+ return 1;
+}
+
+static int stub_setvbuf (FILE *__restrict __stream, char *__restrict __buf, int __modes, size_t __n)
+{
+ return 1;
+}
+
+#ifdef open
+ #undef open
+#endif
+#define fopen stub_fopen
+#define fclose stub_fclose
+#define close stub_close
+#define fflush stub_fflush
+#define fileno stub_fileno
+#define setvbuf stub_setvbuf
+#define dup stub_dup
+#define dup2 stub_dup2
#define sscanf stub_sscanf
+#ifdef __cplusplus
+}
+#endif
+
+
#endif // STUB_STDIO_H
int GETENV_ERROR;
char *stub_getenv_return_value;
+int stub_getenv_return_real_value;
char *stub_getenv_name;
tdm_buffer_info buffer;
char *stub_getenv(const char *name)
{
+ if (stub_getenv_return_real_value)
+ return getenv(name);
+
if (GETENV_ERROR) {
return NULL;
}
GETENV_ERROR = 0;
stub_getenv_return_value = NULL;
stub_getenv_name = NULL;
+ stub_getenv_return_real_value = 0;
}
extern tdm_buffer_info buffer;
extern char *stub_getenv_return_value;
extern char *stub_getenv_name;
+extern int stub_getenv_return_real_value;
void *stub_calloc(size_t nmemb, size_t size);
#include "tdm.h"
static int stub_tdm_vblank_cb_vblank_SW_called;
+static int stub_tdm_vblank_wait_error;
+static tdm_vblank* stub_tdm_vblank_create_returned = NULL;
-void stub_tdm_vblank_init()
+static void
+stub_tdm_vblank_init()
{
stub_tdm_vblank_cb_vblank_SW_called = 0;
+ stub_tdm_vblank_create_returned = NULL;
+ stub_tdm_vblank_wait_error = 0;
}
static tdm_error
(void)vblank_stamp;
stub_tdm_vblank_cb_vblank_SW_called = 1;
+ return TDM_ERROR_NONE;
}
+static tdm_vblank*
+stub_tdm_vblank_create(tdm_display *dpy, tdm_output *output, tdm_error *error)
+{
+ (void)dpy;
+ (void)output;
+ (void)error;
+
+ return stub_tdm_vblank_create_returned;
+}
+
+static void
+stub_tdm_vblank_destroy(tdm_vblank *vblank)
+{
+ (void)vblank;
+}
+
+static tdm_error
+stub_tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps)
+{
+ (void)vblank;
+ (void)fps;
+
+ return TDM_ERROR_NONE;
+}
+
+static unsigned int
+stub_tdm_vblank_get_enable_fake(tdm_vblank *vblank)
+{
+ (void)vblank;
+
+ return 0;
+}
+
+static tdm_error
+stub_tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec,
+ unsigned int interval, tdm_vblank_handler func, void *user_data)
+{
+ (void)vblank;
+ (void)req_sec;
+ (void)req_usec;
+ (void)interval;
+ (void)func;
+ (void)user_data;
+
+ if(stub_tdm_vblank_wait_error)
+ return TDM_ERROR_BAD_REQUEST;
+
+ return TDM_ERROR_NONE;
+}
+
+
#define tdm_vblank_cb_vblank_SW stub_tdm_vblank_cb_vblank_SW
+#define tdm_vblank_wait stub_tdm_vblank_wait
+#define tdm_vblank_get_enable_fake stub_tdm_vblank_get_enable_fake
+#define tdm_vblank_set_fps stub_tdm_vblank_set_fps
+#define tdm_vblank_destroy stub_tdm_vblank_destroy
+#define tdm_vblank_create stub_tdm_vblank_create
#endif // STUB_TDM_VBLANK_H
return 5;
}
+int stub_dup2(int __fd, int __fd2)
+{
+ (void)__fd;
+ (void)__fd2;
+
+ if (stub_dub_error) {
+ return -1;
+ }
+
+ return 5;
+}
+
int stub_poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
(void)fds;
ssize_t stub_read(int fd, void *buf, size_t nbytes);
int stub_dup(int fd);
+int stub_dup2(int __fd, int __fd2);
int stub_poll(struct pollfd *fds, nfds_t nfds, int timeout);
--- /dev/null
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "tdm_backend.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _tdm_backend_module_data {
+ int tmp;
+};
+
+struct _tdm_backend_module_output_data {
+ tdm_caps_output caps;
+};
+
+struct _tdm_backend_module_layer_data {
+ int tmp;
+};
+
+typedef struct _tdm_backend_module_data tdm_backend_module_data;
+typedef struct _tdm_backend_module_output_data tdm_backend_module_output_data;
+typedef struct _tdm_backend_module_layer_data tdm_backend_module_layer_data;
+
+tdm_backend_module_data backend_module_data;
+tdm_backend_module_output_data backend_module_output[4];
+tdm_backend_module_layer_data backend_module_layer;
+
+tdm_error
+tdm_backend_module_creat_output(tdm_backend_module_data *backend_module_data)
+{
+ return TDM_ERROR_NONE;
+}
+
+void
+tdm_backend_module_destroy_output(tdm_backend_module_data *backend_module_data)
+{
+ return;
+}
+
+tdm_error
+tdm_backend_module_creat_layer(tdm_backend_module_data *backend_module_data)
+{
+ return TDM_ERROR_NONE;
+}
+
+void
+tdm_backend_module_destroy_layer(tdm_backend_module_data *backend_module_data)
+{
+}
+
+tdm_error
+backend_module_display_get_pp_capability(tdm_backend_data *bdata, tdm_caps_pp *caps)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_display_get_capability(tdm_backend_data *bdata, tdm_caps_display *caps)
+{
+ caps->max_layer_count = 1;
+ return TDM_ERROR_NONE;
+}
+
+tdm_output**
+backend_module_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error)
+{
+ tdm_output** outputs;
+ *count = 4;
+ outputs = calloc(1, sizeof(tdm_backend_module_output_data*) * (4));
+ outputs[0] = &backend_module_output[0];
+ outputs[1] = &backend_module_output[1];
+ outputs[2] = &backend_module_output[2];
+ outputs[3] = &backend_module_output[3];
+ if (error) *error = TDM_ERROR_NONE;
+ return outputs;
+}
+
+tdm_pp*
+backend_module_display_create_pp(tdm_backend_data *bdata, tdm_error *error)
+{
+ return (tdm_pp*)1;
+}
+
+tdm_error
+backend_module_display_get_capture_capability(tdm_backend_data *bdata, tdm_caps_capture *caps)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_capture*
+backend_module_output_create_capture(tdm_output *output, tdm_error *error)
+{
+ return (tdm_capture*)1;
+}
+tdm_capture*
+backend_module_layer_create_capture(tdm_layer *layer, tdm_error *error)
+{
+ return (tdm_capture*)1;
+}
+
+
+tdm_error
+backend_module_output_get_capability(tdm_output *output, tdm_caps_output *caps)
+{
+
+ tdm_backend_module_output_data *backend_output = (tdm_backend_module_output_data*)output;
+ memcpy(caps, &backend_output->caps, sizeof(tdm_caps_output));
+
+ return TDM_ERROR_NONE;
+}
+
+tdm_layer**
+backend_module_output_get_layers(tdm_output *output, int *count, tdm_error *error)
+{
+ tdm_layer** layers;
+ *count = 1;
+ layers = calloc(*count, sizeof(tdm_layer));
+ layers[0] = &backend_module_layer;
+ if (error) *error = TDM_ERROR_NONE;
+
+ return layers;
+
+}
+
+tdm_error
+backend_module_output_set_property(tdm_output *output, unsigned int id, tdm_value value)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_get_property(tdm_output *output, unsigned int id, tdm_value *value)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_wait_vblank(tdm_output *output, int interval, int sync, void *user_data)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_set_vblank_handler(tdm_output *output, tdm_output_vblank_handler func)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_commit(tdm_output *output, int sync, void *user_data)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_set_commit_handler(tdm_output *output, tdm_output_commit_handler func)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value)
+{
+ *dpms_value = TDM_OUTPUT_DPMS_ON;
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_set_mode(tdm_output *output, const tdm_output_mode *mode)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_output_get_mode(tdm_output *output, const tdm_output_mode **mode)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_set_info(tdm_layer *layer, tdm_info_layer *info)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_get_info(tdm_layer *layer, tdm_info_layer *info)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
+backend_module_layer_unset_buffer(tdm_layer *layer)
+{
+ return TDM_ERROR_NONE;
+}
+
+
+void
+tdm_backend_module_deinit(tdm_backend_data *bdata)
+{
+}
+
+void
+backend_module_pp_destroy(tdm_pp *pp)
+{
+}
+tdm_error
+backend_module_pp_set_info(tdm_pp *pp, tdm_info_pp *info)
+{
+ return TDM_ERROR_NONE;
+}
+tdm_error
+backend_module_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst)
+{
+ return TDM_ERROR_NONE;
+}
+tdm_error
+backend_module_pp_commit(tdm_pp *pp)
+{
+ return TDM_ERROR_NONE;
+}
+tdm_error
+backend_module_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data)
+{
+ return TDM_ERROR_NONE;
+}
+
+//
+void
+backend_module_capture_destroy(tdm_capture *capture)
+{
+}
+tdm_error
+backend_module_capture_set_info(tdm_capture *capture, tdm_info_capture *info)
+{
+ return TDM_ERROR_NONE;
+}
+tdm_error
+backend_module_capture_attach(tdm_capture *capture, tbm_surface_h buffer)
+{
+ return TDM_ERROR_NONE;
+}
+tdm_error
+backend_module_capture_commit(tdm_capture *capture)
+{
+ return TDM_ERROR_NONE;
+}
+tdm_error
+backend_module_capture_set_done_handler(tdm_capture *capture,
+ tdm_capture_done_handler func, void *user_data)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_backend_data*
+tdm_backend_module_init(tdm_display *dpy, tdm_error *error)
+{
+ tdm_func_display backend_module_func_display;
+ tdm_func_output backend_module_func_output;
+ tdm_func_layer backend_module_func_layer;
+ tdm_func_capture func_capture;
+ tdm_func_pp func_pp;
+
+ tdm_error ret;
+
+ if (!dpy) {
+ if (error) *error = TDM_ERROR_BAD_REQUEST;
+ return NULL;
+ }
+
+ backend_module_output[0].caps.status = TDM_OUTPUT_CONN_STATUS_CONNECTED;
+ backend_module_output[0].caps.type = TDM_OUTPUT_TYPE_DSI;
+ backend_module_output[1].caps.status = TDM_OUTPUT_CONN_STATUS_CONNECTED;
+ backend_module_output[1].caps.type = TDM_OUTPUT_TYPE_LVDS;
+ backend_module_output[2].caps.status = TDM_OUTPUT_CONN_STATUS_CONNECTED;
+ backend_module_output[2].caps.type = TDM_OUTPUT_TYPE_HDMIA;
+ backend_module_output[3].caps.status = TDM_OUTPUT_CONN_STATUS_CONNECTED;
+ backend_module_output[3].caps.type = TDM_OUTPUT_TYPE_HDMIB;
+
+ memset(&backend_module_func_display, 0, sizeof(backend_module_func_display));
+ backend_module_func_display.display_get_pp_capability = backend_module_display_get_pp_capability;
+ backend_module_func_display.display_get_capability = backend_module_display_get_capability;
+ backend_module_func_display.display_get_outputs = backend_module_display_get_outputs;
+ backend_module_func_display.display_get_fd = NULL;
+ backend_module_func_display.display_handle_events = NULL;
+
+ backend_module_func_display.display_create_pp = backend_module_display_create_pp;
+ backend_module_func_display.display_get_capture_capability = backend_module_display_get_capture_capability;
+ backend_module_func_output.output_create_capture = backend_module_output_create_capture;
+ backend_module_func_layer.layer_create_capture = backend_module_layer_create_capture;
+
+
+ memset(&backend_module_func_output, 0, sizeof(backend_module_func_output));
+ backend_module_func_output.output_get_capability = backend_module_output_get_capability;
+ backend_module_func_output.output_get_layers = backend_module_output_get_layers;
+ backend_module_func_output.output_set_property = backend_module_output_set_property;
+ backend_module_func_output.output_get_property = backend_module_output_get_property;
+ backend_module_func_output.output_wait_vblank = backend_module_output_wait_vblank;
+ backend_module_func_output.output_set_vblank_handler = backend_module_output_set_vblank_handler;
+ backend_module_func_output.output_commit = backend_module_output_commit;
+ backend_module_func_output.output_set_commit_handler = backend_module_output_set_commit_handler;
+ backend_module_func_output.output_set_dpms = backend_module_output_set_dpms;
+ backend_module_func_output.output_get_dpms = backend_module_output_get_dpms;
+ backend_module_func_output.output_set_mode = backend_module_output_set_mode;
+ backend_module_func_output.output_get_mode = backend_module_output_get_mode;
+
+ memset(&backend_module_func_layer, 0, sizeof(backend_module_func_layer));
+ backend_module_func_layer.layer_get_capability = backend_module_layer_get_capability;
+ backend_module_func_layer.layer_set_property = backend_module_layer_set_property;
+ backend_module_func_layer.layer_get_property = backend_module_layer_get_property;
+ backend_module_func_layer.layer_set_info = backend_module_layer_set_info;
+ backend_module_func_layer.layer_get_info = backend_module_layer_get_info;
+ backend_module_func_layer.layer_set_buffer = backend_module_layer_set_buffer;
+ backend_module_func_layer.layer_unset_buffer = backend_module_layer_unset_buffer;
+
+ memset(&func_capture, 0, sizeof(tdm_func_capture));
+ func_capture.capture_attach = backend_module_capture_attach;
+ func_capture.capture_commit = backend_module_capture_commit;
+ func_capture.capture_destroy = backend_module_capture_destroy;
+ func_capture.capture_set_done_handler = backend_module_capture_set_done_handler;
+ func_capture.capture_set_info = backend_module_capture_set_info;
+
+
+ memset(&func_pp, 0, sizeof(tdm_func_pp));
+ func_pp.pp_attach = backend_module_pp_attach;
+ func_pp.pp_commit = backend_module_pp_commit;
+ func_pp.pp_destroy = backend_module_pp_destroy;
+ func_pp.pp_set_done_handler = backend_module_pp_set_done_handler;
+ func_pp.pp_set_info = backend_module_pp_set_info;
+
+ ret = tdm_backend_register_func_display(dpy, &backend_module_func_display);
+ ret = tdm_backend_register_func_output(dpy, &backend_module_func_output);
+ ret = tdm_backend_register_func_layer(dpy, &backend_module_func_layer);
+ ret = tdm_backend_register_func_pp(dpy, &func_pp);
+ ret = tdm_backend_register_func_capture(dpy, &func_capture);
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ return (tdm_backend_data*) &backend_module_data;
+}
+
+tdm_backend_module tdm_backend_module_stub = {
+ "backend_module_stub",
+ "Samsung",
+ TDM_BACKEND_ABI_VERSION,
+ tdm_backend_module_init,
+ tdm_backend_module_deinit
+};
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+#ifndef _TDM_EVENT_LOOP_STUBS_H_
+#define _TDM_EVENT_LOOP_STUBS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <tdm.h>
+#include "tdm_private.h"
+
+tdm_error
+ut_tdm_event_loop_init(tdm_private_display *private_display)
+{
+ return TDM_ERROR_NONE;
+}
+
+void
+ut_tdm_event_loop_deinit(tdm_private_display *private_display)
+{
+}
+
+void
+ut_tdm_event_loop_create_backend_source(tdm_private_display *private_display)
+{
+}
+
+int
+ut_tdm_event_loop_get_fd(tdm_private_display *private_display)
+{
+ return 1;
+}
+
+tdm_error
+ut_tdm_event_loop_dispatch(tdm_private_display *private_display)
+{
+ return TDM_ERROR_NONE;
+}
+
+
+void
+ut_tdm_event_loop_flush(tdm_private_display *private_display)
+{
+}
+
+
+tdm_event_loop_source *
+ut_tdm_event_loop_add_fd_handler(tdm_display *dpy, int fd, tdm_event_loop_mask mask,
+ tdm_event_loop_fd_handler func, void *user_data,
+ tdm_error *error)
+{
+ return (tdm_event_loop_source*)1;
+}
+
+tdm_error
+ut_tdm_event_loop_source_fd_update(tdm_event_loop_source *source, tdm_event_loop_mask mask)
+{
+ return TDM_ERROR_NONE;
+}
+
+tdm_event_loop_source *
+ut_tdm_event_loop_add_timer_handler(tdm_display *dpy, tdm_event_loop_timer_handler func,
+ void *user_data, tdm_error *error)
+{
+ return (tdm_event_loop_source*)1;
+}
+
+tdm_error
+ut_tdm_event_loop_source_timer_update(tdm_event_loop_source *source, unsigned int ms_delay)
+{
+ return TDM_ERROR_NONE;
+}
+
+void
+ut_tdm_event_loop_source_remove(tdm_event_loop_source *source)
+{
+}
+
+//--------------
+#define tdm_event_loop_init ut_tdm_event_loop_init
+#define tdm_event_loop_deinit ut_tdm_event_loop_deinit
+#define tdm_event_loop_create_backend_source ut_tdm_event_loop_create_backend_source
+#define tdm_event_loop_get_fd ut_tdm_event_loop_get_fd
+#define tdm_event_loop_dispatch ut_tdm_event_loop_dispatch
+#define tdm_event_loop_flush ut_tdm_event_loop_flush
+#define tdm_event_loop_add_fd_handler ut_tdm_event_loop_add_fd_handler
+#define tdm_event_loop_source_fd_update ut_tdm_event_loop_source_fd_update
+#define tdm_event_loop_add_timer_handler ut_tdm_event_loop_add_timer_handler
+#define tdm_event_loop_source_timer_update ut_tdm_event_loop_source_timer_update
+#define tdm_event_loop_source_remove ut_tdm_event_loop_source_remove
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TDM_EVENT_LOOP_STUBS_H_ */
int temp;
};
+wl_display ut_wl_display;
+wl_event_loop ut_wl_event_loop;
+
static void wl_display_flush_clients(struct wl_display *display)
{
(void)display;
static struct wl_display *wl_display_create()
{
- return NULL;
+ return &ut_wl_display;
}
static struct wl_event_loop *wl_display_get_event_loop(struct wl_display *display)
{
(void)display;
- return NULL;
+ return &ut_wl_event_loop;
}
static void wl_display_destroy(struct wl_display *display)