hwc: add API function tdm_output_hwc_get_video_supported_formats 41/162141/6
authorRoman Marchenko <r.marchenko@samsung.com>
Wed, 29 Nov 2017 08:38:57 +0000 (10:38 +0200)
committerBoram Park <boram1288.park@samsung.com>
Mon, 4 Dec 2017 05:39:17 +0000 (05:39 +0000)
  delete API function tdm_hwc_window_video_get_supported_format

Change-Id: I72f7e41f89bbc7f9aee665def673306c1072c992
Signed-off-by: Roman Marchenko <r.marchenko@samsung.com>
include/tdm.h
include/tdm_backend.h
src/tdm_hwc_window.c
src/tdm_output.c
utests/src/ut_tdm_hwc_window.cpp

index 85c3226..a0edef6 100644 (file)
@@ -715,6 +715,17 @@ tbm_surface_queue_h
 tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error);
 
 /**
+ * @brief Get the supported format array for video hwc windows of a output object.
+ * @param[in] output A output object
+ * @param[out] formats The available format array
+ * @param[out] count The count of formats
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_output_hwc_get_video_supported_formats(tdm_layer *layer, const tbm_format **formats,
+                                                               int *count);
+
+/**
  * @brief Get the capabilities of a layer object.
  * @param[in] layer A layer object
  * @param[out] capabilities The capabilities of a layer object
@@ -1083,19 +1094,6 @@ tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
                                                                        tdm_hwc_window_video_capability *video_capability);
 
 /**
- * @brief Get the window video supported format
- * @param[in] hwc_window A window object
- * @param[out] formats A hwc window supported formats
- * @param[out] count A number of the hwc window supported formats
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @since 2.0.0
- */
-tdm_error
-tdm_hwc_window_video_get_supported_format(tdm_hwc_window *hwc_window,
-                                                                                 const tbm_format **formats,
-                                                                                 int *count);
-
-/**
  * @brief Destroy a pp object
  * @param[in] pp A pp object
  * @see tdm_display_create_pp
index 6e96440..51f3d63 100644 (file)
@@ -660,7 +660,15 @@ typedef struct _tdm_func_output {
        tbm_surface_queue_h (*output_hwc_get_target_buffer_queue)(tdm_output *output,
                                                                                                                   tdm_error *error);
 
-       void (*reserved3)(void);
+       /**
+        * @brief Get the supported format array for video hwc windows of a output object.
+        * @param[in] output A output object
+        * @param[out] formats The available format array
+        * @param[out] count The count of formats
+        * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+        */
+       tdm_error (*output_hwc_get_video_supported_formats)(tdm_layer *layer,
+                                                                       const tbm_format **formats, int *count);
        void (*reserved4)(void);
        void (*reserved5)(void);
        void (*reserved6)(void);
@@ -902,18 +910,7 @@ typedef struct _tdm_func_window {
         * @return #TDM_ERROR_NONE if success. Otherwise, error value.
         */
        tdm_error (*hwc_window_video_get_capability)(tdm_hwc_window *hwc_window,
-                                                                                               tdm_hwc_window_video_capability *video_capability);
-
-       /**
-        * @brief Get the window video supported format
-        * @param[in] hwc_window A window object
-        * @param[out] formats A hwc window supported formats
-        * @param[out] count A number of the hwc window supported formats
-        * @return #TDM_ERROR_NONE if success. Otherwise, error value.
-        */
-       tdm_error (*hwc_window_video_get_supported_format)(tdm_hwc_window *hwc_window,
-                                                                                                          const tbm_format **formats,
-                                                                                                          int *count);
+                                                       tdm_hwc_window_video_capability *video_capability);
 
        /**
         * @brief Get the available property array  of a video hwc window object.
index 1166e5b..91191b8 100644 (file)
@@ -452,38 +452,6 @@ tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
 }
 
 EXTERN tdm_error
-tdm_hwc_window_video_get_supported_format(tdm_hwc_window *hwc_window,
-                                                                                 const tbm_format **formats,
-                                                                                 int *count)
-{
-       tdm_func_hwc_window *func_hwc_window = NULL;
-
-       HWC_WINDOW_FUNC_ENTRY();
-
-       TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
-       TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
-
-       _pthread_mutex_lock(&private_display->lock);
-
-       func_hwc_window = &private_display->func_hwc_window;
-
-       if (!func_hwc_window->hwc_window_video_get_supported_format) {
-               /* LCOV_EXCL_START */
-               _pthread_mutex_unlock(&private_display->lock);
-               TDM_ERR("not implemented!!");
-               return TDM_ERROR_NOT_IMPLEMENTED;
-               /* LCOV_EXCL_STOP */
-       }
-
-       ret = func_hwc_window->hwc_window_video_get_supported_format(private_hwc_window->hwc_window_backend,
-                                                                                                                                formats, count);
-
-       _pthread_mutex_unlock(&private_display->lock);
-
-       return ret;
-}
-
-EXTERN tdm_error
 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
                                                                                          const tdm_prop **props, int *count)
 {
index 9188c9c..4c1015c 100644 (file)
@@ -1730,6 +1730,36 @@ tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target
        return ret;
 }
 
+tdm_error
+tdm_output_hwc_get_video_supported_formats(tdm_output *output, const tbm_format **formats,
+                                                               int *count)
+{
+       tdm_func_output *func_output;
+       OUTPUT_FUNC_ENTRY();
+
+       TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
+       TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+       _pthread_mutex_lock(&private_display->lock);
+
+       func_output = &private_display->func_output;
+
+       if (!func_output->output_hwc_get_video_supported_formats) {
+               /* LCOV_EXCL_START */
+               _pthread_mutex_unlock(&private_display->lock);
+               TDM_ERR("not implemented!!");
+               return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
+       }
+
+       ret = func_output->output_hwc_get_video_supported_formats(
+                                                               private_output->output_backend, formats, count);
+
+       _pthread_mutex_unlock(&private_display->lock);
+
+       return ret;
+}
+
 INTERN void
 tdm_output_call_change_handler_internal(tdm_private_output *private_output,
                                                                                struct list_head *change_handler_list,
index f4c33a5..d712740 100644 (file)
@@ -626,38 +626,6 @@ TEST_F(TDMHwcWindow, VideoGetCapabilitySuccessful)
        }
 }
 
-
-/* tdm_error tdm_hwc_window_video_get_supported_format(tdm_hwc_window *hwc_window, const tbm_format **formats, int *count); */
-TEST_F(TDMHwcWindow, VideoGetSupportedFormatFailNull)
-{
-       const tbm_format *formats;
-       int count;
-
-       error = tdm_hwc_window_video_get_supported_format(NULL, &formats, &count);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-
-       if (hwc_count > 0) {
-               error = tdm_hwc_window_video_get_supported_format(hwc_wins[0], NULL, &count);
-               error = tdm_hwc_window_video_get_supported_format(hwc_wins[0], &formats, NULL);
-       }
-}
-
-TEST_F(TDMHwcWindow, VideoGetSupportedFormatSuccessful)
-{
-       const tbm_format *formats;
-       int count;
-
-       for (int i = 0; i < hwc_count; i++) {
-               /* hwc_window with TDM_COMPOSITION_CLIENT dosn't support tdm_hwc_window_video_get_supported_format()*/
-               error = tdm_hwc_window_set_composition_type(hwc_wins[i], TDM_COMPOSITION_CLIENT);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-               error = tdm_hwc_window_video_get_supported_format(hwc_wins[i], &formats, &count);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-
-               /*TODO:: check format for TDM_COMPOSITION_VIDEO*/
-       }
-}
-
 /* tdm_error tdm_output_hwc_validate(tdm_output *output, uint32_t *num_types); */
 TEST_F(TDMOutputHwc, ValidateFailNull)
 {