hwc: add the API function tdm_output_hwc_create_video_window instead of TDM_COMPOSITI... 63/162163/6
authorRoman Marchenko <r.marchenko@samsung.com>
Wed, 29 Nov 2017 09:46:22 +0000 (11:46 +0200)
committerBoram Park <boram1288.park@samsung.com>
Mon, 4 Dec 2017 05:39:41 +0000 (05:39 +0000)
Change-Id: If82b18a3d133abbcedb5d9125e18f5d6682e72f0
Signed-off-by: Roman Marchenko <r.marchenko@samsung.com>
include/tdm.h
include/tdm_backend.h
include/tdm_types.h
src/tdm_hwc_window.c
src/tdm_output.c
src/tdm_private.h
utests/src/ut_tdm_hwc_window.cpp

index a0edef6..77866d5 100644 (file)
@@ -579,6 +579,16 @@ tdm_hwc_window *
 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
index 51f3d63..b1a3657 100644 (file)
@@ -669,7 +669,16 @@ typedef struct _tdm_func_output {
         */
        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);
index 626c1c3..c64a351 100644 (file)
@@ -170,10 +170,10 @@ typedef enum {
         * 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.
@@ -184,7 +184,7 @@ typedef enum {
         * 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.
@@ -224,13 +224,6 @@ typedef enum {
         * 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;
 
 /**
index 91191b8..24b6207 100644 (file)
@@ -293,7 +293,7 @@ tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer)
 }
 
 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;
@@ -304,20 +304,38 @@ tdm_hwc_window_create_internal(tdm_private_output *private_output,
 
        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));
index 4c1015c..6e08225 100644 (file)
@@ -1434,7 +1434,31 @@ tdm_output_hwc_create_window(tdm_output *output, tdm_error *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, 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);
index 5e63e5c..37cceb0 100644 (file)
@@ -519,7 +519,7 @@ void
 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);
 
index d712740..ed12a59 100644 (file)
@@ -461,8 +461,6 @@ TEST_F(TDMHwcWindow, SetCompositionTypeSuccessful)
                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);
        }
 }