From dc97376604c43abf66fae0f66affd0e9735ef814 Mon Sep 17 00:00:00 2001 From: Gunnar Andersson Date: Wed, 11 Apr 2018 15:25:49 +0200 Subject: [PATCH] hmicontroller: (PARTIAL) Pass INVALID_ID to auto-generate layer ID A layer ID of zero is not correct. I am guessing that the previous intention was to use zero to generate an automatic ID, and the ILM documentation incorrectly said that it would (upstream bug [LM-6]). INVALID_ID should be passed instead, to get a generated ID. The parameter to helper function createLayer() must now be passed by reference so that the member variable m_backgroundSurfaceId can be assigned the right value. The layer ID used to be constant (zero) and therefore this was not the case before. [GDP-778] wayland-ivi-extension layer id integration issues from P-0.1 and P-1.0 upgrade [LM-6] Documentation for ilm_layerCreateWithDimension() is wrong regarding creating new ID automatically? Signed-off-by: Gunnar Andersson layercontroller: debug printouts (WIP) Revert "hmicontroller: Pass INVALID_ID to auto-generate layer ID" This reverts commit 4a09142cfdc168a4e4cf6373ca8a35e1957d7214. Redo debug and createlayer-by-ref --- plugins/hmi-controller/layercontroller.cpp | 18 ++++++++++++++++-- plugins/hmi-controller/layercontroller.h | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/hmi-controller/layercontroller.cpp b/plugins/hmi-controller/layercontroller.cpp index c435bad..1bf4a4a 100644 --- a/plugins/hmi-controller/layercontroller.cpp +++ b/plugins/hmi-controller/layercontroller.cpp @@ -359,7 +359,7 @@ void LayerController::setLayerVisible(unsigned int layerId) ilm_commitChanges(); } -bool LayerController::createLayer(unsigned int layerId) +bool LayerController::createLayer(unsigned int &layerId) { ilmErrorTypes callResult = ILM_FAILED; callResult = ilm_layerCreateWithDimension(&layerId, m_screenWidth, m_screenHeight); @@ -615,7 +615,21 @@ void LayerController::addAppProcess(const AppManager::AppInfo app, const pid_t p pinfo.surfaceList = {}; // Create layer for new app - createLayer(pid); + + // We need a new variable because gcc is picky with having a true lvalue + // for the non-const pass by reference, and not pid which is an rvalue. + // (createLayer will modify the input variable to the layer ID that was + // actually chosen. In this case it should be always what we asked + // for, but it can be dynamic in other cases) + unsigned int layerId = pid; + bool result = createLayer(layerId /*by reference*/); + + printf("pid is %d and layerId was set to %d\n",pid, layerId); + printf("createLayer returned result %d\n", (int)result); + + // FIXME: This could use an assert(layerId == pid) and also error + // checking (createLayer should return true). + // but this is a quick fix - changing as little as possible. m_processMap[pid]= pinfo; } diff --git a/plugins/hmi-controller/layercontroller.h b/plugins/hmi-controller/layercontroller.h index 4bc8b17..a045a2d 100644 --- a/plugins/hmi-controller/layercontroller.h +++ b/plugins/hmi-controller/layercontroller.h @@ -60,7 +60,7 @@ class LayerController : public QObject void setSurfaceVisible(unsigned int surfaceId); void setLayerVisible(unsigned int layerId); - bool createLayer(unsigned int layerId); + bool createLayer(unsigned int &layerId); bool destroyLayer(unsigned int layerId); void focusOnLayer(unsigned int layerId);