Patch Detail
Show a patch.
GET /api/patches/10327/?format=api
{ "id": 10327, "url": "https://patchwork.libcamera.org/api/patches/10327/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10327/", "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": "<20201103155025.5948-7-laurent.pinchart@ideasonboard.com>", "date": "2020-11-03T15:50:24", "name": "[libcamera-devel,6/7] qcam: viewfinder_gl: Store textures in an array", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "bf8b8fc5c9af6fa413499a0b3b6ad5297a6fe9f8", "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/10327/mbox/", "series": [ { "id": 1441, "url": "https://patchwork.libcamera.org/api/series/1441/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1441", "date": "2020-11-03T15:50:18", "name": "qcam: Miscellaneous shaders cleanups and RGB support", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1441/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10327/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10327/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 88297BDB8B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 3 Nov 2020 15:51:24 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 52EB862C62;\n\tTue, 3 Nov 2020 16:51:24 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F4CE62C09\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 3 Nov 2020 16:51:21 +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 D648315AB; \n\tTue, 3 Nov 2020 16:51:20 +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=\"josRikuZ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1604418681;\n\tbh=dVIkY52eAO9+0WrMD9ZsJ8F2GKLg/gM/lDb601VRJdQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=josRikuZ0Nd5ZGLHfUHX96bJ/ttHstq+wvdU6W4I8AU6horIDIBQLlV+AmhpJ81WH\n\tvhh6de/6kq01UvCxIu3iMErptzlg7UDdebciBuZymIuKJGoC49ux1PG3XeS6EZ4lfF\n\tgrw013Y7hFCp891w2I4zu1kGH/PcbSpgEFXX3mYM=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 3 Nov 2020 17:50:24 +0200", "Message-Id": "<20201103155025.5948-7-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20201103155025.5948-1-laurent.pinchart@ideasonboard.com>", "References": "<20201103155025.5948-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 6/7] qcam: viewfinder_gl: Store textures\n\tin 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>\n---\n src/qcam/viewfinder_gl.cpp | 37 +++++++++++++++++--------------------\n src/qcam/viewfinder_gl.h | 5 ++---\n 2 files changed, 19 insertions(+), 23 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..17c824a69e39 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@@ -82,9 +83,7 @@ private:\n \tGLuint textureUniformV_;\n \tGLuint textureUniformY_;\n \tGLuint textureUniformStepX_;\n-\tQOpenGLTexture textureU_;\n-\tQOpenGLTexture textureV_;\n-\tQOpenGLTexture textureY_;\n+\tstd::array<std::unique_ptr<QOpenGLTexture>, 3> textures_;\n \tunsigned int horzSubSample_;\n \tunsigned int vertSubSample_;\n \n", "prefixes": [ "libcamera-devel", "6/7" ] }