{"id":25428,"url":"https://patchwork.libcamera.org/api/patches/25428/?format=json","web_url":"https://patchwork.libcamera.org/patch/25428/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20251210005354.44726-12-bryan.odonoghue@linaro.org>","date":"2025-12-10T00:53:39","name":"[v7,11/26] libcamera: shaders: Fix input sampling when width != stride","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3df1df93503916bca4650f3119d0f2e2386c3369","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25428/mbox/","series":[{"id":5645,"url":"https://patchwork.libcamera.org/api/series/5645/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5645","date":"2025-12-10T00:53:28","name":"Add GLES 2.0 GPUISP to libcamera","version":7,"mbox":"https://patchwork.libcamera.org/series/5645/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25428/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25428/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 5B944C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Dec 2025 00:54:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 25CE761473;\n\tWed, 10 Dec 2025 01:54:47 +0100 (CET)","from mail-pf1-x430.google.com (mail-pf1-x430.google.com\n\t[IPv6:2607:f8b0:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C590B6144E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Dec 2025 01:54:45 +0100 (CET)","by mail-pf1-x430.google.com with SMTP id\n\td2e1a72fcca58-7f0da2dfeaeso1327938b3a.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 09 Dec 2025 16:54:45 -0800 (PST)","from inspiron14p-linux (p96936b06.osaknt01.ap.so-net.ne.jp.\n\t[150.147.107.6]) by smtp.gmail.com with ESMTPSA id\n\t41be03b00d2f7-bf6875cc8eesm16057762a12.16.2025.12.09.16.54.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 09 Dec 2025 16:54:43 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"Ic7AuhRa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1765328084; x=1765932884;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=YOU8yzvJmLe2CYSAv2DGpWHlxVqrCoB7v5e5gKZ8hTI=;\n\tb=Ic7AuhRaAotFmUBEjLiS1xt/fE3r8QXWyKsM9MIq3yku8ovEBed5ZLtY4bIxT5sr11\n\t5MDPOvEilwbuAzAcCUZxlQfECpj7863BI2uHsfdTG31HlESpm3UmkwN40xnb2DhnA0Ng\n\tesKGVQAT8hN25uxpOkapWKhFhlxTPQ2w9wb5M8JFPgRxFDa1YjunD6SYDVvy/F/6+gHj\n\tzft0iPFaoDhpyQwM8dprSOs1u2VLFxmTQo+x5JoYlXUF8nEkwCdlH4Oj+Dl0s6TaZfaz\n\tm97lRg0gGw8ipMmJvm/QAb9THr5u38FuO8f1QdPm6wDI/kncyl9Z7YtnRuoUxSV7luCR\n\t3eQg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1765328084; x=1765932884;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=YOU8yzvJmLe2CYSAv2DGpWHlxVqrCoB7v5e5gKZ8hTI=;\n\tb=aBycxRuyNc8FM1rMT4ca6DXs1zVDZgZ+UkTKlbRnDH7j+SYHAmJH64ZkxGcDKbUmoI\n\tcxom3AwGPM3ifIk8Arjz4qJ8xBx6YN+PVo1XHZrM4BPyBdZGdWGN4qEtVvbmpQbEdUWN\n\tIRgYUi7uugboTOH0UXinl2GDxo1Mpyz9oRO/CO506YqXjbANJ7fbHHHJjvzpdqED8gqw\n\tTn1cwfVJzLMtIMjZl8GKExLMj2+/rATw53AW9iEqoqzOcSBmzWiWtOe3L9yke9T74xzq\n\tqLYbtZKMOzFjM0SQoPRFGI3/TC7GcTGDBew/yLua5HEz14KDBNKlO1fQ9mGaN+gnQ456\n\tkbYA==","X-Gm-Message-State":"AOJu0Yw90C5wKOAou17/717FuKnbNgjJgSoavrzSNtVQ63RhZ6Ius0TV\n\tm4gZAe8Exoqo+ujrL19AOcnlJYq+4+olHpVJk585FwMgBGqnIr+uXhLdQ7ZgMl1ElSJv8aHVZl0\n\tWkzmw","X-Gm-Gg":"ASbGncvBha0wmpaNyLAkEziyFHY/Bh+Nx271wAfuvSoEkO7LNqogFS6mKvVA4+T6Ctx\n\tQqtrK8NZQkXS+7YSStthB4pKMgq0jF1gQYwl8m8aZpnO3I4MhgJk9oWIfwzltEBAL7FFahZz0Nm\n\tbox9/zRgS8rrZbBnyjss3WsFAfX56mgGJol2weMlkKdJtgkypjKeMSQY5zfH6zV6bRvDCOVAhjG\n\t2yxCwnWgBJNvaVx57z8Rt4PGnA7t2j63ovLotV9UXhtMF/NYReLT24thtiRG70bX03Nv353EWXo\n\tFTTj2xF9C7sOI2f8yVph7hBQW4qVSftV3bq/OfvBqXqnjReG0GoArjYlvQJMrBqyf+I7IzuN724\n\tvSBIB0iEJDRvMMxUiZBTtYmeXyWxn7RvgwMMZMJ+AQbldN9XWZq5rZyg4RHaleSPddqUgmONlef\n\tJ/btUvLITb/Jj9HGZtX8q4fwdYb/IBosEcXXxwjUN83dwANq+nmCjVDwZ+5E9l6sEO","X-Google-Smtp-Source":"AGHT+IEgnkBt55tcUHxAxpLwzUQaHO5HsAYqJEUwyEq5AJrRC6IZriATljCHKE6bvewu1tlau/V3vw==","X-Received":"by 2002:a05:6a20:7fa0:b0:366:5927:6a09 with SMTP id\n\tadf61e73a8af0-366e03d6b9emr542265637.12.1765328084118; \n\tTue, 09 Dec 2025 16:54:44 -0800 (PST)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz, Hans de Goede <johannes.goede@oss.qualcomm.com>,\n\tMilan Zamazal <mzamazal@redhat.com>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>","Subject":"[PATCH v7 11/26] libcamera: shaders: Fix input sampling when width\n\t!= stride","Date":"Wed, 10 Dec 2025 00:53:39 +0000","Message-ID":"<20251210005354.44726-12-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251210005354.44726-1-bryan.odonoghue@linaro.org>","References":"<20251210005354.44726-1-bryan.odonoghue@linaro.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"From: Hans de Goede <johannes.goede@oss.qualcomm.com>\n\nWhen bayer_unpacked.vert is calculating the center and x/yCoord values\nstride != width is taken into account for x/yCoord deltas since it is taken\ninto account by debayer_egl when setting the x part of tex_step uniform.\n\nBut it is not taken into account for the center.x which is just directly\ncopied from textureIn, leading to the input width sampling covering\nthe entire input stride instead of just covering the input width.\n\nUse the existing and currently unused stride_factor uniform to pass\nthe width/stride ratio and correct center.x for this. This fixes\nthe misrendering seen on x86 laptops which is caused by the CSI2 receiver\nthere requiring a stride which is a multiple of 32 often leading to\nstride != width.\n\nSigned-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/libcamera/shaders/bayer_unpacked.vert | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/shaders/bayer_unpacked.vert b/src/libcamera/shaders/bayer_unpacked.vert\nindex fb5109eee..423dde0fa 100644\n--- a/src/libcamera/shaders/bayer_unpacked.vert\n+++ b/src/libcamera/shaders/bayer_unpacked.vert\n@@ -21,7 +21,7 @@ attribute vec2 textureIn;\n \n uniform mat4 proj_matrix;\n \n-uniform vec2 tex_size;\t/* The texture size in pixels */\n+uniform vec2 tex_size;  /* The texture size in pixels */\n uniform vec2 tex_step;\n \n /** Pixel position of the first red pixel in the */\n@@ -40,8 +40,10 @@ varying vec4            xCoord;\n /** of the adjacent pixels.*/\n varying vec4            yCoord;\n \n+uniform float stride_factor;\n+\n void main(void) {\n-    center.xy = textureIn;\n+    center.xy = vec2(textureIn.x * stride_factor, textureIn.y);\n     center.zw = textureIn * tex_size + tex_bayer_first_red;\n \n     xCoord = center.x + vec4(-2.0 * tex_step.x,\n","prefixes":["v7","11/26"]}