Fixed weston transfromation problem
authorImran Zaman <imran.zaman@intel.com>
Thu, 8 Jan 2015 16:29:13 +0000 (18:29 +0200)
committerBoram Park <boram1288.park@samsung.com>
Fri, 6 Nov 2015 05:10:03 +0000 (14:10 +0900)
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 14294a6..6009074 100644 (file)
@@ -92,6 +92,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 6631c93..91b4ea5 100644 (file)
@@ -24,7 +24,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 4829ff3..dacf642 100644 (file)
@@ -1214,6 +1214,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 &&
@@ -1222,13 +1223,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) {
+                           target_mode->refresh == 0) {
                                return mode;
-                       } else if (!tmp_mode)
+                       } else if (!tmp_mode) {
                                tmp_mode = mode;
+                       }
                }
        }
 
index 935701a..04eb045 100644 (file)
@@ -1164,9 +1164,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;
 
@@ -1692,7 +1691,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;
 
@@ -1706,8 +1706,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);
 
@@ -1724,13 +1737,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;