3.14. sample_hbmem 使用说明
3.14.1. 功能概述
本
sample_hbmem 主要
Com Buffer 的
创建 与 管理:提供 了 创建、管理 和 销毁 共享 通信 缓冲区 的 能力,这些 缓冲区 用于 多个 进程 之间 的 数据交换,有效 支持 进程 间 的 协作 Graphic Buffer 的
创建 与 使用:提供 了 如何 创建 并 管理 图形 缓冲区,包括 对 图形 数据 的 配置、操作 和 转换,能够 满足 视觉 数据处理 中 对 内存 的 动态 需求。 Share Pool 的
使用:实现 了 共享内存 池 的 分配 与 释放 策略,通过 共享内存 池 优化 了 资源 的 利用率,降低 了 创建 和 销毁 缓冲区 时 的 开销,提高 了 内存 管理 的 灵活性。
3.14.1.1. 软件架构说明
本 sample 基于 libhbmem API 实现,libhbmem 是

3.14.1.2. 背景知识
可以
3.14.1.3. API 流程说明
libhbmem 提供

以下

Alloc Com Buf:分配
共享 通信 缓冲区,用于 多个 进程 之间 的 数据交换,有效 支持 进程 间 的 协作。 Alloc Com Buf With Heapmask:分配
共享 通信 缓冲区,并 指定 heapmask,用于 指定 缓冲区 分配 到 指定 的 heap 上。 Alloc Graph Buf:分配
图像 缓存,包括 对 图像 数据 的 配置、操作 和 转换,能够 满足 视觉 数据处理 中 对 内存 的 动态 需求。 Alloc Graph Buf With Heapmask:分配
图像 缓存,并 指定 heapmask,用于 指定 缓冲区 分配 到 指定 的 heap 上。

Share Com Buffer:共享
通信 缓冲区,用于 多个 进程 之间 的 数据交换,有效 支持 进程 间 的 协作。 Share Graph Buffer:共享
图像 缓存,包括 对 图像 数据 的 配置、操作 和 转换,能够 满足 视觉 数据处理 中 对 内存 的 动态 需求。 Share Pool:共享内存
池,实现 了 共享内存 池 的 分配 与 释放 策略,通过 共享内存 池 优化 了 资源 的 利用率,降低 了 创建 和 销毁 缓冲区 时 的 开销,提高 了 内存 管理 的 灵活性。

Share Com Buffer Fork Process Scenario:创建
子 进程 时,共享 通信 缓冲区 的 使用。
3.14.2. 编译部署
3.14.2.1. 源码结构
1. 代码路径:/app/samples/platform_samples/sample_hbmem
2. 目录结构:
sample_hbmem/
├── .gitignore
├── Makefile
├── sample_alloc.c
├── sample_common.c
├── sample_common.h
├── sample_pool.c
├── sample_queue.c
├── sample_share_pool.c
├── sample_share.c
└── sample.c
3.14.2.2. 编译说明
本sample主要
#include <hb_mem_mgr.h>
#include <hb_mem_err.h>
编译
LIBS += -lhbmem -lpthread -lalog -ldl -lstdc++
3.14.2.3. 编译环境
进入 app/samples/platform_samples/sample_hbmem 目录,执行 make 编译
编译
成功 后 输出 的 可执行文件 为 sample_hbmem 详细
程序 编译 方式 请 查阅 编译 方法 章节
把 sample_hbmem 上chmod 777 sample_hbmem 命令
3.14.3. 运行
部署sample_hbmem 之后./sample_hbmem 可以
# ./sample_hbmem
Options:
-m Specify sample use cases
-h Show this help message
Usage: ./sample_hbmem -m <index>
*************** Sample Mode Lists ***************
index: 1 sample_mode: Alloc Com Buf
index: 2 sample_mode: Alloc Com Buf With Cache
index: 3 sample_mode: Alloc Com Buf With Heapmask
index: 4 sample_mode: Alloc Graph Buf
index: 5 sample_mode: Alloc Graph Buf With Heapmask
index: 6 sample_mode: Share Com Buffer
index: 7 sample_mode: Share Com Buffer Fork Process Scenario
index: 8 sample_mode: Share Graph Buffer
index: 9 sample_mode: Share Graph Buffer Fork Process Scenario
index: 10 sample_mode: Share Pool Fork Process Scenario
index: 11 sample_mode: Share Pool
index: 12 sample_mode: Change Com Graph Buf
***************************************************
根据./sample_hbmem -m 1,即会
3.14.3.1. 命令解释
-m: 指定sample用例,具体
见 运行结果展示-h: 帮助
说明
3.14.3.2. 测试结果说明
如果log最后
以 xxxx done结尾,则表示 sample 执行 成功。
3.14.3.3. 运行结果展示
理解/sys/kernel/debug/ion/clients/ 目录
比如1114 的1114-0 的cma_reserved、carveout、ion_cma 等
创建 Com Buf
# ./sample_hbmem -m 1
sample_mode = 1
=================================================
Ready to sample_alloc_com_buf
alloc com buf, share_id: 7
[1432:1432] Do system command cat /sys/kernel/debug/ion/clients/1432*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: 400000 : 1 : 1 : d4b2ed6c : 3: 7 : 1
-------------------------------------------------------------------------
total 400000
-------------------------------------------------------------------------
[1432:1432] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1432 | grep -w sample_hbmem.
ion_cma sample_hbmem 1432 4194304
sample_hbmem 1432 other 4194304 0
[1432:1432] Result 0.
free com buf
[1432:1432] Do system command cat /sys/kernel/debug/ion/clients/1432*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
-------------------------------------------------------------------------
total 0
-------------------------------------------------------------------------
[1432:1432] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1432 | grep -w sample_hbmem.
[1432:1432] Result 256.
sample_alloc_com_buf done
=================================================
创建 Com Buf With Cache
# ./sample_hbmem -m 2
sample_mode = 2
=================================================
Ready to sample_alloc_com_buf_with_cache
memset uncached buf(size:4194304) use time: 691673
memset cached buf(size:4194304) use time: 457194
sample_alloc_com_buf_with_cache done
=================================================
在
各个 heaps 里 创建 Com Buffer
# ./sample_hbmem -m 3
sample_mode = 3
=================================================
Ready to sample_alloc_com_buf_with_heapmask
alloc com buf form ion_cma, size: 1048576
[1471:1471] Do system command cat /sys/kernel/debug/ion/clients/1471*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: 100000 : 1 : 1 : 27d9b8ed : 3: 7 : 1
-------------------------------------------------------------------------
total 100000
-------------------------------------------------------------------------
[1471:1471] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1471 | grep -w sample_hbmem.
ion_cma sample_hbmem 1471 1048576
sample_hbmem 1471 other 1048576 0
[1471:1471] Result 0.
free com buf
alloc com buf form carveout, size: 1048576
[1471:1471] Do system command cat /sys/kernel/debug/ion/clients/1471*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
carveout: 100000 : 1 : 1 : 27d9b8ed : 3: 7 : 1
-------------------------------------------------------------------------
total 100000
-------------------------------------------------------------------------
[1471:1471] Do system command cat /sys/kernel/debug/ion/heaps/carveout | grep -w 1471 | grep -w sample_hbmem.
carveout sample_hbmem 1471 1048576
sample_hbmem 1471 other 1048576 0
[1471:1471] Result 0.
free com buf
alloc com buf form cma_reserved, size: 1048576
[1471:1471] Do system command cat /sys/kernel/debug/ion/clients/1471*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
cma_reserved: 100000 : 1 : 1 : 27d9b8ed : 3: 7 : 1
-------------------------------------------------------------------------
total 100000
-------------------------------------------------------------------------
[1471:1471] Do system command cat /sys/kernel/debug/ion/heaps/cma_reserved | grep -w 1471 | grep -w sample_hbmem.
cma_reserved sample_hbmem 1471 1048576
sample_hbmem 1471 other 1048576 0
[1471:1471] Result 0.
free com buf
sample_alloc_com_buf_with_heapmask done
=================================================
创建 Graph Buffer
# ./sample_hbmem -m 4
sample_mode = 4
=================================================
Ready to sample_alloc_graph_buf
graph_buf.plane_cnt: 2, graph_buf.format: 8, graph_buf.width: 1280, graph_buf.height: 720, graph_buf.stride: 0, graph_buf.vstride: 0, graph_buf.stride: 0, graph_buf.flags: 17
[1487:1487] Do system command cat /sys/kernel/debug/ion/clients/1487*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: e1000 : 1 : 1 : 27d9b8ed : 3: 7 : 1
ion_cma: 71000 : 1 : 1 : 1fe4048d : 3: 8 : 1
-------------------------------------------------------------------------
total 152000
-------------------------------------------------------------------------
[1487:1487] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1487 | grep -w sample_hbmem.
ion_cma sample_hbmem 1487 1384448
sample_hbmem 1487 other 921600 0
sample_hbmem 1487 other 462848 0
[1487:1487] Result 0.
sample_alloc_graph_buf done
=================================================
在
各个 heaps 里,创建 Graph Buffer
# ./sample_hbmem -m 5
sample_mode = 5
=================================================
Ready to sample_alloc_graph_buf_with_heapmask
alloc graph buf form ion_cma
graph_buf.plane_cnt: 2, graph_buf.format: 8, graph_buf.width: 1280, graph_buf.height: 720, graph_buf.stride: 0, graph_buf.vstride: 0, graph_buf.stride: 0, graph_buf.flags: 17
[1493:1493] Do system command cat /sys/kernel/debug/ion/clients/1493*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: 71000 : 1 : 1 : 27d9b8ed : 3: 8 : 1
ion_cma: e1000 : 1 : 1 : 1fe4048d : 3: 7 : 1
-------------------------------------------------------------------------
total 152000
-------------------------------------------------------------------------
[1493:1493] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1493 | grep -w sample_hbmem.
ion_cma sample_hbmem 1493 1384448
sample_hbmem 1493 other 462848 0
sample_hbmem 1493 other 921600 0
[1493:1493] Result 0.
alloc graph buf form carveout
graph_buf.plane_cnt: 2, graph_buf.format: 8, graph_buf.width: 1280, graph_buf.height: 720, graph_buf.stride: 0, graph_buf.vstride: 0, graph_buf.stride: 0, graph_buf.flags: 4294967313
[1493:1493] Do system command cat /sys/kernel/debug/ion/clients/1493*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
carveout: e1000 : 1 : 1 : 27d9b8ed : 3: 7 : 1
carveout: 71000 : 1 : 1 : 1fe4048d : 3: 8 : 1
-------------------------------------------------------------------------
total 152000
-------------------------------------------------------------------------
[1493:1493] Do system command cat /sys/kernel/debug/ion/heaps/carveout | grep -w 1493 | grep -w sample_hbmem.
carveout sample_hbmem 1493 1384448
sample_hbmem 1493 other 921600 0
sample_hbmem 1493 other 462848 0
[1493:1493] Result 0.
alloc graph buf form cma_reserved
graph_buf.plane_cnt: 2, graph_buf.format: 8, graph_buf.width: 1280, graph_buf.height: 720, graph_buf.stride: 0, graph_buf.vstride: 0, graph_buf.stride: 0, graph_buf.flags: 17179869201
[1493:1493] Do system command cat /sys/kernel/debug/ion/clients/1493*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
cma_reserved: 71000 : 1 : 1 : 27d9b8ed : 3: 8 : 1
cma_reserved: e1000 : 1 : 1 : 1fe4048d : 3: 7 : 1
-------------------------------------------------------------------------
total 152000
-------------------------------------------------------------------------
[1493:1493] Do system command cat /sys/kernel/debug/ion/heaps/cma_reserved | grep -w 1493 | grep -w sample_hbmem.
cma_reserved sample_hbmem 1493 1384448
sample_hbmem 1493 other 462848 0
sample_hbmem 1493 other 921600 0
[1493:1493] Result 0.
sample_alloc_graph_buf_with_heapmask done
=================================================
进程
内 Common Buffer 共享
# ./sample_hbmem -m 6
sample_mode = 6
=================================================
Ready to sample_share_com_buffer
alloc com buf, share_id: 7
import com buf, share_id: 7
[1510:1510] Do system command cat /sys/kernel/debug/ion/clients/1510*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: 10000 : 2 : 2 : df1cdf5a : 4: 7 : 2
-------------------------------------------------------------------------
total 10000
-------------------------------------------------------------------------
[1510:1510] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1510 | grep -w sample_hbmem.
ion_cma sample_hbmem 1510 65536
sample_hbmem 1510 other 65536 0
[1510:1510] Result 0.
free com buf
[1510:1510] Do system command cat /sys/kernel/debug/ion/clients/1510*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: 10000 : 1 : 1 : df1cdf5a : 3: 7 : 1
-------------------------------------------------------------------------
total 10000
-------------------------------------------------------------------------
[1510:1510] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1510 | grep -w sample_hbmem.
ion_cma sample_hbmem 1510 65536
sample_hbmem 1510 other 65536 0
[1510:1510] Result 0.
free import buf
[1510:1510] Do system command cat /sys/kernel/debug/ion/clients/1510*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
-------------------------------------------------------------------------
total 0
-------------------------------------------------------------------------
[1510:1510] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1510 | grep -w sample_hbmem.
[1510:1510] Result 256.
sample_share_com_buffer done
=================================================
进程
间 Common Buffer 共享
# ./sample_hbmem -m 7
sample_mode = 7
=================================================
Ready to sample_share_com_buffer_fork_process_scenario
alloc graph buf form ion_cma
socketpair: 0
[1527:902] In parent process.
[1528:1527] In child process.
parent write share buf: parent test common buf share.
share_consume_cnt: 0
[1527:902] parent send msg 1
[1528:1527] child recv msg 1
child read share buf: parent test common buf share.
share_consume_cnt: 1
child write share buf: child test common buf share.
[1528:1527] child send msg 2
[1527:902] parent recv msg 2
parent read share buf: child test common buf share.
[1527:902] parent send msg 3
[1528:1527] child recv msg 3
share_consume_cnt: 0
[1527:902] parent quit
[1528:1527] child quit
alloc graph buf form carveout
socketpair: 0
[1527:902] In parent process.
parent write share buf: parent test common buf share.
share_consume_cnt: 0
[1529:1527] In child process.
[1527:902] parent send msg 1
[1529:1527] child recv msg 1
child read share buf: parent test common buf share.
share_consume_cnt: 1
child write share buf: child test common buf share.
[1529:1527] child send msg 2
[1527:902] parent recv msg 2
parent read share buf: child test common buf share.
[1527:902] parent send msg 3
[1529:1527] child recv msg 3
share_consume_cnt: 0
[1527:902] parent quit
[1529:1527] child quit
alloc graph buf form cma_reserved
socketpair: 0
[1527:902] In parent process.
parent write share buf: parent test common buf share.
share_consume_cnt: 0
[1530:1527] In child process.
[1527:902] parent send msg 1
[1530:1527] child recv msg 1
child read share buf: parent test common buf share.
share_consume_cnt: 1
child write share buf: child test common buf share.
[1530:1527] child send msg 2
[1527:902] parent recv msg 2
parent read share buf: child test common buf share.
[1527:902] parent send msg 3
[1530:1527] child recv msg 3
share_consume_cnt: 0
[1527:902] parent quit
[1530:1527] child quit
sample_share_com_buffer_fork_process_scenario done
=================================================
进程
内 Graphic Buffer 共享
# ./sample_hbmem -m 8
sample_mode = 8
=================================================
Ready to sample_share_graph_buffer
alloc graph buf, share_id0: 7, share_id1: 8, share_id2: 8
import graph buf, share_id0: 7, share_id1: 8, share_id2: 8
[1531:1531] Do system command cat /sys/kernel/debug/ion/clients/1531*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: e1000 : 2 : 2 : b65c6afe : 4: 7 : 2
ion_cma: 71000 : 2 : 2 : d4b2ed6c : 4: 8 : 2
-------------------------------------------------------------------------
total 152000
-------------------------------------------------------------------------
[1531:1531] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1531 | grep -w sample_hbmem.
ion_cma sample_hbmem 1531 1384448
sample_hbmem 1531 other 921600 0
sample_hbmem 1531 other 462848 0
[1531:1531] Result 0.
free graph buf
[1531:1531] Do system command cat /sys/kernel/debug/ion/clients/1531*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: e1000 : 1 : 1 : b65c6afe : 3: 7 : 1
ion_cma: 71000 : 1 : 1 : d4b2ed6c : 3: 8 : 1
-------------------------------------------------------------------------
total 152000
-------------------------------------------------------------------------
[1531:1531] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1531 | grep -w sample_hbmem.
ion_cma sample_hbmem 1531 1384448
sample_hbmem 1531 other 921600 0
sample_hbmem 1531 other 462848 0
[1531:1531] Result 0.
free import buf
[1531:1531] Do system command cat /sys/kernel/debug/ion/clients/1531*.
heap_name: size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
-------------------------------------------------------------------------
total 0
-------------------------------------------------------------------------
[1531:1531] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1531 | grep -w sample_hbmem.
[1531:1531] Result 256.
sample_share_graph_buffer done
=================================================
进程
间 Graphic Buffer 共享
# ./sample_hbmem -m 9
sample_mode = 9
=================================================
Ready to sample_share_graph_buffer_fork_process_scenario
alloc graph buf form ion_cma
socketpair: 0
[1571:902] In parent process.
[1572:1571] In child process.
parent write share buf: parent test graph buf share.
share_consume_cnt: 0
[1571:902] parent send msg 1
[1572:1571] child recv msg 1
child read share buf: parent test graph buf share.
share_consume_cnt: 1
child write share buf: child test common buf share.
[1572:1571] child send msg 2
[1571:902] parent recv msg 2
parent read share buf: child test common buf share.
[1571:902] parent send msg 3
[1572:1571] child recv msg 3
share_consume_cnt: 0
[1571:902] parent quit
[1572:1571] child quit
alloc graph buf form carveout
socketpair: 0
[1571:902] In parent process.
[1573:1571] In child process.
parent write share buf: parent test graph buf share.
share_consume_cnt: 0
[1571:902] parent send msg 1
[1573:1571] child recv msg 1
child read share buf: parent test graph buf share.
share_consume_cnt: 1
child write share buf: child test common buf share.
[1573:1571] child send msg 2
[1571:902] parent recv msg 2
parent read share buf: child test common buf share.
[1571:902] parent send msg 3
[1573:1571] child recv msg 3
share_consume_cnt: 0
[1571:902] parent quit
[1573:1571] child quit
alloc graph buf form cma_reserved
socketpair: 0
[1571:902] In parent process.
[1574:1571] In child process.
parent write share buf: parent test graph buf share.
share_consume_cnt: 0
[1571:902] parent send msg 1
[1574:1571] child recv msg 1
child read share buf: parent test graph buf share.
share_consume_cnt: 1
child write share buf: child test common buf share.
[1574:1571] child send msg 2
[1571:902] parent recv msg 2
parent read share buf: child test common buf share.
[1571:902] parent send msg 3
[1574:1571] child recv msg 3
share_consume_cnt: 0
[1571:902] parent quit
[1574:1571] child quit
sample_share_graph_buffer_fork_process_scenario done
=================================================
进程
间 Share Pool 共享
# ./sample_hbmem -m 10
sample_mode = 10
=================================================
Ready to sample_share_pool_fork_process_scenario
[1576:902] In parent proces[12121.836077] ion_share_pool_monitor_ref_cnt failed -512
s.
[1577:1576] In child process.
[1576:1576] Do system command cat /sys/kernel/debug/ion/clients/1576*.
heap_name: [12121.854779] ion_share_pool_monitor_ref_cnt failed -512
size_in_bytes : handle refcount : handle import : buffer ptr : buffer refcount : buffer share id : buffer share count
ion_cma: 20000 : 1 : 1 : 4b5ef9a2 : 3: 7 : 1
ion_cma: 20000 : 1 : 1 : baf4062a : 3: 8 : 1
ion_cma: 20000 : 1 : 1 : c865393e : 3: 9 : 1
ion_cma: 20000 : 1 : 1 : 5db7853d : 3: 10 : 1
ion_cma: 20000 : 1 : 1 : d973ee69 : 3: 11 : 1
-------------------------------------------------------------------------
total a0000
-------------------------------------------------------------------------
[1576:1576] Do system command cat /sys/kernel/debug/ion/heaps/ion_cma | grep -w 1576 | grep -w sample_hbmem.
ion_cma sample_hbmem 1576 655360
sample_hbmem 1576 other 131072 0
sample_hbmem 1576 other 131072 0
sample_hbmem 1576 other 131072 0
sample_hbmem 1576 other 131072 0
sample_hbmem 1576 other 131072 0
[1576:1576] Result 0.
hb_mem_share_pool_alloc_buf 0 0xffffa12b0000
hb_mem_share_pool_alloc_buf 1 0xffffa12d0000
hb_mem_share_pool_alloc_buf 2 0xffffa12f0000
hb_mem_share_pool_alloc_buf 3 0xffffa1310000
hb_mem_share_pool_alloc_buf 4 0xffffa1330000
[1576:902] parent send msg 1
[1577:1576] child recv msg 1
[1577:1576] child send msg 2
[1576:902] parent recv msg 2
free 0 0xffffa12b0000
[1576:902] parent pool.avail_buf_cnt: 0
free 1 0xffffa12d0000
[1576:902] parent pool.avail_buf_cnt: 1
free 2 0xffffa12f0000
[1576:902] parent pool.avail_buf_cnt: 2
free 3 0xffffa1310000
[1576:902] parent pool.avail_buf_cnt: 3
free 4 0xffffa1330000
[1576:902] parent pool.avail_buf_cnt: 4
[1576:902] parent send msg 3
[1577:1576] child recv msg 3
[1577:1576] child send msg 4
[1576:902] parent recv msg 4
[1576:902] parent pool.avail_buf_cnt: 5
[1577:1576] child quit
[1576:902] parent quit
sample_share_pool_fork_process_scenario done
=================================================
使用 Share Pool
# ./sample_hbmem -m 11
sample_mode = 11
=================================================
Ready to sample_share_pool
pool.avail_buf_cnt: 9
pool.avail_buf_cnt: 8
pool.avail_buf_cnt: 7
pool.avail_buf_cnt: 6
pool.avail_buf_cnt: 5
pool.avail_buf_cnt: 4
pool.avail_buf_cnt: 3
pool.avail_buf_cnt: 2
pool.avail_buf_cnt: 1
pool.avail_buf_cnt: 0
pool.avail_buf_cnt: 1
pool.avail_buf_cnt: 2
pool.avail_buf_cnt: 3
pool.avail_buf_cnt: 4
pool.avail_buf_cnt: 5
pool.avail_buf_cnt: 6
pool.avail_buf_cnt: 7
pool.avail_buf_cnt: 8
pool.avail_buf_cnt: 9
pool.avail_buf_cnt: 10
sample_share_pool done
=================================================
在 Graphic Buffer 与 Common Buffer 之间
实现 Buffer 转换
# ./sample_hbmem -m 12
sample_mode = 12
=================================================
Ready to sample_alloc_graph_buf_group_heapmask
----alloc graphic buffer done!----
the data in graphic buffer:
size: 0x1fa400
flags: 0x8000011
fd: 4
share id: 7
virt_addr: 0x0xffffae348000
paddr: 0xe1800000
----change graphic buffer to common buffer done!----
the data in new common buffer:
size: 0x1fa400
flags: 0x8000011
fd: 4
share id: 7
virt_addr: 0x0xffffae348000
paddr: 0xe1800000
----alloc common buffer done!----
the data in common buffer:
size: 0x10000
flags: 0x8000011
fd: 5
share id: 8
virt_addr: 0x0xffffaeb10000
paddr: 0xe1af8000
----change common buffer to graphic buffer done!----
the data in new graphic buffer:
size: 0x10000
flags: 0x8000011
fd: 5
share id: 8
virt_addr: 0x0xffffaeb10000
paddr: 0xe1af8000
sample_alloc_graph_buf_group_heapmask done
=================================================