draft for SCREEN_PREROTATION_HINT 47/93647/1 ivi-demo
authorBoram Park <boram1288.park@samsung.com>
Tue, 25 Oct 2016 06:44:03 +0000 (15:44 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 25 Oct 2016 06:44:58 +0000 (15:44 +0900)
Change-Id: I2cccf0b62b25d58ac8dcf2d50a3582b23d84c96c

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;