tbm_surface_queue_h sprd_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error);
tdm_error sprd_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h buffer,
tdm_hwc_region damage);
+tdm_error sprd_output_hwc_get_video_supported_formats(tdm_output *output,
+ const tbm_format **formats, int *count);
+tdm_hwc_window *sprd_output_hwc_create_video_window(tdm_output *output, tdm_error *error);
+
tdm_error sprd_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps);
tdm_error sprd_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
tdm_error sprd_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
tdm_error sprd_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
tdm_error sprd_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
tdm_hwc_window_video_capability *video_capability);
-tdm_error sprd_hwc_window_video_get_supported_format(tdm_hwc_window *hwc_window,
- const tbm_format **formats,
- int *count);
tbm_surface_queue_h sprd_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
tdm_error sprd_hwc_window_set_zpos(tdm_hwc_window *hwc_window, uint32_t zpos);
tdm_error sprd_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
tdm_output_dpms dpms_value;
tdm_sprd_hwc_window_data *target_hwc_window;
+ tdm_sprd_hwc_window_data *video_hwc_window;
int need_validate;
int need_target_buffer;
tdm_error ret = TDM_ERROR_NONE;
RETURN_VAL_IF_FAIL(layer_data, TDM_ERROR_OPERATION_FAILED);
- RETURN_VAL_IF_FAIL(hwc_window_data, TDM_ERROR_OPERATION_FAILED);
if (hwc_window_data == NULL || hwc_window_data->display_buffer == NULL) {
ret = sprd_layer_unset_buffer(layer_data);
_sprd_layer_attach_window(layer, output_data->target_hwc_window);
}
+ if (output_data->video_hwc_window) {
+ layer = _sprd_output_get_layer(output_data, 0);
+ _sprd_layer_attach_window(layer, output_data->video_hwc_window);
+ }
+
if (_are_windows_with_client_candidate_type(&output_data->hwc_window_list))
return TDM_ERROR_NONE;
LIST_FOR_EACH_ENTRY_REV(hw, &output_data->hwc_window_list, link) {
if (hw->client_type == TDM_COMPOSITION_NONE)
continue;
- if (hw->client_type != TDM_COMPOSITION_DEVICE && hw->client_type != TDM_COMPOSITION_VIDEO)
+ if (hw->client_type != TDM_COMPOSITION_DEVICE)
continue;
if (i < 0)
return TDM_ERROR_OPERATION_FAILED;
/* disable unused layer */
while (i >= 0) {
+ if (i == 0 && output_data->video_hwc_window)
+ break;
layer = _sprd_output_get_layer(output_data, i--);
_sprd_layer_attach_window(layer, NULL);
}
return TDM_ERROR_NONE;
}
-
tdm_error
sprd_output_commit(tdm_output *output, int sync, void *user_data)
{
return "DEVICE";
else if (composition_type == TDM_COMPOSITION_CURSOR)
return "CURSOR";
- else if (composition_type == TDM_COMPOSITION_VIDEO)
- return "VIDEO";
else if (composition_type == TDM_COMPOSITION_NONE)
return "NONE";
else if (hw->prev_validated_type == TDM_COMPOSITION_DEVICE)
hw->validated_type = TDM_COMPOSITION_CLIENT_CANDIDATE;
-
- else if (hw->prev_validated_type == TDM_COMPOSITION_VIDEO)
- hw->validated_type = TDM_COMPOSITION_CLIENT_CANDIDATE;
}
}
/*
- * If we got at least one device/video -> client transition or we still have at
+ * If we got at least one device -> client transition or we still have at
* least one window at the client_candidate state we reset all windows
* to the client/client_candidate state as it's a reference implementation
* of the driver
hw->validated_type == TDM_COMPOSITION_CLIENT)
return 1;
- if (hw->prev_validated_type == TDM_COMPOSITION_VIDEO &&
- hw->validated_type == TDM_COMPOSITION_CLIENT)
- return 1;
-
if (hw->client_type == TDM_COMPOSITION_CLIENT_CANDIDATE)
return 1;
}
tdm_sprd_layer_data * layer = NULL;
- if (_get_number_of_visible_windows(sprd_output) > max_hw_layer)
+ /* video_hwc_window always is set to the lowest layer (index 0) */
+ if (sprd_output->video_hwc_window)
+ hw_layer_count++;
+
+ if (_get_number_of_visible_windows(sprd_output) > max_hw_layer - hw_layer_count)
need_target_buffer = 1;
- is_client_detected = 0;
/* check client_type */
LIST_FOR_EACH_ENTRY(hw, &sprd_output->hwc_window_list, link) {
if (hw->client_type == TDM_COMPOSITION_NONE)
continue;
- if ((hw->client_type == TDM_COMPOSITION_DEVICE || hw->client_type == TDM_COMPOSITION_VIDEO)
- && !is_client_detected) {
+ if (hw->client_type == TDM_COMPOSITION_DEVICE && !is_client_detected) {
hw->validated_type = TDM_COMPOSITION_DEVICE_CANDIDATE;
} else {
hw->validated_type = TDM_COMPOSITION_CLIENT;
is_client_detected = 1;
hw->validated_type = TDM_COMPOSITION_CLIENT;
} else {
- if (hw->client_type == TDM_COMPOSITION_VIDEO && hw_layer_count == 0 &&
- _sprd_hwc_window_is_reserved_buffer(hw)) {
- hw_layer_count++;
- hw->validated_type = TDM_COMPOSITION_VIDEO;
- continue;
-
- }
layer = _sprd_output_get_layer(sprd_output, hw_layer_count);
/* check format */
if (!_sprd_layer_is_supported_format(layer, hw->info.src_config.format))
hw_layer_count++;
hw->validated_type = TDM_COMPOSITION_DEVICE;
continue;
-
}
is_client_detected = 1;
}
return TDM_ERROR_NONE;
}
+tdm_error
+sprd_output_hwc_get_video_supported_formats(tdm_output *output,
+ const tbm_format **formats,
+ int *count)
+{
+ RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER);
+ RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
+ RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+ *formats = hwc_window_video_formats;
+ *count = sizeof(hwc_window_video_formats) / sizeof(tbm_format);
+
+ return TDM_ERROR_NONE;
+}
+
+tdm_hwc_window *
+sprd_output_hwc_create_video_window(tdm_output *output, tdm_error *error)
+{
+ tdm_sprd_hwc_window_data *sprd_hwc_window = NULL;
+ tdm_sprd_output_data *sprd_output = output;
+
+ if (error)
+ *error = TDM_ERROR_INVALID_PARAMETER;
+
+ RETURN_VAL_IF_FAIL(sprd_output != NULL, NULL);
+
+ if (error)
+ *error = TDM_ERROR_OPERATION_FAILED;
+
+ if (sprd_output->video_hwc_window)
+ return NULL;
+
+ sprd_hwc_window = _sprd_output_hwc_window_create(sprd_output, NULL, error);
+ if (sprd_hwc_window == NULL)
+ return NULL;
+
+ sprd_output->video_hwc_window = sprd_hwc_window;
+
+ TDM_DBG("hwc_window(%p) video create", sprd_hwc_window);
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ return sprd_hwc_window;
+}
+
tbm_surface_queue_h
sprd_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
{
tdm_error
sprd_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
- tdm_hwc_window_video_capability *video_capability)
+ tdm_hwc_window_video_capability *video_capability)
{
tdm_sprd_hwc_window_data *sprd_hwc_window = hwc_window;
+ tdm_sprd_output_data *sprd_output;
RETURN_VAL_IF_FAIL(hwc_window != NULL, TDM_ERROR_INVALID_PARAMETER);
+ sprd_output = sprd_hwc_window->output_data;
+ RETURN_VAL_IF_FAIL(sprd_output != NULL, TDM_ERROR_INVALID_PARAMETER);
RETURN_VAL_IF_FAIL(video_capability != NULL, TDM_ERROR_INVALID_PARAMETER);
- RETURN_VAL_IF_FAIL(sprd_hwc_window->validated_type == TDM_COMPOSITION_VIDEO, TDM_ERROR_INVALID_PARAMETER);
+ RETURN_VAL_IF_FAIL(sprd_output->video_hwc_window == sprd_hwc_window, TDM_ERROR_INVALID_PARAMETER);
*video_capability = TDM_HWC_WINDOW_VIDEO_CAPABILITY_SCANOUT;
return TDM_ERROR_NONE;
}
-
-tdm_error
-sprd_hwc_window_video_get_supported_format(tdm_hwc_window *hwc_window,
- const tbm_format **formats,
- int *count)
-{
- tdm_sprd_hwc_window_data *sprd_hwc_window = hwc_window;
-
- RETURN_VAL_IF_FAIL(hwc_window != NULL, TDM_ERROR_INVALID_PARAMETER);
- RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
- RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- RETURN_VAL_IF_FAIL(sprd_hwc_window->validated_type == TDM_COMPOSITION_VIDEO, TDM_ERROR_INVALID_PARAMETER);
-
- *formats = hwc_window_video_formats;
- *count = sizeof(hwc_window_video_formats) / sizeof(tbm_format);
-
- return TDM_ERROR_NONE;
-}