summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/libimxdmabuffer/libimxdmabuffer_1.1.3.bb
blob: 5b04b1e2c0326a3f03a5bda0e11823980110a667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
DESCRIPTION = 'Library for allocating and managing physically contiguous memory \
               ("DMA memory" or "DMA buffers") on i.MX devices.'
HOMEPAGE = "https://github.com/Freescale/libimxdmabuffer"
LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://LICENSE;md5=38fa42a5a6425b26d2919b17b1527324"
SECTION = "base"

PV .= "+git${SRCPV}"

SRCBRANCH ?= "master"
SRCREV = "faf547cc2345bfbf95507ab7e86530f85289bb5b"
SRC_URI = "git://github.com/Freescale/libimxdmabuffer.git;branch=${SRCBRANCH};protocol=https \
           file://run-ptest \
          "


S = "${WORKDIR}/git"

inherit pkgconfig waf use-imx-headers ptest

EXTRA_OECONF = "--imx-linux-headers-path=${STAGING_INCDIR_IMX} \
                --libdir=${libdir} \
                ${@bb.utils.contains_any('PACKAGECONFIG', \
                   [ 'dma-heap-cached', 'dma-heap-uncached' ], \
                   '', '--with-dma-heap-allocator=no',d)} \
                ${PACKAGECONFIG_CONFARGS}"

# If imxdpu is in use, the DPU is also used for implementing
# libg2d. However, that implementation's g2d_alloc() function
# is broken, so we cannot use it.
LIBG2D_PACKAGECONFIG = "g2d"
LIBG2D_PACKAGECONFIG:imxdpu = ""

# The dma-heap allocator is special in that it can use more than one heap device
# node. In libimxdmabuffer, only heaps that allocate physically contiguous memory
# can be used, otherwise usable DMA buffers cannot be allocated. Furthermore,
# on NXP machines, there is a dma-heap for cached and one for uncached memory.
#
# One of them has to be selected by choosing either the "dma-heap-cached" or the
# "dma-heap-uncached" PACKAGECONFIG. The uncached one is picked by default for
# performance reasons (it does not suffer from cache coherence issues).
#
# Note that the uncached heap is not available prior to imx-kernel 5.15.5;
# older kernels can only use the cached one.

CACHED_DMA_HEAP_DEVICE_NODE_PATH = "/dev/dma_heap/linux,cma"
UNCACHED_DMA_HEAP_DEVICE_NODE_PATH = "/dev/dma_heap/linux,cma-uncached"

CACHED_DMA_HEAP_CONF = "--dma-heap-device-node-path=${CACHED_DMA_HEAP_DEVICE_NODE_PATH}"
UNCACHED_DMA_HEAP_CONF = "--dma-heap-device-node-path=${UNCACHED_DMA_HEAP_DEVICE_NODE_PATH} \
                          --dma-heap-uncached-memory"

PACKAGECONFIG ?= " "
PACKAGECONFIG:append:imxgpu2d         = " ${LIBG2D_PACKAGECONFIG}"
PACKAGECONFIG:append:imxipu           = " ipu"
PACKAGECONFIG:append:imxpxp           = " pxp"
# All i.MX8 machines can use the dma-heap allocator. i.MX8m ones
# can also use the DWL allocator, though dma-heap is preferred.
# Vendor kernels that are older than kernel 5.6 cannot use
# dma-heap, however, and should use ion instead, since the
# former is not available pre-5.6. Out of the dma-heaps, we
# pick the uncached one by default (see above).
PACKAGECONFIG:append:mx8-nxp-bsp      = " dma-heap-uncached"
PACKAGECONFIG:append:mx8mq-nxp-bsp     = " dwl"
PACKAGECONFIG:append:mx8mm-nxp-bsp     = " dwl"
PACKAGECONFIG:append:mx8mp-nxp-bsp     = " dwl"

HANTRO_CONF = "--hantro-headers-path=${STAGING_INCDIR}/hantro_dec --hantro-decoder-version=G2"

PACKAGECONFIG[dwl]      = "--with-dwl-allocator=yes ${HANTRO_CONF}, --with-dwl-allocator=no,imx-vpu-hantro"
PACKAGECONFIG[ion]      = "--with-ion-allocator=yes,                --with-ion-allocator=no,"
PACKAGECONFIG[ipu]      = "--with-ipu-allocator=yes,                --with-ipu-allocator=no,"
PACKAGECONFIG[g2d]      = "--with-g2d-allocator=yes,                --with-g2d-allocator=no,virtual/libg2d"
PACKAGECONFIG[pxp]      = "--with-pxp-allocator=yes,                --with-pxp-allocator=no,"
# --with-dma-heap-allocator=no is not added by these packageconfigs.
# Otherwise, it would always be added, since only one of these two
# dma-heap-* packageconfigs can be selected. Instead, that switch
# is added to EXTRA_OECONF above.
PACKAGECONFIG[dma-heap-cached]   = "--with-dma-heap-allocator=yes ${CACHED_DMA_HEAP_CONF}, \
                                    ,,,,dma-heap-uncached"
PACKAGECONFIG[dma-heap-uncached] = "--with-dma-heap-allocator=yes ${UNCACHED_DMA_HEAP_CONF}, \
                                    ,,,,dma-heap-cached"

# Using do_install_ptest_base instead of do_install_ptest, since
# the default do_install_ptest_base is hardcoded to expect Makefiles.
do_install_ptest_base() {
    install -D ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
    install -m 0755 ${B}/test-alloc ${D}${PTEST_PATH}
}

COMPATIBLE_MACHINE = "(imx-nxp-bsp)"