From patchwork Mon Aug 23 13:12:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 13450 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9412CBD87C for ; Mon, 23 Aug 2021 13:12:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5A46D688CA; Mon, 23 Aug 2021 15:12:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="eJ9u8zLd"; dkim-atps=neutral Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F64768920 for ; Mon, 23 Aug 2021 15:12:47 +0200 (CEST) Received: by mail-pf1-x429.google.com with SMTP id w68so15314259pfd.0 for ; Mon, 23 Aug 2021 06:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9PbGK38tT8uYeY88oZKwqMNsbfemhDMMeb9o2l6F2uA=; b=eJ9u8zLdh4twOwWYRCb+XHAVIZcsqGKgi9nGtola0aPwTuXTrAVGxfN2zx/m2cuFqv cGjiVO2iBFGdCWLeq3y5wnmFTDMdTzjCaVIcElTvltShQDj3BxvtdU7CxAT9PFCJmJYd en4k3IxyNVpqUjOkjykEZ2t5Arxbvqovql4tc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9PbGK38tT8uYeY88oZKwqMNsbfemhDMMeb9o2l6F2uA=; b=eqQyK5OSRFPuHIfFVrEhWxKg3Z+sleVgNT7DxuL54eo4c2R7F2Zk/n51x7h3RCk5p5 eerWQv3h8TWbpYoQ96Vi4brfxhOnVXmYRQLbLrzJl3YfOA+Pd8T4xXoUZvUYYnADTWWP DBuHLDVOic+KMTDueHQ6r+mPB/2NuGH6b/1vMIVnQAOt/LAbqIohiJbIzUd7NormfU9L sLX78/PTGv3fle0g5fvCWKHlORs8TWsJwCGWXGFwreqUD8M+PnmCVkWjRkFoX/PJT9zt IDMoIDBN93gDQY7y6QvwQRlfwyB0y4nBWiyfgBgoN6UoE/REB4nRMtniWNa8c+4hgOw5 IE7A== X-Gm-Message-State: AOAM533JSuMd2cuEq6qHwwzqIXq1j1IvFxUtV/rntSZsNiFlADfGLN4K GV2+SiVVa5UQb2CsMyXgF+KdDN0ehpBNkg== X-Google-Smtp-Source: ABdhPJzIrOFv7D/k+mBv7p7+1oHyknh6O9vX2hCknQHRVDLE2sJAIOEKJ4HfxHS3Hq/QAk2ipGCnbw== X-Received: by 2002:a05:6a00:805:b0:3e2:f682:1b32 with SMTP id m5-20020a056a00080500b003e2f6821b32mr26740531pfk.60.1629724365492; Mon, 23 Aug 2021 06:12:45 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:184e:5d20:8fcb:dfcd]) by smtp.gmail.com with ESMTPSA id j4sm18596891pgi.6.2021.08.23.06.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 06:12:45 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Aug 2021 22:12:18 +0900 Message-Id: <20210823131221.1034059-8-hiroh@chromium.org> X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog In-Reply-To: <20210823131221.1034059-1-hiroh@chromium.org> References: <20210823131221.1034059-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 07/10] gstreamer: gstlibcameraallocator: Use offset in creating a buffer X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The plane length is the length of the plane size. The buffer length to be allocated for a plane is the offset and the length of FrameBuffer::Plane. Signed-off-by: Hirokazu Honda Reviewed-by: Nicolas Dufresne --- src/gstreamer/gstlibcameraallocator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp index 7bd8ba2d..60ead273 100644 --- a/src/gstreamer/gstlibcameraallocator.cpp +++ b/src/gstreamer/gstlibcameraallocator.cpp @@ -52,8 +52,10 @@ FrameWrap::FrameWrap(GstAllocator *allocator, FrameBuffer *buffer, outstandingPlanes_(0) { for (const FrameBuffer::Plane &plane : buffer->planes()) { - GstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(), plane.length, + GstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(), + plane.offset + plane.length, GST_FD_MEMORY_FLAG_DONT_CLOSE); + gst_memory_resize(mem, plane.offset, plane.length); gst_mini_object_set_qdata(GST_MINI_OBJECT(mem), getQuark(), this, nullptr); GST_MINI_OBJECT(mem)->dispose = gst_libcamera_allocator_release; g_object_unref(mem->allocator);