{"id":9638,"url":"https://patchwork.libcamera.org/api/1.1/patches/9638/?format=json","web_url":"https://patchwork.libcamera.org/patch/9638/","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":"<20200916145254.1644-3-laurent.pinchart@ideasonboard.com>","date":"2020-09-16T14:52:49","name":"[libcamera-devel,2/7] qcam: viewfinder_gl: Don't store texture IDs in class members","commit_ref":"52f2581709365992ae54430f2b9563269c2fbfce","pull_url":null,"state":"accepted","archived":false,"hash":"3ae577ee1b85b3c771de43480deb1dd6a7e5e498","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9638/mbox/","series":[{"id":1293,"url":"https://patchwork.libcamera.org/api/1.1/series/1293/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1293","date":"2020-09-16T14:52:47","name":"qcam: Accelerate packed YUV rendering with OpenGL","version":1,"mbox":"https://patchwork.libcamera.org/series/1293/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9638/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9638/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 52F58C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Sep 2020 14:53:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2081262E75;\n\tWed, 16 Sep 2020 16:53:57 +0200 (CEST)","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 D63B760533\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Sep 2020 16:53:55 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CE58F57F;\n\tWed, 16 Sep 2020 16:53:42 +0200 (CEST)"],"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=\"SFhthe73\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600268023;\n\tbh=0AK0kfDsGCE8d8n04+QvYEIYL1/BcMeFDFNlR429Cu0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SFhthe73P25sAk7mFj5tVGBZCJLOduonzgH5AcAuX6plAd6kG4oxXIUbho+JBPqzn\n\ti9oGNz1f3KFNDMTQSA25lLLYqGaPuzMG9/Numb00WX+bfYID8GwDWiPocarCCgdMhL\n\tiRIVcmpW0qoodK3obz5jo9Vp0pfUE3KJVMp8fpA8=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 16 Sep 2020 17:52:49 +0300","Message-Id":"<20200916145254.1644-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200916145254.1644-1-laurent.pinchart@ideasonboard.com>","References":"<20200916145254.1644-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 2/7] qcam: viewfinder_gl: Don't store\n\ttexture IDs in class members","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":"The texture IDs can easily and cheaply be retrieved from the textures,\nthere's no need to store them in class members.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/viewfinder_gl.cpp | 23 ++++++++++-------------\n src/qcam/viewfinder_gl.h   |  5 +----\n 2 files changed, 11 insertions(+), 17 deletions(-)","diff":"diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\nindex fbe21dcf1ad2..18ebe46fe2f9 100644\n--- a/src/qcam/viewfinder_gl.cpp\n+++ b/src/qcam/viewfinder_gl.cpp\n@@ -229,15 +229,12 @@ bool ViewFinderGL::createFragmentShader()\n \tif (!textureV_.isCreated())\n \t\ttextureV_.create();\n \n-\tid_y_ = textureY_.textureId();\n-\tid_u_ = textureU_.textureId();\n-\tid_v_ = textureV_.textureId();\n \treturn true;\n }\n \n-void ViewFinderGL::configureTexture(unsigned int id)\n+void ViewFinderGL::configureTexture(QOpenGLTexture &texture)\n {\n-\tglBindTexture(GL_TEXTURE_2D, id);\n+\tglBindTexture(GL_TEXTURE_2D, texture.textureId());\n \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n@@ -303,7 +300,7 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::NV42:\n \t\t/* Activate texture Y */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(id_y_);\n+\t\tconfigureTexture(textureY_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -317,7 +314,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture UV/VU */\n \t\tglActiveTexture(GL_TEXTURE1);\n-\t\tconfigureTexture(id_u_);\n+\t\tconfigureTexture(textureU_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RG,\n@@ -333,7 +330,7 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::YUV420:\n \t\t/* Activate texture Y */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(id_y_);\n+\t\tconfigureTexture(textureY_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -347,7 +344,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture U */\n \t\tglActiveTexture(GL_TEXTURE1);\n-\t\tconfigureTexture(id_u_);\n+\t\tconfigureTexture(textureU_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -361,7 +358,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture V */\n \t\tglActiveTexture(GL_TEXTURE2);\n-\t\tconfigureTexture(id_v_);\n+\t\tconfigureTexture(textureV_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -377,7 +374,7 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::YVU420:\n \t\t/* Activate texture Y */\n \t\tglActiveTexture(GL_TEXTURE0);\n-\t\tconfigureTexture(id_y_);\n+\t\tconfigureTexture(textureY_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -391,7 +388,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture V */\n \t\tglActiveTexture(GL_TEXTURE2);\n-\t\tconfigureTexture(id_v_);\n+\t\tconfigureTexture(textureV_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\n@@ -405,7 +402,7 @@ void ViewFinderGL::doRender()\n \n \t\t/* Activate texture U */\n \t\tglActiveTexture(GL_TEXTURE1);\n-\t\tconfigureTexture(id_u_);\n+\t\tconfigureTexture(textureU_);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t     0,\n \t\t\t     GL_RED,\ndiff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h\nindex 69502b7a543e..825af1c13cb7 100644\n--- a/src/qcam/viewfinder_gl.h\n+++ b/src/qcam/viewfinder_gl.h\n@@ -53,7 +53,7 @@ protected:\n private:\n \tbool selectFormat(const libcamera::PixelFormat &format);\n \n-\tvoid configureTexture(unsigned int id);\n+\tvoid configureTexture(QOpenGLTexture &texture);\n \tbool createFragmentShader();\n \tbool createVertexShader();\n \tvoid removeShader();\n@@ -78,9 +78,6 @@ private:\n \tQString vertexShaderSrc_;\n \n \t/* YUV texture planars and parameters */\n-\tGLuint id_u_;\n-\tGLuint id_v_;\n-\tGLuint id_y_;\n \tGLuint textureUniformU_;\n \tGLuint textureUniformV_;\n \tGLuint textureUniformY_;\n","prefixes":["libcamera-devel","2/7"]}