private_output->regist_change_cb = 1;
}
- } else
- _tdm_display_destroy_caps_output(&private_output->caps);
+ ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
+ &private_output->caps);
+ if (ret != TDM_ERROR_NONE)
+ return ret;
+ } else {
+ tdm_caps_output new_caps;
- ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
- &private_output->caps);
- if (ret != TDM_ERROR_NONE)
- return ret;
+ ret = _tdm_display_update_caps_output(private_display, pipe, output_backend,
+ &new_caps);
+ if (ret != TDM_ERROR_NONE)
+ return ret;
+
+ /* FIXME: This is very ugly. need to fix after the TDM ABI is changed. */
+ if (private_output->caps.status != new_caps.status) {
+ _tdm_display_destroy_caps_output(&private_output->caps);
+ private_output->caps = new_caps;
+ private_output->current_mode = NULL;
+ } else {
+ tdm_output_mode *old_modes = private_output->caps.modes;
+ unsigned int old_mode_count = private_output->caps.mode_count;
+ if (new_caps.modes)
+ free(new_caps.modes);
+ new_caps.modes = old_modes;
+ new_caps.mode_count = old_mode_count;
+ if (private_output->caps.props)
+ free(private_output->caps.props);
+ private_output->caps = new_caps;
+ }
+ }
layers = func_output->output_get_layers(output_backend, &layer_count, &ret);
if (ret != TDM_ERROR_NONE)
break;
}
}
+
+ _tdm_display_destroy_caps_output(&caps);
}
/* ordering : main output is first */
}
ret = func_output->output_set_mode(private_output->output_backend, mode);
-
+ if (ret == TDM_ERROR_NONE)
+ private_output->current_mode = mode;
_pthread_mutex_unlock(&private_display->lock);
return ret;
EXTERN tdm_error
tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode)
{
- tdm_func_output *func_output;
OUTPUT_FUNC_ENTRY();
TDM_RETURN_VAL_IF_FAIL(mode != NULL, TDM_ERROR_INVALID_PARAMETER);
_pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
-
- if (!func_output->output_get_mode) {
- _pthread_mutex_unlock(&private_display->lock);
- TDM_ERR("not implemented!!");
- return TDM_ERROR_NOT_IMPLEMENTED;
- }
-
- ret = func_output->output_get_mode(private_output->output_backend, mode);
+ *mode = private_output->current_mode;
_pthread_mutex_unlock(&private_display->lock);