1 #ifndef __DALI_INTERNAL_RENDER_THREAD_H__
2 #define __DALI_INTERNAL_RENDER_THREAD_H__
5 * Copyright (c) 2015 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.
25 #include <base/render-helper.h>
26 #include <base/separate-update-render/render-request.h>
27 #include <egl-interface.h>
28 #include <render-surface.h> // needed for Dali::RenderSurface
45 class AdaptorInternalServices;
46 class ThreadSynchronization;
47 class EnvironmentOptions;
50 * The render-thread is responsible for calling Core::Render() after each update.
57 * Create the render-thread; this will not do anything until Start() is called.
58 * @param[in] sync thread synchronization object
59 * @param[in] adaptorInterfaces base adaptor interface
60 * @param[in] environmentOptions environment options
62 RenderThread( ThreadSynchronization& sync,
63 AdaptorInternalServices& adaptorInterfaces,
64 const EnvironmentOptions& environmentOptions );
74 * Starts the render-thread
79 * Stops the render-thread
83 private: // Render thread side helpers
86 * This method is used by the Render thread for rendering the Core to the screen.
87 * Called from render thread
88 * @return true, if the thread finishes properly.
93 * Check if main thread made any requests, e.g. ReplaceSurface
94 * Called from render thread
96 void ProcessRequest( RenderRequest* request );
99 * Helper for the thread calling the entry function.
100 * @param[in] This A pointer to the current RenderThread object
102 static inline void* InternalThreadEntryFunc( void* This )
104 ( static_cast<RenderThread*>( This ) )->Run();
111 RenderThread( const RenderThread& renderThread );
114 RenderThread& operator=( const RenderThread& renderThread );
118 ThreadSynchronization& mThreadSynchronization; ///< Used to synchronize the all threads
119 Dali::Integration::Core& mCore; ///< Dali core reference
120 pthread_t* mThread; ///< render thread
121 const EnvironmentOptions& mEnvironmentOptions; ///< Environment options
122 RenderHelper mRenderHelper; ///< Helper class for EGL, pre & post rendering
125 } // namespace Adaptor
127 } // namespace Internal
131 #endif // __DALI_INTERNAL_RENDER_THREAD_H__