Patch Detail
Show a patch.
GET /api/patches/10329/?format=api
{ "id": 10329, "url": "https://patchwork.libcamera.org/api/patches/10329/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10329/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201104021725.32361-1-laurent.pinchart@ideasonboard.com>", "date": "2020-11-04T02:17:25", "name": "[libcamera-devel,v1.1,6/7] qcam: viewfinder_gl: Store textures in an array", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f907509adf61b97dceef72499d700210c0d38a10", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10329/mbox/", "series": [ { "id": 1442, "url": "https://patchwork.libcamera.org/api/series/1442/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1442", "date": "2020-11-04T02:17:25", "name": null, "version": 1, "mbox": "https://patchwork.libcamera.org/series/1442/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10329/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10329/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 E8CE8BDB89\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 4 Nov 2020 02:18:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 798CD62BC9;\n\tWed, 4 Nov 2020 03:18:19 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE77D60344\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 4 Nov 2020 03:18:17 +0100 (CET)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 58006563;\n\tWed, 4 Nov 2020 03:18:17 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gXHysA6G\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1604456297;\n\tbh=qO5FhKuzidpHR/rGYAaa2IjhIko3o8JZ5hV9HNFPUgg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gXHysA6G0y6dYLa8TFXn3jEwxvms6X6E3GuRvOzG8GkmIkfj3oa0AY/8iD1Ot+IrO\n\tROZXG5z1qwhso4NLrnvqpgNDhmAjnNHYDcHyT26cN9XwP2TqPLbJgE0pu81RdwahBM\n\tE4k3ghITCrpHT4HhC5sOXAeYLkczmThgnMrlUND8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 4 Nov 2020 04:17:25 +0200", "Message-Id": "<20201104021725.32361-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<99ef4bf5-5e13-2264-de05-c550b20d3977@linaro.org>", "References": "<99ef4bf5-5e13-2264-de05-c550b20d3977@linaro.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v1.1 6/7] qcam: viewfinder_gl: Store\n\ttextures in an array", "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>", "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": "In preparation for RGB formats support, store the three Y, U and V\ntextures in an array. This makes the code more generic, and will avoid\nreferring to an RGB texture as textureY_.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n---\nChanges since v1:\n\n- Reorganize texture fields in the ViewFinderGL class\n---\n src/qcam/viewfinder_gl.cpp | 37 +++++++++++++++++--------------------\n src/qcam/viewfinder_gl.h | 9 +++++----\n 2 files changed, 22 insertions(+), 24 deletions(-)", "diff": "diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\nindex e6625cac9795..cbc1365500f5 100644\n--- a/src/qcam/viewfinder_gl.cpp\n+++ b/src/qcam/viewfinder_gl.cpp\n@@ -33,10 +33,7 @@ static const QList<libcamera::PixelFormat> supportedFormats{\n \n ViewFinderGL::ViewFinderGL(QWidget *parent)\n \t: QOpenGLWidget(parent), buffer_(nullptr), data_(nullptr),\n-\t vertexBuffer_(QOpenGLBuffer::VertexBuffer),\n-\t textureU_(QOpenGLTexture::Target2D),\n-\t textureV_(QOpenGLTexture::Target2D),\n-\t textureY_(QOpenGLTexture::Target2D)\n+\t vertexBuffer_(QOpenGLBuffer::VertexBuffer)\n {\n }\n \n@@ -263,14 +260,14 @@ bool ViewFinderGL::createFragmentShader()\n \ttextureUniformV_ = shaderProgram_.uniformLocation(\"tex_v\");\n \ttextureUniformStepX_ = shaderProgram_.uniformLocation(\"tex_stepx\");\n \n-\tif (!textureY_.isCreated())\n-\t\ttextureY_.create();\n+\t/* Create the textures. */\n+\tfor (std::unique_ptr<QOpenGLTexture> &texture : textures_) {\n+\t\tif (texture)\n+\t\t\tcontinue;\n \n-\tif (!textureU_.isCreated())\n-\t\ttextureU_.create();\n-\n-\tif (!textureV_.isCreated())\n-\t\ttextureV_.create();\n+\t\ttexture = std::make_unique<QOpenGLTexture>(QOpenGLTexture::Target2D);\n+\t\ttexture->create();\n+\t}\n \n \treturn true;\n }\n@@ -337,7 +334,7 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::NV42:\n \t\t/* Activate texture Y */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(textureY_);\n+\t\tconfigureTexture(*textures_[0]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -351,7 +348,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture UV/VU */\n \t\tglActiveTexture(GL_TEXTURE1);\n-\t\tconfigureTexture(textureU_);\n+\t\tconfigureTexture(*textures_[1]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RG,\n@@ -367,7 +364,7 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::YUV420:\n \t\t/* Activate texture Y */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(textureY_);\n+\t\tconfigureTexture(*textures_[0]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -381,7 +378,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture U */\n \t\tglActiveTexture(GL_TEXTURE1);\n-\t\tconfigureTexture(textureU_);\n+\t\tconfigureTexture(*textures_[1]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -395,7 +392,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture V */\n \t\tglActiveTexture(GL_TEXTURE2);\n-\t\tconfigureTexture(textureV_);\n+\t\tconfigureTexture(*textures_[2]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -411,7 +408,7 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::YVU420:\n \t\t/* Activate texture Y */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(textureY_);\n+\t\tconfigureTexture(*textures_[0]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -425,7 +422,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture V */\n \t\tglActiveTexture(GL_TEXTURE2);\n-\t\tconfigureTexture(textureV_);\n+\t\tconfigureTexture(*textures_[2]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -439,7 +436,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture U */\n \t\tglActiveTexture(GL_TEXTURE1);\n-\t\tconfigureTexture(textureU_);\n+\t\tconfigureTexture(*textures_[1]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RED,\n@@ -462,7 +459,7 @@ void ViewFinderGL::doRender()\n \t\t * The texture width is thus half of the image with.\n \t\t */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(textureY_);\n+\t\tconfigureTexture(*textures_[0]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n \t\t\t GL_RGBA,\ndiff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h\nindex b3e36514d3d4..150fa4ae94da 100644\n--- a/src/qcam/viewfinder_gl.h\n+++ b/src/qcam/viewfinder_gl.h\n@@ -8,6 +8,7 @@\n #ifndef __VIEWFINDER_GL_H__\n #define __VIEWFINDER_GL_H__\n \n+#include <array>\n #include <memory>\n \n #include <QImage>\n@@ -77,14 +78,14 @@ private:\n \t/* Vertex buffer */\n \tQOpenGLBuffer vertexBuffer_;\n \n-\t/* YUV texture planars and parameters */\n+\t/* Textures */\n+\tstd::array<std::unique_ptr<QOpenGLTexture>, 3> textures_;\n+\n+\t/* YUV texture parameters */\n \tGLuint textureUniformU_;\n \tGLuint textureUniformV_;\n \tGLuint textureUniformY_;\n \tGLuint textureUniformStepX_;\n-\tQOpenGLTexture textureU_;\n-\tQOpenGLTexture textureV_;\n-\tQOpenGLTexture textureY_;\n \tunsigned int horzSubSample_;\n \tunsigned int vertSubSample_;\n \n", "prefixes": [ "libcamera-devel", "v1.1", "6/7" ] }