tdm_output_hwc_create_window(tdm_output *output, tdm_error *error);
/**
+ * @brief Creates a new video window on the given output.
+ * @param[in] output A output object
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A created window object
+ * @since 2.0.0
+ */
+tdm_hwc_window *
+tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error);
+
+/**
* @brief Destroys the given window.
* @param[in] output A output object
* @param[in] window the pointer of the window to destroy
*/
tdm_error (*output_hwc_get_video_supported_formats)(tdm_layer *layer,
const tbm_format **formats, int *count);
- void (*reserved4)(void);
+
+ /**
+ * @brief Creates a new video window on the given output.
+ * @param[in] output A output object
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A created window object. If the video abilities isn't accessed return NULL
+ * @since 2.0.0
+ */
+ tdm_hwc_window *(*output_hwc_create_video_window)(tdm_output *output, tdm_error *error);
+
void (*reserved5)(void);
void (*reserved6)(void);
void (*reserved7)(void);
* a type to the TDM_COMPOSITION_CLIENT_CANDIDATE type.
*
* This transition can happen only if the window has the TDM_COMPOSITION_DEVICE
- * or the TDM_COMPOSITION_VIDEO type already.
+ * type already.
*
- * If an user changed type of a window from the TDM_COMPOSITION_DEVICE or the
- * TDM_COMPOSITION_VIDEO type to the the TDM_COMPOSITION_CLIENT type, the type
+ * If an user changed type of a window from the TDM_COMPOSITION_DEVICE
+ * type to the the TDM_COMPOSITION_CLIENT type, the type
* will be rejected to the TDM_COMPOSITION_CLIENT_CANDIDATE type.
*
* The user has to composite this window itself.
* TDM_COMPOSITION_CLIENT_CANDIDATE type.
*
* This transitional state is used to get rid of blinking at a transition from
- * the TDM_COMPOSITION_DEVICE/TDM_COMPOSITION_VIDEO type to the
+ * the TDM_COMPOSITION_DEVICE type to the
* TDM_COMPOSITION_CLIENT type where the hw has to wait till a buffer, which was
* on a hw overlay, get composited to the fb_target and only after this happens
* unset(or set another window on) this hw overlay.
* still permit the device to composite the layer. */
TDM_COMPOSITION_CURSOR = 5,
- /** The device will handle the composition of this layer through a hardware
- * overlay or other similar means.
- *
- * Upon tdm_output_hwc_validate(), the device may request a change from this type to
- * either TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT, but it is
- * unlikely that content will display correctly in these cases. */
- TDM_COMPOSITION_VIDEO = 6,
} tdm_hwc_window_composition;
/**
}
INTERN tdm_hwc_window *
-tdm_hwc_window_create_internal(tdm_private_output *private_output,
+tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video,
tdm_error *error)
{
tdm_private_display *private_display = private_output->private_display;
TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), NULL);
- if (!func_output->output_hwc_create_window) {
- /* LCOV_EXCL_START */
- if (error)
- *error = TDM_ERROR_BAD_MODULE;
- return NULL;
- /* LCOV_EXCL_STOP */
- }
+ if (!is_video) {
+ if (!func_output->output_hwc_create_window) {
+ /* LCOV_EXCL_START */
+ if (error)
+ *error = TDM_ERROR_BAD_MODULE;
+ return NULL;
+ /* LCOV_EXCL_STOP */
+ }
- hwc_window_backend = func_output->output_hwc_create_window(
+ hwc_window_backend = func_output->output_hwc_create_window(
private_output->output_backend, &ret);
- if (ret != TDM_ERROR_NONE) {
- if (error)
- *error = ret;
- return NULL;
+ if (ret != TDM_ERROR_NONE) {
+ if (error)
+ *error = ret;
+ return NULL;
+ }
+ } else {
+ if (!func_output->output_hwc_create_video_window) {
+ /* LCOV_EXCL_START */
+ if (error)
+ *error = TDM_ERROR_BAD_MODULE;
+ return NULL;
+ /* LCOV_EXCL_STOP */
+ }
+
+ hwc_window_backend = func_output->output_hwc_create_video_window(
+ private_output->output_backend, &ret);
+ if (ret != TDM_ERROR_NONE) {
+ if (error)
+ *error = ret;
+ return NULL;
+ }
}
private_hwc_window = calloc(1, sizeof(tdm_private_capture));
_pthread_mutex_lock(&private_display->lock);
if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC)
- hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, error);
+ hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, 0, error);
+ else {
+ /* LCOV_EXCL_START */
+ TDM_ERR("output(%p) not support HWC", private_output);
+ if (error)
+ *error = TDM_ERROR_BAD_REQUEST;
+ /* LCOV_EXCL_STOP */
+ }
+
+ _pthread_mutex_unlock(&private_display->lock);
+
+ return hwc_window;
+}
+
+EXTERN tdm_hwc_window *
+tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error)
+{
+ tdm_hwc_window *hwc_window = NULL;
+
+ OUTPUT_FUNC_ENTRY_ERROR();
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC)
+ hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, 1, error);
else {
/* LCOV_EXCL_START */
TDM_ERR("output(%p) not support HWC", private_output);
tdm_pp_destroy_internal(tdm_private_pp *private_pp);
tdm_hwc_window *
-tdm_hwc_window_create_internal(tdm_private_output *private_output, tdm_error *error);
+tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video, tdm_error *error);
tdm_error
tdm_hwc_window_destroy_internal(tdm_private_hwc_window * private_hwc_window);
ASSERT_EQ(TDM_ERROR_NONE, error);
error = tdm_hwc_window_set_composition_type(hwc_wins[i], TDM_COMPOSITION_CURSOR);
ASSERT_EQ(TDM_ERROR_NONE, error);
- error = tdm_hwc_window_set_composition_type(hwc_wins[i], TDM_COMPOSITION_VIDEO);
- ASSERT_EQ(TDM_ERROR_NONE, error);
}
}