7 static tdm_dummy_data *dummy_data;
10 tdm_dummy_deinit(tdm_backend_data *bdata)
12 if (dummy_data != bdata)
17 tdm_dummy_display_destroy_output_list(dummy_data);
19 if (dummy_data->pipe[0] >= 0)
20 close(dummy_data->pipe[0]);
21 if (dummy_data->pipe[1] >= 0)
22 close(dummy_data->pipe[1]);
29 tdm_dummy_init(tdm_display *dpy, tdm_error *error)
31 tdm_func_display dummy_func_display;
32 tdm_func_output dummy_func_output;
33 tdm_func_layer dummy_func_layer;
37 TDM_ERR("display is null");
39 *error = TDM_ERROR_INVALID_PARAMETER;
44 TDM_ERR("failed: init twice");
46 *error = TDM_ERROR_BAD_REQUEST;
50 dummy_data = calloc(1, sizeof(tdm_dummy_data));
52 TDM_ERR("alloc failed");
54 *error = TDM_ERROR_OUT_OF_MEMORY;
58 LIST_INITHEAD(&dummy_data->output_list);
59 LIST_INITHEAD(&dummy_data->buffer_list);
61 memset(&dummy_func_display, 0, sizeof(dummy_func_display));
62 dummy_func_display.display_get_capability = dummy_display_get_capability;
63 dummy_func_display.display_get_outputs = dummy_display_get_outputs;
64 dummy_func_display.display_get_fd = dummy_display_get_fd;
65 dummy_func_display.display_handle_events = dummy_display_handle_events;
67 memset(&dummy_func_output, 0, sizeof(dummy_func_output));
68 dummy_func_output.output_get_capability = dummy_output_get_capability;
69 dummy_func_output.output_get_layers = dummy_output_get_layers;
70 dummy_func_output.output_wait_vblank = dummy_output_wait_vblank;
71 dummy_func_output.output_set_vblank_handler = dummy_output_set_vblank_handler;
72 dummy_func_output.output_commit = dummy_output_commit;
73 dummy_func_output.output_set_commit_handler = dummy_output_set_commit_handler;
74 dummy_func_output.output_set_mode = dummy_output_set_mode;
75 dummy_func_output.output_get_mode = dummy_output_get_mode;
77 memset(&dummy_func_layer, 0, sizeof(dummy_func_layer));
78 dummy_func_layer.layer_get_capability = dummy_layer_get_capability;
79 dummy_func_layer.layer_set_info = dummy_layer_set_info;
80 dummy_func_layer.layer_get_info = dummy_layer_get_info;
81 dummy_func_layer.layer_set_buffer = dummy_layer_set_buffer;
82 dummy_func_layer.layer_unset_buffer = dummy_layer_unset_buffer;
84 ret = tdm_backend_register_func_display(dpy, &dummy_func_display);
85 if (ret != TDM_ERROR_NONE)
88 ret = tdm_backend_register_func_output(dpy, &dummy_func_output);
89 if (ret != TDM_ERROR_NONE)
92 ret = tdm_backend_register_func_layer(dpy, &dummy_func_layer);
93 if (ret != TDM_ERROR_NONE)
96 dummy_data->dpy = dpy;
98 if (pipe(dummy_data->pipe) < 0) {
99 TDM_ERR("failed get pipe: %m");
100 ret = TDM_ERROR_OPERATION_FAILED;
104 ret = tdm_dummy_display_create_output_list(dummy_data);
105 if (ret != TDM_ERROR_NONE)
108 ret = tdm_dummy_display_create_layer_list(dummy_data);
109 if (ret != TDM_ERROR_NONE)
113 *error = TDM_ERROR_NONE;
115 TDM_INFO("init success!");
117 return (tdm_backend_data *)dummy_data;
122 tdm_dummy_deinit(dummy_data);
124 TDM_ERR("init failed!");
128 tdm_backend_module tdm_backend_module_data = {
131 TDM_BACKEND_SET_ABI_VERSION(1, 1),