Patch Detail
Show a patch.
GET /api/patches/13176/?format=api
{ "id": 13176, "url": "https://patchwork.libcamera.org/api/patches/13176/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13176/", "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": "<20210803092310.11956-1-laurent.pinchart@ideasonboard.com>", "date": "2021-08-03T09:23:10", "name": "[libcamera-devel] qcam: Support OpenGL ES 2.0", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "35e001fb6ef7a4b714c8114bda95ef3677216c19", "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/13176/mbox/", "series": [ { "id": 2295, "url": "https://patchwork.libcamera.org/api/series/2295/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2295", "date": "2021-08-03T09:23:10", "name": "[libcamera-devel] qcam: Support OpenGL ES 2.0", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2295/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13176/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13176/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 F3FCAC3232\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 3 Aug 2021 09:23:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B3EA687D8;\n\tTue, 3 Aug 2021 11:23:29 +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 C44AB6026D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 3 Aug 2021 11:23:27 +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 2908ADD;\n\tTue, 3 Aug 2021 11:23:27 +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=\"aulJ0heh\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627982607;\n\tbh=w1PYeySMWK/P4PQu2BoAssinVMj0TfaD9O0UhfW9gJg=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=aulJ0hehGwVFcjl8NLNhwPdwLhtYDr/aSfIuRY44jd+5jT9QygKwhjESknxlvhqGM\n\tyUmC4oDLaZ7r/ldszw9shyL2kzgUdq2Xb3ztvHtqtDImGtpXIVATsmEPOLYUTi6oS2\n\t3f+DcKb51ttyJsG/ZqdlpDk7YAWxW8nPdoHEA2X8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 3 Aug 2021 12:23:10 +0300", "Message-Id": "<20210803092310.11956-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] qcam: Support OpenGL ES 2.0", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The GL_RG and GL_RED texture formats are not supported in OpenGL ES\nprior to 3.0. In order to be compatible with OpenGL ES 2.0, use\nGL_LUMINANCE_ALPHA and GL_LUMINANCE instead. The shader code needs to be\nupdated accordingly for GL_RG, as the second component is now stored in\nalpha component instead of the green component. Usage of the red\ncomponent is fine, the luminance value is stored in the red, green and\nblue components.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nTested with vivid, using NV12, YV420, YVU420 and SGRBG8, which should\ncover all code paths.\n---\n src/qcam/assets/shader/YUV_2_planes.frag | 4 +--\n src/qcam/viewfinder_gl.cpp | 40 ++++++++++++------------\n 2 files changed, 22 insertions(+), 22 deletions(-)", "diff": "diff --git a/src/qcam/assets/shader/YUV_2_planes.frag b/src/qcam/assets/shader/YUV_2_planes.frag\nindex 125f1c850a33..254463c05cac 100644\n--- a/src/qcam/assets/shader/YUV_2_planes.frag\n+++ b/src/qcam/assets/shader/YUV_2_planes.frag\n@@ -26,9 +26,9 @@ void main(void)\n \tyuv.x = texture2D(tex_y, textureOut).r - 0.063;\n #if defined(YUV_PATTERN_UV)\n \tyuv.y = texture2D(tex_u, textureOut).r - 0.500;\n-\tyuv.z = texture2D(tex_u, textureOut).g - 0.500;\n+\tyuv.z = texture2D(tex_u, textureOut).a - 0.500;\n #elif defined(YUV_PATTERN_VU)\n-\tyuv.y = texture2D(tex_u, textureOut).g - 0.500;\n+\tyuv.y = texture2D(tex_u, textureOut).a - 0.500;\n \tyuv.z = texture2D(tex_u, textureOut).r - 0.500;\n #else\n #error Invalid pattern\ndiff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp\nindex e7c8620c7024..77a6437e56fd 100644\n--- a/src/qcam/viewfinder_gl.cpp\n+++ b/src/qcam/viewfinder_gl.cpp\n@@ -481,11 +481,11 @@ void ViewFinderGL::doRender()\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 GL_LUMINANCE,\n \t\t\t size_.width(),\n \t\t\t size_.height(),\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_);\n \t\tshaderProgram_.setUniformValue(textureUniformY_, 0);\n@@ -495,11 +495,11 @@ void ViewFinderGL::doRender()\n \t\tconfigureTexture(*textures_[1]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n-\t\t\t GL_RG,\n+\t\t\t GL_LUMINANCE_ALPHA,\n \t\t\t size_.width() / horzSubSample_,\n \t\t\t size_.height() / vertSubSample_,\n \t\t\t 0,\n-\t\t\t GL_RG,\n+\t\t\t GL_LUMINANCE_ALPHA,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_ + size_.width() * size_.height());\n \t\tshaderProgram_.setUniformValue(textureUniformU_, 1);\n@@ -511,11 +511,11 @@ void ViewFinderGL::doRender()\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 GL_LUMINANCE,\n \t\t\t size_.width(),\n \t\t\t size_.height(),\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_);\n \t\tshaderProgram_.setUniformValue(textureUniformY_, 0);\n@@ -525,11 +525,11 @@ void ViewFinderGL::doRender()\n \t\tconfigureTexture(*textures_[1]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t size_.width() / horzSubSample_,\n \t\t\t size_.height() / vertSubSample_,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_ + size_.width() * size_.height());\n \t\tshaderProgram_.setUniformValue(textureUniformU_, 1);\n@@ -539,11 +539,11 @@ void ViewFinderGL::doRender()\n \t\tconfigureTexture(*textures_[2]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t size_.width() / horzSubSample_,\n \t\t\t size_.height() / vertSubSample_,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_ + size_.width() * size_.height() * 5 / 4);\n \t\tshaderProgram_.setUniformValue(textureUniformV_, 2);\n@@ -555,11 +555,11 @@ void ViewFinderGL::doRender()\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 GL_LUMINANCE,\n \t\t\t size_.width(),\n \t\t\t size_.height(),\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_);\n \t\tshaderProgram_.setUniformValue(textureUniformY_, 0);\n@@ -569,11 +569,11 @@ void ViewFinderGL::doRender()\n \t\tconfigureTexture(*textures_[2]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t size_.width() / horzSubSample_,\n \t\t\t size_.height() / vertSubSample_,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_ + size_.width() * size_.height());\n \t\tshaderProgram_.setUniformValue(textureUniformV_, 2);\n@@ -583,11 +583,11 @@ void ViewFinderGL::doRender()\n \t\tconfigureTexture(*textures_[1]);\n \t\tglTexImage2D(GL_TEXTURE_2D,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t size_.width() / horzSubSample_,\n \t\t\t size_.height() / vertSubSample_,\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_ + size_.width() * size_.height() * 5 / 4);\n \t\tshaderProgram_.setUniformValue(textureUniformU_, 1);\n@@ -674,18 +674,18 @@ void ViewFinderGL::doRender()\n \tcase libcamera::formats::SRGGB12_CSI2P:\n \t\t/*\n \t\t * Raw Bayer 8-bit, and packed raw Bayer 10-bit/12-bit formats\n-\t\t * are stored in GL_RED texture.\n-\t\t * The texture width is equal to the stride.\n+\t\t * are stored in GL_LUMINANCE texture. The texture width is\n+\t\t * equal to the stride.\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 GL_LUMINANCE,\n \t\t\t stride_,\n \t\t\t size_.height(),\n \t\t\t 0,\n-\t\t\t GL_RED,\n+\t\t\t GL_LUMINANCE,\n \t\t\t GL_UNSIGNED_BYTE,\n \t\t\t data_);\n \t\tshaderProgram_.setUniformValue(textureUniformY_, 0);\n", "prefixes": [ "libcamera-devel" ] }