From: Imran Zaman Date: Thu, 8 Jan 2015 16:29:13 +0000 (+0200) Subject: Fixed weston transfromation problem X-Git-Tag: accepted/tizen/mobile/20151116.074908~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee625ba7b2f38473f362a489ad88345255570208;p=platform%2Fupstream%2Fweston.git Fixed weston transfromation problem 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 --- diff --git a/configure.ac b/configure.ac index 14294a6..6009074 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/packaging/weston.spec b/packaging/weston.spec index 6631c93..91b4ea5 100644 --- a/packaging/weston.spec +++ b/packaging/weston.spec @@ -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 diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 4829ff34..dacf642 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -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; + } } } diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 935701a..04eb045 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -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;