[{"id":34003,"web_url":"https://patchwork.libcamera.org/comment/34003/","msgid":"<20250422234009.GA17813@pendragon.ideasonboard.com>","date":"2025-04-22T23:40:09","subject":"Re: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane\n\tgeneric texture","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Mon, Apr 21, 2025 at 05:51:06PM +0200, Barnabás Pőcze wrote:\n> Add the `SDLTexture1Plane` type that can be instantiated with\n> an arbitrary SDL pixel format and that uses `SDL_UpdateTexture()`\n> to update the texture using exactly a single plane.\n\nYou can squash patches 2/5, 3/5 and 4/5 together. The commit message can\nbe reworded to explain how SDLTextureYUYV is generalized for later use\nwith other 1-plane formats.\n\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/apps/cam/sdl_texture_1plane.h | 18 ++++++++++++++++++\n>  1 file changed, 18 insertions(+)\n>  create mode 100644 src/apps/cam/sdl_texture_1plane.h\n> \n> diff --git a/src/apps/cam/sdl_texture_1plane.h b/src/apps/cam/sdl_texture_1plane.h\n> new file mode 100644\n> index 000000000..ded35c589\n> --- /dev/null\n> +++ b/src/apps/cam/sdl_texture_1plane.h\n> @@ -0,0 +1,18 @@\n> +#pragma once\n> +\n> +#include <assert.h>\n> +\n> +#include \"sdl_texture.h\"\n> +\n> +class SDLTexture1Plane final : public SDLTexture\n> +{\n> +public:\n> +\tusing SDLTexture::SDLTexture;\n> +\n> +\tvoid update(libcamera::Span<const libcamera::Span<const uint8_t>> data) override\n> +\t{\n> +\t\tassert(data.size() == 1);\n> +\t\tassert(data[0].size_bytes() == std::size_t(rect_.h * stride_));\n> +\t\tSDL_UpdateTexture(ptr_, nullptr, data[0].data(), stride_);\n\nNo need to pass &rect_ as the second argument, like done by\nSDLTextureYUYV ?\n\n> +\t}\n> +};","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 96ADAC327D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Apr 2025 23:40:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C162F68AD4;\n\tWed, 23 Apr 2025 01:40:13 +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 085CA68ACA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Apr 2025 01:40:12 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CB3A816A;\n\tWed, 23 Apr 2025 01:40:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qzRfgiiW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1745365211;\n\tbh=N6JHGKDMF7JrgD/pFDEWZIBO18mQxq+ChDJOUjeiw+A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=qzRfgiiWdvgY93VUNGJ8rV2Cr6Z6s/L6wZl29OR1HQG0I/MTxZGCtPSZfi3g9Pkpp\n\t/qn+FBx8dX9yYSQYuTfbtp6dbONMRgTgTDK7grBIugMUY5dCxhMkdHOTjnxJ4nz0Nn\n\tGZ0cNKp6GEVC6IGSwSI72lgQkjwkRpeVIfXhkp0g=","Date":"Wed, 23 Apr 2025 02:40:09 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane\n\tgeneric texture","Message-ID":"<20250422234009.GA17813@pendragon.ideasonboard.com>","References":"<20250421155109.175930-1-barnabas.pocze@ideasonboard.com>\n\t<20250421155109.175930-3-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250421155109.175930-3-barnabas.pocze@ideasonboard.com>","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>"}},{"id":34026,"web_url":"https://patchwork.libcamera.org/comment/34026/","msgid":"<e5ffdc40-1d15-48f5-97b3-e9191143ba64@ideasonboard.com>","date":"2025-04-24T11:29:54","subject":"Re: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane\n\tgeneric texture","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n\n2025. 04. 23. 1:40 keltezéssel, Laurent Pinchart írta:\n> Hi Barnabás,\n> \n> Thank you for the patch.\n> \n> On Mon, Apr 21, 2025 at 05:51:06PM +0200, Barnabás Pőcze wrote:\n>> Add the `SDLTexture1Plane` type that can be instantiated with\n>> an arbitrary SDL pixel format and that uses `SDL_UpdateTexture()`\n>> to update the texture using exactly a single plane.\n> \n> You can squash patches 2/5, 3/5 and 4/5 together. The commit message can\n> be reworded to explain how SDLTextureYUYV is generalized for later use\n> with other 1-plane formats.\n> \n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>>   src/apps/cam/sdl_texture_1plane.h | 18 ++++++++++++++++++\n>>   1 file changed, 18 insertions(+)\n>>   create mode 100644 src/apps/cam/sdl_texture_1plane.h\n>>\n>> diff --git a/src/apps/cam/sdl_texture_1plane.h b/src/apps/cam/sdl_texture_1plane.h\n>> new file mode 100644\n>> index 000000000..ded35c589\n>> --- /dev/null\n>> +++ b/src/apps/cam/sdl_texture_1plane.h\n>> @@ -0,0 +1,18 @@\n>> +#pragma once\n>> +\n>> +#include <assert.h>\n>> +\n>> +#include \"sdl_texture.h\"\n>> +\n>> +class SDLTexture1Plane final : public SDLTexture\n>> +{\n>> +public:\n>> +\tusing SDLTexture::SDLTexture;\n>> +\n>> +\tvoid update(libcamera::Span<const libcamera::Span<const uint8_t>> data) override\n>> +\t{\n>> +\t\tassert(data.size() == 1);\n>> +\t\tassert(data[0].size_bytes() == std::size_t(rect_.h * stride_));\n>> +\t\tSDL_UpdateTexture(ptr_, nullptr, data[0].data(), stride_);\n> \n> No need to pass &rect_ as the second argument, like done by\n> SDLTextureYUYV ?\n\nAs far as I can see it is only required if only a part of the texture is to be updated,\nand if it is `nullptr, then SDL updates the full size of the texture, which is what\nis wanted here.\n\n   https://github.com/libsdl-org/SDL/blob/3343cb21473ea454261bc4187393aaec9cc3f28f/src/render/SDL_render.c#L2153\n\n\nRegards,\nBarnabás Pőcze\n\n> \n>> +\t}\n>> +};\n>","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 985C3BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Apr 2025 11:30:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D20D68ACD;\n\tThu, 24 Apr 2025 13:30:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 92A4C68AC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Apr 2025 13:29:58 +0200 (CEST)","from [192.168.33.15] (185.221.143.16.nat.pool.zt.hu\n\t[185.221.143.16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 48E9716A;\n\tThu, 24 Apr 2025 13:29:56 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hPM8oEe/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1745494196;\n\tbh=NCbCahOQK3bmFuxKVZXHh4mTbum0oJT0qDg6jzuQBLs=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=hPM8oEe/5uK67AyGEGEuExsvOvsxFj0uoc9HVWmfTmRDCectcH9s6tVtayem2Bdci\n\tq9qhoYdJafYJ9wmOdlu7Qdu0lZxA4kT/4/uM4Licg0ZjyROd7R63h9/I+e64RVDVuA\n\tXmzzA4wyLfszaY6b2+tAD1/WzEj53xZlCJfMh9Nk=","Message-ID":"<e5ffdc40-1d15-48f5-97b3-e9191143ba64@ideasonboard.com>","Date":"Thu, 24 Apr 2025 13:29:54 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane\n\tgeneric texture","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20250421155109.175930-1-barnabas.pocze@ideasonboard.com>\n\t<20250421155109.175930-3-barnabas.pocze@ideasonboard.com>\n\t<20250422234009.GA17813@pendragon.ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250422234009.GA17813@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":34031,"web_url":"https://patchwork.libcamera.org/comment/34031/","msgid":"<20250424142851.GH18085@pendragon.ideasonboard.com>","date":"2025-04-24T14:28:51","subject":"Re: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane\n\tgeneric texture","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nOn Thu, Apr 24, 2025 at 01:29:54PM +0200, Barnabás Pőcze wrote:\n> 2025. 04. 23. 1:40 keltezéssel, Laurent Pinchart írta:\n> > On Mon, Apr 21, 2025 at 05:51:06PM +0200, Barnabás Pőcze wrote:\n> >> Add the `SDLTexture1Plane` type that can be instantiated with\n> >> an arbitrary SDL pixel format and that uses `SDL_UpdateTexture()`\n> >> to update the texture using exactly a single plane.\n> > \n> > You can squash patches 2/5, 3/5 and 4/5 together. The commit message can\n> > be reworded to explain how SDLTextureYUYV is generalized for later use\n> > with other 1-plane formats.\n> > \n> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >> ---\n> >>   src/apps/cam/sdl_texture_1plane.h | 18 ++++++++++++++++++\n> >>   1 file changed, 18 insertions(+)\n> >>   create mode 100644 src/apps/cam/sdl_texture_1plane.h\n> >>\n> >> diff --git a/src/apps/cam/sdl_texture_1plane.h b/src/apps/cam/sdl_texture_1plane.h\n> >> new file mode 100644\n> >> index 000000000..ded35c589\n> >> --- /dev/null\n> >> +++ b/src/apps/cam/sdl_texture_1plane.h\n> >> @@ -0,0 +1,18 @@\n> >> +#pragma once\n> >> +\n> >> +#include <assert.h>\n> >> +\n> >> +#include \"sdl_texture.h\"\n> >> +\n> >> +class SDLTexture1Plane final : public SDLTexture\n> >> +{\n> >> +public:\n> >> +\tusing SDLTexture::SDLTexture;\n> >> +\n> >> +\tvoid update(libcamera::Span<const libcamera::Span<const uint8_t>> data) override\n> >> +\t{\n> >> +\t\tassert(data.size() == 1);\n> >> +\t\tassert(data[0].size_bytes() == std::size_t(rect_.h * stride_));\n> >> +\t\tSDL_UpdateTexture(ptr_, nullptr, data[0].data(), stride_);\n> > \n> > No need to pass &rect_ as the second argument, like done by\n> > SDLTextureYUYV ?\n> \n> As far as I can see it is only required if only a part of the texture is to be updated,\n> and if it is `nullptr, then SDL updates the full size of the texture, which is what\n> is wanted here.\n> \n>    https://github.com/libsdl-org/SDL/blob/3343cb21473ea454261bc4187393aaec9cc3f28f/src/render/SDL_render.c#L2153\n\nIndeed. It seems it was a bug to pass &rect_ to the SDL_UpdateTexture()\ncall. It causes no issue in practice as rect_ always covers the full\nsize of the image in the current code.\n\nCould you drop the rect argument in a separate patch ? It should also be\ndropped from SDL_UpdateNVTexture(), which this series doesn't touch.\n\n> >> +\t}\n> >> +};","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 D7CD6BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Apr 2025 14:28:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F09D68AC5;\n\tThu, 24 Apr 2025 16:28: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 D6F1368AC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Apr 2025 16:28:54 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6182B9CE;\n\tThu, 24 Apr 2025 16:28:52 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UdoydshS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1745504932;\n\tbh=5HR+6YGGSSXeD6aDbMtTgiT8WL3XNBXhqwAuyitUdbE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UdoydshS7dSJrUl3kIBIMIhL/5fTjigbg9wl3aLBC+0JpInx4BJq7nvvptiV0AauH\n\tThvyX4gGHKNYlZivgiwtkdvwqdsj2kVojOgfWW6MqjniB9zvMAwtXNIR8yUcC2W8ie\n\tleDHQlhq5mZgZPZ2jawy5bcIT6sjC2IL/XMhP9cA=","Date":"Thu, 24 Apr 2025 17:28:51 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane\n\tgeneric texture","Message-ID":"<20250424142851.GH18085@pendragon.ideasonboard.com>","References":"<20250421155109.175930-1-barnabas.pocze@ideasonboard.com>\n\t<20250421155109.175930-3-barnabas.pocze@ideasonboard.com>\n\t<20250422234009.GA17813@pendragon.ideasonboard.com>\n\t<e5ffdc40-1d15-48f5-97b3-e9191143ba64@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<e5ffdc40-1d15-48f5-97b3-e9191143ba64@ideasonboard.com>","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>"}}]