implementation for SCREEN_PREROTATION_HINT 23/95823/1 accepted/tizen/3.0/common/20161114.082522 accepted/tizen/3.0/ivi/20161108.061743 accepted/tizen/3.0/mobile/20161108.061637 accepted/tizen/3.0/tv/20161108.061656 accepted/tizen/3.0/wearable/20161108.061716 accepted/tizen/common/20161107.072211 accepted/tizen/ivi/20161108.000907 accepted/tizen/mobile/20161108.000812 accepted/tizen/tv/20161108.000826 accepted/tizen/wearable/20161108.000846 submit/tizen/20161107.022547 submit/tizen_3.0/20161107.022312 submit/tizen_3.0_common/20161110.084657
authorBoram Park <boram1288.park@samsung.com>
Tue, 25 Oct 2016 06:44:03 +0000 (15:44 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 7 Nov 2016 01:31:32 +0000 (10:31 +0900)
Change-Id: I8c5e90ac2a4f2119af380c405e31cf9645ea7a25

src/tdm_macro.h
tools/tdm_test_server.c

index 0dfd031..2bbadcf 100644 (file)
@@ -149,7 +149,7 @@ extern "C" {
 /* don't using !,$,# */
 #define TDM_DELIM           "@^&*+-|,:~"
 #define TDM_ALIGN(a, b)     (((a) + ((b) - 1)) & ~((b) - 1))
-
+#define TDM_SWAP(a, b)      ({ int t; t = a; a = b; b = t; })
 #define TDM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
 struct tdm_type_name {
index d59c6ce..b948a96 100644 (file)
@@ -748,6 +748,7 @@ 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)
@@ -757,6 +758,8 @@ 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);
@@ -846,6 +849,14 @@ 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);
+       }
 
        signal(SIGINT, exit_test);    /* 2 */
        signal(SIGTERM, exit_test);   /* 15 */
@@ -1036,12 +1047,22 @@ 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 (IS_RGB(info.format)) {
-               l->info.src_config.size.h = info.planes[0].stride >> 2;
-               l->info.src_config.size.v = info.height;
+       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;
+               }
        } else {
-               l->info.src_config.size.h = info.planes[0].stride;
-               l->info.src_config.size.v = info.height;
+               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.format = info.format;