From patchwork Thu Aug 26 11:25:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 13506 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 429A2C3242 for ; Thu, 26 Aug 2021 11:26:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D0F3168918; Thu, 26 Aug 2021 13:25:59 +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="XcNJu1pc"; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C2726891B for ; Thu, 26 Aug 2021 13:25:58 +0200 (CEST) Received: by mail-pj1-x102d.google.com with SMTP id mq3so1972271pjb.5 for ; Thu, 26 Aug 2021 04:25:58 -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=w3io4ICj3+SqN8WinyGtF95ZiA98f5dYRzFd6Imr/mY=; b=XcNJu1pcFv4ezLL3mn6zO2tEPAhoBiJZzbNU6ITJQfzd/LzI9DaazqSVyAjb20gzV5 E4ZLh+EGnZHcU0aSDSBcgJKcTIHqQKi/tAfrrgQvampUbSngF/qZHReVH3sNaceE1VvJ Wre+kDLqCAxLmOmXpyqYDJzfOIpv0EltO07Xo= 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=w3io4ICj3+SqN8WinyGtF95ZiA98f5dYRzFd6Imr/mY=; b=eTvDnwCBKyp8CX+UMbodFzxE4bZMSAZA15JPMzKpIxdmcD5nuPc6DS6JhpYWYihAar 6f9GzcZWBMFZ1eaieW6tM7kpIds9dxpWRS3HyKTY5P8tZXQedygOEa/L3mPVKCrJFqdH KBaIYSOYri7Csev7rKW+23UhylQ+JoGFRnDvaK1yDmrvyR2sYrz4PmtAucvjhHQ+Xxo3 /y5V1r1V74Nv+h+4Q9yij0oglbahlZDqxUc69twAN+DD9BAnOkMFkGnoMONrWcRdL4uo zZrtGKMXYhTNNvhNt0Myq0WmDeKh9ZVlw5A0kuwq5Lai3vOjhqfhdbY4jjBux8SEhKIL 9/oA== X-Gm-Message-State: AOAM532AtRieKr0I0qJEbEle4dG/y+ipMEBz08jQFaTDFsaDvGdHrRtg czlT77z8vKugHxiIeT4frG+b8/jCy1OKtw== X-Google-Smtp-Source: ABdhPJwJudQ0T46wu5edtVH3PyDj57kM3dlctnvBBMCA8u9ge5/W+Yj3T/Kn2pwoZDykikRjNEZfQA== X-Received: by 2002:a17:902:dac6:b0:138:85a7:ef80 with SMTP id q6-20020a170902dac600b0013885a7ef80mr1470898plx.45.1629977156410; Thu, 26 Aug 2021 04:25:56 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:a5bc:b3dd:7208:bec1]) by smtp.gmail.com with ESMTPSA id s29sm3472057pgl.38.2021.08.26.04.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 04:25:55 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 26 Aug 2021 20:25:36 +0900 Message-Id: <20210826112539.170694-7-hiroh@chromium.org> X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog In-Reply-To: <20210826112539.170694-1-hiroh@chromium.org> References: <20210826112539.170694-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 6/9] 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: , Cc: Nicolas Dufresne 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 Reviewed-by: Laurent Pinchart --- 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);