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;
}
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;
}
- 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;
}
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;
}
{
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_layer *layer_backend, int index)
{
tdm_private_layer *private_layer;
tdm_error ret;
TDM_RETURN_VAL_IF_FAIL(private_layer != NULL, TDM_ERROR_OUT_OF_MEMORY);
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;
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);
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;
}
#define SUFFIX_MODULE ".so"
#define DEFAULT_MODULE "libtdm-default"SUFFIX_MODULE
-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;
return g_private_display;
}
- debug = getenv("TDM_DEBUG_BUFFER");
- if (debug && (strstr(debug, "1")))
- tdm_debug_buffer = 1;
+ debug = getenv("TDM_DEBUG_MODULE");
+ if (debug)
+ tdm_display_enable_debug_module(debug);
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_buffer = 0;
if (error)
*error = ret;
_pthread_mutex_unlock(&gLock);
pthread_mutex_destroy(&private_display->lock);
free(private_display);
g_private_display = NULL;
- tdm_debug_buffer = 0;
_pthread_mutex_unlock(&gLock);
return 1;
}
-INTERN void
-tdm_display_enable_debug(char *debug, int enable)
+INTERN tdm_error
+tdm_display_enable_debug_module(const char*modules)
{
- if (!strncmp(debug, "TDM_DEBUG_BUFFER", 16))
- tdm_debug_buffer = enable;
- else if (!strncmp(debug, "TDM_DEBUG_THREAD", 16))
- tdm_debug_thread = enable;
- else if (!strncmp(debug, "TDM_DEBUG_MUTEX", 15))
- tdm_debug_mutex = enable;
+ 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 void
+INTERN tdm_error
tdm_display_enable_dump(const char *dump_str)
{
char temp[1024];
char *arg;
char *end;
- int flags = 0;
+
+ 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)) {
- flags = TDM_DUMP_FLAG_LAYER|TDM_DUMP_FLAG_PP|TDM_DUMP_FLAG_CAPTURE;
- break;
+ tdm_debug_dump = 0xFFFFFFFF;
+ return TDM_ERROR_NONE;
}
- else if (!strncmp(arg, "layer", 5))
- flags |= TDM_DUMP_FLAG_LAYER;
+ if (!strncmp(arg, "layer", 5))
+ tdm_debug_dump |= TDM_DUMP_FLAG_LAYER;
else if (!strncmp(arg, "pp", 2))
- flags |= TDM_DUMP_FLAG_PP;
+ tdm_debug_dump |= TDM_DUMP_FLAG_PP;
else if (!strncmp(arg, "capture", 7))
- flags |= TDM_DUMP_FLAG_CAPTURE;
- else if (!strncmp(arg, "none", 4))
- flags = 0;
+ tdm_debug_dump |= TDM_DUMP_FLAG_CAPTURE;
+ else
+ return TDM_ERROR_BAD_REQUEST;
+
arg = strtok_r(NULL, ",", &end);
}
- tdm_debug_dump = flags;
+ 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;
}