Added surface for supporting allocator 64/183364/8 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.012509 accepted/tizen/unified/20180903.062520 submit/tizen/20180831.043334 submit/tizen/20180831.080817 submit/tizen_4.0/20180712.084927 submit/tizen_5.0/20181101.000001
authorSejun Park <sejun79.park@samsung.com>
Thu, 5 Jul 2018 01:49:27 +0000 (10:49 +0900)
committerSejun Park <sejun79.park@samsung.com>
Thu, 12 Jul 2018 05:57:42 +0000 (14:57 +0900)
Change-Id: I199daabd9876d920d215bae7a2e1dd8755fde7c9

packaging/nx-video-api.spec
src/nx_video_alloc.c
src/nx_video_alloc.h

index 275a509..85d0e84 100644 (file)
@@ -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
index 417df69..08fab13 100644 (file)
@@ -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);
   }
index d1fcc70..3b6a042 100644 (file)
@@ -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;