Added function and enum for Checking buffer sharing capability 52/46552/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 10 Aug 2015 02:40:13 +0000 (11:40 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Fri, 21 Aug 2015 10:27:36 +0000 (19:27 +0900)
Change-Id: I03ad3946b46bde047a7e63efaab1350d282dbe8d
Signed-off-by: Changyeon Lee <cyeon.lee@samsung.com>
src/tbm_bufmgr.c
src/tbm_bufmgr.h
src/tbm_bufmgr_backend.h
src/tbm_surface_internal.c [changed mode: 0755->0644]
src/tbm_surface_internal.h [changed mode: 0755->0644]
src/tbm_wayland.c [changed mode: 0755->0644]

index a944d40..7b76978 100644 (file)
@@ -1664,3 +1664,19 @@ tbm_get_last_error (void)
     return tbm_last_error;
 }
 
+unsigned int
+tbm_bufmgr_get_capability (tbm_bufmgr bufmgr)
+{
+    TBM_RETURN_IF_FAIL (TBM_BUFMGR_IS_VALID(bufmgr));
+
+    unsigned int capability = TBM_BUFMGR_CAPABILITY_NONE;
+
+    if (bufmgr->backend->bo_import && bufmgr->backend->bo_export)
+        capability |= TBM_BUFMGR_CAPABILITY_SHARE_KEY;
+
+    if (bufmgr->backend->bo_import_fd && bufmgr->backend->bo_export_fd)
+        capability |= TBM_BUFMGR_CAPABILITY_SHARE_FD;
+
+    return capability;
+}
+
index 0191d9d..9df6f45 100644 (file)
@@ -177,6 +177,16 @@ typedef enum
     TBM_BO_ERROR_DUP_FD_FAILED = TBM_ERROR_BASE|0x0116,       /**< failed to duplicate fd */
 } tbm_error_e;
 
+/**
+ * @brief Enumeration of tbm buffer manager capability.
+ * @since_tizen 2.4
+ */
+enum TBM_BUFMGR_CAPABILITY
+{
+    TBM_BUFMGR_CAPABILITY_NONE = 0,                 /**< Not Support capability*/
+    TBM_BUFMGR_CAPABILITY_SHARE_KEY = (1<<0),       /**< Support sharing buffer by tbm key */
+    TBM_BUFMGR_CAPABILITY_SHARE_FD = (1<<1),        /**< Support sharing buffer by tbm fd */
+};
 
 #ifdef __cplusplus
 extern "C" {
@@ -587,7 +597,7 @@ tbm_bo        tbm_bo_import     (tbm_bufmgr bufmgr, tbm_key key);
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks You must release the fd using close().
  * @param[in] bufmgr : the buffer manager
- * @parak[in] fd : the fd associated with the buffer object
+ * @param[in] fd : the fd associated with the buffer object
  * @return a buffer object
  * @retval #tbm_bo
  * @see tbm_bo_export_fd()
@@ -978,6 +988,28 @@ int tbm_bo_get_user_data    (tbm_bo bo, unsigned long key, void** data);
  */
 tbm_error_e tbm_get_last_error    (void);
 
+/**
+ * @brief Gets the tbm buffer capability.
+ * @since_tizen 2.4
+ * @param[in] bufmgr : the buffer manager
+ * @return the tbm bufmgr capability
+ * @par Example
+   @code
+   #include <tbm_bufmgr.h>
+
+   int bufmgr_fd;
+   tbm_bufmgr bufmgr;
+   unsigned int capability;
+
+   bufmgr = tbm_bufmgr_init (bufmgr_fd);
+
+   capability = tbm_bufmgr_get_capability (bufmgr);
+
+   tbm_bufmgr_deinit (bufmgr);
+   @endcode
+ */
+unsigned int tbm_bufmgr_get_capability (tbm_bufmgr bufmgr);
+
 #ifdef __cplusplus
 }
 #endif
index ef10e9d..cb6efaf 100644 (file)
@@ -125,6 +125,8 @@ struct _tbm_bufmgr_backend
 
     /**
     * @brief import the buffer object associated with the key.
+    * @remarks If the backend doesn't support a buffer sharing by tbm key,
+               fucntion pointer must be set to NULL.
     * @param[in] bo : the buffer object
     * @param[in] key : the key associated with the buffer object
     * @return pointer of the bo private.
@@ -133,6 +135,8 @@ struct _tbm_bufmgr_backend
 
     /**
     * @brief export the buffer object
+    * @remarks If the backend doesn't support a buffer sharing by tbm key,
+               fucntion pointer must be set to NULL.
     * @param[in] bo : the buffer object
     * @return key associated with the buffer object
     */
@@ -239,6 +243,8 @@ struct _tbm_bufmgr_backend
     /**
     * @brief import the buffer object associated with the prime fd.
     * @remarks tbm_fd must be free by user.
+    * @remarks If the backend doesn't support a buffer sharing by tbm fd,
+               fucntion pointer must be set to NULL.
     * @param[in] bo : the buffer object
     * @param[in] fd : the prime fd associated with the buffer object
     * @return pointer of the bo private.
@@ -248,6 +254,8 @@ struct _tbm_bufmgr_backend
     /**
     * @brief export the buffer object
     * @remarks tbm_fd must be free by user.
+    * @remarks If the backend doesn't support a buffer sharing by tbm fd,
+               fucntion pointer must be set to NULL.
     * @param[in] bo : the buffer object
     * @return tbm_fd associated with the buffer object
     */
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)