From patchwork Thu Aug 26 11:25:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 13501 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 801A2BD87C for ; Thu, 26 Aug 2021 11:25:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BBD10688E5; Thu, 26 Aug 2021 13:25:48 +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="FbjbjsAs"; dkim-atps=neutral Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A5786888F for ; Thu, 26 Aug 2021 13:25:47 +0200 (CEST) Received: by mail-pj1-x1031.google.com with SMTP id ot2-20020a17090b3b4200b0019127f8ed87so5784643pjb.1 for ; Thu, 26 Aug 2021 04:25: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:mime-version :content-transfer-encoding; bh=NYthwwd62eAw805O7bvdIsCeMNZHF811KpjboK4UO/s=; b=FbjbjsAsL8h3KqSlZBq5ye5PhB8qOuwdnzQDpKt5MDCHTlNjKF3TkweMBU+ZIjqZdE JDjdJJv0CMf9Gqsk0gE8M5pwa4Jdx6CkajMInVw0F9New7MQQL6QiY43I7vsyh8pKqdq tP/Z6JA9dOzmBiAaDtrJjAT4tosoe3HCTtxYg= 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:mime-version :content-transfer-encoding; bh=NYthwwd62eAw805O7bvdIsCeMNZHF811KpjboK4UO/s=; b=kkdPob+pfVKzlEiHO4RyHorbJjNS2l6xrlXzO88FIGyQa5EM3C/Qx0tNXr6zHJAg3F THWIL3xqVKp4avex8I4hKx2qQpxyqGlz+jNpSwL3tokjVmBU2H3C8T4NmpJUGD5sv65I rg3jajc7s8FzsDp42qQc8CJi9rVVl7la+0vHiIXO7FKHnl2jiVf39CzVcgcQWzAmCJQ/ FM07tIdWxFbEx/JdZHXMNuWe9iQHdUYCHICefUjf3HdOzMAyMo2r/Q/n2ZFhk83Gu+L8 Wb7c+1MPx1QRvPA7HnVMq0I7jyjvF/ir5GIm9cD4u2dblnI3VrJg5hfkYCp3gFJiAYVz yxaA== X-Gm-Message-State: AOAM532Psox7Kb/nYhf45R8wf25kA/cBN2BBrIOMHqxc8a1JWT6p5yty J6S055DAY2v3C3+zwQyY/z4WWv4u9Sr7+g== X-Google-Smtp-Source: ABdhPJzHCjyTI6yVp42eNqrsaYLjatBKNEajpCeOn8Tz7sr/uB8qjibAQajm1hENbRKdjvbfz2XmdA== X-Received: by 2002:a17:90b:1e02:: with SMTP id pg2mr3852588pjb.37.1629977145294; Thu, 26 Aug 2021 04:25:45 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 04:25:44 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 26 Aug 2021 20:25:30 +0900 Message-Id: <20210826112539.170694-1-hiroh@chromium.org> X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/9] Add offset to FrameBuffer::Plane 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" Since FrameBuffer::Plane doesn't have an offset variable, it is impossible to map the FrameBuffer::Plane correctly. This series fixes the issue by adding an offset and aligns some code of mapping and creating FrameBuffer::Plane with the new offset. One of the pateches fixes V4L2Device to make a returned FrameBuffer color format planes from v4l2 format planes. However, V4L2 API doesn't provide a way of getting a dmabuf plane offset, so a multi planar format e.g. V4L2_PIX_FMT_NV12M is not supported with this patch series. This series must be applied on top of the pacth series whose id is 2384. cf.) https://patchwork.libcamera.org/project/libcamera/list/?series=2384 Change in v3: - address review comments to v2 - squash 01/10 and 02/10 (serialization change) of v2 Change in v2: - adress review comments to v1 Hirokazu Honda (9): libcamera: framebuffer: Add offset to FrameBuffer::Plane libcamera: mapped_framebuffer: Return plane begin address by MappedBuffer::maps() cam: file_sink: Use offset in mapping FrameBuffer ipa: rkisp1: Use offset in mapping IPABuffer qcam: main_window: Use offset mapping FrameBuffer gstreamer: gstlibcameraallocator: Use offset in creating a buffer V4L2VideDevice::createBuffer() creates the same number of FrameBuffer::Planes as V4L2 format planes. Therefore, if the v4l2 format single is single-planar format, the created number of FrameBuffer::Planes is 1. It should rather create the same number of FrameBuffer::Planes as the color format planes. android: camera_device: Fill offset and right length in CreateFrameBuffer() libcamera: framebuffer: Add assertion to detect offset is unfilled include/libcamera/framebuffer.h | 12 +- .../libcamera/internal/mapped_framebuffer.h | 4 +- include/libcamera/internal/v4l2_videodevice.h | 10 +- src/android/camera_device.cpp | 52 ++++--- src/android/camera_device.h | 6 +- src/android/mm/generic_camera_buffer.cpp | 2 - src/cam/file_sink.cpp | 20 ++- src/cam/file_sink.h | 1 + src/gstreamer/gstlibcameraallocator.cpp | 4 +- src/ipa/rkisp1/rkisp1.cpp | 33 ++-- src/libcamera/framebuffer.cpp | 29 +++- src/libcamera/ipa_data_serializer.cpp | 5 +- src/libcamera/mapped_framebuffer.cpp | 71 +++++++-- src/libcamera/v4l2_videodevice.cpp | 147 ++++++++++++++---- src/qcam/main_window.cpp | 15 +- src/qcam/main_window.h | 1 + test/v4l2_videodevice/buffer_cache.cpp | 6 +- 17 files changed, 311 insertions(+), 107 deletions(-) --- 2.33.0.rc2.250.ged5fa647cd-goog