/**************************************************************************
-
-libtdm
-
-Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: Eunchul Kim <chulspro.kim@samsung.com>,
- JinYoung Jeon <jy0.jeon@samsung.com>,
- Taeheon Kim <th908.kim@samsung.com>,
- YoungJun Cho <yj44.cho@samsung.com>,
- SooChan Lim <sc1.lim@samsung.com>,
- Boram Park <sc1.lim@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+ *
+ * libtdm
+ *
+ * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: Eunchul Kim <chulspro.kim@samsung.com>,
+ * JinYoung Jeon <jy0.jeon@samsung.com>,
+ * Taeheon Kim <th908.kim@samsung.com>,
+ * YoungJun Cho <yj44.cho@samsung.com>,
+ * SooChan Lim <sc1.lim@samsung.com>,
+ * Boram Park <sc1.lim@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
**************************************************************************/
#ifdef HAVE_CONFIG_H
static tdm_private_layer *
_tdm_display_find_private_layer(tdm_private_output *private_output,
- tdm_layer *layer_backend)
+ tdm_layer *layer_backend)
{
tdm_private_layer *private_layer = NULL;
static tdm_private_output *
_tdm_display_find_private_output(tdm_private_display *private_display,
- tdm_output *output_backend)
+ tdm_output *output_backend)
{
tdm_private_output *private_output = NULL;
INTERN tdm_private_output *
tdm_display_find_output_stamp(tdm_private_display *private_display,
- unsigned long stamp)
+ unsigned long stamp)
{
tdm_private_output *private_output = NULL;
_tdm_display_destroy_caps_output(&private_output->caps);
+ if (private_output->dpms_changed_timer)
+ tdm_event_loop_source_remove(private_output->dpms_changed_timer);
+
private_output->stamp = 0;
free(private_output);
}
static tdm_error
_tdm_display_update_caps_pp(tdm_private_display *private_display,
- tdm_caps_pp *caps)
+ tdm_caps_pp *caps)
{
tdm_func_display *func_display = &private_display->func_display;
- char buf[1024];
- int bufsize = sizeof(buf);
- char *str_buf = buf;
- int *len_buf = &bufsize;
- int i;
tdm_error ret;
if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
return TDM_ERROR_BAD_MODULE;
}
- TDM_DBG("pp capabilities: %x", caps->capabilities);
- buf[0] = '\0';
- for (i = 0; i < caps->format_count; i++)
- TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
- TDM_DBG("pp formats: %s", buf);
- TDM_DBG("pp min : %dx%d", caps->min_w, caps->min_h);
- TDM_DBG("pp max : %dx%d", caps->max_w, caps->max_h);
- TDM_DBG("pp align: %d", caps->preferred_align);
-
return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_update_caps_capture(tdm_private_display *private_display,
- tdm_caps_capture *caps)
+ tdm_caps_capture *caps)
{
tdm_func_display *func_display = &private_display->func_display;
- char buf[1024];
- int bufsize = sizeof(buf);
- char *str_buf = buf;
- int *len_buf = &bufsize;
- int i;
tdm_error ret;
if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
return TDM_ERROR_BAD_MODULE;
}
- ret = func_display->display_get_capture_capability(private_display->bdata,
- caps);
+ ret = func_display->display_get_capture_capability(private_display->bdata, caps);
if (ret != TDM_ERROR_NONE) {
TDM_ERR("display_get_capture_capability() failed");
return TDM_ERROR_BAD_MODULE;
}
- buf[0] = '\0';
- for (i = 0; i < caps->format_count; i++)
- TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
- TDM_DBG("capture formats: %s", buf);
-
return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_update_caps_layer(tdm_private_display *private_display,
- tdm_layer *layer_backend, tdm_caps_layer *caps)
+ tdm_layer *layer_backend, tdm_caps_layer *caps)
{
tdm_func_layer *func_layer = &private_display->func_layer;
- char buf[1024];
- int bufsize = sizeof(buf);
- char *str_buf = buf;
- int *len_buf = &bufsize;
- int i;
tdm_error ret;
if (!func_layer->layer_get_capability) {
return TDM_ERROR_BAD_MODULE;
}
- TDM_DBG("layer capabilities: %x", caps->capabilities);
- TDM_DBG("layer zpos : %d", caps->zpos);
- buf[0] = '\0';
- for (i = 0; i < caps->format_count; i++)
- TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
- TDM_DBG("layer formats: %s", buf);
- for (i = 0; i < caps->prop_count; i++)
- TDM_DBG("layer props: %d, %s", caps->props[i].id, caps->props[i].name);
-
return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_update_caps_output(tdm_private_display *private_display, int pipe,
- tdm_output *output_backend, tdm_caps_output *caps)
+ tdm_output *output_backend, tdm_caps_output *caps)
{
tdm_func_output *func_output = &private_display->func_output;
char temp[TDM_NAME_LEN];
- int i;
tdm_error ret;
if (!func_output->output_get_capability) {
snprintf(temp, TDM_NAME_LEN, "%s-%d", caps->model, pipe);
snprintf(caps->model, TDM_NAME_LEN, "%s", temp);
- TDM_DBG("output maker: %s", caps->maker);
- TDM_DBG("output model: %s", caps->model);
- TDM_DBG("output name: %s", caps->name);
- TDM_DBG("output status: %d", caps->status);
- TDM_DBG("output type : %d", caps->type);
- for (i = 0; i < caps->prop_count; i++)
- TDM_DBG("output props: %d, %s", caps->props[i].id, caps->props[i].name);
- for (i = 0; i < caps->mode_count; i++) {
- TDM_DBG("output modes: name(%s), clock(%d) vrefresh(%d), flags(%x), type(%d)",
- caps->modes[i].name, caps->modes[i].clock, caps->modes[i].vrefresh,
- caps->modes[i].flags, caps->modes[i].type);
- TDM_DBG("\t\t %d, %d, %d, %d, %d",
- caps->modes[i].hdisplay, caps->modes[i].hsync_start, caps->modes[i].hsync_end,
- caps->modes[i].htotal, caps->modes[i].hskew);
- TDM_DBG("\t\t %d, %d, %d, %d, %d",
- caps->modes[i].vdisplay, caps->modes[i].vsync_start, caps->modes[i].vsync_end,
- caps->modes[i].vtotal, caps->modes[i].vscan);
- }
- TDM_DBG("output min : %dx%d", caps->min_w, caps->min_h);
- TDM_DBG("output max : %dx%d", caps->max_w, caps->max_h);
- TDM_DBG("output align: %d", caps->preferred_align);
-
return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_update_layer(tdm_private_display *private_display,
- tdm_private_output *private_output,
- tdm_layer *layer_backend)
+ tdm_private_output *private_output,
+ tdm_layer *layer_backend, int index)
{
tdm_private_layer *private_layer;
tdm_error ret;
private_layer = calloc(1, sizeof(tdm_private_layer));
TDM_RETURN_VAL_IF_FAIL(private_layer != NULL, TDM_ERROR_OUT_OF_MEMORY);
- LIST_ADD(&private_layer->link, &private_output->layer_list);
+ LIST_ADDTAIL(&private_layer->link, &private_output->layer_list);
+ private_layer->index = index;
private_layer->private_display = private_display;
private_layer->private_output = private_output;
private_layer->layer_backend = layer_backend;
_tdm_display_destroy_caps_layer(&private_layer->caps);
ret = _tdm_display_update_caps_layer(private_display, layer_backend,
- &private_layer->caps);
+ &private_layer->caps);
if (ret != TDM_ERROR_NONE)
goto failed_update;
INTERN tdm_error
tdm_display_update_output(tdm_private_display *private_display,
- tdm_output *output_backend, int pipe)
+ tdm_output *output_backend, int pipe)
{
tdm_func_output *func_output = &private_display->func_output;
tdm_private_output *private_output = NULL;
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);
private_output->current_dpms_value = TDM_OUTPUT_DPMS_OFF;
private_output->output_backend = output_backend;
private_output->pipe = pipe;
+ private_output->index = pipe;
LIST_INITHEAD(&private_output->layer_list);
LIST_INITHEAD(&private_output->capture_list);
if (func_output->output_set_status_handler) {
func_output->output_set_status_handler(private_output->output_backend,
- tdm_output_cb_status,
- private_output);
+ tdm_output_cb_status,
+ private_output);
private_output->regist_change_cb = 1;
}
_tdm_display_destroy_caps_output(&private_output->caps);
ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
- &private_output->caps);
+ &private_output->caps);
if (ret != TDM_ERROR_NONE)
return ret;
goto failed_update;
for (i = 0; i < layer_count; i++) {
- ret = _tdm_display_update_layer(private_display, private_output, layers[i]);
+ ret = _tdm_display_update_layer(private_display, private_output, layers[i], i);
if (ret != TDM_ERROR_NONE)
goto failed_update;
}
if (private_display->outputs)
return private_display->outputs;
- outputs = func_display->display_get_outputs(private_display->bdata,
- &output_count, &ret);
+ outputs = func_display->display_get_outputs(private_display->bdata, &output_count, &ret);
if (ret != TDM_ERROR_NONE)
goto failed_get_outputs;
output_hdmib = outputs[i];
index_hdmib = i;
break;
- default :
+ default:
break;
}
}
static tdm_error
_tdm_display_update_internal(tdm_private_display *private_display,
- int only_display)
+ int only_display)
{
tdm_output **outputs = NULL;
int output_count = 0, i;
- tdm_error ret;
+ tdm_error ret = TDM_ERROR_NONE;
LIST_INITHEAD(&private_display->output_list);
LIST_INITHEAD(&private_display->pp_list);
goto failed_update;
ret = _tdm_display_update_caps_capture(private_display,
- &private_display->caps_capture);
+ &private_display->caps_capture);
if (ret != TDM_ERROR_NONE)
goto failed_update;
}
#define SUFFIX_MODULE ".so"
#define DEFAULT_MODULE "libtdm-default"SUFFIX_MODULE
-int tdm_debug;
-int tdm_debug_buffer;
-int tdm_debug_thread;
-int tdm_debug_mutex;
+int tdm_debug_module;
+int tdm_debug_dump;
static tdm_private_display *g_private_display;
static pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER;
static tdm_error
_tdm_display_check_module(tdm_backend_module *module)
{
- const char *name;
- const char *vendor;
int major, minor;
TDM_INFO("TDM ABI version : %d.%d",
- TDM_MAJOR_VERSION, TDM_MINOR_VERSION);
+ TDM_MAJOR_VERSION, TDM_MINOR_VERSION);
+
+ if (!module->name) {
+ TDM_ERR("TDM backend doesn't have name");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ if (!module->vendor) {
+ TDM_ERR("TDM backend doesn't have vendor");
+ return TDM_ERROR_BAD_MODULE;
+ }
- name = module->name ? module->name : "unknown";
- vendor = module->vendor ? module->vendor : "unknown";
major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version);
minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version);
- TDM_INFO("TDM module name: %s", name);
- TDM_INFO("'%s' vendor: %s", name, vendor);
- TDM_INFO("'%s' version: %d.%d", name, major, minor);
+ TDM_INFO("TDM module name: %s", module->name);
+ TDM_INFO("'%s' vendor: %s", module->name, module->vendor);
+ TDM_INFO("'%s' version: %d.%d", module->name, major, minor);
if (major != TDM_MAJOR_VERSION) {
TDM_ERR("'%s' major version mismatch, %d != %d",
- name, major, TDM_MAJOR_VERSION);
+ module->name, major, TDM_MAJOR_VERSION);
return TDM_ERROR_BAD_MODULE;
}
if (minor > TDM_MINOR_VERSION) {
TDM_ERR("'%s' minor version(%d) is newer than %d",
- name, minor, TDM_MINOR_VERSION);
+ module->name, minor, TDM_MINOR_VERSION);
return TDM_ERROR_BAD_MODULE;
}
if (!module->init) {
- TDM_ERR("'%s' doesn't have init function", name);
+ TDM_ERR("'%s' doesn't have init function", module->name);
return TDM_ERROR_BAD_MODULE;
}
if (!module->deinit) {
- TDM_ERR("'%s' doesn't have deinit function", name);
+ TDM_ERR("'%s' doesn't have deinit function", module->name);
return TDM_ERROR_BAD_MODULE;
}
/* 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_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_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);
- ret = func_display->display_get_capabilitiy(private_display->bdata,
- &private_display->caps_display);
+ ret = func_display->display_get_capabilitiy(private_display->bdata, &private_display->caps_display);
if (ret != TDM_ERROR_NONE) {
TDM_ERR("display_get_capabilitiy() failed");
return TDM_ERROR_BAD_MODULE;
if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP) {
tdm_func_pp *func_pp = &private_display->func_pp;
- TDM_RETURN_VAL_IF_FAIL(func_display->display_get_pp_capability,
- TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_get_pp_capability, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_display->display_create_pp, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_pp->pp_destroy, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_pp->pp_commit, TDM_ERROR_BAD_MODULE);
if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) {
tdm_func_capture *func_capture = &private_display->func_capture;
- TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capture_capability,
- TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_output->output_create_capture,
- TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capture_capability, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_output->output_create_capture, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_layer->layer_create_capture, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_capture->capture_destroy, TDM_ERROR_BAD_MODULE);
TDM_RETURN_VAL_IF_FAIL(func_capture->capture_commit, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_capture->capture_set_done_handler,
- TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_capture->capture_set_done_handler, TDM_ERROR_BAD_MODULE);
}
return TDM_ERROR_NONE;
static tdm_error
_tdm_display_load_module_with_file(tdm_private_display *private_display,
- const char *file)
+ const char *file)
{
char path[PATH_MAX] = {0,};
tdm_backend_module *module_data;
/* We don't care if backend_data is NULL or not. It's up to backend. */
TDM_TRACE_BEGIN(Init_Backend);
- private_display->bdata = module_data->init((tdm_display *)private_display,
- &ret);
+ private_display->bdata = module_data->init((tdm_display *)private_display, &ret);
TDM_TRACE_END();
if (ret != TDM_ERROR_NONE) {
TDM_ERR("'%s' init failed", file);
return g_private_display;
}
- debug = getenv("TDM_DEBUG");
- if (debug && (strstr(debug, "1")))
- tdm_debug = 1;
+ debug = getenv("TDM_DEBUG_MODULE");
+ if (debug)
+ tdm_display_enable_debug_module(debug);
- debug = getenv("TDM_DEBUG_BUFFER");
- if (debug && (strstr(debug, "1")))
- tdm_debug_buffer = 1;
+ debug = getenv("TDM_DEBUG_DUMP");
+ if (debug)
+ tdm_display_enable_dump(debug);
- debug = getenv("TDM_DEBUG_THREAD");
- if (debug && (strstr(debug, "1")))
- tdm_debug_thread = 1;
-
- debug = getenv("TDM_DEBUG_MUTEX");
- if (debug && (strstr(debug, "1")))
- tdm_debug_mutex = 1;
+ debug = getenv("TDM_DEBUG_PATH");
+ if (debug)
+ tdm_display_enable_path(debug);
private_display = calloc(1, sizeof(tdm_private_display));
if (!private_display) {
failed_mutex_init:
free(private_display);
failed_alloc:
- tdm_debug = 0;
- tdm_debug_buffer = 0;
if (error)
*error = ret;
_pthread_mutex_unlock(&gLock);
return;
}
+ /* dont move the position of lock/unlock. all resource should be protected
+ * during destroying. after tdm_event_loop_deinit, we don't worry about thread
+ * things because it's finalized.
+ */
_pthread_mutex_lock(&private_display->lock);
-
tdm_event_loop_deinit(private_display);
+ _pthread_mutex_unlock(&private_display->lock);
_tdm_display_destroy_private_display(private_display);
_tdm_display_unload_module(private_display);
tdm_helper_set_fd("TDM_DRM_MASTER_FD", -1);
- _pthread_mutex_unlock(&private_display->lock);
-
pthread_mutex_destroy(&private_display->lock);
free(private_display);
g_private_display = NULL;
- tdm_debug = 0;
- tdm_debug_buffer = 0;
_pthread_mutex_unlock(&gLock);
return 1;
}
+INTERN tdm_error
+tdm_display_enable_debug_module(const char*modules)
+{
+ char temp[TDM_PATH_LEN];
+ char *arg;
+ char *end;
+
+ snprintf(temp, TDM_PATH_LEN, "%s", modules);
+
+ tdm_debug_module = 0;
+
+ arg = strtok_r(temp, TDM_DELIM, &end);
+ while (arg) {
+ if (!strncmp(arg, "none", 4)) {
+ tdm_debug_module = 0;
+ return TDM_ERROR_NONE;
+ }
+ if (!strncmp(arg, "all", 3)) {
+ tdm_debug_module = 0xFFFFFFFF;
+ return TDM_ERROR_NONE;
+ }
+ if (!strncmp(arg, "buffer", 6))
+ tdm_debug_module |= TDM_DEBUG_BUFFER;
+ else if (!strncmp(arg, "thread", 6))
+ tdm_debug_module |= TDM_DEBUG_THREAD;
+ else if (!strncmp(arg, "mutex", 5))
+ tdm_debug_module |= TDM_DEBUG_MUTEX;
+ else if (!strncmp(arg, "vblank", 6))
+ tdm_debug_module |= TDM_DEBUG_VBLANK;
+ else
+ return TDM_ERROR_BAD_REQUEST;
+
+ arg = strtok_r(NULL, TDM_DELIM, &end);
+ }
+
+ TDM_INFO("module debugging... '%s'", modules);
+
+ return TDM_ERROR_NONE;
+}
+
+INTERN tdm_error
+tdm_display_enable_dump(const char *dump_str)
+{
+ char temp[1024];
+ char *arg;
+ char *end;
+
+ tdm_debug_dump = 0;
+
+ snprintf(temp, sizeof(temp), "%s", dump_str);
+ arg = strtok_r(temp, ",", &end);
+ while (arg) {
+ if (!strncmp(arg, "none", 4)) {
+ tdm_debug_dump = 0;
+ return TDM_ERROR_NONE;
+ }
+ if (!strncmp(arg, "all", 3)) {
+ tdm_debug_dump = 0xFFFFFFFF;
+ return TDM_ERROR_NONE;
+ }
+ if (!strncmp(arg, "layer", 5))
+ tdm_debug_dump |= TDM_DUMP_FLAG_LAYER;
+ else if (!strncmp(arg, "pp", 2))
+ tdm_debug_dump |= TDM_DUMP_FLAG_PP;
+ else if (!strncmp(arg, "capture", 7))
+ tdm_debug_dump |= TDM_DUMP_FLAG_CAPTURE;
+ else
+ return TDM_ERROR_BAD_REQUEST;
+
+ arg = strtok_r(NULL, ",", &end);
+ }
+
+ TDM_INFO("dump... '%s'", dump_str);
+
+ return TDM_ERROR_NONE;
+}
+
+INTERN tdm_error
+tdm_display_enable_path(const char *path)
+{
+ static int old_stdout = -1;
+ char fd_name[TDM_PATH_LEN];
+ int log_fd = -1;
+ FILE *log_fl;
+
+ if (old_stdout == -1)
+ old_stdout = dup(STDOUT_FILENO);
+
+ tdm_log_enable_dlog(0);
+
+ snprintf(fd_name, TDM_PATH_LEN, "%s", path);
+
+ log_fl = fopen(fd_name, "a");
+ if (!log_fl) {
+ TDM_ERR("failed: open file(%s)\n", fd_name);
+ return TDM_ERROR_OPERATION_FAILED;
+ }
+
+ fflush(stderr);
+ close(STDOUT_FILENO);
+
+ setvbuf(log_fl, NULL, _IOLBF, 512);
+ log_fd = fileno(log_fl);
+
+ dup2(log_fd, STDOUT_FILENO);
+ fclose(log_fl);
+
+ return TDM_ERROR_NONE;
+}