minigbm: refactor bo refcount and mapping destruction

1. internalize drv specific helpers into drv.c
2. simplify bo ref counting and clean up
3. refactor drv_bo_mapping_destroy

BUG=b:201110412
TEST=CQ

Change-Id: If297ef7007c1d14a69ae467b6d1c67c4edf5b177
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3188470
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
Yiwei Zhang 2021-09-24 21:54:20 +00:00 committed by Commit Bot
parent 50c42dfdc3
commit 7fae5d05e6
4 changed files with 97 additions and 121 deletions

View file

@ -67,6 +67,12 @@ struct driver {
void *buffer_table;
struct drv_array *mappings;
struct drv_array *combos;
/*
* The driver_lock currently protects:
* 1. buffer_table
* 2. mappings
* 3. metadata_cache in virtgpu_cros_domain
*/
pthread_mutex_t driver_lock;
bool compression;
};