return TDM_ERROR_NONE;
}
+#if 0
static int
_sprd_layer_is_supported_format(tdm_sprd_layer_data *layer_data, tbm_format format)
{
return falgs & TBM_BO_SCANOUT;
}
+#endif
tdm_error
_sprd_output_insert_hwc_window(tdm_sprd_output_data *output, tdm_sprd_hwc_window_data *hwc_window_data)
{
tdm_sprd_output_data *output_data = output;
tdm_sprd_data *sprd_data = NULL;
+ tdm_sprd_hwc_window_data *hwc_window_data = NULL;
+
RETURN_VAL_IF_FAIL(output_data != NULL, TDM_ERROR_INVALID_PARAMETER);
RETURN_VAL_IF_FAIL(num_types != NULL, TDM_ERROR_INVALID_PARAMETER);
- tdm_sprd_hwc_window_data *hwc_window_data = NULL;
- int hw_layer_count = 0;
- int need_target_buffer = 0;
- int is_client_detected = 0;
- int max_hw_layer = HW_LAYER_NUM;
sprd_data = output_data->sprd_data;
RETURN_VAL_IF_FAIL(sprd_data != NULL, TDM_ERROR_INVALID_PARAMETER);
- tdm_sprd_layer_data * layer = NULL;
-
- /* video_hwc_window always is set to the lowest layer (index 0) */
- if (output_data->video_hwc_window)
- hw_layer_count++;
-
- if (_get_number_of_visible_windows(output_data) > max_hw_layer - hw_layer_count)
- need_target_buffer = 1;
-
- /* check client_type */
+ /* decide the validated_types with client_types */
LIST_FOR_EACH_ENTRY(hwc_window_data, &output_data->hwc_window_list, link) {
- if (hwc_window_data->client_type == TDM_COMPOSITION_NONE)
+ /* set the none to validated_type */
+ if (hwc_window_data->client_type == TDM_COMPOSITION_NONE &&
+ hwc_window_data->validated_type != TDM_COMPOSITION_NONE) {
+ hwc_window_data->validated_type = TDM_COMPOSITION_NONE;
continue;
+ }
- if (hwc_window_data->client_type == TDM_COMPOSITION_DEVICE && !is_client_detected) {
- hwc_window_data->validated_type = TDM_COMPOSITION_DEVICE_CANDIDATE;
- } else {
- hwc_window_data->validated_type = TDM_COMPOSITION_CLIENT;
- need_target_buffer = 1;
- is_client_detected = 1;
- }
- }
-
- if (need_target_buffer)
- max_hw_layer--;
-
- is_client_detected = 0;
- /* check format and flags for DEVICE_CANDIDATE */
- LIST_FOR_EACH_ENTRY(hwc_window_data, &output_data->hwc_window_list, link) {
- if (hwc_window_data->client_type == TDM_COMPOSITION_NONE)
+ /* set the TDM_COMPOSITION_VIDEO type */
+ if (hwc_window_data == output_data->video_hwc_window) {
+ hwc_window_data->validated_type = TDM_COMPOSITION_DEVICE;
continue;
+ }
- if (hwc_window_data->validated_type == TDM_COMPOSITION_DEVICE_CANDIDATE) {
- if (is_client_detected || hw_layer_count >= max_hw_layer) {
- is_client_detected = 1;
- hwc_window_data->validated_type = TDM_COMPOSITION_CLIENT;
- } else {
- layer = _sprd_output_get_layer(output_data, hw_layer_count);
- /* check format */
- if (!_sprd_layer_is_supported_format(layer, hwc_window_data->info.src_config.format))
- hwc_window_data->validated_type = TDM_COMPOSITION_CLIENT;
- else if (!hwc_window_data->display_buffer || !hwc_window_data->display_buffer->buffer)
- hwc_window_data->validated_type = TDM_COMPOSITION_CLIENT;
- /* check buffer flags */
- else if (_sprd_hwc_window_is_reserved_buffer(hwc_window_data)) {
- hw_layer_count++;
- hwc_window_data->validated_type = TDM_COMPOSITION_DEVICE;
- continue;
- }
- is_client_detected = 1;
- }
+ /* all hwc_windows make TDM_COMPOSITION_CLIENT */
+ if (hwc_window_data->client_type != TDM_COMPOSITION_CLIENT) {
+ hwc_window_data->validated_type = TDM_COMPOSITION_CLIENT;
}
}
- if (is_client_detected)
- need_target_buffer = 1;
-
+ /* debugging log */
LIST_FOR_EACH_ENTRY(hwc_window_data, &output_data->hwc_window_list, link) {
if (hwc_window_data->client_type == TDM_COMPOSITION_NONE)
continue;
TDM_DBG(" window(%p) type: %s -> %s", hwc_window_data,
- _comp_to_str(hwc_window_data->client_type), _comp_to_str(hwc_window_data->validated_type));
+ _comp_to_str(hwc_window_data->client_type),
+ _comp_to_str(hwc_window_data->validated_type));
}
- output_data->need_target_buffer = need_target_buffer;
+ /* The driver always needs the target_buffer */
+ output_data->need_target_buffer = 1;
*num_types = _sprd_output_get_changed_number(output_data);
-
if (*num_types == 0)
output_data->need_validate = 0;
return TDM_ERROR_NONE;
hwc_window_data->client_type = comp_type;
- if (comp_type == TDM_COMPOSITION_NONE)
- hwc_window_data->validated_type = comp_type;
+
output_data->need_validate = 1;
return TDM_ERROR_NONE;