From 5e03176f3e78ed01a4db9d6c9684581d9916ca1d Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Sun, 18 Dec 2016 17:38:37 +0900 Subject: [PATCH] Support scaled output for non-FHD screen This is a quick hack supporting scaled output to fit various monitors which has not FHD screen resolution. (Especially useful for running CES2017 demo on QEMU) - Layer - source rectangle is 1080x1920 - destination rectangle is variable to fit screen resolution - Surface - source rectangle is based 1080x1920 - destination rectangle is based 1080x1920 - From application view - screen size is always 1080x1920 and does not need to care about phsycial screen size This change enables scaled output which changes the size according to the ratio of source and destination region of homescreen layer. This patch doesn't resolve an issue, 'CES2017 demo keep blank screen after booting on some platform (QEMU, Raspberry Pi3, MinnowMax)'. (Workaround: just run any weayland client application such as 'LayerManagerControl', 'qmlscene', or weston example like 'weston-flower', then it breaks blank screen) Signed-off-by: Tadao Tanikawa --- WindowManager/src/windowmanager.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/WindowManager/src/windowmanager.cpp b/WindowManager/src/windowmanager.cpp index 38889c7..cee7ad7 100644 --- a/WindowManager/src/windowmanager.cpp +++ b/WindowManager/src/windowmanager.cpp @@ -38,6 +38,14 @@ // the HomeScreen app has to have the surface id 1000 #define WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID 1000 +// Quick hack for scaling layer to fit non-FHD(1920x1080) screen +// * source rect of layer should be 1920x1080 +// * destination rect of layer should fit physical display resolution +// * source rect of surface shoud be based on 1920x1080 +// * destination rect of surface should be based on 1920x1080 +#define WINDOWMANAGER_HOMESCREEN_WIDTH 1080 +#define WINDOWMANAGER_HOMESCREEN_HEIGHT 1920 + void* WindowManager::myThis = 0; WindowManager::WindowManager(int displayId, QObject *parent) : @@ -159,14 +167,16 @@ void WindowManager::createNewLayer(int layerId) qDebug(" layerId %d", layerId); t_ilm_layer newLayerId = layerId; - ilm_layerCreateWithDimension(&newLayerId, m_screenWidth, m_screenHeight); + ilm_layerCreateWithDimension(&newLayerId, + WINDOWMANAGER_HOMESCREEN_WIDTH, + WINDOWMANAGER_HOMESCREEN_HEIGHT); ilm_layerSetOpacity(newLayerId, 1.0); ilm_layerSetVisibility(newLayerId, ILM_TRUE); ilm_layerSetSourceRectangle(newLayerId, 0, 0, - m_screenWidth, - m_screenHeight); + WINDOWMANAGER_HOMESCREEN_WIDTH, + WINDOWMANAGER_HOMESCREEN_HEIGHT); ilm_layerSetDestinationRectangle(newLayerId, 0, 0, @@ -229,7 +239,9 @@ void WindowManager::addSurfaceToLayer(int surfaceId, int layerId) ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties); // homescreen app always fullscreen in the back - ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, m_screenWidth, m_screenHeight); + ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, + WINDOWMANAGER_HOMESCREEN_WIDTH, + WINDOWMANAGER_HOMESCREEN_HEIGHT); //ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, m_screenWidth, m_screenHeight); ilm_surfaceSetOpacity(surfaceId, 1.0); ilm_surfaceSetVisibility(surfaceId, ILM_TRUE); -- 2.16.6