* Taeheon Kim <th908.kim@samsung.com>,
* YoungJun Cho <yj44.cho@samsung.com>,
* SooChan Lim <sc1.lim@samsung.com>,
- * Boram Park <sc1.lim@samsung.com>
+ * Boram Park <boram1288.park@samsung.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
#include <tbm_surface.h>
#include <tbm_surface_internal.h>
-#include <tdm.h>
-#include <tdm_log.h>
-#include <tdm_list.h>
-#include <tdm_helper.h>
-#include <tdm_backend.h>
+#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"
printf("\t%s\n", usages[t].desc);
}
printf("\n");
- exit(0);
}
////////////////////////////////////////////////////////////////////////////////
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);
if (argc < 2) {
usage(argv[0]);
+ destroy(data);
exit(0);
}
data->do_vblank = 1;
} else {
usage(argv[0]);
+ destroy(data);
exit(0);
}
}
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);
}
}
-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)
{
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);
}
static void
-exit_test(int sig)
+destroy(tdm_test_server *data)
{
- tdm_test_server *data = &tts_data;
tdm_test_server_output *o = NULL, *oo = NULL;
tdm_test_server_layer *l = NULL, *ll = NULL;
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;
- printf("got signal: %d\n", sig);
+ LIST_FOR_EACH_ENTRY_SAFE(c, cc, &data->capture_list, link) {
+ LIST_DEL(&c->link);
+ tdm_capture_destroy(c->capture);
+ free(c);
+ }
- LIST_FOR_EACH_ENTRY_SAFE(o, oo, &data->output_list, link) {
- LIST_DEL(&o->link);
+ LIST_FOR_EACH_ENTRY_SAFE(p, pp, &data->pp_list, link) {
+ tdm_display_lock(data->display);
+ tdm_event_loop_source_remove(p->timer_source);
+ tdm_display_unlock(data->display);
+
+ tdm_pp_destroy(p->pp);
+ }
+ LIST_FOR_EACH_ENTRY_SAFE(o, oo, &data->output_list, link) {
LIST_FOR_EACH_ENTRY_SAFE(l, ll, &o->layer_list, link) {
- LIST_DEL(&l->link);
+ ret = tdm_layer_unset_buffer(l->layer);
+ TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
+ }
+ ret = tdm_layer_commit(l->layer, NULL, NULL);
+ TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE);
+ }
- tdm_layer_unset_buffer(l->layer);
+ LIST_FOR_EACH_ENTRY_SAFE(p, pp, &data->pp_list, link) {
+ LIST_DEL(&p->link);
+ for (i = 0; i < TDM_ARRAY_SIZE(p->bufs); i++)
+ tbm_surface_destroy(p->bufs[i]);
+ free(p);
+ }
+ LIST_FOR_EACH_ENTRY_SAFE(o, oo, &data->output_list, link) {
+ LIST_DEL(&o->link);
+ LIST_FOR_EACH_ENTRY_SAFE(l, ll, &o->layer_list, link) {
+ LIST_DEL(&l->link);
LIST_FOR_EACH_ENTRY_SAFE(w, ww, &l->prop_list, link) {
LIST_DEL(&w->link);
free(w);
tbm_surface_destroy(l->bufs[i]);
free(l);
}
-
- tdm_output_commit(o->output, 0, NULL, NULL);
-
LIST_FOR_EACH_ENTRY_SAFE(w, ww, &o->prop_list, link) {
LIST_DEL(&w->link);
free(w);
free(o);
}
-
- LIST_FOR_EACH_ENTRY_SAFE(p, pp, &data->pp_list, link) {
- LIST_DEL(&p->link);
-
- tdm_display_lock(data->display);
- tdm_event_loop_source_remove(p->timer_source);
- tdm_display_unlock(data->display);
-
- tdm_pp_destroy(p->pp);
- for (i = 0; i < TDM_ARRAY_SIZE(p->bufs); i++)
- tbm_surface_destroy(p->bufs[i]);
- free(p);
- }
-
- LIST_FOR_EACH_ENTRY_SAFE(c, cc, &data->capture_list, link) {
- LIST_DEL(&c->link);
- tdm_capture_destroy(c->capture);
- free(c);
- }
-
if (data->display)
tdm_display_deinit(data->display);
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);
}
- signal(SIGINT, exit_test); /* 2 */
- signal(SIGTERM, exit_test); /* 15 */
+ 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);
}
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) {
int i, size = TDM_ARRAY_SIZE(l->bufs);
if (!l->bufs[0]) {
for (i = 0; i < size; i++) {
- int width = (l->info.src_config.size.h)?:l->info.src_config.pos.w;
- int height = (l->info.src_config.size.v)?:l->info.src_config.pos.h;
- unsigned int format = (l->info.src_config.format)?:DEFAULT_FORMAT;
+ int width = (l->info.src_config.size.h) ? : l->info.src_config.pos.w;
+ int height = (l->info.src_config.size.v) ? : l->info.src_config.pos.h;
+ unsigned int format = (l->info.src_config.format) ? : DEFAULT_FORMAT;
int flags = l->o->data->bflags;
tbm_surface_h b = buffer_allocate(width, height, format, flags);
TDM_EXIT_IF_FAIL(b != NULL);
}
static void
-layer_cb_commit(tdm_output *output, unsigned int sequence,
+layer_cb_commit(tdm_layer *layer, unsigned int sequence,
unsigned int tv_sec, unsigned int tv_usec,
void *user_data)
{
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_output_commit(l->o->output, 0, layer_cb_commit, l);
+ ret = tdm_layer_commit(l->layer, layer_cb_commit, l);
else
- ret = tdm_output_commit(l->o->output, 0, NULL, NULL);
+ ret = tdm_layer_commit(l->layer, NULL, NULL);
TDM_EXIT_IF_FAIL(ret == TDM_ERROR_NONE);
printf("show:\tl(%p) b(%p)\n", l, 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;
int i, size = TDM_ARRAY_SIZE(p->bufs);
if (!p->bufs[0]) {
for (i = 0; i < size; i++) {
- int width = (p->info.src_config.size.h)?:p->info.src_config.pos.w;
- int height = (p->info.src_config.size.v)?:p->info.src_config.pos.h;
- unsigned int format = (p->info.src_config.format)?:DEFAULT_FORMAT;
+ int width = (p->info.src_config.size.h) ? : p->info.src_config.pos.w;
+ int height = (p->info.src_config.size.v) ? : p->info.src_config.pos.h;
+ unsigned int format = (p->info.src_config.format) ? : DEFAULT_FORMAT;
tbm_surface_h b = buffer_allocate(width, height, format, 0);
TDM_EXIT_IF_FAIL(b != NULL);
p->bufs[i] = 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);
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);
return;
no_pp: