#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/threading/conditional-wait.h>
#include <tbm_surface.h>
#include <tbm_surface_queue.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/devel-api/threading/conditional-wait.h>
// INTERNAL INCLUDES
-#include <dali/integration-api/native-render-surface.h>
+#include <dali/integration-api/adaptor-framework/egl-interface.h>
+#include <dali/integration-api/adaptor-framework/native-render-surface.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
+#include <dali/public-api/dali-adaptor-common.h>
namespace Dali
{
+class DisplayConnection;
+class EglInterface;
/**
* Ecore Wayland Native implementation of render surface.
class NativeRenderSurfaceEcoreWl : public Dali::NativeRenderSurface
{
public:
-
/**
* Uses an Wayland surface to render to.
- * @param [in] positionSize the position and size of the surface
- * @param [in] name optional name of surface passed in
+ * @param [in] surfaceSize the size of the surface
+ * @param [in] surface the native surface handle
* @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
*/
- NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize,
- const std::string& name,
- bool isTransparent = false );
+ NativeRenderSurfaceEcoreWl(SurfaceSize surfaceSize, Any surface, bool isTransparent = false);
/**
* @brief Destructor
virtual ~NativeRenderSurfaceEcoreWl();
public: // from WindowRenderSurface
-
/**
- * @copydoc Dali::NativeRenderSurface::GetSurface()
+ * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
*/
- virtual Any GetDrawable() override;
+ void SetRenderNotification(TriggerEventInterface* renderNotification) override;
/**
- * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
+ * @copydoc Dali::NativeRenderSurface::GetNativeRenderable()
*/
- virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
+ virtual Any GetNativeRenderable() override;
+public: // from Dali::RenderSurfaceInterface
/**
- * @copydoc Dali::NativeRenderSurface::WaitUntilSurfaceReplaced()
+ * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
*/
- virtual void WaitUntilSurfaceReplaced() override;
+ PositionSize GetPositionSize() const override;
-public: // from Dali::RenderSurface
+ /**
+ * @copydoc Dali::RenderSurfaceInterface::GetDpi()
+ */
+ void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
/**
- * @copydoc Dali::RenderSurface::GetPositionSize()
+ * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
*/
- virtual PositionSize GetPositionSize() const;
+ int GetOrientation() const override;
/**
- * @copydoc Dali::RenderSurface::InitializeEgl()
+ * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
*/
- virtual void InitializeEgl( EglInterface& egl );
+ void InitializeGraphics() override;
/**
- * @copydoc Dali::RenderSurface::CreateEglSurface()
+ * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
*/
- virtual void CreateEglSurface( EglInterface& egl );
+ void CreateSurface() override;
/**
- * @copydoc Dali::RenderSurface::DestroyEglSurface()
+ * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
*/
- virtual void DestroyEglSurface( EglInterface& egl );
+ void DestroySurface() override;
/**
- * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
+ * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
*/
- virtual bool ReplaceEGLSurface( EglInterface& egl );
+ bool ReplaceGraphicsSurface() override;
/**
- * @copydoc Dali::RenderSurface::MoveResize()
+ * @copydoc Dali::RenderSurfaceInterface::MoveResize()
*/
- virtual void MoveResize( Dali::PositionSize positionSize);
+ void MoveResize(Dali::PositionSize positionSize) override;
/**
- * @copydoc Dali::RenderSurface::SetViewMode()
+ * @copydoc Dali::RenderSurfaceInterface::StartRender()
*/
- void SetViewMode( ViewMode viewMode );
+ void StartRender() override;
/**
- * @copydoc Dali::RenderSurface::StartRender()
+ * @copydoc Dali::RenderSurfaceInterface::PreRender()
*/
- virtual void StartRender();
+ bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect) override;
/**
- * @copydoc Dali::RenderSurface::PreRender()
+ * @copydoc Dali::RenderSurfaceInterface::PostRender()
*/
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
+ void PostRender() override;
/**
- * @copydoc Dali::RenderSurface::PostRender()
+ * @copydoc Dali::RenderSurfaceInterface::StopRender()
*/
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
+ void StopRender() override;
/**
- * @copydoc Dali::RenderSurface::StopRender()
+ * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
*/
- virtual void StopRender();
+ void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override;
/**
- * @copydoc Dali::RenderSurface::SetThreadSynchronization
+ * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
*/
- virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
+ Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
/**
- * @copydoc Dali::RenderSurface::GetSurfaceType()
+ * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
*/
- virtual RenderSurface::Type GetSurfaceType();
+ void MakeContextCurrent() override;
-private:
+ /**
+ * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
+ */
+ Integration::DepthBufferAvailable GetDepthBufferRequired() override;
/**
- * @copydoc Dali::RenderSurface::ReleaseLock()
+ * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
*/
- virtual void ReleaseLock() override;
+ Integration::StencilBufferAvailable GetStencilBufferRequired() override;
+private:
/**
- * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
+ * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
*/
- virtual void CreateNativeRenderable() override;
+ void ReleaseLock() override;
/**
- * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
+ * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
*/
- virtual void ReleaseDrawable() override;
+ void CreateNativeRenderable() override;
private: // Data
-
- PositionSize mPosition;
- std::string mTitle;
- TriggerEventInterface* mRenderNotification;
- ColorDepth mColorDepth;
- tbm_format mTbmFormat;
- bool mOwnSurface;
- bool mDrawableCompleted;
+ SurfaceSize mSurfaceSize;
+ TriggerEventInterface* mRenderNotification;
+ Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
+ EglInterface* mEGL;
+ EGLSurface mEGLSurface;
+ EGLContext mEGLContext;
+ ColorDepth mColorDepth;
+ tbm_format mTbmFormat;
+ bool mOwnSurface;
+ std::vector<Rect<int>> mDamagedRects{}; ///< Keeps collected damaged render items rects for one render pass
tbm_surface_queue_h mTbmQueue;
- tbm_surface_h mConsumeSurface;
- ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
- ConditionalWait mTbmSurfaceCondition;
-
+ ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
};
} // namespace Dali