From: taeyoon Date: Thu, 22 Dec 2016 05:14:41 +0000 (+0900) Subject: Add release request in update buffer callback X-Git-Tag: accepted/tizen/4.0/unified/20170920.081503~1^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a816bf093d5969c5a1a72d4e2f2590c0ba43c72;p=platform%2Fcore%2Fuifw%2Fwidget-viewer-dali.git Add release request in update buffer callback By tizen remote surface protocol version up (2), update buffer callback should call release request Change-Id: I07cc06b81a2b7a76735991635c11d0535f5600eb --- diff --git a/internal/widget_view/widget_view_impl.cpp b/internal/widget_view/widget_view_impl.cpp index 7927adc..d49aab0 100644 --- a/internal/widget_view/widget_view_impl.cpp +++ b/internal/widget_view/widget_view_impl.cpp @@ -36,6 +36,7 @@ #include #include #include +#include namespace Dali { @@ -88,6 +89,8 @@ DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "activateFaultedWidget", DALI_TYPE_REGISTRATION_END() +struct wl_buffer* preBuffer; + static void OnBufferChanged( struct tizen_remote_surface *surface, uint32_t type, struct wl_buffer *buffer, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct wl_array *keys, void *data) { @@ -107,6 +110,15 @@ static void OnBufferChanged( struct tizen_remote_surface *surface, uint32_t type tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) ); widgetView->UpdateImageSource( tbmSurface ); } + + if( preBuffer != NULL && tizen_remote_surface_get_version( surface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION ) + { + tizen_remote_surface_release( surface, preBuffer ); + } + + preBuffer = buffer; + + close( img_file_fd ); } static void OnBufferUpdated( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data ) @@ -127,6 +139,13 @@ static void OnBufferUpdated( struct tizen_remote_surface* surface, wl_buffer* bu tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) ); widgetView->UpdateImageSource( tbmSurface ); } + + if( preBuffer != NULL && tizen_remote_surface_get_version( surface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION ) + { + tizen_remote_surface_release( surface, preBuffer ); + } + + preBuffer = buffer; } static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )