add hal_tbm_surface and backend functions for it. 41/257541/4
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 27 Apr 2021 10:21:43 +0000 (19:21 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 30 Apr 2021 07:53:05 +0000 (07:53 +0000)
The hal-tbm backend can manage the hal_tbm_surface resource now.
The hal-tbm backend can allocate a hal_tbm_surface,
export hal_tbm_surface_buffer_data with hal_tbm_surface
and import a hal_tbm_surface with hal_tbm_surface_buffer_data.

Change-Id: I0d828ebb351ffa5fccaff9c161a47a37b80c0279

include/hal-tbm-interface.h
include/hal-tbm-types.h

index edd5e23..28c1699 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 typedef struct _hal_tbm_backend_data hal_tbm_backend_data;
 
 typedef struct _hal_tbm_bufmgr_funcs hal_tbm_bufmgr_funcs;
+typedef struct _hal_tbm_surface_funcs   hal_tbm_surface_funcs;
 typedef struct _hal_tbm_bo_funcs     hal_tbm_bo_funcs;
 
 typedef hal_tbm_error (*hal_tbm_authenticated_drm_fd_handler)(hal_tbm_fd auth_fd, void *user_data);
@@ -58,6 +59,7 @@ struct _hal_tbm_backend_data {
        } drm_info;
 
        hal_tbm_bufmgr_funcs *bufmgr_funcs;
+       hal_tbm_surface_funcs *surface_funcs;
        hal_tbm_bo_funcs     *bo_funcs;
 };
 
@@ -72,6 +74,15 @@ struct _hal_tbm_bufmgr_funcs {
                                                                                hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
        hal_tbm_bo *(*bufmgr_import_fd)(hal_tbm_bufmgr *bufmgr, hal_tbm_fd fd, hal_tbm_error *error);
        hal_tbm_bo *(*bufmgr_import_key)(hal_tbm_bufmgr *bufmgr, hal_tbm_key key, hal_tbm_error *error);
+       hal_tbm_surface *(*bufmgr_alloc_surface)(hal_tbm_bufmgr *bufmgr, int width, int height, hal_tbm_format format, hal_tbm_error *error);
+       hal_tbm_surface *(*bufmgr_import_surface)(hal_tbm_bufmgr *bufmgr, int width, int height, hal_tbm_format format, hal_tbm_surface_buffer_data *buffer_data, hal_tbm_error *error);
+};
+
+struct _hal_tbm_surface_funcs {
+       void                           (*surface_free) (hal_tbm_surface *surface);
+       hal_tbm_bo                   **(*surface_get_bos)(hal_tbm_surface *surface, int *num_bos, hal_tbm_error *error);
+       hal_tbm_error                  (*surface_get_plane_data)(hal_tbm_surface *surface, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx);
+       hal_tbm_surface_buffer_data   *(*surface_export)(hal_tbm_surface *surface, hal_tbm_error *error);
 };
 
 struct _hal_tbm_bo_funcs {
index b054f24..89f2550 100644 (file)
@@ -129,6 +129,18 @@ enum {
 };
 
 /**
+ * @brief Deficitino for the buffer data of hal_tbm_surface
+ */
+typedef struct _hal_tbm_surface_buffer_data {
+       int *fds;                       /**< an array of dmabuf fds */
+       unsigned int num_fds;           /**< the number of dmabuf fds */
+       int *meta_data;                 /**< an array of meta data */
+       unsigned int num_meta_data;     /**< the number of meta data */
+       void *reserved1;                /**< reserved data1 */
+       void *reserved2;                /**< reserved data2 */
+} hal_tbm_surface_buffer_data;
+
+/**
  * @brief hal_tbm_bo_handle abstraction of the memory handle by HAL_TBM_DEVICE_TYPE
  */
 typedef union _hal_tbm_bo_handle {
@@ -150,6 +162,11 @@ typedef void hal_tbm_backend;
 typedef void hal_tbm_bufmgr;
 
 /**
+ * @brief Definition for the tizen surface object
+ */
+typedef void hal_tbm_surface;
+
+/**
  * @brief Definition for the tizen buffer object
  */
 typedef void hal_tbm_bo;