video: driver: optimize buffer pool design

Added change to avoid unnecessary list iteration during
msm_memory_free also added logic to catch double free
request.

Change-Id: Ie3fb8019fd039e95ea75ba8f3fbd266af515e5cd
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal
2021-06-24 18:19:14 +05:30
parent f19e84239c
commit 1d8d7ac788
5 changed files with 46 additions and 36 deletions

View File

@@ -28,11 +28,12 @@ enum msm_memory_pool_type {
struct msm_memory_alloc_header {
struct list_head list;
u32 type;
bool busy;
void *buf;
};
struct msm_memory_pool {
u32 type;
u32 size;
char *name;
struct list_head free_pool; /* list of struct msm_memory_alloc_header */
@@ -57,7 +58,6 @@ int msm_memory_pools_init(struct msm_vidc_inst *inst);
void msm_memory_pools_deinit(struct msm_vidc_inst *inst);
void *msm_memory_alloc(struct msm_vidc_inst *inst,
enum msm_memory_pool_type type);
void msm_memory_free(struct msm_vidc_inst *inst,
enum msm_memory_pool_type type, void *vidc_buf);
void msm_memory_free(struct msm_vidc_inst *inst, void *vidc_buf);
#endif // _MSM_VIDC_MEMORY_H_