From patchwork Tue Oct 27 12:28:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Remy Alipoursafari X-Patchwork-Id: 28645 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 544DDC324C for ; Tue, 27 Oct 2026 12:30:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 083936904B; Tue, 27 Oct 2026 13:30:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=remy.alipoursafari@collabora.com header.b="fFsRodmB"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1350B69046 for ; Tue, 27 Oct 2026 13:30:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1793104234; cv=none; d=zohomail.com; s=zohoarc; b=c8v89fomAUQTagz3MIqVtl2ALU6R3AlVsbBnwCboSz2Resj6SqI0veRTGCfXdbJK/g/9BAWKLXxy9gC++NGkux44aSO/EaivuBs0seqELgpYzsb8Zcf6QvfSk+ht4I32wgby8oy/djrtb6c3tIRbMqGb/JpHWSORX/0tOdXMydk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793104234; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=KfWGC28mPB3Q4P7KRyL1S+sj//stpouB6+RdnTJXuTE=; b=Mx/imD1wkM9q9c/aUh+DZLqXqtIefZ79jT3PPlzMRcDsd5aLTz3YumcxszrsAK9VnMRWZ70qYJH7EGuk/b7Ihr5zWV65PppkXYmgoB/PjTZtR6kT/i0WXSXrNFdAhZzVqhAf/8/oBmVUGMl68KeO87lnXEwKhVzsvGVOC+ektDM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=remy.alipoursafari@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1793104234; s=zohomail; d=collabora.com; i=remy.alipoursafari@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=KfWGC28mPB3Q4P7KRyL1S+sj//stpouB6+RdnTJXuTE=; b=fFsRodmBT/417UQjSPkhp0y55yykORH0D9m9EbcKzQ1VLgQEdv3duSbfkvHJ+qKI 1jFOJfxXEVrZbZlTqCvkosETLUh4UeCU8m4aOMgMDlN0xbKdymHSXCtP91G77Y/BGD4 9hRYU12htIIHwDdxWafKEQupxb/Li6Ijf4gd+g/g= Received: by smtp.zohomail.com with SMTPS id 17931042290970.348156925491935; Tue, 27 Oct 2026 05:30:29 -0700 (PDT) From: Remy Alipoursafari To: libcamera-devel@lists.libcamera.org Cc: jacopo.mondi@ideasonboard.com, laurent.pinchart@ideasonboard.com, Remy Alipoursafari Subject: [PATCH v2 1/3] libcamera: pipeline: simple: Enable SoftISP for the Rockchip CIF Date: Wed, 28 Oct 2026 01:28:31 +1300 Message-ID: <20261027122844.56616-2-remy.alipoursafari@collabora.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261027122844.56616-1-remy.alipoursafari@collabora.com> References: <20261027122844.56616-1-remy.alipoursafari@collabora.com> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Tested with an IMX415 on the Radxa Rock 5B. Signed-off-by: Remy Alipoursafari --- src/libcamera/pipeline/simple/simple.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 35c29cec..c5cdfe29 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -264,6 +264,7 @@ static const SimplePipelineInfo supportedDevices[] = { { "mtk-seninf", { { "mtk-mdp", 3 } }, false }, { "mxc-isi", {}, false }, { "qcom-camss", {}, true }, + { "rockchip-cif", {}, true }, { "sun6i-csi", {}, false }, }; From patchwork Tue Oct 27 12:28:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Remy Alipoursafari X-Patchwork-Id: 28646 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E8DADC324C for ; Tue, 27 Oct 2026 12:30:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 994A069057; Tue, 27 Oct 2026 13:30:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=remy.alipoursafari@collabora.com header.b="G2eKCyLg"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A5B2E69046 for ; Tue, 27 Oct 2026 13:30:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1793104238; cv=none; d=zohomail.com; s=zohoarc; b=I1whqNhI5BNkxrndOA8Q1TBw82tWm0Ve65ZUQuTWXHKM3Ur4uS4+ep26ZfA7ZGRWynJ0jFDNPYqGFOaNd11trgq2pd/s+5+Fbz0DlAU5hUKY1h6tqrPM0fczu3w9ofgoFgok5fRgOEizcKEdRS0tNcEizkzkkGn3GqMxDqLdsXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793104238; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=acK5Aj1U2hiphPrnkrr+0hBgAQZepZN34ksg8+I1+wk=; b=kpE6oTbPccKxE8jnCVGp56b1hdoB4IMUK/jhIsDFTqkkm1lnBrzsOP4todeYu0cYAQSHTOP0lwQT99I0cBnxMWCq9Cu8VEZYR6jIqRJXZqYh1HdE56i7pYVmWXIpAYTklGGJatHwbb8xx8Kg1h+5N1JixLlzASHI1Io5X3uJO3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=remy.alipoursafari@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1793104238; s=zohomail; d=collabora.com; i=remy.alipoursafari@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=acK5Aj1U2hiphPrnkrr+0hBgAQZepZN34ksg8+I1+wk=; b=G2eKCyLg7hWpDLl6ivrQF1Hffhnka+E/C5+GShJlZXfDWjuWLb0bdTF56LCnsTkE OsEhJ5PitSGYdWK5IbQ6apE2jj8MkcUU3IZVBw6kus8qe2BRkJpQwo0kqfdvp85U5c2 iUCzDzHqdZ4i31T5ucMSKDKN/B9tlV60/eSh1DV8= Received: by smtp.zohomail.com with SMTPS id 1793104235037343.41162072670033; Tue, 27 Oct 2026 05:30:35 -0700 (PDT) From: Remy Alipoursafari To: libcamera-devel@lists.libcamera.org Cc: jacopo.mondi@ideasonboard.com, laurent.pinchart@ideasonboard.com, Remy Alipoursafari Subject: [PATCH v2 2/3] libcamera: software_isp: debayer_egl: Check for errors when getting shader variable locations Date: Wed, 28 Oct 2026 01:28:32 +1300 Message-ID: <20261027122844.56616-3-remy.alipoursafari@collabora.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261027122844.56616-1-remy.alipoursafari@collabora.com> References: <20261027122844.56616-1-remy.alipoursafari@collabora.com> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" According to the OpenGL spec, glGet{Attrib,Uniform}Location return -1 if the name passed does not correspond to an active attribute/uniform variable in the shader program. This acts as an early check in case there is something wrong with the shader program. Signed-off-by: Remy Alipoursafari --- src/libcamera/software_isp/debayer_egl.cpp | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 33933b11..5236e1f9 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -130,6 +130,25 @@ int DebayerEGL::getShaderVariableLocations(void) << " tex_bayer_first_red " << textureUniformBayerFirstRed_ << " proj_matrix " << textureUniformProjMatrix_ << " tex_lsc " << textureUniformLsc_; + + if ( + attributeVertex_ == -1 || + attributeTexture_ == -1 || + textureUniformBayerDataIn_ == -1 || + awbUniformDataIn_ == -1 || + ccmUniformDataIn_ == -1 || + blackLevelUniformDataIn_ == -1 || + gammaUniformDataIn_ == -1 || + contrastExpUniformDataIn_ == -1 || + textureUniformStep_ == -1 || + textureUniformSize_ == -1 || + textureUniformStrideFactor_ == -1 || + textureUniformBayerFirstRed_ == -1 || + textureUniformProjMatrix_ == -1 || + (lscEnabled_ && textureUniformLsc_ == -1)) { + return -1; + } + return 0; } @@ -274,7 +293,12 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm return -ENODEV; } - return getShaderVariableLocations(); + if (getShaderVariableLocations() != 0) { + LOG(Debayer, Error) << "Find shader variables fail"; + return -ENODEV; + } + + return 0; } int DebayerEGL::configure(const StreamConfiguration &inputCfg, From patchwork Tue Oct 27 12:28:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Remy Alipoursafari X-Patchwork-Id: 28647 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 97A0CC324C for ; Tue, 27 Oct 2026 12:30:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4EF906905A; Tue, 27 Oct 2026 13:30:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=remy.alipoursafari@collabora.com header.b="An/9vOIV"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9CF8D69046 for ; Tue, 27 Oct 2026 13:30:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1793104242; cv=none; d=zohomail.com; s=zohoarc; b=UJwil+4LXpK7DmNX78y67JXpb/g7KQ6xp7jH1uE5w6HJrZwM80WUacT9W5fhWyoK5GdCqBtESbkPkCXl3TU6KvfIu19vMXIgC2RV7Fub8acUG5SlHbBNO2TAkIg0DvFZJnMpZYMKqyoCGOV88WxVfh+u1S05oBuz17UQ3uRt7DU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793104242; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=hliVJPPJEhEoMnY/bxNdfqV4mjTsW3Of13AwFYwwVfs=; b=hM4P/H++KO3YoFbGLC1HzQG1fpYyzXooOZfEnRu0bKPY21Z3MUUprp1P6x6Jz/1dGmoUWx9uupDIR+NI6oI23jxgDIKb9E3bmbr/hsqJnm90aKuwrz7Y70K4Hs/toRDT7aCN0ppThrEvMHgNpU0RsoEHdR8xLSxopxLMXexybmI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=remy.alipoursafari@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1793104242; s=zohomail; d=collabora.com; i=remy.alipoursafari@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=hliVJPPJEhEoMnY/bxNdfqV4mjTsW3Of13AwFYwwVfs=; b=An/9vOIVgYUSdbyW1CjbxNX8TZTGopTxnxU/9VDK61rlp6ZMpHcU5mSpm63ZF8Bu YJcixWtG+ZZmoAMxhASrrYCLHch53Z1+imVJZ0eM49diWWkpNa76a5esHPlr2TCENZI fpXKxvT7938jQHnzx1M20/hmqYm62557aSzPd3K8= Received: by smtp.zohomail.com with SMTPS id 179310423759764.61029320206933; Tue, 27 Oct 2026 05:30:37 -0700 (PDT) From: Remy Alipoursafari To: libcamera-devel@lists.libcamera.org Cc: jacopo.mondi@ideasonboard.com, laurent.pinchart@ideasonboard.com, Remy Alipoursafari Subject: [PATCH v2 3/3] libcamera: software_isp: debayer_egl: Only assign static shader variables once Date: Wed, 28 Oct 2026 01:28:33 +1300 Message-ID: <20261027122844.56616-4-remy.alipoursafari@collabora.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261027122844.56616-1-remy.alipoursafari@collabora.com> References: <20261027122844.56616-1-remy.alipoursafari@collabora.com> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Both uniforms and attributes in GLSL do not change from one shader invocation to another, allowing static value assignments to be moved out of the main loop, and only be assigned on start. This results in only a negligible performance increase. Signed-off-by: Remy Alipoursafari --- src/libcamera/software_isp/debayer_egl.cpp | 21 +++++++++++++-------- src/libcamera/software_isp/debayer_egl.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 5236e1f9..1386cb54 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -298,6 +298,8 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm return -ENODEV; } + setShaderUniformValues(); + return 0; } @@ -408,7 +410,7 @@ uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const return info.stride(size.width, 0, 256); } -void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerParams ¶ms) +void DebayerEGL::setShaderUniformValues() { /* * Raw Bayer 8-bit, and packed raw Bayer 10-bit/12-bit formats @@ -459,13 +461,6 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara glVertexAttribPointer(attributeTexture_, 2, GL_FLOAT, GL_TRUE, 2 * sizeof(GLfloat), tcoordinates); - /* - * Set the sampler2D to the respective texture unit for each texutre - * To simultaneously sample multiple textures we need to use multiple - * texture units - */ - glUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_); - /* * These values are: * firstRed = tex_bayer_first_red - bayer_8.vert @@ -496,6 +491,16 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara << " textureUniformStep_.y " << Step[1] << " textureUniformStrideFactor_ " << Stride << " textureUniformProjMatrix_ " << textureUniformProjMatrix_; +} + +void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerParams ¶ms) +{ + /* + * Set the sampler2D to the respective texture unit for each texutre + * To simultaneously sample multiple textures we need to use multiple + * texture units + */ + glUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_); /* Pre-transpose matrix for GLES 2.0. */ Matrix ccm = params.combinedMatrix.transpose(); diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h index cbbc6a45..45692aa4 100644 --- a/src/libcamera/software_isp/debayer_egl.h +++ b/src/libcamera/software_isp/debayer_egl.h @@ -66,6 +66,7 @@ private: static int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config); int initBayerShaders(PixelFormat inputFormat, PixelFormat outputFormat); int getShaderVariableLocations(); + void setShaderUniformValues(); void setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams ¶ms); int debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms, std::optional *mappedInputBuffer, std::optional *inputBufferDmaSyncer);