Revert "[Tizen] ecore-wl2: add zxdg_shell define"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl / pixmap-render-surface-ecore-wl.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/wayland/ecore-wl/pixmap-render-surface.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/gl-abstraction.h>
23 #include <dali/integration-api/debug.h>
24
25 // INTERNAL INCLUDES
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>
30
31 namespace Dali
32 {
33
34 #if defined(DEBUG_ENABLED)
35 extern Debug::Filter* gRenderSurfaceLogFilter;
36 #endif
37
38 namespace ECore
39 {
40
41 PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize,
42                                          Any surface,
43                                          const std::string& name,
44                                          bool isTransparent)
45 : EcoreWlRenderSurface( positionSize, surface, name, isTransparent )
46 {
47   Init( surface );
48 }
49
50 PixmapRenderSurface::~PixmapRenderSurface()
51 {
52   // release the surface if we own one
53   if( mOwnSurface )
54   {
55     //TODO: if we did create the pixmap, delete the pixmap
56   }
57 }
58
59 Ecore_Wl_Window* PixmapRenderSurface::GetDrawable()
60 {
61   return NULL;
62 }
63
64 Any PixmapRenderSurface::GetSurface()
65 {
66   return Any( NULL );
67 }
68
69 void PixmapRenderSurface::InitializeEgl( EglInterface& egl )
70 {
71   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
72
73   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
74
75   eglImpl.ChooseConfig(false, mColorDepth);
76 }
77
78 void PixmapRenderSurface::CreateEglSurface( EglInterface& egl )
79 {
80   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
81
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
84   // FIXME
85 }
86
87 void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl )
88 {
89   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
90
91   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
92   eglImpl.DestroySurface();
93 }
94
95 bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl )
96 {
97   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
98
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
101   // FIXME
102   return false;
103 }
104
105 void PixmapRenderSurface::StartRender()
106 {
107   // FIXME
108 }
109
110 bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
111 {
112   // nothing to do for pixmaps
113   return true;
114 }
115
116 void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
117 {
118   // flush gl instruction queue
119   glAbstraction.Flush();
120
121  // create damage for client applications which wish to know the update timing
122   if( mRenderNotification )
123   {
124     // use notification trigger
125     // Tell the event-thread to render the pixmap
126     mRenderNotification->Trigger();
127   }
128   else
129   {
130     // FIXME
131   }
132
133   // Do render synchronisation
134   // AcquireLock( replacingSurface ? SYNC_MODE_NONE : SYNC_MODE_WAIT );
135 }
136
137 void PixmapRenderSurface::StopRender()
138 {
139   // FIXME
140 }
141
142 void PixmapRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
143 {
144   // Nothing to do
145 }
146
147 void PixmapRenderSurface::CreateWlRenderable()
148 {
149   // check we're creating one with a valid size
150   DALI_ASSERT_ALWAYS( mPositionSize.width > 0 && mPositionSize.height > 0 && "Pixmap size is invalid" );
151
152   // FIXME
153 }
154
155 void PixmapRenderSurface::UseExistingRenderable( unsigned int surfaceId )
156 {
157   // FIXME
158 }
159
160 void PixmapRenderSurface::SetSyncMode( SyncMode syncMode )
161 {
162   // FIXME
163 }
164
165 void PixmapRenderSurface::AcquireLock()
166 {
167   // FIXME
168 }
169
170 void PixmapRenderSurface::ReleaseLock()
171 {
172   // FIXME
173 }
174
175 } // namespace ECore
176
177 } // namespace Dali