[{"id":37545,"web_url":"https://patchwork.libcamera.org/comment/37545/","msgid":"<f485746c-778f-4dab-b250-df00dff3733b@ideasonboard.com>","date":"2026-01-10T17:48:35","subject":"Re: [PATCH 4/4] egl: Detect and print GLES version","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2026. 01. 10. 18:09 keltezéssel, Robert Mader írta:\n> It might come in handy to know whether 2.0 or e.g. 3.2 is used.\n> \n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n> ---\n>   include/libcamera/internal/egl.h |  1 +\n>   src/libcamera/egl.cpp            | 17 +++++++++++++++++\n>   2 files changed, 18 insertions(+)\n> \n> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\n> index 21e2aa9df..f007f448a 100644\n> --- a/include/libcamera/internal/egl.h\n> +++ b/include/libcamera/internal/egl.h\n> @@ -136,5 +136,6 @@ private:\n>   \tPFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;\n>   \tPFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;\n>   \tPFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;\n> +\tPFNGLGETSTRINGPROC glGetString;\n>   };\n>   } //namespace libcamera\n> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\n> index 0bd9a83be..0ffd008c7 100644\n> --- a/src/libcamera/egl.cpp\n> +++ b/src/libcamera/egl.cpp\n> @@ -288,6 +288,10 @@ int eGL::initEGLContext(GBM *gbmContext)\n>   \tEGLint major;\n>   \tEGLint minor;\n>   \n> +\tconst char *glVersion;\n> +\tEGLint glMajor;\n> +\tEGLint glMinor;\n> +\n>   \tif (!eglBindAPI(EGL_OPENGL_ES_API)) {\n>   \t\tLOG(eGL, Error) << \"API bind fail\";\n>   \t\tgoto fail;\n> @@ -327,6 +331,12 @@ int eGL::initEGLContext(GBM *gbmContext)\n>   \t\tgoto fail;\n>   \t}\n>   \n> +\tglGetString = (PFNGLGETSTRINGPROC)eglGetProcAddress(\"glGetString\");\n> +\tif (!glGetString) {\n> +\t\tLOG(eGL, Error) << \"glGetString not found\";\n> +\t\tgoto fail;\n> +\t}\n> +\n>   \tif (eglChooseConfig(display_, configAttribs, &config, 1, &numConfigs) != EGL_TRUE) {\n>   \t\tLOG(eGL, Error) << \"eglChooseConfig fail\";\n>   \t\tgoto fail;\n> @@ -342,6 +352,13 @@ int eGL::initEGLContext(GBM *gbmContext)\n>   \n>   \tmakeCurrent();\n>   \n> +\tglVersion = (const char *)glGetString(GL_VERSION);\n\nconst char *glVersion = reinterpret_cast<const char *>(glGetString(GL_VERSION));\n\n\n> +\tif (glVersion &&\n> +\t    sscanf(glVersion, \"OpenGL ES %d.%d\", &glMajor, &glMinor) == 2 &&\n> +\t    glMajor > 0 && glMinor >= 0) {\n> +\t\tLOG(eGL, Info) << \"GLES: version: \" << glMajor << \".\" << glMinor;\n\nIs there any reason not to just print the string as is? I think it not much\nharder to read and would avoid the need for the string parsing.\n\n\nRegards,\nBarnabás Pőcze\n\n> +\t}\n> +\n>   \treturn 0;\n>   fail:\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 396E2BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 10 Jan 2026 17:48:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8322461FA0;\n\tSat, 10 Jan 2026 18:48:41 +0100 (CET)","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 2F55E61A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 10 Jan 2026 18:48:40 +0100 (CET)","from [192.168.33.23] (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 736853A2;\n\tSat, 10 Jan 2026 18:48:15 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FSNvojpl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768067296;\n\tbh=SyjCDZfJtUY1dwc+Pkx3MX9a+CMktFrEwU2ryguDsXw=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=FSNvojplNLj79feairZLzxqSlJMaQ/JoAXRcYnkpzu6Kfp13bGXRPaY0viZFeUST5\n\t2YrGWSkA7WxUBbkVuzVCXGSSjorGOeosV+KC9rZ+3I6hRxGdUWd1RkQoqlIUmsQEMC\n\tKTzbEMpA1UidnF6KspGeCVwNJGExAnMxoKr4cB0M=","Message-ID":"<f485746c-778f-4dab-b250-df00dff3733b@ideasonboard.com>","Date":"Sat, 10 Jan 2026 18:48:35 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 4/4] egl: Detect and print GLES version","To":"Robert Mader <robert.mader@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20260110170927.79918-1-robert.mader@collabora.com>\n\t<20260110170927.79918-5-robert.mader@collabora.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260110170927.79918-5-robert.mader@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>"}},{"id":37546,"web_url":"https://patchwork.libcamera.org/comment/37546/","msgid":"<04059d93-c577-4739-a275-d68fd36abd12@collabora.com>","date":"2026-01-10T19:01:10","subject":"Re: [PATCH 4/4] egl: Detect and print GLES version","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Hi, thanks for the feedback.\n\nOn 10.01.26 18:48, Barnabás Pőcze wrote:\n> Hi\n>\n> 2026. 01. 10. 18:09 keltezéssel, Robert Mader írta:\n>> It might come in handy to know whether 2.0 or e.g. 3.2 is used.\n>>\n>> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n>> ---\n>>   include/libcamera/internal/egl.h |  1 +\n>>   src/libcamera/egl.cpp            | 17 +++++++++++++++++\n>>   2 files changed, 18 insertions(+)\n>>\n>> diff --git a/include/libcamera/internal/egl.h \n>> b/include/libcamera/internal/egl.h\n>> index 21e2aa9df..f007f448a 100644\n>> --- a/include/libcamera/internal/egl.h\n>> +++ b/include/libcamera/internal/egl.h\n>> @@ -136,5 +136,6 @@ private:\n>>       PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;\n>>       PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;\n>>       PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;\n>> +    PFNGLGETSTRINGPROC glGetString;\n>>   };\n>>   } //namespace libcamera\n>> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\n>> index 0bd9a83be..0ffd008c7 100644\n>> --- a/src/libcamera/egl.cpp\n>> +++ b/src/libcamera/egl.cpp\n>> @@ -288,6 +288,10 @@ int eGL::initEGLContext(GBM *gbmContext)\n>>       EGLint major;\n>>       EGLint minor;\n>>   +    const char *glVersion;\n>> +    EGLint glMajor;\n>> +    EGLint glMinor;\n>> +\n>>       if (!eglBindAPI(EGL_OPENGL_ES_API)) {\n>>           LOG(eGL, Error) << \"API bind fail\";\n>>           goto fail;\n>> @@ -327,6 +331,12 @@ int eGL::initEGLContext(GBM *gbmContext)\n>>           goto fail;\n>>       }\n>>   +    glGetString = \n>> (PFNGLGETSTRINGPROC)eglGetProcAddress(\"glGetString\");\n>> +    if (!glGetString) {\n>> +        LOG(eGL, Error) << \"glGetString not found\";\n>> +        goto fail;\n>> +    }\n>> +\n>>       if (eglChooseConfig(display_, configAttribs, &config, 1, \n>> &numConfigs) != EGL_TRUE) {\n>>           LOG(eGL, Error) << \"eglChooseConfig fail\";\n>>           goto fail;\n>> @@ -342,6 +352,13 @@ int eGL::initEGLContext(GBM *gbmContext)\n>>         makeCurrent();\n>>   +    glVersion = (const char *)glGetString(GL_VERSION);\n>\n> const char *glVersion = reinterpret_cast<const char \n> *>(glGetString(GL_VERSION));\n>\n>\n>> +    if (glVersion &&\n>> +        sscanf(glVersion, \"OpenGL ES %d.%d\", &glMajor, &glMinor) == \n>> 2 &&\n>> +        glMajor > 0 && glMinor >= 0) {\n>> +        LOG(eGL, Info) << \"GLES: version: \" << glMajor << \".\" << \n>> glMinor;\n>\n> Is there any reason not to just print the string as is? I think it not \n> much\n> harder to read and would avoid the need for the string parsing.\n\nTrue, will do in v2!\n\n>\n>\n> Regards,\n> Barnabás Pőcze\n>\n>> +    }\n>> +\n>>       return 0;\n>>   fail:\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 005DEBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 10 Jan 2026 19:01:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3EC1F61FC1;\n\tSat, 10 Jan 2026 20:01:21 +0100 (CET)","from sender4-pp-e103.zoho.com (sender4-pp-e103.zoho.com\n\t[136.143.188.103])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F0B9B61A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 10 Jan 2026 20:01:19 +0100 (CET)","by mx.zohomail.com with SMTPS id 1768071672727113.54877564957496; \n\tSat, 10 Jan 2026 11:01:12 -0800 (PST)"],"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=\"MM9jithc\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1768071675; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=YGCOhZR6Gzrq5d7Xfrld/n24BSduvm3mmZmWi9vY13mLIAMMlTBi8mrwCouqPmCIXxQKKm9AEDKNoM+xOCthQeFO4B+bdD44LffWZMx4/QW/NE2jGtrChOClmjh176bsioRzwAXtFkZAxU0fzW9gW2SMNWPGUOEa9Juqqe0GvjQ=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1768071675;\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=L05sdM6iwBXsdvta/aVwF1c84g+b+HWs5cCQAIk2BAI=; \n\tb=cuFRadUASAISd6vneQ9NMa/6m8Pywirgelk+mo0p9IhSfb30jDYADrHEy9yktSAjCoROs4/xi0XKG8ZjyBSsrR/dal4vE/EnMqPA85Q/48P/2INJxzLH0NmspY2VpEow/hP8n5wSz4dhU+NaGNRDitPx3W5T7Oqmo29UDJtB48s=","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=1768071675;\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=L05sdM6iwBXsdvta/aVwF1c84g+b+HWs5cCQAIk2BAI=;\n\tb=MM9jithcfIA0jTyqL5MlqvGIAtY+DLTzutY/pr9UC33lWOyWT4eRNPN8yGkIvN2w\n\tfTAutDXeSROxFke6LXjg6KsBR1OqQVHg2bnGt/3JGwWbjlOTVSJ6BU2GwvnluDc4Bu4\n\tJUxnD7uw5ZuyXoB+034K5mindMIWAUJEOYu3iXUI=","Message-ID":"<04059d93-c577-4739-a275-d68fd36abd12@collabora.com>","Date":"Sat, 10 Jan 2026 20:01:10 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 4/4] egl: Detect and print GLES version","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20260110170927.79918-1-robert.mader@collabora.com>\n\t<20260110170927.79918-5-robert.mader@collabora.com>\n\t<f485746c-778f-4dab-b250-df00dff3733b@ideasonboard.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<f485746c-778f-4dab-b250-df00dff3733b@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>"}}]