{"id":10854,"url":"https://patchwork.libcamera.org/api/1.1/patches/10854/?format=json","web_url":"https://patchwork.libcamera.org/patch/10854/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210113130832.15549-4-andrey.konovalov@linaro.org>","date":"2021-01-13T13:08:31","name":"[libcamera-devel,3/4] qcam: viewfinder_gl: RAW10P: handle the padding bytes properly","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2a058bd182259bef32218f6c2248972e01400ab5","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/1.1/people/25/?format=json","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10854/mbox/","series":[{"id":1576,"url":"https://patchwork.libcamera.org/api/1.1/series/1576/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1576","date":"2021-01-13T13:08:28","name":"qcam: viewfinder_gl: add RAW10P and RAW12P format support","version":1,"mbox":"https://patchwork.libcamera.org/series/1576/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10854/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10854/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 73362BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jan 2021 13:09:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 41678680D8;\n\tWed, 13 Jan 2021 14:09:01 +0100 (CET)","from mail-lf1-x135.google.com (mail-lf1-x135.google.com\n\t[IPv6:2a00:1450:4864:20::135])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 659386054E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jan 2021 14:08:59 +0100 (CET)","by mail-lf1-x135.google.com with SMTP id s26so2639248lfc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jan 2021 05:08:59 -0800 (PST)","from localhost.localdomain ([85.249.43.69])\n\tby smtp.googlemail.com with ESMTPSA id\n\td2sm179477ljg.39.2021.01.13.05.08.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Jan 2021 05:08:57 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"XQT/3gBS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=veWN98fZcbakbj7dt4jyzAprw0las+6G3CgLk/aoTdY=;\n\tb=XQT/3gBSiBbzUppVRAn1Ov1/Us8bjxgmJdoJ16ZYNOGtaS33jzMosINuF88gwfbvRl\n\tcGxfRRuHL1VYu/4j3FC+1eBKTqwolaVqxTJMPHgpZ3YqJ/cMYv9RZf8qYx5LUiYT++N9\n\tYUkbyKJSaiM0x6/mM8M3ZjDQ7C5hdjcEyqbl//elCLcCPXQU0+HxZMsTuwAVeqzNTTgT\n\t3VYQfttgpRXdKhvc9JLxZKi/LOTzrblj1jDXqtPtSgJke7GP55WvJuX5XmPcxK+CXneK\n\tUWae6TCypiQglb4xPkwrs3ULLjfb+yTDrTPXfDTUaHkTDPFy4kvNQSR6o1Cqn3q9JPGt\n\t9EuQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=veWN98fZcbakbj7dt4jyzAprw0las+6G3CgLk/aoTdY=;\n\tb=KgbpXL8iyndy32VQykY/bSPKCeqbRrdOgewH1f7wDQ6YdktJ11vDtF9Gg3FyMtc+6l\n\tDIUVNZvCuDKAFB2NxXWAwVN2QcTCHapOK242yOFM0DY1jWgpVQ/UVYyu+VueZR5Tgk0+\n\tb265RYQMETrtW533j7x0lH+uoqeaz/dl9hGBCTr0TMD0+jqZWgUpbdVj6x2CwDyMEgwf\n\tN9pIu1o+CvTc1QWeuEZw4X6DyV/ANT8wEKblf9sst5zbWq54Gkhv06eOvnC3aajTZVE1\n\tFesUNeAl+ukjRk8/JUhkU1O9y6XXU2zH64Vcy8VZGoCX3iOK/9AkPEdgMOGnB1hLDkBv\n\t/BYw==","X-Gm-Message-State":"AOAM5313rePX+zmxhUD4IOjnBIbuv6im13frooDiQT8KuUYeFO6ROyzE\n\tM0B5eW05G4n0N0bKIheu+ePngIjEOc80fw==","X-Google-Smtp-Source":"ABdhPJxAaKjMxShOg+CM7ho0389jOL9sNIVoNZXi/3yVo+aIcHqWMBL2YqB1rXaVpt3nzhbC33fWmQ==","X-Received":"by 2002:a19:94f:: with SMTP id 76mr813380lfj.642.1610543338425; \n\tWed, 13 Jan 2021 05:08:58 -0800 (PST)","From":"Andrey Konovalov <andrey.konovalov@linaro.org>","To":"libcamera-devel@lists.libcamera.org,\n\tlaurent.pinchart@ideasonboard.com","Date":"Wed, 13 Jan 2021 16:08:31 +0300","Message-Id":"<20210113130832.15549-4-andrey.konovalov@linaro.org>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20210113130832.15549-1-andrey.konovalov@linaro.org>","References":"<20210113130832.15549-1-andrey.konovalov@linaro.org>","Subject":"[libcamera-devel] [PATCH 3/4] qcam: viewfinder_gl: RAW10P: handle\n\tthe padding bytes properly","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"morgan@casual-effects.com","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The texture size must account for the padding bytes which may be present\nat the end of the lines in the frame.\n\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n---\n src/qcam/viewfinder_gl.cpp | 11 +++++++----\n src/qcam/viewfinder_gl.h   |  1 +\n 2 files changed, 8 insertions(+), 4 deletions(-)","diff":"diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\nindex b324d77f..9db536a6 100644\n--- a/src/qcam/viewfinder_gl.cpp\n+++ b/src/qcam/viewfinder_gl.cpp\n@@ -111,6 +111,10 @@ void ViewFinderGL::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t\trenderComplete(buffer_);\n \n \tdata_ = static_cast<unsigned char *>(map->memory);\n+\t/*\n+\t * \\todo Get the stride from the buffer instead of computing it naively\n+\t */\n+\tstride_ = buffer->metadata().planes[0].bytesused / size_.height();\n \tupdate();\n \tbuffer_ = buffer;\n }\n@@ -594,14 +598,13 @@ void ViewFinderGL::doRender()\n \t\t/*\n \t\t * Packed raw Bayer 10-bit formats are stored in GL_RED texture.\n \t\t * The texture width is 10/8 of the image width.\n-\t\t * TODO: account for padding bytes at the end of the line.\n \t\t */\n \t\tglActiveTexture(GL_TEXTURE0);\n \t\tconfigureTexture(*textures_[0]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n-\t\t\t     size_.width() * 5 / 4,\n+\t\t\t     stride_,\n \t\t\t     size_.height(),\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -611,12 +614,12 @@ void ViewFinderGL::doRender()\n \t\tshaderProgram_.setUniformValue(textureUniformBayerFirstRed_,\n \t\t\t\t\t       firstRed_);\n \t\tshaderProgram_.setUniformValue(textureUniformSize_,\n-\t\t\t\t\t       size_.width() * 5 / 4,\n+\t\t\t\t\t       stride_,\n \t\t\t\t\t       size_.height(),\n \t\t\t\t\t       size_.width(),\n \t\t\t\t\t       size_.height());\n \t\tshaderProgram_.setUniformValue(textureUniformStep_,\n-\t\t\t\t\t       1.0f / (size_.width() * 5 / 4 - 1),\n+\t\t\t\t\t       1.0f / (stride_ - 1),\n \t\t\t\t\t       1.0f / (size_.height() - 1));\n \t\tbreak;\n \ndiff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h\nindex 337718e3..49f8364a 100644\n--- a/src/qcam/viewfinder_gl.h\n+++ b/src/qcam/viewfinder_gl.h\n@@ -66,6 +66,7 @@ private:\n \tlibcamera::FrameBuffer *buffer_;\n \tlibcamera::PixelFormat format_;\n \tQSize size_;\n+\tint stride_;\n \tunsigned char *data_;\n \n \t/* Shaders */\n","prefixes":["libcamera-devel","3/4"]}