2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/integration-api/wayland/pixmap-render-surface.h>
22 #include <dali/integration-api/gl-abstraction.h>
23 #include <dali/integration-api/debug.h>
26 #include <dali/integration-api/wayland/wl-types.h>
27 #include <dali/internal/system/common/trigger-event.h>
28 #include <dali/internal/graphics/gles20/egl-implementation.h>
29 #include <dali/internal/window-system/common/display-connection.h>
34 #if defined(DEBUG_ENABLED)
35 extern Debug::Filter* gRenderSurfaceLogFilter;
41 PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize,
43 const std::string& name,
45 : EcoreWlRenderSurface( positionSize, surface, name, isTransparent )
50 PixmapRenderSurface::~PixmapRenderSurface()
52 // release the surface if we own one
55 //TODO: if we did create the pixmap, delete the pixmap
59 Ecore_Wl_Window* PixmapRenderSurface::GetDrawable()
64 Any PixmapRenderSurface::GetSurface()
69 void PixmapRenderSurface::InitializeEgl( EglInterface& egl )
71 DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
73 Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
75 eglImpl.ChooseConfig(false, mColorDepth);
78 void PixmapRenderSurface::CreateEglSurface( EglInterface& egl )
80 DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
82 // create the EGL surface
83 // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
87 void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl )
89 DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
91 Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
92 eglImpl.DestroySurface();
95 bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl )
97 DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
99 // a new surface for the new pixmap
100 // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
105 void PixmapRenderSurface::StartRender()
110 bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
112 // nothing to do for pixmaps
116 void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
118 // flush gl instruction queue
119 glAbstraction.Flush();
121 // create damage for client applications which wish to know the update timing
122 if( mRenderNotification )
124 // use notification trigger
125 // Tell the event-thread to render the pixmap
126 mRenderNotification->Trigger();
133 // Do render synchronisation
134 // AcquireLock( replacingSurface ? SYNC_MODE_NONE : SYNC_MODE_WAIT );
137 void PixmapRenderSurface::StopRender()
142 void PixmapRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
147 void PixmapRenderSurface::CreateWlRenderable()
149 // check we're creating one with a valid size
150 DALI_ASSERT_ALWAYS( mPositionSize.width > 0 && mPositionSize.height > 0 && "Pixmap size is invalid" );
155 void PixmapRenderSurface::UseExistingRenderable( unsigned int surfaceId )
160 void PixmapRenderSurface::SetSyncMode( SyncMode syncMode )
165 void PixmapRenderSurface::AcquireLock()
170 void PixmapRenderSurface::ReleaseLock()