summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/libimxdmabuffer
diff options
context:
space:
mode:
authorCarlos Rafael Giani <crg7475@mailbox.org>2022-05-06 22:57:49 +0200
committerCarlos Rafael Giani <crg7475@mailbox.org>2022-05-08 21:47:07 +0200
commit256ce3c49740302ac2bdfed9f329d1ecc0651d11 (patch)
treedf883321f1f5fd54407b754fbcf4cc6d7a360d95 /recipes-bsp/libimxdmabuffer
parentec1198df9a4d40dada3db66f8aba4a33543d3eae (diff)
downloadmeta-freescale-256ce3c49740302ac2bdfed9f329d1ecc0651d11.tar.gz
libimxdmabuffer: Upgrade to version 1.1.2
* waf: update to 2.0.23 * dma-heap: Add support for uncached dma-heap memory imx_dma_buffer_dma_heap_allocator_new_from_fd() is a new function that partially deprecates the dma_heap_fd argument of imx_dma_buffer_dma_heap_allocator_new(). * Add sync access functions to ensure cache coherency when allocating cached DMA memory; only done by dma-heap allocator at this time * Relax buffer mapping flags checks * Add API functions to retrieve dma-heap / ION FDs Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
Diffstat (limited to 'recipes-bsp/libimxdmabuffer')
-rw-r--r--recipes-bsp/libimxdmabuffer/files/0001-g2d-Fix-typo.patch28
-rw-r--r--recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.0.bb65
-rw-r--r--recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.2.bb90
3 files changed, 118 insertions, 65 deletions
diff --git a/recipes-bsp/libimxdmabuffer/files/0001-g2d-Fix-typo.patch b/recipes-bsp/libimxdmabuffer/files/0001-g2d-Fix-typo.patch
new file mode 100644
index 00000000..490d3a2f
--- /dev/null
+++ b/recipes-bsp/libimxdmabuffer/files/0001-g2d-Fix-typo.patch
@@ -0,0 +1,28 @@
1From 41825b11289be251fed64470893d18b89b0dd38b Mon Sep 17 00:00:00 2001
2From: Carlos Rafael Giani <crg7475@mailbox.org>
3Date: Sun, 8 May 2022 16:25:44 +0200
4Subject: [PATCH] g2d: Fix typo
5
6Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
7
8Upstream-Status: Backport [41825b11289be251fed64470893d18b89b0dd38b]
9---
10 imxdmabuffer/imxdmabuffer_g2d_allocator.c | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/imxdmabuffer/imxdmabuffer_g2d_allocator.c b/imxdmabuffer/imxdmabuffer_g2d_allocator.c
14index f10a909..497dcea 100644
15--- a/imxdmabuffer/imxdmabuffer_g2d_allocator.c
16+++ b/imxdmabuffer/imxdmabuffer_g2d_allocator.c
17@@ -139,7 +139,7 @@ static uint8_t* imx_dma_buffer_g2d_allocator_map(ImxDmaBufferAllocator *allocato
18 * (Other allocators perform more steps than this.) */
19 if (imx_g2d_buffer->mapping_refcount > 0)
20 {
21- assert((imx_dwl_buffer->map_flags & flags & IMX_DMA_BUFFER_MAPPING_READWRITE_FLAG_MASK) == (flags & IMX_DMA_BUFFER_MAPPING_READWRITE_FLAG_MASK));
22+ assert((imx_g2d_buffer->map_flags & flags & IMX_DMA_BUFFER_MAPPING_READWRITE_FLAG_MASK) == (flags & IMX_DMA_BUFFER_MAPPING_READWRITE_FLAG_MASK));
23 imx_g2d_buffer->mapping_refcount++;
24 }
25 else
26--
272.32.0
28
diff --git a/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.0.bb b/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.0.bb
deleted file mode 100644
index 3b820ed6..00000000
--- a/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.0.bb
+++ /dev/null
@@ -1,65 +0,0 @@
1DESCRIPTION = 'Library for allocating and managing physically contiguous memory \
2 ("DMA memory" or "DMA buffers") on i.MX devices.'
3HOMEPAGE = "https://github.com/Freescale/libimxdmabuffer"
4LICENSE = "LGPL-2.1-only"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=38fa42a5a6425b26d2919b17b1527324"
6SECTION = "base"
7
8PV .= "+git${SRCPV}"
9
10SRCBRANCH ?= "master"
11SRCREV = "5e15481b71468e689f7529d7609dc31790275504"
12SRC_URI = "git://github.com/Freescale/libimxdmabuffer.git;branch=${SRCBRANCH};protocol=https \
13 file://run-ptest \
14 "
15
16
17S = "${WORKDIR}/git"
18
19inherit pkgconfig waf use-imx-headers ptest
20
21# Device node path to the DMA-BUF heap to use in the dma-heap allocator.
22# This must be one that allocates physically contiguous memory, otherwise
23# it cannot allocate usable DMA buffers.
24DMA_HEAP_DEVICE_NODE_PATH = "/dev/dma_heap/linux,cma"
25
26EXTRA_OECONF = "--imx-linux-headers-path=${STAGING_INCDIR_IMX} \
27 --dma-heap-device-node-path=${DMA_HEAP_DEVICE_NODE_PATH} \
28 --libdir=${libdir} \
29 ${PACKAGECONFIG_CONFARGS}"
30
31# If imxdpu is in use, the DPU is also used for implementing
32# libg2d. However, that implementation's g2d_alloc() function
33# is broken, so we cannot use it.
34LIBG2D_PACKAGECONFIG = "g2d"
35LIBG2D_PACKAGECONFIG:imxdpu = ""
36
37PACKAGECONFIG ?= " "
38PACKAGECONFIG:append:imxgpu2d = " ${LIBG2D_PACKAGECONFIG}"
39PACKAGECONFIG:append:imxipu = " ipu"
40PACKAGECONFIG:append:imxpxp = " pxp"
41# All i.MX8 machines can use the dma-heap allocator. i.MX8m ones
42# can also use the DWL allocator, though dma-heap is preferred.
43# Vendor kernels that are older than kernel 5.6 cannot use
44# dma-heap, however, and should use ion instead, since the
45# former is not available pre-5.6.
46PACKAGECONFIG:append:mx8-nxp-bsp = " dma-heap"
47PACKAGECONFIG:append:mx8m-nxp-bsp = " dwl"
48
49HANTRO_CONF = "--hantro-headers-path=${STAGING_INCDIR}/hantro_dec --hantro-decoder-version=G2"
50
51PACKAGECONFIG[dwl] = "--with-dwl-allocator=yes ${HANTRO_CONF},--with-dwl-allocator=no,imx-vpu-hantro"
52PACKAGECONFIG[ion] = "--with-ion-allocator=yes, --with-ion-allocator=no,"
53PACKAGECONFIG[ipu] = "--with-ipu-allocator=yes, --with-ipu-allocator=no,"
54PACKAGECONFIG[g2d] = "--with-g2d-allocator=yes, --with-g2d-allocator=no,virtual/libg2d"
55PACKAGECONFIG[pxp] = "--with-pxp-allocator=yes, --with-pxp-allocator=no,"
56PACKAGECONFIG[dma-heap] = "--with-dma-heap-allocator=yes, --with-dma-heap-allocator=no,"
57
58# Using do_install_ptest_base instead of do_install_ptest, since
59# the default do_install_ptest_base is hardcoded to expect Makefiles.
60do_install_ptest_base() {
61 install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
62 install -m 0755 ${B}/test-alloc ${D}${PTEST_PATH}
63}
64
65COMPATIBLE_MACHINE = "(imx-nxp-bsp)"
diff --git a/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.2.bb b/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.2.bb
new file mode 100644
index 00000000..090593be
--- /dev/null
+++ b/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.2.bb
@@ -0,0 +1,90 @@
1DESCRIPTION = 'Library for allocating and managing physically contiguous memory \
2 ("DMA memory" or "DMA buffers") on i.MX devices.'
3HOMEPAGE = "https://github.com/Freescale/libimxdmabuffer"
4LICENSE = "LGPL-2.1-only"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=38fa42a5a6425b26d2919b17b1527324"
6SECTION = "base"
7
8PV .= "+git${SRCPV}"
9
10SRCBRANCH ?= "master"
11SRCREV = "5410b44fb0c5bbd9fb1f3ba0681e65068d8cde57"
12SRC_URI = "git://github.com/Freescale/libimxdmabuffer.git;branch=${SRCBRANCH};protocol=https \
13 file://0001-g2d-Fix-typo.patch \
14 file://run-ptest \
15 "
16
17
18S = "${WORKDIR}/git"
19
20inherit pkgconfig waf use-imx-headers ptest
21
22EXTRA_OECONF = "--imx-linux-headers-path=${STAGING_INCDIR_IMX} \
23 --libdir=${libdir} \
24 ${@bb.utils.contains_any('PACKAGECONFIG', \
25 [ 'dma-heap-cached', 'dma-heap-uncached' ], \
26 '', '--with-dma-heap-allocator=no',d)} \
27 ${PACKAGECONFIG_CONFARGS}"
28
29# If imxdpu is in use, the DPU is also used for implementing
30# libg2d. However, that implementation's g2d_alloc() function
31# is broken, so we cannot use it.
32LIBG2D_PACKAGECONFIG = "g2d"
33LIBG2D_PACKAGECONFIG:imxdpu = ""
34
35# The dma-heap allocator is special in that it can use more than one heap device
36# node. In libimxdmabuffer, only heaps that allocate physically contiguous memory
37# can be used, otherwise usable DMA buffers cannot be allocated. Furthermore,
38# on NXP machines, there is a dma-heap for cached and one for uncached memory.
39#
40# One of them has to be selected by choosing either the "dma-heap-cached" or the
41# "dma-heap-uncached" PACKAGECONFIG. The uncached one is picked by default for
42# performance reasons (it does not suffer from cache coherence issues).
43#
44# Note that the uncached heap is not available prior to imx-kernel 5.15.5;
45# older kernels can only use the cached one.
46
47CACHED_DMA_HEAP_DEVICE_NODE_PATH = "/dev/dma_heap/linux,cma"
48UNCACHED_DMA_HEAP_DEVICE_NODE_PATH = "/dev/dma_heap/linux,cma-uncached"
49
50CACHED_DMA_HEAP_CONF = "--dma-heap-device-node-path=${CACHED_DMA_HEAP_DEVICE_NODE_PATH}"
51UNCACHED_DMA_HEAP_CONF = "--dma-heap-device-node-path=${UNCACHED_DMA_HEAP_DEVICE_NODE_PATH} \
52 --dma-heap-uncached-memory"
53
54PACKAGECONFIG ?= " "
55PACKAGECONFIG:append:imxgpu2d = " ${LIBG2D_PACKAGECONFIG}"
56PACKAGECONFIG:append:imxipu = " ipu"
57PACKAGECONFIG:append:imxpxp = " pxp"
58# All i.MX8 machines can use the dma-heap allocator. i.MX8m ones
59# can also use the DWL allocator, though dma-heap is preferred.
60# Vendor kernels that are older than kernel 5.6 cannot use
61# dma-heap, however, and should use ion instead, since the
62# former is not available pre-5.6. Out of the dma-heaps, we
63# pick the uncached one by default (see above).
64PACKAGECONFIG:append:mx8-nxp-bsp = " dma-heap-uncached"
65PACKAGECONFIG:append:mx8m-nxp-bsp = " dwl"
66
67HANTRO_CONF = "--hantro-headers-path=${STAGING_INCDIR}/hantro_dec --hantro-decoder-version=G2"
68
69PACKAGECONFIG[dwl] = "--with-dwl-allocator=yes ${HANTRO_CONF}, --with-dwl-allocator=no,imx-vpu-hantro"
70PACKAGECONFIG[ion] = "--with-ion-allocator=yes, --with-ion-allocator=no,"
71PACKAGECONFIG[ipu] = "--with-ipu-allocator=yes, --with-ipu-allocator=no,"
72PACKAGECONFIG[g2d] = "--with-g2d-allocator=yes, --with-g2d-allocator=no,virtual/libg2d"
73PACKAGECONFIG[pxp] = "--with-pxp-allocator=yes, --with-pxp-allocator=no,"
74# --with-dma-heap-allocator=no is not added by these packageconfigs.
75# Otherwise, it would always be added, since only one of these two
76# dma-heap-* packageconfigs can be selected. Instead, that switch
77# is added to EXTRA_OECONF above.
78PACKAGECONFIG[dma-heap-cached] = "--with-dma-heap-allocator=yes ${CACHED_DMA_HEAP_CONF}, \
79 ,,,,dma-heap-uncached"
80PACKAGECONFIG[dma-heap-uncached] = "--with-dma-heap-allocator=yes ${UNCACHED_DMA_HEAP_CONF}, \
81 ,,,,dma-heap-cached"
82
83# Using do_install_ptest_base instead of do_install_ptest, since
84# the default do_install_ptest_base is hardcoded to expect Makefiles.
85do_install_ptest_base() {
86 install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
87 install -m 0755 ${B}/test-alloc ${D}${PTEST_PATH}
88}
89
90COMPATIBLE_MACHINE = "(imx-nxp-bsp)"