video: driver: optimize buffer pool implementation

- Maintain free & busy pool to track buffers separately
- track double-free cases during msm_memory_free()
- track memory leak, by checking busy pool buffer count.
  it is expected to be zero at the end of a session.
- maintain common api's to init, alloc, free, destroy
  for all below buffer types.
    - struct msm_vidc_buffer
    - struct msm_vidc_alloc
    - struct msm_vidc_map
    - struct msm_vidc_timestamp.

Change-Id: Ib8655047c3883ea6601344661058d7a629ffd5bd
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal
2021-06-07 14:37:02 +05:30
parent b113af07cb
commit 3e4248dfb0
9 changed files with 232 additions and 296 deletions

View File

@@ -7,6 +7,7 @@
#define _MSM_VIDC_INST_H_
#include "msm_vidc_internal.h"
#include "msm_vidc_memory.h"
#include "hfi_property.h"
struct msm_vidc_inst;
@@ -27,13 +28,6 @@ struct msm_vidc_session_ops {
int (*extra_count)(struct msm_vidc_inst *inst, enum msm_vidc_buffer_type type);
};
struct msm_vidc_pool_info {
struct msm_vidc_pool allocations;
struct msm_vidc_pool mappings;
struct msm_vidc_pool buffers;
struct msm_vidc_pool timestamps;
};
struct msm_vidc_allocations_info {
struct msm_vidc_allocations bin;
struct msm_vidc_allocations arp;
@@ -119,7 +113,7 @@ struct msm_vidc_inst {
struct msm_vidc_rectangle compose;
struct msm_vidc_power power;
struct vidc_bus_vote_data bus_data;
struct msm_vidc_pool_info pool;
struct msm_memory_pool pool[MSM_MEM_POOL_MAX];
struct msm_vidc_buffers_info buffers;
struct msm_vidc_mappings_info mappings;
struct msm_vidc_allocations_info allocations;