// EXTERNAL INCLUDES
#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/adaptors/ecore-wl-render-surface.h>
+#include <dali/integration-api/adaptors/trigger-event-factory.h>
#include <dali/integration-api/debug.h>
namespace Dali
Output::OnStartRepaintLoop,
Output::OnRepaint,
Output::OnAttachSurface,
- Output::OnFlushSurface
+ Output::OnFlushSurfaceDamage
};
} // unnamed namespace
: mSize(),
mOutput( NULL ),
mPrimaryPlane( NULL ),
- mRepaintRequest( false )
+ mBufferAttached( false )
{
}
application.ResizeSignal().Connect( this, &Output::OnResize );
- // Set the thread-synchronization interface on the render-surface
- surface.SetThreadSynchronization( *this );
+ // Sets the render notification trigger to call when rendering is completed a frame
+ TriggerEventFactory triggerEventFactory;
+ TriggerEventInterface* renderNotification = triggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Output::OnPostRender ),
+ TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
+
+ ECore::EcoreWlRenderSurface* renderSurface = dynamic_cast< ECore::EcoreWlRenderSurface* >( &surface );
+ if( renderSurface )
+ {
+ renderSurface->SetRenderNotification( renderNotification );
+ }
DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::Initialize: success [width = %.2f height = %.2f]\n", mSize.width, mSize.height );
}
void Output::OnRepaint( void* data, const pepper_list_t* planeList )
{
- Output* output = static_cast< Output* >( data );
-
- DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnRepaint\n" );
-
- output->mRepaintRequest = true;
-
- // TODO: temp
- if( !output->mRenderFinishTimer )
- {
- output->mRenderFinishTimer= Timer::New(1);
- output->mRenderFinishTimer.TickSignal().Connect( output, &Output::OnRenderFinishTimerTick );
- }
-
- output->mRenderFinishTimer.Start();
}
void Output::OnAttachSurface( void* data, pepper_surface_t* surface, int* width, int* height )
*height = 0;
}
- // TODO: temp
- struct timespec ts;
-
- pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( output->mCompositor ).GetCompositorHandle() ), &ts );
- pepper_output_finish_frame( output->mOutput, &ts );
+ output->mBufferAttached = true;
}
-void Output::OnFlushSurface( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer )
+void Output::OnFlushSurfaceDamage( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer )
{
}
}
}
-void Output::PostRenderComplete()
+void Output::OnPostRender()
{
- if( mRepaintRequest )
+ if( mBufferAttached )
{
struct timespec ts;
- DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::PostRenderComplete" );
+ DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnPostRender" );
pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( mCompositor ).GetCompositorHandle() ), &ts );
pepper_output_finish_frame( mOutput, &ts );
- mRepaintRequest = false;
+ mBufferAttached = false;
}
}
-void Output::PostRenderStarted()
-{
- // Do nothing
-}
-
-void Output::PostRenderWaitForCompletion()
-{
- // Do nothing
-}
-
-// TODO: temp
-bool Output::OnRenderFinishTimerTick()
-{
- struct timespec ts;
-
- DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnRenderFinishTimerTick\n" );
-
- pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( mCompositor ).GetCompositorHandle() ), &ts );
- pepper_output_finish_frame( mOutput, &ts );
-
- return false;
-}
-
} // namespace Internal
} // namespace Pepper