1 #ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
2 #define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <boost/thread.hpp>
25 #include <ecore-x-render-surface.h>
34 * Ecore X11 implementation of render surface.
36 class PixmapRenderSurface : public EcoreXRenderSurface
41 * Uses an X11 surface to render to.
42 * @param [in] positionSize the position and size of the surface
43 * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
44 * @param [in] name optional name of surface passed in
45 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
47 PixmapRenderSurface( Dali::PositionSize positionSize,
49 const std::string& name,
50 bool isTransparent = false);
53 * @copydoc Dali::RenderSurface::~RenderSurface
55 virtual ~PixmapRenderSurface();
60 * @copydoc Dali::ECore::EcoreXRenderSurface::GetDrawable()
62 virtual Ecore_X_Drawable GetDrawable();
69 virtual Any GetSurface();
71 public: // from Dali::RenderSurface
74 * @copydoc Dali::RenderSurface::InitializeEgl()
76 virtual void InitializeEgl( EglInterface& egl );
79 * @copydoc Dali::RenderSurface::CreateEglSurface()
81 virtual void CreateEglSurface( EglInterface& egl );
84 * @copydoc Dali::RenderSurface::DestroyEglSurface()
86 virtual void DestroyEglSurface( EglInterface& egl );
89 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
91 virtual bool ReplaceEGLSurface( EglInterface& egl );
94 * @copydoc Dali::RenderSurface::StartRender()
96 virtual void StartRender();
99 * @copydoc Dali::RenderSurface::PreRender()
101 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction );
104 * @copydoc Dali::RenderSurface::PostRender()
106 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface );
109 * @copydoc Dali::RenderSurface::StopRender()
111 virtual void StopRender();
122 * @param[in] syncMode The sync mode
124 void SetSyncMode( SyncMode syncMode );
127 * If sync mode is WAIT, then acquire a lock. This prevents render thread from
128 * continuing until the pixmap has been drawn by the compositor.
129 * It must be released for rendering to continue.
130 * @param[in] syncMode The current sync mode
132 void AcquireLock( SyncMode syncMode );
142 virtual void CreateXRenderable();
145 * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::UseExistingRenderable
147 virtual void UseExistingRenderable( unsigned int surfaceId );
151 boost::condition_variable mSyncNotify; ///< condition to notify main thread that pixmap was flushed to onscreen
152 boost::mutex mSyncMutex; ///< mutex to lock during waiting sync
153 Ecore_X_Pixmap mX11Pixmap; ///< X-Pixmap
154 SyncMode mSyncMode; ///< Stores whether the post render should block waiting for compositor
155 bool mSyncReceived; ///< true, when a pixmap sync has occurred, (cleared after reading)
162 #endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__