return NULL;
}
-static tdm_private_output *
-_tdm_display_find_private_output(tdm_private_display *private_display,
- tdm_output *output_backend)
+INTERN tdm_private_output *
+tdm_display_find_private_output(tdm_private_display *private_display, tdm_output *output_backend)
{
tdm_private_output *private_output = NULL;
return NULL;
}
-INTERN tdm_private_output *
+INTERN void *
tdm_display_find_output_stamp(tdm_private_display *private_display, double stamp)
{
tdm_private_output *private_output = NULL;
{
tdm_private_capture *c = NULL, *cc = NULL;
- LIST_DEL(&private_layer->link);
-
tdm_layer_unset_buffer_internal(private_layer);
LIST_FOR_EACH_ENTRY_SAFE(c, cc, &private_layer->capture_list, link)
_tdm_display_destroy_caps_layer(&private_layer->caps);
+ /* when destroying layer, someone could check if layer is valid. So delete
+ * the layer's link at last.
+ */
+ LIST_DEL(&private_layer->link);
+
free(private_layer);
}
tdm_private_layer *l = NULL, *ll = NULL;
tdm_private_hwc_window *hw = NULL, *hww = NULL;
tdm_private_capture *c = NULL, *cc = NULL;
- tdm_private_vblank_handler *v = NULL, *vv = NULL;
+ tdm_private_output_vblank_handler *v = NULL, *vv = NULL;
tdm_private_output_commit_handler *om = NULL, *omm = NULL;
tdm_private_layer_commit_handler *lm = NULL, *lmm = NULL;
tdm_private_output_change_handler *h = NULL, *hh = NULL;
- LIST_DEL(&private_output->link);
-
free(private_output->layers_ptr);
if (private_output->vblank_timeout_timer)
free(lm);
}
- LIST_FOR_EACH_ENTRY_SAFE(h, hh, &private_output->change_handler_list_main, link) {
- LIST_DEL(&h->link);
- free(h);
- }
-
- LIST_FOR_EACH_ENTRY_SAFE(h, hh, &private_output->change_handler_list_sub, link) {
+ LIST_FOR_EACH_ENTRY_SAFE(h, hh, &private_output->change_handler_list, link) {
LIST_DEL(&h->link);
+ tdm_thread_cb_remove(h->private_output, TDM_THREAD_CB_OUTPUT_CHANGE, NULL, tdm_output_thread_cb_change, h);
free(h);
}
_tdm_display_destroy_caps_output(&private_output->caps);
- if (private_output->dpms_changed_timer)
- tdm_event_loop_source_remove(private_output->dpms_changed_timer);
-
+ tdm_thread_cb_remove(private_output, TDM_THREAD_CB_NEED_VALIDATE, NULL,
+ tdm_output_need_validate_handler_thread, NULL);
tdm_event_loop_source_remove(private_output->need_validate.event_source);
close(private_output->need_validate.event_fd);
+ /* when destroying output, vblank objects are also destroyed. vblank checks
+ * if output object is valid. So delete the output's link at last.
+ */
+ LIST_DEL(&private_output->link);
+
private_output->stamp = 0;
free(private_output);
}
int layer_count = 0, i;
tdm_error ret;
- private_output = _tdm_display_find_private_output(private_display, output_backend);
+ private_output = tdm_display_find_private_output(private_display, output_backend);
if (!private_output) {
private_output = calloc(1, sizeof(tdm_private_output));
TDM_RETURN_VAL_IF_FAIL(private_output != NULL, TDM_ERROR_OUT_OF_MEMORY);
LIST_INITHEAD(&private_output->output_commit_handler_list);
LIST_INITHEAD(&private_output->layer_commit_handler_list);
LIST_INITHEAD(&private_output->pending_commit_handler_list);
- LIST_INITHEAD(&private_output->change_handler_list_main);
- LIST_INITHEAD(&private_output->change_handler_list_sub);
+ LIST_INITHEAD(&private_output->change_handler_list);
if (func_output->output_set_status_handler) {
func_output->output_set_status_handler(private_output->output_backend,
/* LCOV_EXCL_STOP */
}
+ private_display->stamp = tdm_helper_get_time();
+
str = tdm_config_get_string(TDM_CONFIG_KEY_DEBUG_MODULE, NULL);
if (str)
tdm_display_enable_debug_module(str);
TDM_INFO("event loop init time: %.3f ms", (stamp2 - stamp1) * 1000.0);
stamp1 = stamp2;
+ ret = tdm_output_init(private_display);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_load;
+
+ ret = tdm_pp_init(private_display);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_load;
+
+ ret = tdm_capture_init(private_display);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_load;
+
ret = _tdm_display_load_module(private_display);
if (ret != TDM_ERROR_NONE)
goto failed_load;
*/
_pthread_mutex_lock(&private_display->lock);
tdm_event_loop_stop(private_display);
+ tdm_event_loop_deinit(private_display);
+ _pthread_mutex_unlock(&private_display->lock);
+
+ /* when private_output is destroyed, all vblank resources of client and server
+ * are destroyed. Then we can call tdm_vblank_deinit. After destroying display,
+ * we can unload backend modulues.
+ */
_tdm_display_destroy_private_display(private_display);
_tdm_display_unload_module(private_display);
- _pthread_mutex_unlock(&private_display->lock);
- tdm_event_loop_deinit(private_display);
tdm_vblank_deinit(private_display);
#ifdef INIT_BUFMGR