diff options
author | Changyeon Lee <cyeon.lee@samsung.com> | 2023-07-18 18:16:44 +0900 |
---|---|---|
committer | Changyeon Lee <cyeon.lee@samsung.com> | 2023-07-18 18:16:44 +0900 |
commit | 9cec27924e6a9b95d757747699fa2b099f203f62 (patch) | |
tree | f2930d8da2b89c249ab35b0dda81385ed07e99fe | |
parent | c46e8ec640f5fbe445802aa454407bd56fd9c7ea (diff) | |
download | libtbm-dumb-9cec27924e6a9b95d757747699fa2b099f203f62.tar.gz libtbm-dumb-9cec27924e6a9b95d757747699fa2b099f203f62.tar.bz2 libtbm-dumb-9cec27924e6a9b95d757747699fa2b099f203f62.zip |
Add checking dma-buf.h headeraccepted/tizen/unified/riscv/20230719.000807
Change-Id: Id5012aeb1e3b20c9118118ec605c85d47db9e1bd
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/tbm_backend_dumb.c | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 189329f..59839c5 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,11 @@ if test "x$CACHE_CTRL" = xyes; then AC_DEFINE(ENABLE_CACHECRTL, 1, [Enable cache control]) fi +AC_CHECK_HEADERS([linux/dma-buf.h], [have_dma_buf="yes"], [have_dma_buf="no"]) +if test "x${have_dma_buf}" = "xyes" ; then + AC_DEFINE(HAVE_DMA_BUF, 1, [Enable dma buf sync]) +fi + LIBHAL_BACKEND_TBM_DUMB_CFLAGS="$HAL_API_COMMON_CFLAGS $HAL_API_TBM_CFLAGS $LIBDRM_CFLAGS $DLOG_CFLAGS $LIBUDEV_CFLAGS " LIBHAL_BACKEND_TBM_DUMB_LIBS="$HAL_API_COMMON_LIBS $HAL_API_TBM_LIBS $LIBDRM_LIBS $DLOG_LIBS $LIBUDEV_LIBS " diff --git a/src/tbm_backend_dumb.c b/src/tbm_backend_dumb.c index 9b21984..6680e7a 100644 --- a/src/tbm_backend_dumb.c +++ b/src/tbm_backend_dumb.c @@ -51,9 +51,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <hal-common.h> #include <hal-tbm-types.h> #include <hal-tbm-interface.h> -#include <linux/dma-buf.h> #include "tbm_backend_log.h" +#ifdef HAVE_DMA_BUF +#include <linux/dma-buf.h> +#endif + #define TBM_COLOR_FORMAT_COUNT 4 #define SIZE_ALIGN(value, base) (((value) + ((base) - 1)) & ~((base) - 1)) @@ -1033,7 +1036,6 @@ tbm_dumb_bo_map(hal_tbm_bo *bo, hal_tbm_bo_device_type device, tbm_dumb_bo *bo_data = (tbm_dumb_bo *)bo; hal_tbm_bo_handle bo_handle; tbm_dumb_bufmgr *bufmgr_data; - struct dma_buf_sync sync = {0, }; if (!bo_data) { if (error) @@ -1073,6 +1075,9 @@ tbm_dumb_bo_map(hal_tbm_bo *bo, hal_tbm_bo_device_type device, return (hal_tbm_bo_handle) NULL; } +#ifdef HAVE_DMA_BUF + struct dma_buf_sync sync = {0, }; + if (device == HAL_TBM_DEVICE_CPU) { sync.flags |= DMA_BUF_SYNC_START; if (opt & HAL_TBM_OPTION_READ) @@ -1085,6 +1090,7 @@ tbm_dumb_bo_map(hal_tbm_bo *bo, hal_tbm_bo_device_type device, bo_data); } } +#endif bo_data->device = device; bo_data->opt = opt; @@ -1100,7 +1106,6 @@ tbm_dumb_bo_unmap(hal_tbm_bo *bo) { tbm_dumb_bo *bo_data = (tbm_dumb_bo *)bo; tbm_dumb_bufmgr *bufmgr_data; - struct dma_buf_sync sync = {0, }; if (!bo_data) return HAL_TBM_ERROR_INVALID_PARAMETER; @@ -1112,6 +1117,9 @@ tbm_dumb_bo_unmap(hal_tbm_bo *bo) if (!bo_data->gem) return HAL_TBM_ERROR_INVALID_PARAMETER; +#ifdef HAVE_DMA_BUF + struct dma_buf_sync sync = {0, }; + if (bo_data->device == HAL_TBM_DEVICE_CPU) { sync.flags |= DMA_BUF_SYNC_END; if (bo_data->opt & HAL_TBM_OPTION_READ) @@ -1124,6 +1132,7 @@ tbm_dumb_bo_unmap(hal_tbm_bo *bo) bo_data); } } +#endif bo_data->device = 0; bo_data->opt = 0; |