Fixed weston transfromation problem 72/33372/1 accepted/tizen_3.0_ivi tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common tizen_3.0_ivi accepted/tizen/common/20150109.143416 accepted/tizen/ivi/20150112.124309 submit/tizen_common/20150109.141219 submit/tizen_ivi/20150109.654321 tizen_3.0_ivi_release
authorImran Zaman <imran.zaman@intel.com>
Thu, 8 Jan 2015 16:29:13 +0000 (18:29 +0200)
committerImran Zaman <imran.zaman@intel.com>
Thu, 8 Jan 2015 16:51:08 +0000 (18:51 +0200)
Transformations are applied by system compositor on the
surface created by the child compositor

Change-Id: I3067d0f17085d5049f4684db0ef7483bbd4eb4d3
Fixed Bug TC-2320
Signed-off-by: Imran Zaman <imran.zaman@intel.com>
configure.ac
packaging/weston.spec
src/compositor-drm.c
src/compositor-wayland.c

index 1cb1dcd..cae500a 100644 (file)
@@ -103,6 +103,15 @@ if test "x$enable_default_vkb" = "xyes"; then
   AC_DEFINE(HAVE_DEFAULT_VKB, [1], [Enable default virtual keyboard])
 fi
 
+AC_ARG_ENABLE([transform],
+              [AC_HELP_STRING([--enable-transform],
+                              [Enable transformation for nested westons])],
+              [],
+              [enable_transform=no])
+if test "x$enable_transform" = "xyes"; then
+  AC_DEFINE(HAVE_TRANSFORM, [1], [Enable transformation for nested westons])
+fi
+
 AC_ARG_ENABLE(sys-uid, [  --enable-sys-uid],,
               enable_sys_uid=no)
 if test x$enable_sys_uid = xyes; then
index abacbd2..9f15d7e 100644 (file)
@@ -16,7 +16,7 @@
 %endif
 
 %if "%{profile}" == "ivi"
-%define extra_config_options4 --disable-default-vkb
+%define extra_config_options4 --disable-default-vkb --enable-transform
 %endif
 
 Name:           weston
index 4c0e2d6..8b84aad 100644 (file)
@@ -1178,6 +1178,7 @@ static struct drm_mode *
 choose_mode (struct drm_output *output, struct weston_mode *target_mode)
 {
        struct drm_mode *tmp_mode = NULL, *mode;
+       int32_t w, h;
 
        if (output->base.current_mode->width == target_mode->width &&
            output->base.current_mode->height == target_mode->height &&
@@ -1186,13 +1187,29 @@ choose_mode (struct drm_output *output, struct weston_mode *target_mode)
                return (struct drm_mode *)output->base.current_mode;
 
        wl_list_for_each(mode, &output->base.mode_list, base.link) {
-               if (mode->mode_info.hdisplay == target_mode->width &&
-                   mode->mode_info.vdisplay == target_mode->height) {
+               switch (output->base.transform) {
+               case WL_OUTPUT_TRANSFORM_90:
+               case WL_OUTPUT_TRANSFORM_270:
+               case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+               case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+#if HAVE_TRANSFORM
+                       w = mode->mode_info.vdisplay;
+                       h = mode->mode_info.hdisplay;
+                       break;
+#endif
+               default:
+                       w = mode->mode_info.hdisplay;
+                       h = mode->mode_info.vdisplay;
+                       break;
+               }
+               if (w == target_mode->width &&
+                   h == target_mode->height) {
                        if (mode->mode_info.vrefresh == target_mode->refresh || 
                            target_mode->refresh == 0) {
                                return mode;
-                       } else if (!tmp_mode) 
+                       } else if (!tmp_mode) {
                                tmp_mode = mode;
+                       }
                }
        }
 
index bf1eccc..6c72426 100644 (file)
@@ -1181,9 +1181,8 @@ wayland_output_create_for_parent_output(struct wayland_compositor *c,
                x = 0;
        }
 
-       output = wayland_output_create(c, x, 0, mode->width, mode->height,
-                                      NULL, 0,
-                                      WL_OUTPUT_TRANSFORM_NORMAL, 1);
+       output = wayland_output_create(c, x, 0, mode->width, mode->height, NULL,
+                                      0, WL_OUTPUT_TRANSFORM_NORMAL, 1);
        if (!output)
                return NULL;
 
@@ -1828,7 +1827,8 @@ wayland_parent_output_geometry(void *data, struct wl_output *output_proxy,
 }
 
 static struct weston_mode *
-find_mode(struct wl_list *list, int32_t width, int32_t height, uint32_t refresh)
+find_mode(struct wl_list *list, int32_t width, int32_t height, uint32_t refresh,
+         int32_t transform)
 {
        struct weston_mode *mode;
 
@@ -1842,8 +1842,21 @@ find_mode(struct wl_list *list, int32_t width, int32_t height, uint32_t refresh)
        if (!mode)
                return NULL;
 
-       mode->width = width;
-       mode->height = height;
+       switch (transform) {
+       case WL_OUTPUT_TRANSFORM_90:
+       case WL_OUTPUT_TRANSFORM_270:
+       case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+       case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+#if HAVE_TRANSFORM
+               mode->width = height;
+               mode->height = width;
+               break;
+#endif
+       default:
+               mode->width = width;
+               mode->height = height;
+               break;
+       }
        mode->refresh = refresh;
        wl_list_insert(list, &mode->link);
 
@@ -1860,13 +1873,15 @@ wayland_parent_output_mode(void *data, struct wl_output *wl_output_proxy,
 
        if (output->output) {
                mode = find_mode(&output->output->base.mode_list,
-                                width, height, refresh);
+                                width, height, refresh, output->transform);
                if (!mode)
                        return;
                mode->flags = flags;
+
                /* Do a mode-switch on current mode change? */
        } else {
-               mode = find_mode(&output->mode_list, width, height, refresh);
+               mode = find_mode(&output->mode_list, width, height, refresh,
+                                output->transform);
                if (!mode)
                        return;
                mode->flags = flags;