}
-EXTERN const tdm_output*
+EXTERN tdm_output*
tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error)
{
tdm_private_output *private_output = NULL;
if (i == index)
{
pthread_mutex_unlock(&private_display->lock);
- return (const tdm_output*)private_output;
+ return private_output;
}
i++;
}
}
-EXTERN const tdm_layer*
+EXTERN tdm_layer*
tdm_output_get_layer(tdm_output *output, int index, tdm_error *error)
{
tdm_private_layer *private_layer = NULL;
private_display = vblank_handler->private_output->private_display;
- pthread_mutex_unlock(&private_display->lock);
-
if (vblank_handler->func)
+ {
+ pthread_mutex_unlock(&private_display->lock);
vblank_handler->func(vblank_handler->private_output, sequence,
tv_sec, tv_usec, vblank_handler->user_data);
-
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ }
LIST_DEL(&vblank_handler->link);
free(vblank_handler);
{
tdm_private_commit_handler *commit_handler = user_data;
tdm_private_display *private_display;
+ tdm_private_output *private_output;
+ tdm_private_layer *private_layer;
TDM_RETURN_IF_FAIL(commit_handler);
- private_display = commit_handler->private_output->private_display;
-
- pthread_mutex_unlock(&private_display->lock);
+ private_output = commit_handler->private_output;
+ private_display = private_output->private_display;
if (commit_handler->func)
- commit_handler->func(commit_handler->private_output, sequence,
+ {
+ pthread_mutex_unlock(&private_display->lock);
+ commit_handler->func(private_output, sequence,
tv_sec, tv_usec, commit_handler->user_data);
+ pthread_mutex_lock(&private_display->lock);
+ }
- pthread_mutex_lock(&private_display->lock);
+ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link)
+ {
+ if (!private_layer->waiting_buffer)
+ continue;
+
+ if (private_layer->showing_buffer)
+ {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->showing_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ }
+
+ private_layer->showing_buffer = private_layer->waiting_buffer;
+ private_layer->waiting_buffer = NULL;
+ }
LIST_DEL(&commit_handler->link);
free(commit_handler);
}
EXTERN tdm_error
-tdm_output_set_mode(tdm_output *output, tdm_output_mode *mode)
+tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode)
{
tdm_func_display *func_display;
OUTPUT_FUNC_ENTRY();
}
EXTERN tdm_error
-tdm_layer_set_buffer(tdm_layer *layer, tdm_buffer *buffer)
+tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
{
tdm_func_display *func_display;
LAYER_FUNC_ENTRY();
return TDM_ERROR_NONE;
}
- if (private_layer->current_buffer)
+ if (private_layer->waiting_buffer)
{
- /* TODO: need to unref after next buffer is showing on screen */
- tdm_buffer_unref_backend(private_layer->current_buffer);
- tdm_buffer_unref(private_layer->current_buffer);
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ pthread_mutex_lock(&private_display->lock);
}
- private_layer->current_buffer = tdm_buffer_ref(buffer, NULL);
- tdm_buffer_ref_backend(buffer);
+ private_layer->waiting_buffer = tdm_buffer_ref_backend(buffer);
- ret = func_display->layer_set_buffer(private_layer->layer_backend,
- tdm_buffer_get_surface(buffer));
+ ret = func_display->layer_set_buffer(private_layer->layer_backend, buffer);
pthread_mutex_unlock(&private_display->lock);
func_display = &private_display->func_display;
- if (private_layer->current_buffer)
+ if (private_layer->waiting_buffer)
+ {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ private_layer->waiting_buffer = NULL;
+ }
+
+ if (private_layer->showing_buffer)
{
- tdm_buffer_unref(private_layer->current_buffer);
- tdm_buffer_unref_backend(private_layer->current_buffer);
- private_layer->current_buffer = NULL;
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->showing_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ private_layer->showing_buffer = NULL;
}
private_layer->usable = 1;
return ret;
}
+EXTERN tdm_error
+tdm_layer_set_video_pos(tdm_layer *layer, int zpos)
+{
+ tdm_func_display *func_display;
+ LAYER_FUNC_ENTRY();
+
+ pthread_mutex_lock(&private_display->lock);
+
+ func_display = &private_display->func_display;
+
+ if (!(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO))
+ {
+ TDM_ERR("layer is not video layer");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!func_display->layer_set_video_pos)
+ {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
+
+ ret = func_display->layer_set_video_pos(private_layer->layer_backend, zpos);
+
+ pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
+}
EXTERN tdm_capture*
tdm_layer_create_capture(tdm_layer *layer, tdm_error *error)