- /* we don't need to handle pending data here because the changes in this function
- * should be applied immediately. we can't expect calling tdm_layer_commit.
- */
- ret = func_layer->layer_set_buffer(private_layer->layer_backend, surface);
- TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
-
- if (ret == TDM_ERROR_NONE) {
- if (private_layer->waiting_buffer) {
- TDM_DBG("layer(%p) drop waiting_buffer(%p)", private_layer, private_layer->waiting_buffer->buffer);
- _tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
- }
-
- private_layer->waiting_buffer = layer_buffer;
- private_layer->waiting_buffer->buffer = tdm_buffer_ref_backend(surface);
-
- if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) waiting_buffer(%p)",
- private_layer, private_layer->waiting_buffer->buffer);
+ ret = tdm_layer_set_buffer_internal(private_layer, buffer);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("tdm_layer_set_buffer_internal failed");
+ _pthread_mutex_unlock(&private_display->lock);
+ return;
+ }