[{"id":12549,"web_url":"https://patchwork.libcamera.org/comment/12549/","msgid":"<20200916150221.GF1850958@oden.dyn.berto.se>","date":"2020-09-16T15:02:21","subject":"Re: [libcamera-devel] [PATCH 2/7] qcam: viewfinder_gl: Don't store\n\ttexture IDs in class members","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2020-09-16 17:52:49 +0300, Laurent Pinchart wrote:\n> The texture IDs can easily and cheaply be retrieved from the textures,\n> there's no need to store them in class members.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/qcam/viewfinder_gl.cpp | 23 ++++++++++-------------\n>  src/qcam/viewfinder_gl.h   |  5 +----\n>  2 files changed, 11 insertions(+), 17 deletions(-)\n> \n> diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\n> index 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,\n> diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h\n> index 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> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 0ABAEC3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Sep 2020 15:02:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B5A860533;\n\tWed, 16 Sep 2020 17:02:24 +0200 (CEST)","from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 046CE60533\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Sep 2020 17:02:23 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id m5so7346179lfp.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Sep 2020 08:02:22 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tm22sm5409720lji.36.2020.09.16.08.02.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 16 Sep 2020 08:02:21 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"fexhLFRl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=B9TZi2sro/lwcnxXQNI1xt9zpw6PpSTXjmc7+8ZVzSI=;\n\tb=fexhLFRlTTgPmlyY/97pDEJ6CCtN/7HCXdzNP2qIkZpbNsVSfxzdYqcHMUiDRUgul8\n\t3RKbxt9gP+eCRbZhpukFlMQ1QepyMNZwf3LfLKJYu9MORYJNTcbtMObsuyo+aZuytbjk\n\tsXdDIemyn1FOdk2mKfVNqkiQ2DTYI/ve8S8IFRDAWiT3NjTYJ2/aQBRIgDlipHKHIFpb\n\t2V+P4XySw9Otl38NVnUajdpAbxuYrf+am9d1KWTxEZf5OKEXKz1vSqWYv27TUCu0I9TR\n\tgEecceJxHAT51FJA523XdR7b8u1hjQV5x2oivEBD0J91ibkltHqu235RUO/o5uce9vSF\n\t9BMQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=B9TZi2sro/lwcnxXQNI1xt9zpw6PpSTXjmc7+8ZVzSI=;\n\tb=asU1yQzN0A35SxmpGnKrISz3qlDiUx5+G3dyIww9bHH2cwiS6ru7CZ5+A0kNK6jX32\n\tFbYU/sIp1N3NB+T2h7DFy7thGtOJzijMttlRIn8TfopMOZg4Ay1lLkQ4ZE8c46BhUlue\n\tm182Dmexat209kaspInIg76gO7quNEKQa1g/IgZTNIV4UiXiX/0HnYVWFT2pkcYJPb8L\n\tCvDf83OVUEeI962n1rnbZxNtKggfpH5nzvDJCa9Uqg/XhDQoRk5+6ea0OaWzWwKu4qwy\n\t3sxYmHJGiALzoNYI1/DKn2zAjE9NCL8xSw4Nay1nNxU731Ih3Mng74hkgp3+RyfMezSe\n\taFVQ==","X-Gm-Message-State":"AOAM530Z851ROhSXAnYlaI42Rp0JVSL/qjKhVSjR8HyjtPkkVl4mEnXH\n\tWFQDENROgvWWFAT3UP1DAhNyUA==","X-Google-Smtp-Source":"ABdhPJzzDrJU7xL6VtUwie74Su2AAJ3Amu1k82E3DtjV8hJtz2u03tCJdbg1fEDHbQ0BTHJg28eKSw==","X-Received":"by 2002:a05:6512:3702:: with SMTP id\n\tz2mr7672157lfr.35.1600268542389; \n\tWed, 16 Sep 2020 08:02:22 -0700 (PDT)","Date":"Wed, 16 Sep 2020 17:02:21 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200916150221.GF1850958@oden.dyn.berto.se>","References":"<20200916145254.1644-1-laurent.pinchart@ideasonboard.com>\n\t<20200916145254.1644-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200916145254.1644-3-laurent.pinchart@ideasonboard.com>","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]