[{"id":38941,"web_url":"https://patchwork.libcamera.org/comment/38941/","msgid":"<16daa914-a55e-4cbf-a2c4-5204aadb7c10@collabora.com>","date":"2026-05-21T16:36:54","subject":"Re: [PATCH v1 2/3] egl: Call glFlush before glFinish","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Opened a Mesa issue about this: \nhttps://gitlab.freedesktop.org/mesa/mesa/-/work_items/15516\n\nOn 21.05.26 16:10, Robert Mader wrote:\n> Apparently it is not guaranteed that drivers will do so implicitly,\n> which may or may not be a driver bug. The impact on performance has been\n> observed to be significant and it's easy enough, so let's do it\n> explicitly.\n>\n> Below are some benchmark results. All where done using postmarketOS edge\n> with updates from 21th May 2026 (Mesa 26.1.1). The mentioned pipelines\n> where run five times each, with the mean value included here, which should\n> be quite representive as the variance was rather small. All devices\n> where using the powersave governor.\n>\n> cam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@1a -s width=1920,height=1080 --capture=60\n> Before: 47986 us/frame\n> After: 33596 us/frame !\n>\n> cam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@1a -s width=1920,height=1080 --capture=60\n> Before: 30294 us/frame\n> After: 14922 us/frame !\n>\n> cam -c /base/soc@0/cci@ac4b000/i2c-bus@1/camera@10 -s width=1920,height=1080 --capture=60\n> Before: 27373 us/frame\n> After: 26106 us/frame\n>\n> cam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@29 -s width=1920,height=1080 --capture=60\n> Before: 16339 us/frame\n> After: 15897 us/frame\n>\n> cam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@10 -s width=1920,height=1080 --capture=60\n> Before: 26206 us/frame\n> After: 25721 us/frame\n>\n> cam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@10 -s width=1920,height=1080 --capture=60\n> Before: 43723 us/frame\n> After: 34124 us/frame !\n>\n> cam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@1a -s width=1920,height=1080 --capture=60\n> Before: 23597 us/frame\n> After: 23707 us/frame\n>\n> cam -c /base/soc@0/bus@30800000/i2c@30a40000/camera@20 -s width=1280,height=720 --capture=60\n> Before: 91200 us/frame\n> After: 91649 us/frame\n>\n> cam -c /base/soc@0/bus@30800000/i2c@30a50000/camera@2d -s width=1280,height=720 --capture=60\n> Before: 76577 us/frame\n> After: 76956 us/frame\n>\n> cam -c /base/i2c-csi/front-camera@3c -s width=1280,height=720 --capture=60\n> Before: 188122 us/frame\n> After: 188500 us/frame\n>\n> cam -c /base/i2c-csi/rear-camera@4c -s width=1280,height=720 --capture=60\n> Before: 193712 us/frame\n> After: 190222 us/frame\n>\n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n> ---\n>   src/libcamera/egl.cpp | 1 +\n>   1 file changed, 1 insertion(+)\n>\n> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\n> index 357918711..d9bc4f555 100644\n> --- a/src/libcamera/egl.cpp\n> +++ b/src/libcamera/egl.cpp\n> @@ -94,6 +94,7 @@ void eGL::syncOutput()\n>   {\n>   \tASSERT(tid_ == Thread::currentId());\n>   \n> +\tglFlush();\n>   \tglFinish();\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 28BDEBDCBC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 May 2026 16:37:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA64162FEC;\n\tThu, 21 May 2026 18:37:03 +0200 (CEST)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC00B62E6A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 May 2026 18:37:01 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1779381417133538.3045711715414;\n\tThu, 21 May 2026 09:36:57 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"OV5xMRwL\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1779381418; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=id61XGC6c1gMOvOAQ4+6CixGCWZVTbn8OpWDTZatp627mM7UUvcroTYJ5xdeFdUV1pIw3AMh/aTRZZeTMSiRXlZXeGFqOHHxnlRVY7rrlAiKs3ubuu4rIAxVW0RpnCbSwrwoBXJfHJO743Cs3UKOVmbaka+POQb5Q4usgtXD9Yo=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1779381418;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=2QymcqbeXCiHgHyEhvzi1H2Gcd7m/jE3UUPwg5WtIL8=; \n\tb=BZ2GxemTSH1HWEoGt0Dk6X9b5S5gkmJRgyKzs7DazroAPHMMmVB1csvgRkMmO3BKFnWCgoMfCGnqtYbFXfo5Hf/bIQiMYvUHV/asmBVaymcGMswK0A2GlNnAzOmo+0hl8bu66i6gKv8xndLf+LqydoKxKB+i7BU5aP9qhhuRv7I=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1779381418;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=2QymcqbeXCiHgHyEhvzi1H2Gcd7m/jE3UUPwg5WtIL8=;\n\tb=OV5xMRwLvUzAAoL1Z373Xskw5UuA+zrrJ2CEA4PTFcoiuyrskF/Y9ExsjfO0n1dz\n\t35p+3VkTcveuM4bhQjYvpAlsdtkh3h93ztZu3QZFDX5vx7O8DKdKPjXDazY2JfuaBWL\n\tPc7psVabz7cTSqd1S0M86HRMdZuVyQ7GpeCtJaEc=","Message-ID":"<16daa914-a55e-4cbf-a2c4-5204aadb7c10@collabora.com>","Date":"Thu, 21 May 2026 18:36:54 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1 2/3] egl: Call glFlush before glFinish","To":"libcamera-devel@lists.libcamera.org","References":"<20260521141006.101016-1-robert.mader@collabora.com>\n\t<20260521141006.101016-3-robert.mader@collabora.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20260521141006.101016-3-robert.mader@collabora.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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":38946,"web_url":"https://patchwork.libcamera.org/comment/38946/","msgid":"<463f714d-db90-4387-9f30-dafca521755d@collabora.com>","date":"2026-05-25T11:44:39","subject":"Re: [PATCH v1 2/3] egl: Call glFlush before glFinish","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"It turned out that this patch just works around a driver bug (apparently \nscheduling related) and that running with `GALLIUM_THREAD=0` - i.e. \nnon-threaded GL driver - has the same positive impact. Thus I'll drop \nthe patch from v2 (the following patch reverts it anyway) and re-run the \nbenchmarks with `GALLIUM_THREAD=0`.\n\nWith that clarified I think this series should be ready to go and mostly \na non-brainer for merging. Thus quick question: does anyone reading this \nhave more remarks / suggestions? Maybe Bryan or Barnabás?\n\nOn 21.05.26 18:36, Robert Mader wrote:\n> Opened a Mesa issue about this: \n> https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15516\n>\n> On 21.05.26 16:10, Robert Mader wrote:\n>> Apparently it is not guaranteed that drivers will do so implicitly,\n>> which may or may not be a driver bug. The impact on performance has been\n>> observed to be significant and it's easy enough, so let's do it\n>> explicitly.\n>>\n>> Below are some benchmark results. All where done using postmarketOS edge\n>> with updates from 21th May 2026 (Mesa 26.1.1). The mentioned pipelines\n>> where run five times each, with the mean value included here, which \n>> should\n>> be quite representive as the variance was rather small. All devices\n>> where using the powersave governor.\n>>\n>> cam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@1a -s \n>> width=1920,height=1080 --capture=60\n>> Before: 47986 us/frame\n>> After: 33596 us/frame !\n>>\n>> cam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@1a -s \n>> width=1920,height=1080 --capture=60\n>> Before: 30294 us/frame\n>> After: 14922 us/frame !\n>>\n>> cam -c /base/soc@0/cci@ac4b000/i2c-bus@1/camera@10 -s \n>> width=1920,height=1080 --capture=60\n>> Before: 27373 us/frame\n>> After: 26106 us/frame\n>>\n>> cam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@29 -s \n>> width=1920,height=1080 --capture=60\n>> Before: 16339 us/frame\n>> After: 15897 us/frame\n>>\n>> cam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@10 -s \n>> width=1920,height=1080 --capture=60\n>> Before: 26206 us/frame\n>> After: 25721 us/frame\n>>\n>> cam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@10 -s \n>> width=1920,height=1080 --capture=60\n>> Before: 43723 us/frame\n>> After: 34124 us/frame !\n>>\n>> cam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@1a -s \n>> width=1920,height=1080 --capture=60\n>> Before: 23597 us/frame\n>> After: 23707 us/frame\n>>\n>> cam -c /base/soc@0/bus@30800000/i2c@30a40000/camera@20 -s \n>> width=1280,height=720 --capture=60\n>> Before: 91200 us/frame\n>> After: 91649 us/frame\n>>\n>> cam -c /base/soc@0/bus@30800000/i2c@30a50000/camera@2d -s \n>> width=1280,height=720 --capture=60\n>> Before: 76577 us/frame\n>> After: 76956 us/frame\n>>\n>> cam -c /base/i2c-csi/front-camera@3c -s width=1280,height=720 \n>> --capture=60\n>> Before: 188122 us/frame\n>> After: 188500 us/frame\n>>\n>> cam -c /base/i2c-csi/rear-camera@4c -s width=1280,height=720 \n>> --capture=60\n>> Before: 193712 us/frame\n>> After: 190222 us/frame\n>>\n>> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n>> ---\n>>   src/libcamera/egl.cpp | 1 +\n>>   1 file changed, 1 insertion(+)\n>>\n>> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\n>> index 357918711..d9bc4f555 100644\n>> --- a/src/libcamera/egl.cpp\n>> +++ b/src/libcamera/egl.cpp\n>> @@ -94,6 +94,7 @@ void eGL::syncOutput()\n>>   {\n>>       ASSERT(tid_ == Thread::currentId());\n>>   +    glFlush();\n>>       glFinish();\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 3D555BDCBC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 May 2026 11:44:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 141326301A;\n\tMon, 25 May 2026 13:44:56 +0200 (CEST)","from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8149A62010\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 May 2026 13:44:53 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1779709487593302.0489075068713;\n\tMon, 25 May 2026 04:44:47 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"ZcZyYude\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1779709490; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=d5VXVJGfYY6DQKq4N4i9KMkEujoVl6WlYZIxfOl3AHe0krjpzLW9IE2ldex8IMTHld20udzxk0o/VM9N3VXCnWJ/N+l2nkjTxHJUEUdUvcXdEbiyrZemNEY2FGPgLuOEkhdNP6bAdbcbHygsqdM5GmLhvZeSCgMF1hnA02FaV0s=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1779709490;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=SdQ7lB4kPwIhDdjs8ycR7De4U152lvSw5deEBA86PJw=; \n\tb=I55iiS9EkrfbZJ/9pCXjKGfKCDPjLlacAaKfOdKpo3yB7lbDbh00AggiZmNnJtqnvSPzvgIi1CY2mbYFqZRPr6RDs+5Er1RSVsKdc+nAEBMrBZobpOTMs7qCVN3czEq8jGyOra6AXocnzG2BI1TStStDnDiwx67+H56kkGI4py8=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1779709490;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=SdQ7lB4kPwIhDdjs8ycR7De4U152lvSw5deEBA86PJw=;\n\tb=ZcZyYude1ADEWnJKvbVJVE8ID5ge9POBVpQUlwbILB/i7e6Jn8G8nHjz/UCbROFc\n\t58OqT3TK+qCXUq5IMv8Y5Fqoe/KeMoxR1bAd55RXWSFGKa0nrKyesRZCDcilSFb2yOD\n\t1kvNDIPguaZF25iYtrZJNTzVxTsnWEJR0v7MXHRU=","Message-ID":"<463f714d-db90-4387-9f30-dafca521755d@collabora.com>","Date":"Mon, 25 May 2026 13:44:39 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1 2/3] egl: Call glFlush before glFinish","To":"libcamera-devel@lists.libcamera.org","References":"<20260521141006.101016-1-robert.mader@collabora.com>\n\t<20260521141006.101016-3-robert.mader@collabora.com>\n\t<16daa914-a55e-4cbf-a2c4-5204aadb7c10@collabora.com>","Content-Language":"en-US, de-DE, en-GB","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<16daa914-a55e-4cbf-a2c4-5204aadb7c10@collabora.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>"}}]