From b5dc20f7bf057cfdd76dcd4fbf8f8e22810587e1 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Sat, 14 Mar 2026 21:22:11 +0800 Subject: [PATCH] Revert unsafe DMA inference handoff --- plugins/ai_shoe_det/ai_shoe_det_node.cpp | 8 +------- plugins/ai_yolo/ai_yolo_node.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/plugins/ai_shoe_det/ai_shoe_det_node.cpp b/plugins/ai_shoe_det/ai_shoe_det_node.cpp index a1cd4c8..964f208 100644 --- a/plugins/ai_shoe_det/ai_shoe_det_node.cpp +++ b/plugins/ai_shoe_det/ai_shoe_det_node.cpp @@ -571,7 +571,6 @@ private: const uint8_t* model_input_data = nullptr; size_t model_input_size = 0; - int model_input_dma_fd = -1; if (image_processor_ && win_w > 0 && win_h > 0) { Frame crop_frame; @@ -596,11 +595,7 @@ private: ? resized_frame.planes[0].stride : (resized_frame.stride > 0 ? resized_frame.stride : model_w_ * 3); const size_t packed_size = static_cast(model_w_) * static_cast(model_h_) * 3; - if (resized_frame.DmaFd() >= 0 && resized_data) { - model_input_data = resized_data; - model_input_size = resized_frame.data_size > 0 ? resized_frame.data_size : packed_size; - model_input_dma_fd = resized_frame.DmaFd(); - } else if (resized_data && resized_stride > 0) { + if (resized_data && resized_stride > 0) { if (packed_size > input_buf_.size()) input_buf_.resize(packed_size); for (int row = 0; row < model_h_; ++row) { memcpy(input_buf_.data() + static_cast(row) * static_cast(model_w_) * 3, @@ -627,7 +622,6 @@ private: input.is_nhwc = true; input.data = model_input_data; input.size = model_input_size; - input.dma_fd = model_input_dma_fd; input.type = RKNN_TENSOR_UINT8; auto r = infer_backend_->InferBorrowed(model_handle_, input); diff --git a/plugins/ai_yolo/ai_yolo_node.cpp b/plugins/ai_yolo/ai_yolo_node.cpp index e1a972f..5ac7017 100644 --- a/plugins/ai_yolo/ai_yolo_node.cpp +++ b/plugins/ai_yolo/ai_yolo_node.cpp @@ -929,14 +929,7 @@ private: const int resized_stride = resized_frame.planes[0].stride > 0 ? resized_frame.planes[0].stride : (resized_frame.stride > 0 ? resized_frame.stride : static_cast(input_row)); - if (resized_frame.DmaFd() >= 0 && resized_data) { - input.data = resized_data; - input.size = resized_frame.data_size > 0 ? resized_frame.data_size : input_size; - input.width = model_input_w_; - input.height = model_input_h_; - input.dma_fd = resized_frame.DmaFd(); - input.dma_offset = 0; - } else if (resized_data && resized_stride > 0) { + if (resized_data && resized_stride > 0) { for (int y = 0; y < model_input_h_; ++y) { memcpy(resized_input_.data() + static_cast(y) * input_row, resized_data + static_cast(y) * static_cast(resized_stride), @@ -946,6 +939,8 @@ private: input.size = input_size; input.width = model_input_w_; input.height = model_input_h_; + input.dma_fd = -1; + input.dma_offset = 0; } else { ResizeRgbBilinear(src, w, h, src_stride, resized_input_.data(), model_input_w_, model_input_h_, @@ -954,6 +949,8 @@ private: input.size = input_size; input.width = model_input_w_; input.height = model_input_h_; + input.dma_fd = -1; + input.dma_offset = 0; } } else { ResizeRgbBilinear(src, w, h, src_stride, @@ -963,6 +960,8 @@ private: input.size = input_size; input.width = model_input_w_; input.height = model_input_h_; + input.dma_fd = -1; + input.dma_offset = 0; } } else { ResizeRgbBilinear(src, w, h, src_stride, @@ -972,6 +971,8 @@ private: input.size = input_size; input.width = model_input_w_; input.height = model_input_h_; + input.dma_fd = -1; + input.dma_offset = 0; } } input.is_nhwc = true;