X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Ftdm_test_server.c;h=535462f7648d17cb708d21fc6e2ab4be78fc906e;hb=3ad3e82dc0bc043697fc72d34c5cf7d051b69af4;hp=0c30519a2b68dfef2f4edf76c89066880790e868;hpb=5ef467feec2b03979eb0d98e7768ed488f7fc81d;p=platform%2Fcore%2Fuifw%2Flibtdm.git diff --git a/tools/tdm_test_server.c b/tools/tdm_test_server.c index 0c30519..535462f 100644 --- a/tools/tdm_test_server.c +++ b/tools/tdm_test_server.c @@ -9,7 +9,7 @@ * Taeheon Kim , * YoungJun Cho , * SooChan Lim , - * Boram Park + * Boram Park * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -45,11 +45,11 @@ #include #include -#include -#include -#include -#include -#include +#include "tdm.h" +#include "tdm_log.h" +#include "tdm_list.h" +#include "tdm_helper.h" +#include "tdm_backend.h" #include "tdm_macro.h" #include "tdm_private.h" @@ -183,7 +183,6 @@ usage(char *app_name) printf("\t%s\n", usages[t].desc); } printf("\n"); - exit(0); } //////////////////////////////////////////////////////////////////////////////// @@ -316,6 +315,7 @@ struct _tdm_test_server { tdm_display *display; }; +static void destroy(tdm_test_server *data); static void run_test(tdm_test_server *data); static void output_setup(tdm_test_server_output *o); static void layer_show_buffer(tdm_test_server_layer *l, tbm_surface_h b); @@ -517,6 +517,7 @@ parse_args(tdm_test_server *data, int argc, char *argv[]) if (argc < 2) { usage(argv[0]); + destroy(data); exit(0); } @@ -597,6 +598,7 @@ parse_args(tdm_test_server *data, int argc, char *argv[]) data->do_vblank = 1; } else { usage(argv[0]); + destroy(data); exit(0); } } @@ -639,7 +641,9 @@ interpret_args(tdm_test_server *data) for (i = 0; i < output_count; i++) { tdm_output *output = tdm_display_get_output(data->display, i, NULL); tdm_output_conn_status status; - tdm_output_get_conn_status(output, &status); + ret = tdm_output_get_conn_status(output, &status); + TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE); + if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) continue; o = calloc(1, sizeof * o); @@ -760,7 +764,6 @@ interpret_args(tdm_test_server *data) } } -static unsigned int tts_screen_prerotation_hint; static tdm_test_server tts_data; static int tts_buffer_key; #define TTS_BUFFER_KEY ((unsigned long)&tts_buffer_key) @@ -770,8 +773,6 @@ buffer_allocate(int width, int height, int format, int flags) { tdm_test_server_buffer *tb = calloc(1, sizeof *tb); TDM_EXIT_IF_FAIL(tb != NULL); - if (tts_screen_prerotation_hint % 180) - TDM_SWAP(width, height); tb->b = tbm_surface_internal_create_with_flags(width, height, format, flags); TDM_EXIT_IF_FAIL(tb->b != NULL); tdm_helper_clear_buffer(tb->b); @@ -796,6 +797,7 @@ destroy(tdm_test_server *data) tdm_test_server_pp *p = NULL, *pp = NULL; tdm_test_server_capture *c = NULL, *cc = NULL; tdm_test_server_prop *w = NULL, *ww = NULL; + tdm_error ret; int i; LIST_FOR_EACH_ENTRY_SAFE(c, cc, &data->capture_list, link) { @@ -814,9 +816,11 @@ destroy(tdm_test_server *data) LIST_FOR_EACH_ENTRY_SAFE(o, oo, &data->output_list, link) { LIST_FOR_EACH_ENTRY_SAFE(l, ll, &o->layer_list, link) { - tdm_layer_unset_buffer(l->layer); + ret = tdm_layer_unset_buffer(l->layer); + TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); } - tdm_layer_commit(l->layer, NULL, NULL); + ret = tdm_layer_commit(l->layer, NULL, NULL); + TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE); } LIST_FOR_EACH_ENTRY_SAFE(p, pp, &data->pp_list, link) { @@ -859,14 +863,26 @@ main(int argc, char *argv[]) char temp[TDM_SERVER_REPLY_MSG_LEN]; int len = sizeof temp; tdm_error ret; - const char *value; - value = (const char*)getenv("SCREEN_PREROTATION_HINT"); - if (value) { - char *end; - tts_screen_prerotation_hint = strtol(value, &end, 10); - printf("SCREEN_PREROTATION_HINT = %d", tts_screen_prerotation_hint); +#if 1 /* for testing */ + const char *s = (const char*)getenv("XDG_RUNTIME_DIR"); + if (!s) { + char buf[32]; + snprintf(buf, sizeof(buf), "/run"); + int ret = setenv("XDG_RUNTIME_DIR", (const char*)buf, 1); + if (ret != 0) + exit(0); + } + + s = (const char*)getenv("TBM_DISPLAY_SERVER"); + if (!s) { + char buf[32]; + snprintf(buf, sizeof(buf), "1"); + int ret = setenv("TBM_DISPLAY_SERVER", (const char*)buf, 1); + if (ret != 0) + exit(0); } +#endif memset(data, 0, sizeof * data); LIST_INITHEAD(&data->output_list); @@ -921,7 +937,7 @@ output_setup(tdm_test_server_output *o) } if (!best) best = &modes[i]; - if (modes[i].flags & TDM_OUTPUT_MODE_TYPE_PREFERRED) + if (modes[i].type & TDM_OUTPUT_MODE_TYPE_PREFERRED) prefer = &modes[i]; } if (!found && prefer) { @@ -1029,7 +1045,8 @@ layer_show_buffer(tdm_test_server_layer *l, tbm_surface_h b) TDM_EXIT_IF_FAIL(tb != NULL); tb->in_use = 1; - tdm_buffer_add_release_handler(b, layer_cb_buffer_release, NULL); + ret = tdm_buffer_add_release_handler(b, layer_cb_buffer_release, NULL); + TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE); if (data->do_vblank) ret = tdm_layer_commit(l->layer, layer_cb_commit, l); @@ -1054,22 +1071,12 @@ layer_setup(tdm_test_server_layer *l, tbm_surface_h b) /* The size and format information should be same with buffer's */ tbm_surface_get_info(b, &info); - if (tts_screen_prerotation_hint % 180) { - if (IS_RGB(info.format)) { - l->info.src_config.size.h = info.height; - l->info.src_config.size.v = info.planes[0].stride >> 2; - } else { - l->info.src_config.size.h = info.height; - l->info.src_config.size.v = info.planes[0].stride; - } + if (IS_RGB(info.format)) { + l->info.src_config.size.h = info.planes[0].stride >> 2; + l->info.src_config.size.v = info.height; } else { - if (IS_RGB(info.format)) { - l->info.src_config.size.h = info.planes[0].stride >> 2; - l->info.src_config.size.v = info.height; - } else { - l->info.src_config.size.h = info.planes[0].stride; - l->info.src_config.size.v = info.height; - } + l->info.src_config.size.h = info.planes[0].stride; + l->info.src_config.size.v = info.height; } l->info.src_config.format = info.format; @@ -1359,6 +1366,7 @@ capture_setup(tdm_test_server_capture *c, tbm_surface_h b) c->info.dst_config.size.v = info.height; } c->info.dst_config.format = info.format; + c->info.type = TDM_CAPTURE_TYPE_ONESHOT; ret = tdm_capture_set_info(c->capture, &c->info); TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE); @@ -1425,8 +1433,10 @@ run_test(tdm_test_server *data) printf("enter test loop\n"); - while (1) - tdm_display_handle_events(data->display); + while (1) { + ret = tdm_display_handle_events(data->display); + TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE); + } destroy(data);