From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D06F3138334 for ; Mon, 23 Jul 2018 17:11:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A209E096A; Mon, 23 Jul 2018 17:11:47 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 885A7E0960 for ; Mon, 23 Jul 2018 17:11:46 +0000 (UTC) Received: from [192.168.2.51] (62.65.230.13.cable.starman.ee [62.65.230.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: leio) by smtp.gentoo.org (Postfix) with ESMTPSA id 5310E335D98 for ; Mon, 23 Jul 2018 17:11:44 +0000 (UTC) Message-ID: <1532365897.6802.78.camel@gentoo.org> Subject: [gentoo-dev] RFC: gles global USE flag, USE=opengl clarifying From: Mart Raudsepp To: gentoo-dev@lists.gentoo.org Date: Mon, 23 Jul 2018 20:11:37 +0300 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-N53r3Ta3TB/d88YlBkE+" X-Mailer: Evolution 3.24.6 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 X-Archives-Salt: 16d47bb9-a333-4743-91d7-8df5503e54a0 X-Archives-Hash: e04f6d321e424a237af62721d1d09211 --=-N53r3Ta3TB/d88YlBkE+ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, Currently we have rather a mess in terms of OpenGL API handling. I think much of it comes from USE=3Dopengl being rather vague - is it supposed to mean "Use desktop GL", "Use GLX", or "Enable OpenGL support". All of these mean quite different things: * desktop GL means full OpenGL API, which in turn can be either used via GLX platform (X11 only) or EGL platform. * GLX means GLX platform - usable only on X11; all good and same as desktop GL in the past, but we have people wanting wayland-only now (and YES, desktop GL via EGL platform _is_ a thing), and GLX obviously isn't something that works in native wayland. * GL support could mean 3D via OpenGL in general; be it OpenGL, GLESv2, GLESv3... To make things easier to follow, there are basically three different concepts and potential choices to make: * API * Platform * Windowing system API is either "full desktop" OpenGL (think e.g. OpenGL 4.5), or GLES; GLES has multiple versions, but in practice it's GLESv2 with optional support for GLESv3 - however afaik latest mesa supports GLESv3 too whenever GLESv2 is built. Platform is either GLX or EGL. GLX only works in combination with "full desktop" OpenGL; EGL can work with either. For non-Linux there's also CGL (OSX), WGL (Windows), EAGL (iOS) and more. Can be interesting for Gentoo Prefix. "EGL is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system." - thus the third choice with EGL platform - windowing system. This then is about supporting a certain graphics environment with EGL (with GLX that can be taken as just always X). This can be for example x11, wayland, GBM (think rendering 3D directly on top of a KMS terminal), win32, cocoa, android, vivante framebuffer (with proprietary vivante 3D stack; not applicable to open source etnaviv), DispmanX (RPi), etc. This can be a choice especially for certain kind of OpenGL libraries; one big example I know of is GStreamer GL libraries. Anyhow, here's an initial proposal to try to sort it out via a USE=3Dgles global USE flag and a set of guidelines how to use it together with a USE=3Dopengl and other related USE flags in ebuilds: use.desc: opengl - Add support for desktop OpenGL (3D graphics) gles - Add support for OpenGL ES, or prefer it over desktop OpenGL. This sh= ould usually only be enabled globally on embedded systems that do not suppo= rt full desktop GL. [How is it correct to refer to "full desktop" GL without it being confusing with OpenGL in general?] Guidelines: * If package has optional GL support in general (can work with either desktop GL or GLES when OpenGL is enabled; doesn't care which one is there), use both opengl and gles in IUSE and enable GL support and ebuild logic when either is enabled * If package is fully about OpenGL (GL itself isn't optional) and supports either desktop GL or GLES, but not both at once: IUSE=3D"gles" and use GLES if that is set, "full desktop" GL otherwise. * If package is fully about OpenGL (GL itself isn't optional) and supports either desktop GL or GLES, including both at once: IUSE=3D"gles +opengl" and use whichever is enabled. As GL isn't optional as a whole, require at least one of them: REQUIRED_USE=3D"|| ( gles opengl )". * If package has optional OpenGL support and needs specific logic for the chosen API: IUSE=3D"gles opengl" or IUSE=3D"gles +opengl", depending if GL should be default enabled (albeit we might want to revise this via profile level defaults flag instead?) - don't default enable gles, as it's not a common use case and such embedded system users will have it globally enabled anyways. ** Enable any of the GL logic only if either gles or opengl is enabled. ** If both are supported at the same time, enable whichever is chosen by user (this could often mean also passing a generic --enable-gl passing if either USE is set and then specifying the API to use with a separate build flag). ** If both are not supported at the same time, set REQUIRED_USE=3D"gles? ( !opengl )", use whichever is chosen (keeping in mind that both might be disabled =E2=86=92 no GL at all). * If package needs to provide choices for the used GL platform or windowing system, while GL itself is optional as a whole, don't forget to keep the dependencies and other logic for the platform/WS conditional to USE=3Dgles and/or USE=3Dopengl. This is usually easiest to handle via GL_DEPS helper variable with dependencies applicable to either and then putting it in as e.g. "opengl? ( $GL_DEPS ) gles? ( $GL_DEPS )" together with any specific ones; similar for certain needed REQUIRED_USEs, with appropriate conditional blocks in src_configure(). * If package supports X11 via either GLX or EGL x11 windowing system, just enable GLX via USE=3D"opengl X" (or USE=3D"-gles X" if no opengl in IUSE) and EGL x11 via USE=3D"egl X". Don't forget that "egl X" should pull in EGL and X dependencies necessary for it only if GL as a whole is enabled, if that is optional. * It is OK to have certain REQUIRED_USE restrictions when applicable, but avoid unnecessary pain via appropriate use of IUSE defaults. Also don't forget that some restrictions might only apply if GL as a whole is enabled =E2=80=94 e.g. REQUIRED_USE=3D"gles? ( $GL_REQUIRED_USE ) opengl= ? ( $GL_REQUIRED_USE )". Don't force users to make choices when that choice isn't even relevant =E2=80=94 e.g. REQUIRED_USE=3D"wayland? ( egl )", when = this is only relevant if optional GL is enable via either USE=3D"opengl" or USE=3D"gles" - user would have to potentially enable egl without reason, because he wanted non-GL wayland support for the package, but wayland windowing system support isn't built anyways (just generic wayland support). ---- Initially I thought of a global USE=3Dgles2, but during the writing of this e-mail, I realized that as USE=3Dopengl doesn't specify a version either (e.g. 3.3 or 4.5), so combined with gles3 not really needing a separate handling, it'd be more consistent with just USE=3Dgles. However I'm rather torn on this - it could just as well be USE=3Dgles2 instead, which just specifies that it's GLESv2 or later; then it's also clear we don't deal with old GLESv1 via this. I doubt this proposal is perfect, but I think it does bring a bit of sanity and consistency to the situation. Additionally I only have a view of what my co-maintained packages are doing, support and need; I might not have thought of valid setups needed by other packages, which this wouldn't work for. I also realize this can be complex to handle by maintainers in ebuilds, but the goal is to have it consistent and understandable to users, and=20 easier to handle via global USE choice: "If you want to enable OpenGL when it's a choice =E2=86=92 enable USE=3Dope= ngl or USE=3Dgles globally, depending if you have full desktop OpenGL support or not (embedded)". For ebuild complexity, it's not all that bad; see for example media- libs/gst-plugins-base-1.14.1 or newer. I'm happy to hear valid concerns where this wouldn't work or situations where this isn't good for global choosing by user. But please be considerate and bring up only new cases, not those that are already brought up on the thread (that is, read all unread mails in thread before posting yourself). Mart --=-N53r3Ta3TB/d88YlBkE+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQKTBAABCgB9FiEEUdZn9pOq0mlNjRvdEKbJ+k9JlgYFAltWDElfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDUx RDY2N0Y2OTNBQUQyNjk0RDhEMUJERDEwQTZDOUZBNEY0OTk2MDYACgkQEKbJ+k9J lgZdNQ//eABz709QylkoidtHyJBQSdyZHp9d7DX8PJb9dzLSexbz4gFgLPq/LdwF oJE02fR7TnoAbGLvHywXECYeX2AXEsu7oe9HASVQZr8C/YOas1T5vSIuLrLwifCk /e6rG7rDUecKJSfeYnC+5TRdyOTO5hcLuIv+MuKJJQY29y7tVZk9umnRFARNWSRr yhDvIloPBoX7y2uCqlfMS0+CRB6JMjBMWudwmxeHNVF9Xg0gyujBe5nPQQ0zL7Og 0riqtpnOGv27iR7gofFoOS18HcMa9Lo+jVM/S+dAAJQfaqZZGWCExS0sVdtDYx96 HUq0Y/K086ZDDyQtaYxWVCfo+xCw+wBDw0sO4jktIoq/iEXu/rJkW3dDnMKUizcT sRsRYeJteKBs85L8gKAf4bEEzPmSWOBvN7AxxqyVgdwYUTHux4l8upBsTVIjtF7F 9euMwi5wvfgxz9x9ecNwrNJvYpnkcRUBF6LYS1of+8u87OkSjMLhtPef7n58ZvwK o58V8TmA8z25TleFMELjp5aEGx2bABcskMaMlWJXov/8FM9TI1d7t+ykEci48bYJ ICQK24vFfL2ey7KlUnv2+RzqDWsyCLle2AmXzNf/uVvnZmindks+gvpRsefnWwOz M/fzINvCYmz1jfr1lzxLblHr0uAqfKKF4nIOW+lh/vNlb9tO0lI= =oMn2 -----END PGP SIGNATURE----- --=-N53r3Ta3TB/d88YlBkE+--