[RAMEN9610-9016][RAMEN ERD 9610] VIPx : Add ENF_YUV function
authorDongmin Shin <mini.shin@samsung.com>
Thu, 29 Nov 2018 11:09:36 +0000 (20:09 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:07 +0000 (20:23 +0300)
Change-Id: I7f2d5a427f84ec7963ecadd713345ca9c8d7ec4c
Signed-off-by: Dongmin Shin <mini.shin@samsung.com>
drivers/vision/include/vs4l.h
drivers/vision/vipx/include/interface/ap_vip_if.h
drivers/vision/vipx/include/vipx-config.h
drivers/vision/vipx/include/vipx-memory.h
drivers/vision/vipx/interface/hardware/vipx-interface.c
drivers/vision/vipx/interface/hardware/vipx-mailbox.c
drivers/vision/vipx/vipx-graph.c
drivers/vision/vipx/vipx-memory.c
drivers/vision/vipx/vipx-system.c
drivers/vision/vipx/vipx-vertex.c

index d8cdcf7bf87aa4a88a59bea787055ccae1a2701b..9f1a320b04f42db2d00785ff20d7c00044b8d22e 100755 (executable)
@@ -17,7 +17,7 @@
 #define VS4L_TARGET_SC_SHIFT   16
 #define VS4L_TARGET_PU         0xFFFF
 #define VS4L_TARGET_PU_SHIFT   0
-#define _MAX_NUM_OF_USER_PARAMS 80
+#define _MAX_NUM_OF_USER_PARAMS 180
 
 
 enum vs4l_graph_flag {
index 1abe9f026adaedc67eace5e33ce8d59b14d5115c..2949f07443ec4d9f1bbd982789948bd2183700e2 100755 (executable)
@@ -72,7 +72,7 @@ MAX_NUM_OF_INPUTS = 16,
 #else
        MAX_NUM_OF_INPUTS = 24,
 #endif
-#if 0
+#if 0 
        MAX_NUM_OF_OUTPUTS = 12,
 #else
        MAX_NUM_OF_OUTPUTS = 8,
@@ -81,7 +81,7 @@ MAX_NUM_OF_INPUTS = 16,
 #if 0
        MAX_NUM_OF_USER_PARAMS = 8,
 #else
-       MAX_NUM_OF_USER_PARAMS = 80,
+       MAX_NUM_OF_USER_PARAMS = 180,
 #endif
 };
 
@@ -113,14 +113,13 @@ enum
        SCENARIO_DE = 1,
        SCENARIO_SDOF_FULL,
        SCENARIO_DE_SDOF,
-// temp for previous host ver
-// SCENARIO_ENF,
        SCENARIO_DE_CAPTURE,
        SCENARIO_SDOF_CAPTURE,
        SCENARIO_DE_SDOF_CAPTURE,
        SCENARIO_GDC,
        SCENARIO_ENF,
        SCENARIO_ENF_UV,
+       SCENARIO_ENF_YUV,
        SCENARIO_BLEND,
        SCENARIO_AP_MAX,
 };
index 21184fe46bd4e674ac642c7708c5f828d7bbc90f..472b6e1e1cda6ec6751faa5311024b51d5a18250 100755 (executable)
 /* #define DBG_PRINT_TASK */
 /* #define DBG_VERBOSE_IO */
 
+#if 0
 //#define DUMP_DEBUG_LOG_REGION
 #define DEBUG_LOG_MEMORY
 //#define PRINT_DBG
-
+#endif
 #define DISABLE_VIPX_LOG 0
 
 #if DISABLE_VIPX_LOG
index 1ac32d5bf2f0e6b63d4a0a420c4d9bb2a006cebf..58b3e22c7bfeb692b23a3129bff26011ce426716 100755 (executable)
@@ -34,6 +34,9 @@
 #define VIPX_IOVA_DRAM_FIRMWARE        0xB8000000
 #define VIPX_IOVA_DRAM_MBOX    0xA9000000
 
+#define ION_FLAG_NON_CACHED            0
+
+
 struct vipx_vb2_buf;
 struct vipx_vb2_buf_ops {
        ulong (*plane_kvaddr)(struct vipx_vb2_buf *vbuf, u32 plane);
index 201dec78cc8cbad3df5f3698161351001e3e7e76..a92c4213265a8211f3b8aa5dc7750749104bd5c0 100755 (executable)
@@ -888,7 +888,7 @@ int vipx_interface_stop(struct vipx_interface *interface)
        retry = VIPX_STOP_WAIT_COUNT;
        while (--retry && itaskmgr->req_cnt) {
                vipx_warn("waiting %d request completion...(%d)\n", itaskmgr->req_cnt, retry);
-               msleep(10);
+               msleep(1);
        }
 
        if (!retry) {
@@ -900,7 +900,7 @@ int vipx_interface_stop(struct vipx_interface *interface)
        retry = VIPX_STOP_WAIT_COUNT;
        while (--retry && itaskmgr->pro_cnt) {
                vipx_warn("waiting %d process completion...(%d)\n", itaskmgr->pro_cnt, retry);
-               msleep(10);
+               msleep(1);
        }
 
        if (!retry) {
@@ -912,7 +912,7 @@ int vipx_interface_stop(struct vipx_interface *interface)
        retry = VIPX_STOP_WAIT_COUNT;
        while (--retry && itaskmgr->com_cnt) {
                vipx_warn("waiting %d complete completion...(%d)\n", itaskmgr->com_cnt, retry);
-               msleep(10);
+               msleep(1);
        }
 
        if (!retry) {
@@ -933,20 +933,23 @@ int vipx_interface_stop(struct vipx_interface *interface)
 int vipx_hw_wait_bootup(struct vipx_interface *interface)
 {
        int ret = 0;
-       int try_cnt = 10;
        struct vipx_system *system = container_of(interface, struct vipx_system, interface);
-       struct vipx_binary *binary = &system->binary;
 
        BUG_ON(!interface);
 
+#ifdef DUMP_DEBUG_LOG_REGION
+        int try_cnt = 10;
+        struct vipx_binary *binary = &system->binary;
        while (try_cnt && !test_bit(VIPX_ITF_STATE_BOOTUP, &interface->state)) {
-               msleep(5);
+               msleep(1);
                try_cnt--;
                vipx_info("%s(): wait CM7 bootup\n",__func__);
        }
+#endif
 
     vipx_info("debug kva(0x%p), dva(0x%x), size(%ld)\n", system->memory.info.kvaddr_debug, (u32)system->memory.info.dvaddr_debug, system->memory.info.pb_debug->size);
 
+#ifdef DUMP_DEBUG_LOG_REGION
        if (try_cnt == 0)
        {
                if (!IS_ERR_OR_NULL(system->memory.info.kvaddr_debug)) {
@@ -957,7 +960,7 @@ int vipx_hw_wait_bootup(struct vipx_interface *interface)
                }
                ret = -EINVAL;
        }
-
+#endif
        vipx_info("%s():%d\n", __func__, ret);
        return ret;
 }
@@ -1145,7 +1148,8 @@ int vipx_hw_destroy(struct vipx_interface *interface, struct vipx_task *itask)
 
        if (payload.msg_u.destroy_graph_req.graph_id < SCENARIO_DE_CAPTURE)
                heap_size = VIPX_CM7_HEAP_SIZE_PREVIEW;
-       else if (payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF)
+       else if ((payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF) ||
+                (payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF_YUV))
                heap_size = VIPX_CM7_HEAP_SIZE_ENF;
        else
                heap_size = VIPX_CM7_HEAP_SIZE_CAPTURE;
@@ -1246,8 +1250,9 @@ int vipx_hw_config(struct vipx_interface *interface, struct vipx_task *itask)
        // Allocate and assign heap
        if (payload.msg_u.set_graph_req.graph_id < SCENARIO_DE_CAPTURE)
                heap_size = VIPX_CM7_HEAP_SIZE_PREVIEW;
-       else if (payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF_UV || 
-        payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF)
+       else if ((payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF_UV) || 
+           (payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF) ||
+           (payload.msg_u.destroy_graph_req.graph_id == SCENARIO_ENF_YUV))
                heap_size = VIPX_CM7_HEAP_SIZE_ENF;
        else
                heap_size = VIPX_CM7_HEAP_SIZE_CAPTURE;
index a7f7566a89e23c036c9257009b68a99ae7e2c8f6..ecd98f8a835a4bfc938034a32166083b103266ed 100644 (file)
@@ -107,7 +107,7 @@ int vipx_mbox_wait_reply(struct vipx_mailbox_ctrl *mctrl,
        try_count = 1000;
        while (--try_count && (mbox->wmsg_idx == mbox->rmsg_idx)) {
                vipx_warn("waiting vipx reply(%d, %d)...(%d)\n", mbox->wmsg_idx, mbox->rmsg_idx, try_count);
-               msleep(10);
+               msleep(1);
        }
 
        if (try_count <= 0) {
index c3697638e67de52e8fb92c5488db3124e3dc2783..b359dd34c4f692ca0ffaa676a997db297fbd5672 100755 (executable)
@@ -65,7 +65,7 @@ static int __vipx_graph_stop(struct vipx_graph *graph)
        retry = VIPX_STOP_WAIT_COUNT;
        while (--retry && taskmgr->req_cnt) {
                vipx_iwarn("waiting %d request cancel...(%d)\n", graph, taskmgr->req_cnt, retry);
-               msleep(10);
+               msleep(1);
        }
 
        if (!retry) {
@@ -76,7 +76,7 @@ static int __vipx_graph_stop(struct vipx_graph *graph)
        retry = VIPX_STOP_WAIT_COUNT;
        while (--retry && taskmgr->pre_cnt) {
                vipx_iwarn("waiting %d prepare cancel...(%d)\n", graph, taskmgr->pre_cnt, retry);
-               msleep(10);
+               msleep(1);
        }
 
        if (!retry) {
@@ -87,7 +87,7 @@ static int __vipx_graph_stop(struct vipx_graph *graph)
        retry = VIPX_STOP_WAIT_COUNT;
        while (--retry && taskmgr->pro_cnt) {
                vipx_iwarn("waiting %d process done...(%d)\n", graph, taskmgr->pro_cnt, retry);
-               msleep(10);
+               msleep(1);
        }
 
        if (!retry) {
index 4c74ebd4a3d39a77c42c0e1600fb58d9624bd066..ba5acfe2204845ae8b6659dd58b6b427220b4365 100755 (executable)
@@ -299,7 +299,8 @@ static struct vipx_priv_buf *vipx_ion_alloc(void *ctx,
 
        size = PAGE_ALIGN(size);
 
-       buf->dma_buf = ion_alloc_dmabuf(heapname, size, alloc_ctx->flags);
+       buf->dma_buf = ion_alloc_dmabuf(heapname, size, ION_FLAG_NON_CACHED);
+       //buf->dma_buf = ion_alloc_dmabuf(heapname, size, alloc_ctx->flags);
        if (IS_ERR(buf->dma_buf)) {
                ret = -ENOMEM;
                goto err_alloc;
@@ -495,7 +496,9 @@ dma_addr_t vipx_allocate_heap(struct vipx_memory *mem, u32 size)
                        vipx_err("failed to allocate buffer for VIPX_CM7_HEAP_SIZE");
                        ret = -ENOMEM;
                }
+#ifdef DUMP_DEBUG_LOG_REGION
                minfo->kvaddr_heap = vipx_ion_kvaddr(minfo->pb_heap);
+#endif
                minfo->dvaddr_heap = vipx_ion_dvaddr(minfo->pb_heap);
                vipx_info("heap kva(0x%p), dva(0x%x), size(%ld)\n",
                        minfo->kvaddr_heap, (u32)minfo->dvaddr_heap, minfo->pb_heap->size);
index 55ce834a10a59b7d894fcb0a063cacb436ee3ceb..ee78c8f6eab7888209d2f260b3811559f8f9434f 100755 (executable)
@@ -411,12 +411,13 @@ int vipx_system_fw_bootup(struct vipx_system *system)
                vipx_err("CTL_OP(ctl_start) is fail(%d)\n", ret);
                goto p_err;
        }
-
+#if 0  // change code position to vipx_vertex_streamon in vipx-vertex.c before streamon execution
        ret = vipx_hw_wait_bootup(&system->interface);
        if (ret) {
                vipx_err("vipx_hw_wait_bootup is fail(%d)\n", ret);
                goto p_err;
        }
+#endif
 
 p_err:
        vipx_info("%s():%d\n", __func__, ret);
index 3e97f6188f46caef55cb5ec8e4a1a6efb763e41d..1e87b8f5efdd0083bf916269f624c7eae4239d9f 100755 (executable)
@@ -459,12 +459,20 @@ static int vipx_vertex_streamon(struct file *file)
        struct vipx_vertex *vertex = vctx->vertex;
        struct vipx_queue *queue = &vctx->queue;
        struct mutex *lock = &vctx->lock;
+       struct vipx_device *device = container_of(vertex, struct vipx_device, vertex);
+       struct vipx_system *system = &device->system;
 
        if (mutex_lock_interruptible(lock)) {
                vipx_ierr("mutex_lock_interruptible is fail\n", vctx);
                return -ERESTARTSYS;
        }
 
+       ret = vipx_hw_wait_bootup(&system->interface);
+       if (ret) {
+               vision_err("CM7 bootup is fail(%d)\n", ret);
+               goto p_err;
+       }
+
        if (!(vctx->state & (BIT(VIPX_VERTEX_FORMAT) | BIT(VIPX_VERTEX_STOP)))) {
                vipx_ierr("invalid state(%X)\n", vctx, vctx->state);
                ret = -EINVAL;