Convert tbm buffer type to HW specific one 50/158450/2
authorInki Dae <inki.dae@samsung.com>
Tue, 24 Oct 2017 05:33:18 +0000 (14:33 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Wed, 1 Nov 2017 06:24:44 +0000 (15:24 +0900)
Add format converting code to _get_nexell_flag_from_tbm function.

This patch converts several tbm generic formats to HW specific ones
like below,
     TBM_BO_DEFAULT -> NEXELL_BO_SYSTEM_NONCONTIG_CACHABLE
     TBM_BO_SCANOUT -> NEXELL_BO_DMA
     TBM_BO_WC/TBM_BO_NONCACHABLE -> NEXELL_BO_SYSTEM_NONCONTIG

Change-Id: Ib28b5d8c0f5b33eeb359e11b23baef589442c06b
Signed-off-by: Inki Dae <inki.dae@samsung.com>
src/tbm_bufmgr_nexell.c

index 8fb1cf4d2e8ec3680dd6ecca685cdfa9eb585abb..80df0a858842d119729a99926c4541b4181959eb 100644 (file)
@@ -388,7 +388,8 @@ _bo_set_cache_state(tbm_bufmgr_nexell bufmgr_nexell, tbm_bo_nexell bo_nexell, in
        char need_flush = 0;
        unsigned short cntFlush = 0;
 
-       if (bo_nexell->flags_nexell == NEXELL_BO_DMA)
+       if (bo_nexell->flags_nexell == NEXELL_BO_DMA ||
+           bo_nexell->flags_nexell == NEXELL_BO_SYSTEM_NONCONTIG)
                return 1;
 
        /* get cache state of a bo */
@@ -742,7 +743,36 @@ _get_nexell_flag_from_tbm(unsigned int ftbm)
 {
        unsigned int flags = 0;
 
-       flags = ftbm;
+       switch (ftbm) {
+       /*
+        * As default, allocate DMA buffer with physically non-contiguous
+        * and cachable attributes for Wayland clients who consider CPU
+        * access to DMA buffer.
+        */
+       case TBM_BO_DEFAULT:
+               flags = NEXELL_BO_SYSTEM_NONCONTIG_CACHEABLE;
+               break;
+       /*
+        * Nexell Display controller has no IOMMU so alloate DMA buffer
+        * with phycially contiguous memory and non-cachable attributes
+        * for SCANOUT buffer.
+        */
+       case TBM_BO_SCANOUT:
+               flags = NEXELL_BO_DMA;
+               break;
+       /*
+        * Allocate DMA buffer with physically non-contiguous
+        * and non-cachable attributes for Wayland clients
+        * who never consider CPU access to DMA buffer.
+        */
+       case TBM_BO_WC:
+       case TBM_BO_NONCACHABLE:
+               flags = NEXELL_BO_SYSTEM_NONCONTIG;
+               break;
+       default:
+               flags = NEXELL_BO_DMA;
+               break;
+       }
 
        return flags;
 }