[{"id":28254,"web_url":"https://patchwork.libcamera.org/comment/28254/","msgid":"<170186170659.2829918.12604607370646500367@ping.linuxembedded.co.uk>","date":"2023-12-06T11:21:46","subject":"Re: [libcamera-devel] cam: Support RGB888 texture in sdl sink","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Pavel Machek via libcamera-devel (2023-12-06 11:00:27)\n>     \n> Lightly tested; this is useful for SoftISP testing. I get wrong\n> red/blue swapped, but that may be due to my SoftISP hacks.\n>     \n> Signed-off-by: Pavel Machek <pavel@ucw.cz>\n> \n> diff --git a/src/apps/cam/sdl_sink.cpp b/src/apps/cam/sdl_sink.cpp\n> index a2f4abc1..105fa781 100644\n> --- a/src/apps/cam/sdl_sink.cpp\n> +++ b/src/apps/cam/sdl_sink.cpp\n> @@ -76,6 +76,9 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)\n>         case libcamera::formats::YUYV:\n>                 texture_ = std::make_unique<SDLTextureYUYV>(rect_, cfg.stride);\n>                 break;\n> +       case libcamera::formats::RGB888:\n\nI haven't confirmed, but I would bet if you have RB swaps, then you\nshould probably map SDL RGB888 to libcamera BGR888, and libcamera RGB888\nto SDL BGR888.\n\nDRM RGB formats are specified differently to V4L2 formats. libcamera\nuses the DRM specification.\n\n> +               texture_ = std::make_unique<SDLTextureRGB888>(rect_, cfg.stride);\n> +               break;\n>         default:\n>                 std::cerr << \"Unsupported pixel format \"\n>                           << cfg.pixelFormat.toString() << std::endl;\n> diff --git a/src/apps/cam/sdl_texture_yuv.cpp b/src/apps/cam/sdl_texture_yuv.cpp\n> index b29c3b93..c4c4144b 100644\n> --- a/src/apps/cam/sdl_texture_yuv.cpp\n> +++ b/src/apps/cam/sdl_texture_yuv.cpp\n> @@ -31,3 +31,13 @@ void SDLTextureYUYV::update(const std::vector<libcamera::Span<const uint8_t>> &d\n>  {\n>         SDL_UpdateTexture(ptr_, &rect_, data[0].data(), stride_);\n>  }\n> +\n> +SDLTextureRGB888::SDLTextureRGB888(const SDL_Rect &rect, unsigned int stride)\n> +       : SDLTexture(rect, SDL_PIXELFORMAT_RGB24, stride)\n> +{\n> +}\n> +\n> +void SDLTextureRGB888::update(const std::vector<libcamera::Span<const uint8_t>> &data)\n> +{\n> +       SDL_UpdateTexture(ptr_, &rect_, data[0].data(), stride_);\n> +}\n> diff --git a/src/apps/cam/sdl_texture_yuv.h b/src/apps/cam/sdl_texture_yuv.h\n> index 310e4e50..0df6b445 100644\n> --- a/src/apps/cam/sdl_texture_yuv.h\n> +++ b/src/apps/cam/sdl_texture_yuv.h\n> @@ -24,3 +24,10 @@ public:\n>         SDLTextureYUYV(const SDL_Rect &rect, unsigned int stride);\n>         void update(const std::vector<libcamera::Span<const uint8_t>> &data) override;\n>  };\n> +\n> +class SDLTextureRGB888 : public SDLTexture\n> +{\n> +public:\n> +       SDLTextureRGB888(const SDL_Rect &rect, unsigned int stride);\n> +       void update(const std::vector<libcamera::Span<const uint8_t>> &data) override;\n> +};\n> \n> -- \n> People of Russia, stop Putin before his war on Ukraine escalates.","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 6E81EC322E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Dec 2023 11:21:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B6870629E3;\n\tWed,  6 Dec 2023 12:21:50 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6C17629CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Dec 2023 12:21:49 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0CAC3720;\n\tWed,  6 Dec 2023 12:21:09 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701861710;\n\tbh=3uyFPeFpR5zW40SyhpyDDApHFnGKtuxHbIPSXLEu3QU=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=wbFxZCy3XQjvbbNvavSI2v2DLn78up90afmItnJiHhrMEggkg93gKrcChei1rnqAF\n\tQcLcQgKL7MR0hXATWpw/xU43hJQmmYOcapQ3DIDQ+taY0u0mQOWdA2vJmAmqxJPPZU\n\tbirNsio33erpAmJQob88EFLTT/QmowvR8gVJ52/5ds6XruatithlxND+yE6g1NkiQ2\n\taEOrvtx7XYp06NcdiCiCiO33E6VE2qR6ECMaYrL+LQP3FrVXuUYKBGfI6W+qQnwGDZ\n\tD/pKRAGK/HgHHoN3S7xl2LPkvC/3E4Myms+LEqebhZW15nox0bpQOSWfx6Eun72cpi\n\thoQA0E5Lvn/5w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1701861669;\n\tbh=3uyFPeFpR5zW40SyhpyDDApHFnGKtuxHbIPSXLEu3QU=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=dIRbMWgKj2qTL3qv/lfyo6PErq8baSV1GgynsWJgqu/WM/izJGJEz6XWdG6rbXTWn\n\tvgWUnga/miuaQVSxPNBbjJjTmEbaXSMh9kw079sm8KuD6zBOcFmLiSZovOvplKdmgw\n\tPsUAU7Rhqb6Lqup69Ppn9PukCUhCVmTGycEv3zh8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"dIRbMWgK\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<ZXBUSx4+6EVqyWnp@duo.ucw.cz>","References":"<ZXBUSx4+6EVqyWnp@duo.ucw.cz>","To":"Pavel Machek <pavel@ucw.cz>, libcamera-devel@lists.libcamera.org","Date":"Wed, 06 Dec 2023 11:21:46 +0000","Message-ID":"<170186170659.2829918.12604607370646500367@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] cam: Support RGB888 texture in sdl sink","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28256,"web_url":"https://patchwork.libcamera.org/comment/28256/","msgid":"<ZXBhapztE74UQu1r@duo.ucw.cz>","date":"2023-12-06T11:56:26","subject":"Re: [libcamera-devel] cam: Support RGB888 texture in sdl sink","submitter":{"id":49,"url":"https://patchwork.libcamera.org/api/people/49/","name":"Pavel Machek","email":"pavel@ucw.cz"},"content":"Hi!\n\n> > Lightly tested; this is useful for SoftISP testing. I get wrong\n> > red/blue swapped, but that may be due to my SoftISP hacks.\n> >     \n> > Signed-off-by: Pavel Machek <pavel@ucw.cz>\n> > \n> > diff --git a/src/apps/cam/sdl_sink.cpp b/src/apps/cam/sdl_sink.cpp\n> > index a2f4abc1..105fa781 100644\n> > --- a/src/apps/cam/sdl_sink.cpp\n> > +++ b/src/apps/cam/sdl_sink.cpp\n> > @@ -76,6 +76,9 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)\n> >         case libcamera::formats::YUYV:\n> >                 texture_ = std::make_unique<SDLTextureYUYV>(rect_, cfg.stride);\n> >                 break;\n> > +       case libcamera::formats::RGB888:\n> \n> I haven't confirmed, but I would bet if you have RB swaps, then you\n> should probably map SDL RGB888 to libcamera BGR888, and libcamera RGB888\n> to SDL BGR888.\n> \n> DRM RGB formats are specified differently to V4L2 formats. libcamera\n> uses the DRM specification.\n\nThanks a lot. This stuff is quite confusing :-(.\n\nBest regards,\n\t\t\t\t\t\t\t\tPavel","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 14075C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Dec 2023 11:56:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4AC92629E3;\n\tWed,  6 Dec 2023 12:56:29 +0100 (CET)","from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 78D20629CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Dec 2023 12:56:27 +0100 (CET)","by jabberwock.ucw.cz (Postfix, from userid 1017)\n\tid 177851C0075; Wed,  6 Dec 2023 12:56:27 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701863789;\n\tbh=Gdf2n6D5bGuL7DXS70E6cmso7o2zUiKinZaCO4PKnmg=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=zIHsw1wJZJ2QUn5s7bkyjqrNAyTBDAHT9Q4yZhbF7dPeMWJKJaU4CLDf+rIX01POf\n\tq9Qv3btTssyVlNtTQFtECbI29FrIKPny8DZcB2zFwxWznHb8SuInOk+8F3OhNuhPGm\n\tKM5B7Pn+xYrxb5TESx0OCmeTaZmNSEj09XSpOmAnhUDNV0UMkhDSJNNj/FXDL2oeld\n\t0vs8TJD5pkW/NuhPzN1nkl9qx6K2qzffN/06DXdLf71GDYrnxQkZ2/ZUp8y3yNt0gQ\n\tCaKRVofIaYUUHdilMu6hsnKT+sihoG6rJkVrNFNYgzNdMmFBrV7iHiQTU5K1B+wACI\n\t1Bbrt76z+gPlw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1;\n\tt=1701863787;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=upbZ6WGGNZYJ7iMczNDo0mQTrqppVdfAlWIoWXwnV9s=;\n\tb=WvQ6EL8yLgqWlWXzULpbQd3gZvcfWqlI3vvnIZASiOoMEyJbLOc6ZrMmJsKMLWZLxYh7xF\n\t6ZJJE4HOh0qzGGqmHUU8Mms1VssOflkCgtC9WQw/ohpO9jTrdGCn1fSlszO5thZMqh9bhV\n\tT0UOdegwp/vLZQj0RYy2P9B8C15eH2M="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ucw.cz header.i=@ucw.cz\n\theader.b=\"WvQ6EL8y\"; dkim-atps=neutral","Date":"Wed, 6 Dec 2023 12:56:26 +0100","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<ZXBhapztE74UQu1r@duo.ucw.cz>","References":"<ZXBUSx4+6EVqyWnp@duo.ucw.cz>\n\t<170186170659.2829918.12604607370646500367@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha1;\n\tprotocol=\"application/pgp-signature\"; boundary=\"VK/im0L4Pd3JMHjc\"","Content-Disposition":"inline","In-Reply-To":"<170186170659.2829918.12604607370646500367@ping.linuxembedded.co.uk>","Subject":"Re: [libcamera-devel] cam: Support RGB888 texture in sdl sink","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>","From":"Pavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Pavel Machek <pavel@ucw.cz>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28306,"web_url":"https://patchwork.libcamera.org/comment/28306/","msgid":"<ZXiZ8H62YaphvFBn@duo.ucw.cz>","date":"2023-12-12T17:35:44","subject":"Re: [libcamera-devel] cam: Support RGB888 texture in sdl sink","submitter":{"id":49,"url":"https://patchwork.libcamera.org/api/people/49/","name":"Pavel Machek","email":"pavel@ucw.cz"},"content":"Hi!\n\n> > Lightly tested; this is useful for SoftISP testing. I get wrong\n> > red/blue swapped, but that may be due to my SoftISP hacks.\n> >     \n> > Signed-off-by: Pavel Machek <pavel@ucw.cz>\n> > \n> > diff --git a/src/apps/cam/sdl_sink.cpp b/src/apps/cam/sdl_sink.cpp\n> > index a2f4abc1..105fa781 100644\n> > --- a/src/apps/cam/sdl_sink.cpp\n> > +++ b/src/apps/cam/sdl_sink.cpp\n> > @@ -76,6 +76,9 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)\n> >         case libcamera::formats::YUYV:\n> >                 texture_ = std::make_unique<SDLTextureYUYV>(rect_, cfg.stride);\n> >                 break;\n> > +       case libcamera::formats::RGB888:\n> \n> I haven't confirmed, but I would bet if you have RB swaps, then you\n> should probably map SDL RGB888 to libcamera BGR888, and libcamera RGB888\n> to SDL BGR888.\n> \n> DRM RGB formats are specified differently to V4L2 formats. libcamera\n> uses the DRM specification.\n\nThank you, fixed, and now I have good colors, v2 will follow.\n\nBest regards,\n\t\t\t\t\t\t\t\tPavel","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 3D160C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Dec 2023 17:35:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83C29629E1;\n\tTue, 12 Dec 2023 18:35:47 +0100 (CET)","from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E17B3629BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Dec 2023 18:35:45 +0100 (CET)","by jabberwock.ucw.cz (Postfix, from userid 1017)\n\tid 596CA1C006F; Tue, 12 Dec 2023 18:35:45 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1702402547;\n\tbh=vOQj51Sn1KfqUXVGUpEjyYURsSzXjC+WiZKy0T9lYBE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=KCfKeRlTIpCN9aeFtCFpB0vLx9P0bKmsk3bWmgiCjBwG83XEgWaa+g49H5yPM9wN1\n\tMYklu7xAe7tKpUAKJi2zMsoiB6Z4bGAgD+6MQGC9PFsso0+SqlaxAgdPBfeokJfE5u\n\tfpIKXmSaY1k+tZhxdmpfxfZBQTTPpLFF34T09ISX2YOu/wAFAQOtEPVqEtrKvMjazz\n\tU5qCdl2Ldp3rN+EHCLmUxaVjmIaNlUht/CBiXH+q7RoyIQgaolbPHoDYNKU6+8MBvV\n\t/7+uLLeiANNBIDIuMkHDgi3a6I7Nk+l3a8UooZRtWh0eMKyj64QwcI7GLNfyUUTHnI\n\tjUiNHyNqsFp8g==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1;\n\tt=1702402545;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=mODUesMQJcSjblr8ZIgi32+P3cXxOQxeeFQSYdidKxY=;\n\tb=drG/SajCksAMgrwGuBgkEvKyXAw5Bm9TxLtj34gMqpEX5BJtMJvvWZYs4371Jl4DhUlAf2\n\tHRafvyN9f08uKU97yx7e6o33zFtX/nYnAkTmQKX6UaYBw/4B0yKmVDFgi+yfkXgH0/q+lc\n\tto60k/nX6uGuvBe41X59BsGait+OHck="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ucw.cz header.i=@ucw.cz\n\theader.b=\"drG/SajC\"; dkim-atps=neutral","Date":"Tue, 12 Dec 2023 18:35:44 +0100","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<ZXiZ8H62YaphvFBn@duo.ucw.cz>","References":"<ZXBUSx4+6EVqyWnp@duo.ucw.cz>\n\t<170186170659.2829918.12604607370646500367@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha1;\n\tprotocol=\"application/pgp-signature\"; boundary=\"HgoP1WUP1T/IebuQ\"","Content-Disposition":"inline","In-Reply-To":"<170186170659.2829918.12604607370646500367@ping.linuxembedded.co.uk>","Subject":"Re: [libcamera-devel] cam: Support RGB888 texture in sdl sink","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>","From":"Pavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Pavel Machek <pavel@ucw.cz>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]