}
INTERN tdm_private_output *
-tdm_display_find_output_stamp(tdm_private_display *private_display,
- unsigned long stamp)
+tdm_display_find_output_stamp(tdm_private_display *private_display, double stamp)
{
tdm_private_output *private_output = NULL;
tdm_func_output *func_output = &private_display->func_output;
char temp[TDM_NAME_LEN];
tdm_error ret;
+ double stamp;
if (!func_output->output_get_capability) {
TDM_ERR("no output_get_capability()");
return TDM_ERROR_BAD_MODULE;
}
+ stamp = tdm_helper_get_time();
ret = func_output->output_get_capability(output_backend, caps);
+ TDM_DBG("backend output_get_capability() time: %.3f ms", (tdm_helper_get_time() - stamp) * 1000.0);
+
if (ret != TDM_ERROR_NONE) {
TDM_ERR("output_get_capability() failed");
return TDM_ERROR_BAD_MODULE;
private_output = calloc(1, sizeof(tdm_private_output));
TDM_RETURN_VAL_IF_FAIL(private_output != NULL, TDM_ERROR_OUT_OF_MEMORY);
- private_output->stamp = tdm_helper_get_time_in_millis();
+ private_output->stamp = tdm_helper_get_time();
while (tdm_display_find_output_stamp(private_display, private_output->stamp))
private_output->stamp++;
private_output->regist_change_cb = 1;
}
- } else
- _tdm_display_destroy_caps_output(&private_output->caps);
+ ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
+ &private_output->caps);
+ if (ret != TDM_ERROR_NONE)
+ return ret;
+ } else {
+ tdm_caps_output new_caps;
- ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
- &private_output->caps);
- if (ret != TDM_ERROR_NONE)
- return ret;
+ ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
+ &new_caps);
+ if (ret != TDM_ERROR_NONE)
+ return ret;
+
+ /* FIXME: This is very ugly. need to fix after the TDM ABI is changed. */
+ if (private_output->caps.status != new_caps.status) {
+ _tdm_display_destroy_caps_output(&private_output->caps);
+ private_output->caps = new_caps;
+ private_output->current_mode = NULL;
+ } else {
+ tdm_output_mode *old_modes = private_output->caps.modes;
+ unsigned int old_mode_count = private_output->caps.mode_count;
+ if (new_caps.modes)
+ free(new_caps.modes);
+ new_caps.modes = old_modes;
+ new_caps.mode_count = old_mode_count;
+ if (private_output->caps.props)
+ free(private_output->caps.props);
+ private_output->caps = new_caps;
+ }
+ }
layers = func_output->output_get_layers(output_backend, &layer_count, &ret);
if (ret != TDM_ERROR_NONE)
break;
}
}
+
+ _tdm_display_destroy_caps_output(&caps);
}
/* ordering : main output is first */
/* below functions should be implemented in backend side */
TDM_RETURN_VAL_IF_FAIL(func_display != NULL, TDM_ERROR_BAD_MODULE);
-// TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capabilitiy, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_display->display_get_outputs, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_output->output_get_capability, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_output->output_get_layers, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_layer->layer_get_capability, TDM_ERROR_BAD_MODULE);
- if (func_display->display_get_capability)
- ret = func_display->display_get_capability(private_display->bdata, &private_display->caps_display);
- else
- ret = func_display->display_get_capabilitiy(private_display->bdata, &private_display->caps_display);
+ ret = func_display->display_get_capability(private_display->bdata, &private_display->caps_display);
if (ret != TDM_ERROR_NONE) {
TDM_ERR("display_get_capability() failed");
return TDM_ERROR_BAD_MODULE;
tdm_backend_module *module_data;
void *module;
tdm_error ret;
+ double stamp;
snprintf(path, sizeof(path), TDM_MODULE_PATH "/%s", file);
+ stamp = tdm_helper_get_time();
TDM_TRACE_BEGIN(Load_Backend);
module = dlopen(path, RTLD_LAZY);
goto failed_load;
}
+ TDM_DBG("dlopen, dlsym time: %.3f ms", (tdm_helper_get_time() - stamp) * 1000.0);
+
private_display->module_data = module_data;
private_display->module = module;
/* We don't care if backend_data is NULL or not. It's up to backend. */
TDM_TRACE_BEGIN(Init_Backend);
+ stamp = tdm_helper_get_time();
private_display->bdata = module_data->init((tdm_display *)private_display, &ret);
+ TDM_DBG("backend init() time: %.3f ms", (tdm_helper_get_time() - stamp) * 1000.0);
TDM_TRACE_END();
+
if (ret != TDM_ERROR_NONE) {
TDM_ERR("failed to init '%s' module", module_data->name);
goto failed_load;
tdm_private_display *private_display = NULL;
const char *debug;
tdm_error ret;
+ double stamp1, stamp2, start;
_pthread_mutex_lock(&gLock);
return g_private_display;
}
+ start = stamp1 = tdm_helper_get_time();
+
private_display = calloc(1, sizeof(tdm_private_display));
if (!private_display) {
ret = TDM_ERROR_OUT_OF_MEMORY;
_pthread_mutex_lock(&private_display->lock);
+ stamp2 = tdm_helper_get_time();
+ TDM_DBG("prepare init time: %.3f ms", (stamp2 - stamp1) * 1000.0);
+ stamp1 = stamp2;
+
ret = tdm_event_loop_init(private_display);
if (ret != TDM_ERROR_NONE)
goto failed_event;
+ stamp2 = tdm_helper_get_time();
+ TDM_DBG("creating event loop time: %.3f ms", (stamp2 - stamp1) * 1000.0);
+ stamp1 = stamp2;
+
ret = _tdm_display_load_module(private_display);
if (ret != TDM_ERROR_NONE)
goto failed_load;
+ stamp2 = tdm_helper_get_time();
+ TDM_DBG("loading backend time: %.3f ms", (stamp2 - stamp1) * 1000.0);
+ stamp1 = stamp2;
+
#ifdef INIT_BUFMGR
int tdm_drm_fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
if (tdm_drm_fd >= 0) {
} else {
TDM_INFO("tbm_bufmgr_init successed");
}
+
+ stamp2 = tdm_helper_get_time();
+ TDM_DBG("initializing bufmgr time: %.3f ms", (stamp2 - stamp1) * 1000.0);
+ stamp1 = stamp2;
}
#endif
if (ret != TDM_ERROR_NONE)
goto failed_update;
+ stamp2 = tdm_helper_get_time();
+ TDM_DBG("updating display time: %.3f ms", (stamp2 - stamp1) * 1000.0);
+ stamp1 = stamp2;
+
tdm_event_loop_create_backend_source(private_display);
private_display->init_count = 1;
_pthread_mutex_unlock(&private_display->lock);
_pthread_mutex_unlock(&gLock);
+ TDM_INFO("init time: %.3f ms", (tdm_helper_get_time() - start) * 1000.0);
+
return (tdm_display *)private_display;
failed_update:
tdm_display_enable_dump(tdm_private_display *private_display, const char *dump_str, char *reply, int *len)
{
char temp[TDM_PATH_LEN] = {0,}, temp2[TDM_PATH_LEN] = {0,};
- char *path, *path2;
+ char *path = NULL, *path2;
char *arg;
char *end;
else
path2++;
- path = tdm_helper_dump_make_directory(path2, reply, len);
- TDM_GOTO_IF_FAIL(path != NULL, done);
-
tdm_debug_dump = 0;
snprintf(temp, sizeof(temp), "%s", dump_str);
if (!strncmp(arg, "none", 4)) {
tdm_debug_dump = 0;
+ TDM_SNPRINTF(reply, len, "path: %s\n", (tdm_debug_dump_dir)?:"unknown");
if (tdm_debug_dump_dir) {
free(tdm_debug_dump_dir);
tdm_debug_dump_dir = NULL;
}
- TDM_SNPRINTF(reply, len, "path: %s\n", path);
goto done;
}
+ path = tdm_helper_dump_make_directory(path2, reply, len);
+ TDM_GOTO_IF_FAIL(path != NULL, done);
+
if (!strncmp(arg, "current", 7)) {
tdm_private_output *o = NULL;
if (!private_display) {
tdm_private_layer *l = NULL;
LIST_FOR_EACH_ENTRY(l, &o->layer_list, link) {
char str[TDM_PATH_LEN];
- if (l->usable)
+ if (l->usable || l->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)
continue;
snprintf(str, TDM_PATH_LEN, "layer_%d_%d", o->index, l->index);
tdm_helper_dump_buffer_str(l->showing_buffer, path, str);
TDM_INFO("dump... '%s'", dump_str);
done:
- free(path);
+ if (path)
+ free(path);
+
return TDM_ERROR_NONE;
}
return TDM_ERROR_NONE;
}
+
+
+static void
+_tdm_display_ttrace_vblank_cb(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
+ unsigned int tv_sec, unsigned int tv_usec, void *user_data)
+{
+ tdm_error ret = TDM_ERROR_NONE;
+
+ TDM_TRACE_MARK(VBlank);
+
+ ret = tdm_vblank_wait(vblank, 0, 0, 1, _tdm_display_ttrace_vblank_cb, NULL);
+ TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+}
+
+INTERN tdm_error
+tdm_display_enable_ttrace_vblank(tdm_display *dpy, tdm_output *output, int enable)
+{
+ static tdm_vblank *vblank = NULL;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ if (!enable) {
+ if (vblank)
+ tdm_vblank_destroy(vblank);
+ vblank = NULL;
+ return TDM_ERROR_NONE;
+ } else {
+ const tdm_output_mode *mode = NULL;
+
+ if (vblank)
+ return TDM_ERROR_NONE;
+
+ vblank = tdm_vblank_create(dpy, output, &ret);
+ TDM_RETURN_VAL_IF_FAIL(vblank != NULL, ret);
+
+ ret = tdm_output_get_mode(output, &mode);
+ TDM_GOTO_IF_FAIL(mode != NULL, enable_fail);
+
+ ret = tdm_vblank_set_fps(vblank, mode->vrefresh);
+ TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, enable_fail);
+
+ ret = tdm_vblank_set_enable_fake(vblank, 1);
+ TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, enable_fail);
+
+ ret = tdm_vblank_wait(vblank, 0, 0, 1, _tdm_display_ttrace_vblank_cb, NULL);
+ TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, enable_fail);
+ }
+
+ return TDM_ERROR_NONE;
+
+enable_fail:
+ if (vblank)
+ tdm_vblank_destroy(vblank);
+ vblank = NULL;
+ return ret;
+}
+