Modify Frame Broker API 41/226641/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 4 Mar 2020 08:57:50 +0000 (17:57 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 4 Mar 2020 08:57:50 +0000 (17:57 +0900)
Adds:
 - frame_type_e: FRAME_TYPE_REMOTE_SURFACE_TBM_SURFACE
 - frame_get_tbm_surface()

Removes:
 - frame_type_e: FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER
 - frame_get_native_buffer()
 - frame_native_buffer_get_raw()
 - frame_native_buffer_get_width()
 - frame_native_buffer_get_height()
 - frame_native_buffer_get_bpp()
 - frame_native_buffer_get_tbm_surface()

Change-Id: I6f72cb4d639147b7bb1a36632881a60cd9151665
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
frame-broker/include/frame.h
frame-broker/src/frame.c

index c0fe832..2112e6c 100644 (file)
@@ -34,17 +34,11 @@ extern "C" {
 typedef struct frame_s *frame_h;
 
 /**
- * @brief The native buffer handle.
- * @since_tizen 5.5
- */
-typedef void *frame_native_buffer_h;
-
-/**
  * @brief Enumeration for the frame type.
  * @since_tizen 5.5
  */
 typedef enum {
-       FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER,        /**< The remote surface: The native buffer */
+       FRAME_TYPE_REMOTE_SURFACE_TBM_SURFACE,          /**< The remote surface: The tbm surface */
        FRAME_TYPE_REMOTE_SURFACE_IMAGE_FILE,           /**< The remote surface: The image file */
        FRAME_TYPE_SPLASH_SCREEN_IMAGE,                 /**< The splash screen: The image */
        FRAME_TYPE_SPLASH_SCREEN_EDJE,                  /**< The splash screen: The EDJE */
@@ -60,26 +54,21 @@ typedef enum {
 } frame_direction_e;
 
 /**
- * @brief Gets the native buffer.
+ * @brief Gets the Tizen buffer surface handle.
  * @since_tizen 5.5
- * @detils If the type of the frame is not FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER,
+ * @detils If the type of the frame is not FRAME_TYPE_REMOTE_SURFACE_TBM_SURFACE,
  *         this function returns a negative error value that is FRAME_BROKER_ERROR_INVALID_PARAMETER.
- * @remarks The @a buffer should not be released.
+ * @remarks The @a tbm_surface should not be released using tbm_surface_destroy().
  *
  * @param[in]   handle          The frame handle
- * @param[out]  buffer          The native buffer
+ * @param[out]  tbm_surface     The Tizen buffer surface
  * @return      @c 0 on success,
  *              otherwise a negative error value
  *
  * @retval #FRAME_BROKER_ERROR_NONE Successful
  * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @see frame_native_buffer_get_raw()
- * @see frame_native_buffer_get_width()
- * @see frame_native_buffer_get_height()
- * @see frame_native_buffer_get_bbp()
  */
-int frame_get_native_buffer(frame_h handle, frame_native_buffer_h *buffer);
+int frame_get_tbm_surface(frame_h handle, tbm_surface_h *tbm_surface);
 
 /**
  * @brief Gets the image file information.
@@ -213,79 +202,6 @@ int frame_get_position_y(frame_h handle, int32_t *y);
  */
 int frame_get_extra_data(frame_h handle, bundle **extra_data);
 
-/**
- * @brief Gets the raw data of the native buffer.
- * @since_tizen 5.5
- *
- * @param[in]   handle          The native buffer handle
- * @param[out]  raw             The raw data
- * @return      @c 0 on success,
- *              otherwise a negative error value
- *
- * @retval #FRAME_BROKER_ERROR_NONE Successful
- * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int frame_native_buffer_get_raw(frame_native_buffer_h handle, void **raw);
-
-/**
- * @brief Gets the width of the native buffer.
- * @since_tizen 5.5
- *
- * @param[in]   handle          The native buffer handle
- * @param[out]  width           The width of the native buffer
- * @return      @c 0 on success,
- *              otherwise a negative error value
- *
- * @retval #FRAME_BROKER_ERROR_NONE Successful
- * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int frame_native_buffer_get_width(frame_native_buffer_h handle,
-               uint32_t *width);
-
-/**
- * @brief Gets the height of the native buffer.
- * @since_tizen 5.5
- *
- * @param[in]   handle          The native buffer handle
- * @param[out]  height          The height of the native buffer
- * @return      @c 0 on success,
- *              otherwise a negative error value
- *
- * @retval #FRAME_BROKER_ERROR_NONE Successful
- * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int frame_native_buffer_get_height(frame_native_buffer_h handle,
-               uint32_t *height);
-/**
- * @brief Gets the bpp of the native buffer.
- * @since_tizen 5.5
- *
- * @param[in]   handle          The native buffer handle
- * @param[out]  bpp             The bpp of the native buffer
- * @return      @c 0 on success,
- *              otherwise a negative error value
- *
- * @retval #FRAME_BROKER_ERROR_NONE Successful
- * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int frame_native_buffer_get_bpp(frame_native_buffer_h handle,
-               uint32_t *bpp);
-
-/**
- * @brief Gets the Tizen buffer surface handle of the native buffer.
- * @since_tizen 5.5
- *
- * @param[in]   handle          The native buffer handle
- * @param[out]  tbm_surface     The Tizen buffer surface
- * @return      @c 0 on success,
- *              otherwise a negative error value
- *
- * @retval #FRAME_BROKER_ERROR_NONE Successful
- * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int frame_native_buffer_get_tbm_surface(frame_native_buffer_h handle,
-               tbm_surface_h *tbm_surface);
-
 #ifdef __cplusplus
 }
 #endif
index 8b14b8e..4eedca9 100644 (file)
@@ -34,7 +34,7 @@ static frame_type_e __convert_type(
 {
        switch (type) {
        case SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_TBM:
-               return FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER;
+               return FRAME_TYPE_REMOTE_SURFACE_TBM_SURFACE;
        case SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE:
                return FRAME_TYPE_REMOTE_SURFACE_IMAGE_FILE;
        case SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_SPLASH_SCREEN_IMAGE:
@@ -109,39 +109,31 @@ int frame_destroy(frame_h handle)
        return FRAME_BROKER_ERROR_NONE;
 }
 
-API int frame_get_native_buffer(frame_h handle, frame_native_buffer_h *buffer)
+API int frame_get_tbm_surface(frame_h handle, tbm_surface_h *tbm_surface)
 {
-       tbm_surface_info_s *surface_info = NULL;
-       tbm_surface_h tbm_surface = NULL;
+       tbm_surface_h tbm_surf = NULL;
        frame_type_e type;
        int ret;
 
-       if (!handle || !buffer) {
+       if (!handle || !tbm_surface) {
                _E("Invalid parameter");
                return FRAME_BROKER_ERROR_INVALID_PARAMETER;
        }
 
        frame_get_type(handle, &type);
-       if (type != FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER) {
+       if (type != FRAME_TYPE_REMOTE_SURFACE_TBM_SURFACE) {
                _E("Invalid parameter. type(%d)", type);
                return FRAME_BROKER_ERROR_INVALID_PARAMETER;
        }
 
-       ret = screen_connector_launcher_service_image_get_tbm_surface_info(
-                       handle->image, &surface_info);
-       if (ret != 0) {
-               _E("Failed to get tbm surface info. error(%d)", ret);
-               return FRAME_BROKER_ERROR_INVALID_PARAMETER;
-       }
-
        ret = screen_connector_launcher_service_image_get_tbm_surface(
-                       handle->image, &tbm_surface);
+                       handle->image, &tbm_surf);
        if (ret != 0) {
                _E("Failed to get tbm surface. error(%d)", ret);
                return FRAME_BROKER_ERROR_INVALID_PARAMETER;
        }
 
-       *buffer = (frame_native_buffer_h)handle->image;
+       *tbm_surface = tbm_surf;
 
        return ret;
 }
@@ -296,93 +288,3 @@ API int frame_get_extra_data(frame_h handle, bundle **extra_data)
 
        return FRAME_BROKER_ERROR_NONE;
 }
-
-API int frame_native_buffer_get_raw(frame_native_buffer_h handle,
-               void **raw)
-{
-       screen_connector_launcher_service_image_h image = handle;
-       tbm_surface_info_s *info = NULL;
-
-       if (!handle || !raw) {
-               _E("Invalid parameter");
-               return FRAME_BROKER_ERROR_INVALID_PARAMETER;
-       }
-
-       screen_connector_launcher_service_image_get_tbm_surface_info(image,
-                       &info);
-       *raw = info->planes[0].ptr;
-
-       return FRAME_BROKER_ERROR_NONE;
-}
-
-API int frame_native_buffer_get_width(frame_native_buffer_h handle,
-               uint32_t *width)
-{
-       screen_connector_launcher_service_image_h image = handle;
-       tbm_surface_info_s *info = NULL;
-
-       if (!handle || !width) {
-               _E("Invalid parameter");
-               return FRAME_BROKER_ERROR_INVALID_PARAMETER;
-       }
-
-       screen_connector_launcher_service_image_get_tbm_surface_info(image,
-                       &info);
-       *width = info->width;
-
-       return FRAME_BROKER_ERROR_NONE;
-}
-
-API int frame_native_buffer_get_height(frame_native_buffer_h handle,
-               uint32_t *height)
-{
-       screen_connector_launcher_service_image_h image = handle;
-       tbm_surface_info_s *info = NULL;
-
-       if (!handle || !height) {
-               _E("Invalid parameter");
-               return FRAME_BROKER_ERROR_INVALID_PARAMETER;
-       }
-
-       screen_connector_launcher_service_image_get_tbm_surface_info(image,
-                       &info);
-       *height = info->height;
-
-       return FRAME_BROKER_ERROR_NONE;
-}
-
-API int frame_native_buffer_get_bpp(frame_native_buffer_h handle,
-               uint32_t *bpp)
-{
-       screen_connector_launcher_service_image_h image = handle;
-       tbm_surface_info_s *info = NULL;
-
-       if (!handle || !bpp) {
-               _E("Invalid parameter");
-               return FRAME_BROKER_ERROR_INVALID_PARAMETER;
-       }
-
-       screen_connector_launcher_service_image_get_tbm_surface_info(image,
-                       &info);
-       *bpp = info->bpp;
-
-       return FRAME_BROKER_ERROR_NONE;
-}
-
-API int frame_native_buffer_get_tbm_surface(frame_native_buffer_h handle,
-               tbm_surface_h *tbm_surface)
-{
-       screen_connector_launcher_service_image_h image = handle;
-       tbm_surface_h surface = NULL;
-
-       if (!handle || !tbm_surface) {
-               _E("Invalid parameter");
-               return FRAME_BROKER_ERROR_INVALID_PARAMETER;
-       }
-
-       screen_connector_launcher_service_image_get_tbm_surface(image,
-                       &surface);
-       *tbm_surface = surface;
-
-       return FRAME_BROKER_ERROR_NONE;
-}