1 /* 2 * Support for Intel Camera Imaging ISP subsystem. 3 * Copyright (c) 2010 - 2015, Intel Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 */ 14 15 #ifndef _IA_CSS_RMGR_VBUF_H 16 #define _IA_CSS_RMGR_VBUF_H 17 18 #include "ia_css_rmgr.h" 19 #include <type_support.h> 20 #include <ia_css_types.h> 21 #include <system_types.h> 22 23 /** 24 * @brief Data structure for the resource handle (host, vbuf) 25 */ 26 struct ia_css_rmgr_vbuf_handle { 27 ia_css_ptr vptr; 28 u8 count; 29 u32 size; 30 }; 31 32 /** 33 * @brief Data structure for the resource pool (host, vbuf) 34 */ 35 struct ia_css_rmgr_vbuf_pool { 36 u8 copy_on_write; 37 u8 recycle; 38 u32 size; 39 u32 index; 40 struct ia_css_rmgr_vbuf_handle **handles; 41 }; 42 43 /** 44 * @brief VBUF resource pools 45 */ 46 extern struct ia_css_rmgr_vbuf_pool *vbuf_ref; 47 extern struct ia_css_rmgr_vbuf_pool *vbuf_write; 48 extern struct ia_css_rmgr_vbuf_pool *hmm_buffer_pool; 49 50 /** 51 * @brief Initialize the resource pool (host, vbuf) 52 * 53 * @param pool The pointer to the pool 54 */ 55 STORAGE_CLASS_RMGR_H int ia_css_rmgr_init_vbuf( 56 struct ia_css_rmgr_vbuf_pool *pool); 57 58 /** 59 * @brief Uninitialize the resource pool (host, vbuf) 60 * 61 * @param pool The pointer to the pool 62 */ 63 STORAGE_CLASS_RMGR_H void ia_css_rmgr_uninit_vbuf( 64 struct ia_css_rmgr_vbuf_pool *pool); 65 66 /** 67 * @brief Acquire a handle from the pool (host, vbuf) 68 * 69 * @param pool The pointer to the pool 70 * @param handle The pointer to the handle 71 */ 72 STORAGE_CLASS_RMGR_H void ia_css_rmgr_acq_vbuf( 73 struct ia_css_rmgr_vbuf_pool *pool, 74 struct ia_css_rmgr_vbuf_handle **handle); 75 76 /** 77 * @brief Release a handle to the pool (host, vbuf) 78 * 79 * @param pool The pointer to the pool 80 * @param handle The pointer to the handle 81 */ 82 STORAGE_CLASS_RMGR_H void ia_css_rmgr_rel_vbuf( 83 struct ia_css_rmgr_vbuf_pool *pool, 84 struct ia_css_rmgr_vbuf_handle **handle); 85 86 /** 87 * @brief Retain the reference count for a handle (host, vbuf) 88 * 89 * @param handle The pointer to the handle 90 */ 91 void ia_css_rmgr_refcount_retain_vbuf(struct ia_css_rmgr_vbuf_handle **handle); 92 93 /** 94 * @brief Release the reference count for a handle (host, vbuf) 95 * 96 * @param handle The pointer to the handle 97 */ 98 void ia_css_rmgr_refcount_release_vbuf(struct ia_css_rmgr_vbuf_handle **handle); 99 100 #endif /* _IA_CSS_RMGR_VBUF_H */ 101