From 49059dd16f4f87528a703604070568dd40b0b3dc Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 07:56:44 +0900 Subject: [PATCH 01/16] DSWindowManager: add a API to get window geometry Change-Id: Ide5af8ae79888c2ddcea65d6c7c74fe0b5c6677f --- src/DSWindowManager/DSWindowManager.cpp | 17 +++++++++++++++++ src/DSWindowManager/DSWindowManager.h | 2 ++ src/DSWindowManager/DSWindowManagerPrivate.h | 1 + src/DSZone/DSZone.cpp | 9 +++++++++ src/DSZone/DSZone.h | 1 + 5 files changed, 30 insertions(+) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index 1364b87..4e8e32c 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -269,6 +269,17 @@ void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int } } +stGeometry DSWindowManagerPrivate::getWindowGeometry(DSWaylandSurface *dsSurface) +{ + DSZone *zone = __getZone(dsSurface); + stGeometry geometry = {0, }; + if (zone) + { + return zone->getWindowGeometry(dsSurface); + } + return geometry; +} + void DSWindowManagerPrivate::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { // find dsSurface's window @@ -502,6 +513,12 @@ void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int priv->setWindowPosition(dsSurface, x, y); } +stGeometry DSWindowManager::getWindowGeometry(DSWaylandSurface *dsSurface) +{ + DS_GET_PRIV(DSWindowManager); + return priv->getWindowGeometry(dsSurface); +} + void DSWindowManager::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { DS_GET_PRIV(DSWindowManager); diff --git a/src/DSWindowManager/DSWindowManager.h b/src/DSWindowManager/DSWindowManager.h index 79d7893..838b821 100644 --- a/src/DSWindowManager/DSWindowManager.h +++ b/src/DSWindowManager/DSWindowManager.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" namespace display_server { @@ -60,6 +61,7 @@ public: void setWindowType(DSWaylandSurface *dsSurface, int type); void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + stGeometry getWindowGeometry(DSWaylandSurface *dsSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); diff --git a/src/DSWindowManager/DSWindowManagerPrivate.h b/src/DSWindowManager/DSWindowManagerPrivate.h index 6b80037..e40eadc 100644 --- a/src/DSWindowManager/DSWindowManagerPrivate.h +++ b/src/DSWindowManager/DSWindowManagerPrivate.h @@ -55,6 +55,7 @@ public: void setWindowType(DSWaylandSurface *dsSurface, int type); void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + stGeometry getWindowGeometry(DSWaylandSurface *dsSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index ebbdae4..9174851 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -420,6 +420,15 @@ bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y) */ } +stGeometry DSZone::getWindowGeometry(DSWaylandSurface *dswSurface) +{ + stGeometry geometry = {0, }; + DSWindowShell *wShell = __findWindowShell(dswSurface); + if (!wShell) return geometry; + + return wShell->getGeometry(); +} + void DSZone::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { DSWindowShell *wShell = __findWindowShell(dswlSurface); diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 96068bc..48df95a 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -69,6 +69,7 @@ public: bool setWindowType(DSWaylandSurface *dswSurface, int type); bool setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h); bool setWindowPosition(DSWaylandSurface *dswSurface, int x, int y); + stGeometry getWindowGeometry(DSWaylandSurface *dswSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); -- 2.7.4 From 4d82076cda2163cee3414198438b517d44807910 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 10:47:27 +0900 Subject: [PATCH 02/16] DSDebug: null check after getenv and strdup Change-Id: I9f82aa12b71c95b930958be6d30d04d1e9bfa232 --- src/DSDebug/DSDebugLog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp index 3966335..bd579df 100644 --- a/src/DSDebug/DSDebugLog.cpp +++ b/src/DSDebug/DSDebugLog.cpp @@ -33,18 +33,20 @@ namespace display_server { -DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG) +DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG), __enableDlog(false) { char *tmp = getenv("DSLOG_DLOG_ENABLE"); + if (!tmp) return; + char *env = strdup(tmp); + if (!env) return; + int value = atoi(env); free(env); if (value == 1) __enableDlog = true; - else - __enableDlog = false; } DSDebugLog::~DSDebugLog() -- 2.7.4 From 74a1aaebfc04a67bec100f71265ee04b7f3b4b17 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:45:56 +0900 Subject: [PATCH 03/16] DSWindow: make raiseToTop method and registerCallback method of it. Change-Id: Ife39d0b26c24e244f7da242b9b6a1004b51e9dc0 --- src/DSWindow/DSWindow.cpp | 12 ++++++++++++ src/DSWindow/DSWindow.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 3e5597f..41e5288 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -355,6 +355,13 @@ bool DSWindow::lower(void) return priv->lower(); } +bool DSWindow::raiseToTop() +{ + __windowRaiseToTopSignal.emit(nullptr); + + return true; +} + bool DSWindow::unsetFocus(void) { DS_GET_PRIV(DSWindow); @@ -491,4 +498,9 @@ void DSWindow::registerCallbackWindowDestroyed(DSObject *slot, std::function func) +{ + __windowRaiseToTopSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 4426809..21ef2b0 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -68,6 +68,7 @@ public: bool setLayer(int layer); bool raise(void); bool lower(void); + bool raiseToTop(); bool unsetFocus(void); bool setFocus(void); @@ -94,6 +95,7 @@ public: void registerCallbackSizeChanged(DSObject *slot, std::function)> func); void registerCallbackBufferChanged(DSObject *slot, std::function)> func); void registerCallbackWindowDestroyed(DSObject *slot, std::function func); + void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); protected: //virtual bool _onFocus(void); @@ -104,6 +106,7 @@ private: DSSignal> __sizeChangedSignal; DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; + DSSignal __windowRaiseToTopSignal; }; } -- 2.7.4 From c9aa079a6e2e56bb871e2fa3848f6677ee031cd6 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:48:38 +0900 Subject: [PATCH 04/16] DSZone: call raiseToTop of the top window on the window list. when the window list is updated. Change-Id: I1f68de7ab6ff2002e45bb2736fb7cfdfbbdb84b4 --- src/DSZone/DSZone.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 9174851..3af703e 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -235,6 +235,7 @@ void DSZone::__prependWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); } @@ -247,6 +248,7 @@ void DSZone::__appendWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); } @@ -303,6 +305,7 @@ void DSZone::__destroyWindow(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); } -- 2.7.4 From 6a41d0968ad98aaed1d9a40116db9e6773ebe9b4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:56:13 +0900 Subject: [PATCH 05/16] DSRenderView: add registerCallbackUpdated method Change-Id: I49f1d68a3da95d7f6b5a9459db47b55cc3b141e9 --- src/DSRender/DSRenderView.h | 3 +++ src/DSRender/DSRenderViewDaliImpl.cpp | 7 +++++++ src/DSRender/DSRenderViewDaliImpl.h | 4 ++++ src/DSRender/DSRenderViewEcoreEvasImpl.cpp | 6 ++++++ src/DSRender/DSRenderViewEcoreEvasImpl.h | 4 ++++ 5 files changed, 24 insertions(+) diff --git a/src/DSRender/DSRenderView.h b/src/DSRender/DSRenderView.h index 74a4a2c..e5c85b4 100644 --- a/src/DSRender/DSRenderView.h +++ b/src/DSRender/DSRenderView.h @@ -26,6 +26,8 @@ #include "IDSBuffer.h" #include "DSWindow.h" +#include "DSObject.h" +#include "DSSignal.h" namespace display_server { @@ -38,6 +40,7 @@ public: virtual bool setBuffer(std::shared_ptr buffer) = 0; virtual std::shared_ptr getWindow() = 0; + virtual void registerCallbackUpdated(DSObject *slot, std::function func) = 0; private: /* data */ diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 1b64d5b..d860d64 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -146,6 +146,11 @@ std::shared_ptr DSRenderViewDaliImpl::getWindow() return __window; } +void DSRenderViewDaliImpl::registerCallbackUpdated(DSObject *slot, std::function func) +{ + __updatedSignal.connect(slot, func); +} + void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr buffer) { if (buffer) { @@ -159,6 +164,8 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu DSLOG_ERR("DSRenderViewDaliImpl", "setBuffer fails."); return; } + + __updatedSignal.emit(nullptr); } } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 47c72ff..356b787 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -43,6 +43,8 @@ public: bool setBuffer(std::shared_ptr buffer) override; std::shared_ptr getWindow() override; + void registerCallbackUpdated(DSObject *slot, std::function func) override; + Dali::Geometry CreateTexturedQuad(); private: @@ -52,6 +54,8 @@ private: Dali::OffscreenWindow __offscreenWindow; Dali::Renderer __renderer; Dali::Actor __textureViewActor; + + DSSignal __updatedSignal; }; } diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp index e66845c..9fe237d 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp @@ -78,4 +78,10 @@ std::shared_ptr DSRenderViewEcoreEvasImpl::getWindow() return __window; } +void DSRenderViewEcoreEvasImpl::registerCallbackUpdated(DSObject *slot, std::function func) +{ + // No updated signal at ecore evas implementation yet. + //__updatedSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.h b/src/DSRender/DSRenderViewEcoreEvasImpl.h index 11ab261..0572a19 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.h +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.h @@ -40,11 +40,15 @@ public: bool setBuffer(std::shared_ptr buffer) override; std::shared_ptr getWindow() override; + void registerCallbackUpdated(DSObject *slot, std::function func) override; + private: void __onWindowBufferChanged(std::shared_ptr buffer); Evas_Object *__evasView; std::shared_ptr __window; + + DSSignal __updatedSignal; }; -- 2.7.4 From 50b55800437f7f88fedadfe43c79757e98f1a64e Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:59:20 +0900 Subject: [PATCH 06/16] DSRenderEngineDaliImpl: register renderViewUpdate callback intead of window callbacks Change-Id: I7b7ea777c59746650ce1d715ca0711b55d4c059c --- src/DSRender/DSRenderEngineDaliImpl.cpp | 19 +++---------------- src/DSRender/DSRenderEngineDaliImpl.h | 3 +-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index a76fc95..d18784f 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -61,8 +61,7 @@ std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared std::shared_ptr renderView = std::make_shared(window, __offscreenApplication.GetWindow()); // callbacks - window->registerCallbackBufferChanged(this, std::bind(&DSRenderEngineDaliImpl::__onWindowUpdated, this, std::placeholders::_1)); - window->registerCallbackWindowDestroyed(this, std::bind(&DSRenderEngineDaliImpl::__onWindowDestroyed, this, std::placeholders::_1)); + renderView->registerCallbackUpdated(this, std::bind(&DSRenderEngineDaliImpl::__onRenderViewUpdated, this, std::placeholders::_1)); return renderView; } @@ -82,22 +81,10 @@ bool DSRenderEngineDaliImpl::renderFrame() return true; } -void DSRenderEngineDaliImpl::__onWindowUpdated(std::shared_ptr buffer) +void DSRenderEngineDaliImpl::__onRenderViewUpdated(void *data) { if (!__needToRender) { - DSLOG_DBG("DSRenderEngineDaliImpl", "Something updated!! with buffer(%p)", buffer.get()); - __needToRender = true; - } -} - -void DSRenderEngineDaliImpl::__onWindowDestroyed(void *data) -{ - if (!__needToRender) { - DSLOG_DBG("DSRenderEngineDaliImpl", "Window destroyed!!"); - // TODO: update twice, at this time and at idle handler. - // do not update a frame only once.. - // NEED to check why dali does not update a frame at this time by execute one RenderOnce call. - Adaptor::Get().RenderOnce(); + DSLOG_DBG("DSRenderEngineDaliImpl", "Something updated on RenderView!! with buffer(%p)"); __needToRender = true; } } diff --git a/src/DSRender/DSRenderEngineDaliImpl.h b/src/DSRender/DSRenderEngineDaliImpl.h index 2cbdc7b..977c580 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.h +++ b/src/DSRender/DSRenderEngineDaliImpl.h @@ -47,8 +47,7 @@ public: void onInitialize(); private: - void __onWindowUpdated(std::shared_ptr buffer); - void __onWindowDestroyed(void *data); + void __onRenderViewUpdated(void *data); std::shared_ptr __bufferQueue; Dali::OffscreenApplication __offscreenApplication; -- 2.7.4 From 5a8d37203a9ee6a128db15f203320566480b3840 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 12:00:33 +0900 Subject: [PATCH 07/16] DSRenderViewDaliImpl: register raiseToTop callback of window Change-Id: I2fd8c02e7cc740039d73fef62a09d9a62522df51 --- src/DSRender/DSRenderViewDaliImpl.cpp | 11 +++++++++++ src/DSRender/DSRenderViewDaliImpl.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index d860d64..5182934 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -105,6 +105,7 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal // callbacks window->registerCallbackBufferChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowBufferChanged, this, std::placeholders::_1)); + window->registerCallbackWindowRaiseToTop(this, std::bind(&DSRenderViewDaliImpl::__onWindowRaiseToTopChanged, this, std::placeholders::_1)); } DSRenderViewDaliImpl::~DSRenderViewDaliImpl() @@ -168,4 +169,14 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu __updatedSignal.emit(nullptr); } +void DSRenderViewDaliImpl::__onWindowRaiseToTopChanged(void *data) +{ + DSLOG_INF("DSRenderViewDaliImpl", "__onWindowRaiseToTopChanged."); + + __textureViewActor.SetProperty(Actor::Property::VISIBLE, true); + __textureViewActor.RaiseToTop(); + + __updatedSignal.emit(nullptr); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 356b787..d6fe3f6 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -49,6 +49,7 @@ public: private: void __onWindowBufferChanged(std::shared_ptr buffer); + void __onWindowRaiseToTopChanged(void *data); std::shared_ptr __window; Dali::OffscreenWindow __offscreenWindow; -- 2.7.4 From f6ee6341c6265fff5223c900241f8c1a9b41df96 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 12:01:28 +0900 Subject: [PATCH 08/16] DSDisplayArea: remove logs at idle enterer Change-Id: I2bb1ce8e244d8a9022073e6368eaba0dec57f992 --- src/DSDisplayArea/DSDisplayArea.cpp | 9 +++------ src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp | 2 +- src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index ecfd519..0fee756 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -166,13 +166,10 @@ void DSDisplayAreaPrivate::__onWindowDestroy(std::shared_ptr window) void DSDisplayAreaPrivate::__onEventIdleEnterer(void *data) { - DSLOG_INF("DSDisplayAreaPrivate", "__onEventIdleEnterer"); + //DSLOG_INF("DSDisplayAreaPrivate", "__onEventIdleEnterer"); - if (!__displayDeviceHWC->commit()) - DSLOG_INF("DSDisplayAreaPrivate", "No commit at this time."); - - if (!__renderEngine->renderFrame()) - DSLOG_INF("DSDisplayAreaPrivate", "No renderFrame at this time."); + __displayDeviceHWC->commit(); + __renderEngine->renderFrame(); } } // namespace display_server diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp index f26f02a..9a3b3a0 100644 --- a/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp @@ -123,7 +123,7 @@ bool DSDisplayDeviceHWCTDMImpl::commit() uint32_t numChanges; if (!__updateFrameWindows()) { - DSLOG_INF("HWCTDM", "no update windows."); + //DSLOG_INF("HWCTDM", "no update windows."); return false; } diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp index 5377c3b..81b9f5d 100644 --- a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp @@ -55,7 +55,7 @@ bool DSDisplayDeviceHWCWindowTDMTargetImpl::updateFrame() std::shared_ptr dsBuffer; if (!__bufferQueue->canAcquireBuffer(false)) { - DSLOG_INF("TDM_HWC", "no acquirable buffer."); + //DSLOG_INF("TDM_HWC", "no acquirable buffer."); return false; } -- 2.7.4 From 68c25f612800bf71ca0bb5f15c6555c87d9713e8 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 13:57:44 +0900 Subject: [PATCH 09/16] DSRenderEngineDaliImpl: Fix a problem with 1 frame latency. Change-Id: I247b77569a247378154bf74b86358abcdf06be52 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderEngineDaliImpl.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index d18784f..5314d7f 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -36,7 +36,7 @@ namespace display_server DSRenderEngineDaliImpl::DSRenderEngineDaliImpl(std::shared_ptr bufferQueue) : __bufferQueue(bufferQueue), - __needToRender(true) + __needToRender(false) { tbm_surface_queue_h nativeBufferQueue = (tbm_surface_queue_h)bufferQueue->getNativeBufferQueue(); __offscreenApplication = OffscreenApplication::New(nativeBufferQueue, true, OffscreenApplication::RenderMode::MANUAL); @@ -69,9 +69,6 @@ std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared bool DSRenderEngineDaliImpl::renderFrame() { if (__needToRender) { - // TODO: do not get the acquired buffer with only one call of Adaptor::Get().RenderOnce(); - // NEED do check it. - Adaptor::Get().RenderOnce(); Adaptor::Get().RenderOnce(); DSLOG_DBG("DSRenderEngineDaliImpl", "RENDER RENDER RENDER~!!!!"); } -- 2.7.4 From 93e84b8eb7b1fff03906772686d5072ffb9637b9 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 13:18:11 +0900 Subject: [PATCH 10/16] DSWindowShell: add code to handle geometry we add code to check DSWindow's allowUserGeometry property before applying geometry Change-Id: Id0bbe05e229eac683b7592f714ce138275697354 --- src/DSWindowShell/DSWindowShell.cpp | 12 +++ src/DSWindowShell/DSWindowShell.h | 4 + src/DSWindowShell/DSWindowShellPrivate.cpp | 141 ++++++++++++++++++++++++++--- src/DSWindowShell/DSWindowShellPrivate.h | 13 ++- src/DSZone/DSZone.cpp | 4 + tests/DSWindowShell-test.cpp | 38 +++++++- 6 files changed, 193 insertions(+), 19 deletions(-) diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index 6863736..8b9a78b 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -55,6 +55,18 @@ void DSWindowShell::destroy(void) } +bool DSWindowShell::setZone(DSZone *zone) +{ + DS_GET_PRIV(DSWindowShell); + return priv->setZone(zone); +} + +DSZone *DSWindowShell::getZone(void) +{ + DS_GET_PRIV(DSWindowShell); + return priv->getZone(); +} + void DSWindowShell::setShellSurface(IDSWaylandShellSurface *shellSurface) { DS_GET_PRIV(DSWindowShell); diff --git a/src/DSWindowShell/DSWindowShell.h b/src/DSWindowShell/DSWindowShell.h index f5a76f2..7690094 100644 --- a/src/DSWindowShell/DSWindowShell.h +++ b/src/DSWindowShell/DSWindowShell.h @@ -33,6 +33,7 @@ namespace display_server class DSWindow; class DSWindowShellPrivate; +class DSZone; class DSWindowShell { @@ -47,6 +48,9 @@ public: void destroy(void); + bool setZone(DSZone *zone); + DSZone *getZone(void); + void setShellSurface(IDSWaylandShellSurface *zxdgSurface); IDSWaylandShellSurface *getShellSurface(void); diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 928bee4..f70ebf0 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -21,6 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ +#include "DSZone.h" #include "DSWindowShell.h" #include "DSWindowShellPrivate.h" @@ -63,6 +64,7 @@ DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *windo : __p_ptr(p_ptr), __window(window), __shellSurface(nullptr), + __zone(nullptr), __x(0), __y(0), __w(0), __h(0), __reqX(0), __reqY(0), @@ -155,10 +157,42 @@ void DSWindowShellPrivate::__handleAuxHint(stWindowAuxHint *hint) else set = false; - __window->allowUserGeometry(set); + __handleUserGeometryHint(set); } } +bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) +{ + if (!__window) return false; + + __window->allowUserGeometry(setUserGeometry); + if (setUserGeometry) + { + // reset windows geometry + __x = __y = __w = __h = 0; + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + else + { + // apply zone's geometry + if (__zone) + { + stPosition zPos = __zone->getPosition(); + stSize zSize = __zone->getSize(); + __x = zPos.x; + __y = zPos.y; + __w = zSize.w; + __h = zSize.h; + + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + } + + return true; +} + bool DSWindowShellPrivate::create(DSWindowShell *pParent) { return true; @@ -186,6 +220,49 @@ void DSWindowShellPrivate::destroy(void) } +bool DSWindowShellPrivate::setZone(DSZone *zone) +{ + if (__zone) + { + // unset information for old zone + } + + __zone = zone; + if (__zone) + { + stPosition zPos = __zone->getPosition(); + stSize zSize = __zone->getSize(); + + // check whether DSWindowShell's geometry has to change or not + if (__window) + { + if (!__window->isAllowUserGeometry()) + { + __x = zPos.x; + __y = zPos.y; + __w = zSize.w; + __h = zSize.h; + + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + } + else + { + __x = zPos.x; + __y = zPos.y; + __w = zSize.w; + __h = zSize.h; + } + } + + return true; +} + +DSZone *DSWindowShellPrivate::getZone(void) +{ + return __zone; +} void DSWindowShellPrivate::setShellSurface(IDSWaylandShellSurface *shellSurface) { @@ -247,11 +324,23 @@ bool DSWindowShellPrivate::setSkipFocus(bool set) bool DSWindowShellPrivate::setPosition(int x, int y) { - __x = x; - __y = y; + __reqX = x; + __reqY = y; if (__window) - __window->setPosition(__x, __y); + { + if (__window->isAllowUserGeometry()) + { + __x = x; + __y = y; + __window->setPosition(__x, __y); + } + } + else + { + __x = x; + __y = y; + } return true; } @@ -268,26 +357,52 @@ stPosition DSWindowShellPrivate::getPosition(void) bool DSWindowShellPrivate::setSize(unsigned int w, unsigned int h) { - __w = w; - __h = h; + __reqW = w; + __reqH = h; if (__window) - __window->setSize(__w, __h); + { + if (__window->isAllowUserGeometry()) + { + __w = w; + __h = h; + __window->setSize(__w, __h); + } + } + else + { + __w = w; + __h = h; + } return true; } bool DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned int h) { - __x = x; - __y = y; - __w = w; - __h = h; + __reqX = x; + __reqY = y; + __reqW = w; + __reqH = h; if (__window) { - __window->setPosition(__x, __y); - __window->setSize(__w, __h); + if (__window->isAllowUserGeometry()) + { + __x = x; + __y = y; + __w = w; + __h = h; + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + } + else + { + __x = x; + __y = y; + __w = w; + __h = h; } return true; diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index df1e9c8..25e27ae 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -52,6 +52,9 @@ public: void destroy(void); + bool setZone(DSZone *zone); + DSZone *getZone(void); + void setShellSurface(IDSWaylandShellSurface *shellSurface); IDSWaylandShellSurface *getShellSurface(void); @@ -126,14 +129,16 @@ private: struct stWindowAuxHint* __findAuxHint(int32_t id); void __handleAuxHint(stWindowAuxHint *hint); + bool __handleUserGeometryHint(bool setUserGeometry); private: DSWindow *__window; IDSWaylandShellSurface *__shellSurface; - int __x, __y; - unsigned int __w, __h; - int __reqX, __reqY; - unsigned int __reqW, __reqH; + DSZone *__zone; + int __x, __y; // real (applied) position + unsigned int __w, __h; // real (applied) size + int __reqX, __reqY; // requested position by client + unsigned int __reqW, __reqH; // requested size by client DSWindowShell *__parent; int __layer; std::list __childList; diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 3af703e..c1027be 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -325,6 +325,10 @@ std::shared_ptr DSZone::__createWindowShell(std::shared_ptr shell = std::make_shared(ptrWindow); + if (!shell) return nullptr; + + shell->setZone(this); + __windowShellList.push_front(shell); __windowShellMap.insert(std::make_pair(ptrWindow->surface(), shell.get())); diff --git a/tests/DSWindowShell-test.cpp b/tests/DSWindowShell-test.cpp index 01fba49..0ac8b4d 100644 --- a/tests/DSWindowShell-test.cpp +++ b/tests/DSWindowShell-test.cpp @@ -104,7 +104,23 @@ TEST_F(DSWindowShellTest, getPosition_P1) std::unique_ptr shell = std::make_unique(window.get()); EXPECT_TRUE(shell != nullptr); - EXPECT_TRUE(shell->create(0, 0, 720, 1280, nullptr) == true); + EXPECT_TRUE(shell->setPosition(100, 150) == true); + pos = shell->getPosition(); + + EXPECT_TRUE(pos.x == 0); + EXPECT_TRUE(pos.y == 0); +} + +TEST_F(DSWindowShellTest, getPosition_P2) +{ + stPosition pos; + auto window = std::make_shared(); + std::unique_ptr shell = std::make_unique(window.get()); + EXPECT_TRUE(shell != nullptr); + + // set user geometry + shell->addAuxHint(1, "wm.policy.win.user.geometry", "1"); + EXPECT_TRUE(shell->setPosition(100, 150) == true); pos = shell->getPosition(); @@ -131,7 +147,25 @@ TEST_F(DSWindowShellTest, Geometry_P1) std::unique_ptr shell = std::make_unique(window.get()); EXPECT_TRUE(shell != nullptr); - EXPECT_TRUE(shell->create(0, 0, 720, 1280, nullptr) == true); + shell->setGeometry(100, 150, 480, 800); + geo = shell->getGeometry(); + + EXPECT_TRUE(geo.x == 0); + EXPECT_TRUE(geo.y == 0); + EXPECT_TRUE(geo.w == 0); + EXPECT_TRUE(geo.h == 0); +} + +TEST_F(DSWindowShellTest, Geometry_P2) +{ + stGeometry geo; + + auto window = std::make_shared(); + std::unique_ptr shell = std::make_unique(window.get()); + EXPECT_TRUE(shell != nullptr); + + // set user geometry + shell->addAuxHint(1, "wm.policy.win.user.geometry", "1"); shell->setGeometry(100, 150, 480, 800); geo = shell->getGeometry(); -- 2.7.4 From 393989d84c128ec003cf1de144ef3658c14ee572 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 14:50:18 +0900 Subject: [PATCH 11/16] DSWindowShell: implement raise/lower/activate Change-Id: I97afb6786594587791c37499ed874ee6364794d8 --- src/DSWindowShell/DSWindowShellPrivate.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index f70ebf0..20eeff5 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -495,12 +495,18 @@ int DSWindowShellPrivate::getLayer(void) bool DSWindowShellPrivate::raise(void) { - return true; + if (__window) + return __window->raise(); + + return false; } bool DSWindowShellPrivate::lower(void) { - return true; + if (__window) + return __window->lower(); + + return false; } bool DSWindowShellPrivate::unsetFocus(void) @@ -527,7 +533,10 @@ bool DSWindowShellPrivate::isFocused(void) bool DSWindowShellPrivate::activate(void) { - return true; + if (__window) + return __window->raiseToTop(); + + return false; } bool DSWindowShellPrivate::isActivated(void) -- 2.7.4 From fa80de055a2cd186eccf44c42b5bc907cd1d8a2f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 14:38:42 +0900 Subject: [PATCH 12/16] DSZone: send stackChanged Signal when there is a window on the list. Change-Id: I1001aa81c92b4dbc0b2d5041e02fe0450aab46ea --- src/DSZone/DSZone.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index c1027be..3973120 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -304,9 +304,11 @@ void DSZone::__destroyWindow(std::shared_ptr window) __stackChanged = true; __updateWindowOrder(); - std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); - __windowStackChangedSignal.emit(wTop); + if (!__windowList.empty()) { + std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); + __windowStackChangedSignal.emit(wTop); + } } void DSZone::__updateWindowOrder(void) -- 2.7.4 From d74f12b0cb6155dddf71db43c20ca678b3d4086e Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 16:09:15 +0900 Subject: [PATCH 13/16] DSWaylandServer: set temporary size to BaseOutputResolution Change-Id: I3df77c32564de2e0e8131d33ab75c65e1b998412 --- src/DSWaylandServer/DSWaylandTizenAppinfo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp index 44d5416..8f4a684 100644 --- a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp +++ b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp @@ -87,6 +87,9 @@ void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_get_base_output_resoluti result = pub->__dsAppinfoMgr->getBaseOutputResolution(pid, &res_w, &res_h); if (!result) { /* TODO: Read configured resolution values */ + /* FIXME : get base resolution from the correct way */ + res_w = 720; + res_h = 1280; } send_base_output_resolution_done(resource->handle, pid, res_w, res_h); DSLOG_DBG("TizenAppinfoPriv", "SEND base_output_resolution_done event with width(%d), height(%d)", res_w, res_h); -- 2.7.4 From 8e815fa90c0586a2110de0f1e4bb4d5e7058c2e1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 14:38:17 +0900 Subject: [PATCH 14/16] DSRenderViewDaliImpl: Move the emit updatedSignal to setBuffer. - setBuffer is clearer than the __onWindowBufferChanged callback. - This modification is required to properly verify the function of setBuffer in libds-test. Change-Id: I29c565ad5bc4cd19a926d6a8e418325c4ff3bad6 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 5182934..d1aac16 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -139,6 +139,8 @@ bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) __textureViewActor.SetProperty(Actor::Property::VISIBLE, false); } + __updatedSignal.emit(nullptr); + return true; } @@ -165,8 +167,6 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu DSLOG_ERR("DSRenderViewDaliImpl", "setBuffer fails."); return; } - - __updatedSignal.emit(nullptr); } void DSRenderViewDaliImpl::__onWindowRaiseToTopChanged(void *data) -- 2.7.4 From 235ed23cfd02afc85bc194f9ca786c961cc88b3a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 16:22:11 +0900 Subject: [PATCH 15/16] test: enqueue buffer Change-Id: I410b5f3b1fbab0616ccd20a2e28dc418e1db1484 --- tests/DSDisplayDeviceTDMImpl-test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/DSDisplayDeviceTDMImpl-test.cpp b/tests/DSDisplayDeviceTDMImpl-test.cpp index a366e19..7f9f47c 100644 --- a/tests/DSDisplayDeviceTDMImpl-test.cpp +++ b/tests/DSDisplayDeviceTDMImpl-test.cpp @@ -295,8 +295,7 @@ TEST_F(DSDisplayDeviceTDMImplTest, DeviceHWC_commit) auto buffer = bufferQueue->dequeueBuffer(); EXPECT_TRUE(buffer != nullptr); - - EXPECT_TRUE(deviceHWC->setTargetBuffer(buffer)); + EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer)); // commit EXPECT_TRUE(deviceHWC->commit()); -- 2.7.4 From 53468212c2e2a3afc1e56942c376458502e2a92b Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 15:35:41 +0900 Subject: [PATCH 16/16] DSWindow: send positionChanged signal when window's position is changed Change-Id: Iab9cca37ffcf22c48e9380078c38dca22c616c0d --- src/DSWindow/DSWindow.cpp | 7 +++++++ src/DSWindow/DSWindow.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 41e5288..5854b0d 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -391,6 +391,8 @@ void DSWindow::setPosition(int x, int y) priv->__y = y; priv->__changedGeometry = true; + + __windowPositionChangedSignal.emit(nullptr); } stPosition DSWindow::getPosition(void) @@ -503,4 +505,9 @@ void DSWindow::registerCallbackWindowRaiseToTop(DSObject *slot, std::function func) +{ + __windowPositionChangedSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 21ef2b0..627065e 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -96,6 +96,7 @@ public: void registerCallbackBufferChanged(DSObject *slot, std::function)> func); void registerCallbackWindowDestroyed(DSObject *slot, std::function func); void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); + void registerCallbackWindowPositionChanged(DSObject *slot, std::function func); protected: //virtual bool _onFocus(void); @@ -107,6 +108,7 @@ private: DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; DSSignal __windowRaiseToTopSignal; + DSSignal __windowPositionChangedSignal; }; } -- 2.7.4