diff options
author | Sejun Park <sejun79.park@samsung.com> | 2018-07-05 10:49:27 +0900 |
---|---|---|
committer | Sejun Park <sejun79.park@samsung.com> | 2018-07-12 14:57:42 +0900 |
commit | 877660d82c750169a5638286339aa7c1110311cf (patch) | |
tree | 07781a37411c52cb1c2623515ab0636f18c13e59 | |
parent | 0c7b82025047a0dad4e1024bdf210d78149eff2a (diff) | |
download | nx-video-api-877660d82c750169a5638286339aa7c1110311cf.tar.gz nx-video-api-877660d82c750169a5638286339aa7c1110311cf.tar.bz2 nx-video-api-877660d82c750169a5638286339aa7c1110311cf.zip |
Added surface for supporting allocatorsubmit/tizen_5.0/20181101.000001submit/tizen_4.0/20180712.084927submit/tizen/20180831.080817submit/tizen/20180831.043334accepted/tizen/unified/20180903.062520accepted/tizen/5.0/unified/20181102.012509tizen_5.0accepted/tizen_5.0_unified
Change-Id: I199daabd9876d920d215bae7a2e1dd8755fde7c9
-rw-r--r-- | packaging/nx-video-api.spec | 2 | ||||
-rw-r--r-- | src/nx_video_alloc.c | 29 | ||||
-rw-r--r-- | src/nx_video_alloc.h | 5 |
3 files changed, 33 insertions, 3 deletions
diff --git a/packaging/nx-video-api.spec b/packaging/nx-video-api.spec index 275a509..85d0e84 100644 --- a/packaging/nx-video-api.spec +++ b/packaging/nx-video-api.spec @@ -1,5 +1,5 @@ Name: nx-video-api -Version: 1.0.5 +Version: 1.1.0 Release: 0 License: LGPL-2.1+ Summary: Nexell video APIs diff --git a/src/nx_video_alloc.c b/src/nx_video_alloc.c index 417df69..08fab13 100644 --- a/src/nx_video_alloc.c +++ b/src/nx_video_alloc.c @@ -231,6 +231,9 @@ NX_AllocateVideoMemory (void *bufmgr, int width, int height, int32_t planes, uin int32_t stride[NX_MAX_PLANES]; int32_t size[NX_MAX_PLANES]; uint32_t flink[NX_MAX_PLANES]; +#ifdef TIZEN_FEATURE_ARTIK530 + tbm_surface_info_s info; +#endif NX_VID_MEMORY_INFO *pVidMem = NULL; @@ -364,6 +367,23 @@ NX_AllocateVideoMemory (void *bufmgr, int width, int height, int32_t planes, uin pVidMem->planes = planes; pVidMem->format = format; pVidMem->drmFd = drmFd; + +#ifdef TIZEN_FEATURE_ARTIK530 + info.width = width; + info.height = height; + info.format = TBM_FORMAT_YUV420; + info.size = size[0]; + info.num_planes = 3; + info.planes[0].stride = luStride; + info.planes[0].size = luStride * luVStride; + info.planes[0].offset = 0; + info.planes[1].stride = cStride; + info.planes[1].size = cStride * cVStride; + info.planes[1].offset = info.planes[0].size; + info.planes[2].stride = cStride; + info.planes[2].size = cStride * cVStride; + info.planes[2].offset = info.planes[1].offset + info.planes[1].size; +#endif for (i = 0; i < planes; i++) { pVidMem->dmaFd[i] = dmaFd[i]; pVidMem->gemFd[i] = gemFd[i]; @@ -371,11 +391,14 @@ NX_AllocateVideoMemory (void *bufmgr, int width, int height, int32_t planes, uin pVidMem->stride[i] = stride[i]; #ifdef TIZEN_FEATURE_ARTIK530 pVidMem->bo[i] = tbm_bo_import_fd (bufmgr, dmaFd[i]); - _D ("bo[%d] = %p", i, pVidMem->bo[i]); if (!pVidMem->bo[i]) goto alloc_bo_fail; #endif } + pVidMem->surface = tbm_surface_internal_create_with_bos (&info, pVidMem->bo, planes); + if (!pVidMem->surface) + goto alloc_bo_fail; + return pVidMem; #ifdef TIZEN_FEATURE_ARTIK530 @@ -420,6 +443,10 @@ NX_FreeVideoMemory (NX_VID_MEMORY_INFO * pMem) free_gem (pMem->drmFd, pMem->gemFd[i]); close (pMem->dmaFd[i]); } +#ifdef TIZEN_FEATURE_ARTIK530 + if (pMem->surface) + tbm_surface_internal_destroy (pMem->surface); +#endif close (pMem->drmFd); free (pMem); } diff --git a/src/nx_video_alloc.h b/src/nx_video_alloc.h index d1fcc70..3b6a042 100644 --- a/src/nx_video_alloc.h +++ b/src/nx_video_alloc.h @@ -13,6 +13,8 @@ extern "C" #endif #include <stdint.h> +#include <tbm_surface.h> +#include <tbm_surface_internal.h> #define NX_MAX_PLANES 4 @@ -52,7 +54,8 @@ extern "C" void *pBuffer[NX_MAX_PLANES]; // virtual address. uint32_t reserved[NX_MAX_PLANES]; // for debugging or future user. #ifdef TIZEN_FEATURE_ARTIK530 - void *bo[NX_MAX_PLANES]; // tbm bo + void *bo[NX_MAX_PLANES]; // tbm bo + tbm_surface_h surface; #endif } NX_VID_MEMORY_INFO, *NX_VID_MEMORY_HANDLE; |